Skip to content

fix: isolate query plans by schema generation - #814

Open
zhanglei1949 wants to merge 3 commits into
alibaba:mainfrom
zhanglei1949:zl/schema-aware-query-cache
Open

fix: isolate query plans by schema generation#814
zhanglei1949 wants to merge 3 commits into
alibaba:mainfrom
zhanglei1949:zl/schema-aware-query-cache

Conversation

@zhanglei1949

Copy link
Copy Markdown
Member

Summary

  • tag each published graph snapshot with a schema generation that remains stable while readers keep that snapshot pinned
  • key global and execution-slot query caches by {schema_generation, query} instead of query text alone
  • advance the generation only for schema changes, while ordinary DML keeps the same generation
  • add a regression that lets an old-snapshot reader repopulate the cache after DDL and verifies a new reader cannot reuse that plan

Cache clearing remains useful for reclamation, but cache correctness no longer depends on clear timing. This PR is independently based on main; it intentionally excludes the coherent read-view protocol, transaction admission gate, and snapshot/WAL preparation changes split from #803.

Fixes #775

Validation

  • cmake --build build --target test_db_svc graph_snapshot_store_test tp_index_test transaction_test -j4
  • MODERN_GRAPH_DATA_DIR=$PWD/example_dataset/modern_graph build/tests/unittest/test_db_svc --gtest_filter=NeugDBServiceTest.QueryCacheSeparatesSchemaGenerations (passed)
  • MODERN_GRAPH_DATA_DIR=$PWD/example_dataset/modern_graph ctest --test-dir build -R '^test_db_svc$' --output-on-failure (34/34 passed; run outside the sandbox for local-port tests)\n- ctest --test-dir build -R 'graph_snapshot_store_test|tp_index_test|transaction_test' --output-on-failure (3/3 passed)

Copilot AI review requested due to automatic review settings July 30, 2026 04:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zhanglei1949
zhanglei1949 force-pushed the zl/schema-aware-query-cache branch from df3c927 to 46684b0 Compare July 31, 2026 09:04
Copilot AI review requested due to automatic review settings July 31, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 31, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zhanglei1949
zhanglei1949 marked this pull request as ready for review July 31, 2026 10:14
@zhanglei1949
zhanglei1949 requested a review from liulx20 July 31, 2026 10:34
Copilot AI review requested due to automatic review settings July 31, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Query cache can be repopulated with stale plans after schema changes

2 participants