Skip to content

Fix stale state after collection drop and re-create#203

Merged
farhan-syah merged 2 commits into
mainfrom
fix/drop-recreate-cache-isolation
Jul 21, 2026
Merged

Fix stale state after collection drop and re-create#203
farhan-syah merged 2 commits into
mainfrom
fix/drop-recreate-cache-isolation

Conversation

@farhan-syah

Copy link
Copy Markdown
Member

Summary

  • invalidate aggregate and facet cache entries using the canonical collection-key prefix
  • make collection and materialized-view reclaim synchronous, all-core, restart-safe, and fail-closed
  • serialize same-name lifecycle operations and propagate persistent L1/WAL reclaim failures
  • add regression coverage for strict, grouped aggregate, and materialized-view drop/re-create behavior

Validation

  • cargo fmt --all --check
  • cargo check -p nodedb --all-targets
  • cargo clippy -p nodedb --lib -- -D warnings
  • cargo nextest run -p nodedb-wal
  • cargo nextest run -p nodedb --test sql_drop_collection
  • cargo nextest run -p nodedb --test sql_materialized_view_refresh
  • focused reclaim, quiesce, cache, hard-delete, pending-reclaim, persistent-purge, and facet suites

All-target clippy also reaches an unrelated pre-existing manual_is_multiple_of lint in nodedb/tests/native_txn_commit_visibility.rs:89.

Fixes #199

…ilures

Route shared on-disk L1 checkpoint/partition reclaim (vector, spatial,
sparse-vector, timeseries) to a single homing core per collection during
the all-cores UnregisterCollection fan-out, since those paths are keyed
by (database, tenant, collection) rather than by core and concurrent
cores racing remove_dir_all/unlink on the same tree could turn a benign
concurrent-removal errno into a fatal barrier failure. Other cores still
evict their own per-core in-memory state.

Replace the untyped reclaim error with ReclaimFailure, which records
whether a durable pending_reclaim retry record was persisted. Callers
now disarm their lifecycle guard only when a retry owner exists;
otherwise the guard's unwind Drop releases the in-memory drain so a
same-name CREATE can self-heal off the durable inactive catalog row
instead of wedging behind an orphaned hold. Also make catalog existence
checks in collection/materialized-view CREATE abort on a read fault
rather than silently treating it as "does not exist".
@farhan-syah
farhan-syah merged commit bece881 into main Jul 21, 2026
1 check passed
@farhan-syah
farhan-syah deleted the fix/drop-recreate-cache-isolation branch July 21, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

count(*) on a recreated same-name collection returns the dropped predecessor's row count until the first write

1 participant