Skip to content

fix: Introduce Drop() for MMapContainer and fix checkpoint related bugs#306

Closed
zhanglei1949 wants to merge 1 commit into
alibaba:mainfrom
zhanglei1949:zl/fix-ckp
Closed

fix: Introduce Drop() for MMapContainer and fix checkpoint related bugs#306
zhanglei1949 wants to merge 1 commit into
alibaba:mainfrom
zhanglei1949:zl/fix-ckp

Conversation

@zhanglei1949
Copy link
Copy Markdown
Member

Fix #293

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes checkpoint-related correctness issues (per #293) by ensuring dropped tables/CSRs actually release persisted state and by expanding coverage for drop/recreate and checkpoint recovery scenarios.

Changes:

  • Add new Python and C++ regression tests for DROP/RECREATE and post-checkpoint visibility.
  • Refactor C++ checkpoint tests into typed suites over memory levels, with shared helpers/fixtures.
  • Implement drop() paths for property columns/CSR/indexer and update graph table open semantics to avoid loading from checkpoint on newly created tables.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/python_bind/tests/test_db_query.py Adds Python regressions for DROP/RECREATE and delete-then-reinsert visibility around checkpointing.
tests/storage/test_checkpoint.cc Introduces typed checkpoint test suites and adds new DROP TABLE / edge-table checkpoint scenarios.
src/utils/property/table.cc Implements Table::drop() by dropping column storage and clearing state.
src/storages/graph/vertex_table.cc Extends VertexTable::Open to optionally skip loading from checkpoint.
src/storages/graph/property_graph.cc Uses the new “don’t load from checkpoint” open mode for newly created tables; handles tombstoned labels.
src/storages/graph/edge_table.cc Extends EdgeTable::Open similarly and adds explicit Close()/Drop() helpers.
src/storages/csr/mutable_csr.cc Adds drop() implementations to delete backing files and release resources; makes snapshot open path conditional.
include/neug/utils/property/column.h Adds pure-virtual drop() to columns and implements it for concrete column types.
include/neug/utils/id_indexer.h Resets additional state on close() and implements file deletion in drop().
include/neug/storages/graph/vertex_table.h Adds a default ctor and extends Open() signature with load_from_checkpoint.
include/neug/storages/graph/edge_table.h Extends Open() and adds Close()/Drop() declarations.
include/neug/storages/csr/mutable_csr.h Declares drop() on CSR implementations.
include/neug/storages/csr/csr_base.h Adds default drop() implementation delegating to close().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/python_bind/tests/test_db_query.py
Comment thread tests/storage/test_checkpoint.cc
Comment thread tests/storage/test_checkpoint.cc Outdated
Comment thread tests/storage/test_checkpoint.cc Outdated
Comment thread tests/storage/test_checkpoint.cc
@zhanglei1949 zhanglei1949 changed the title fix: Fix checkpoint related bugs fix: Introduce Drop() for MMapContainer and fix checkpoint related bugs May 6, 2026
@zhanglei1949 zhanglei1949 reopened this May 22, 2026
Add Drop() to MMapContainer

fix
@zhanglei1949
Copy link
Copy Markdown
Member Author

Will be resolved by #399

zhanglei1949 added a commit that referenced this pull request May 25, 2026
… (#399)

## Summary

Fixes #293 and implements the refactor tracked in #398. Replaces the
earlier PR #306 approach with a tighter Drop/checkpoint contract that
keeps file-system mutation out of the container layer.

- **Drop()** at every layer releases in-memory state only;
`checkpoint_dir` is touched exclusively by `Dump()`. This preserves the
implicit crash-rollback semantics for DROP-before-CHECKPOINT.
- **`Open()` split into `Open()` (restore from checkpoint) and
`Initialize()` (fresh table).** Replaces the leaky `bool
load_from_checkpoint = true` parameter.
- **`Initialize()` sweeps `tmp_dir` for files keyed on the same label
name/triple** before opening fresh containers. This is what unsticks the
same-session DROP+CREATE stale-data path — schema reuses the numeric
`label_t` for a same-name CREATE, but tmp filenames key on the string
name.
- **`DeleteVertexType` and `DeleteEdgeType` call `Drop()` before
erasing**, making the two paths symmetric.
- **`IDataContainer::Drop()` is intentionally NOT added.** In
`kInMemory` / `kHugePagePreferred` modes a container's `path_` points at
the checkpoint file, so a generic Drop-deletes-path contract would
silently corrupt checkpoint state. See #398 for the full rationale.
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.

[BUG] DROP TABLE does not clear checkpointed data; stale nodes visible after CREATE TABLE IF NOT EXISTS

2 participants