fix(core): fix for view becomes suspended after it is altered#6623
fix(core): fix for view becomes suspended after it is altered#6623bluestreak01 merged 5 commits intomasterfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughChanges relocate metadata write operation in TableUtils to execute unconditionally for both views and non-views, add suspension validation in view tests, and introduce a new checkpoint recovery test for altered views. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @core/src/test/java/io/questdb/test/cairo/view/AbstractViewTest.java:
- Around line 142-146: The helper assertViewState should null-check the
TableToken returned by engine.getTableTokenIfExists(name) before calling
engine.getTableSequencerAPI().isSuspended(viewToken); if viewToken is null, fail
the test with a clear message (e.g., "view/table not found: " + name) so the
root cause is exposed, then proceed to call isSuspended(viewToken) and
engine.getViewStateStore().getViewState(viewToken) only when viewToken is
non-null.
🧹 Nitpick comments (1)
core/src/test/java/io/questdb/test/griffin/CheckpointTest.java (1)
999-1044: Tighten test wording + add a null-check forviewToken
- Line 1032: comment says “dropped view” but the view is altered; this reads like copy/paste and can confuse future readers.
- Line 1035-1036: add
Assert.assertNotNull(viewToken)for clearer failures.Proposed tweak
- // the dropped view should be restored + // the pre-checkpoint view definition should be restored final TableToken viewToken = engine.getTableTokenIfExists("v"); + Assert.assertNotNull(viewToken); final ViewDefinition viewDefinition = engine.getViewGraph().getViewDefinition(viewToken);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
core/src/main/java/io/questdb/cairo/TableUtils.javacore/src/test/java/io/questdb/test/cairo/view/AbstractViewTest.javacore/src/test/java/io/questdb/test/griffin/CheckpointTest.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-08T21:35:08.739Z
Learnt from: glasstiger
Repo: questdb/questdb PR: 6612
File: core/src/main/java/io/questdb/cairo/TableNameRegistryStore.java:313-325
Timestamp: 2026-01-08T21:35:08.739Z
Learning: In TableNameRegistryStore.java's readTableId() method, NumericException from getTableIdFromTableDir() for view directories is intentionally allowed to propagate and fail database startup. This fail-fast behavior is correct because corrupted view directory names indicate database tampering, and views with table id 0 would not show obvious failures. Regular tables without _meta files return 0 to allow database startup for resilience.
Applied to files:
core/src/test/java/io/questdb/test/griffin/CheckpointTest.java
🧬 Code graph analysis (1)
core/src/main/java/io/questdb/cairo/TableUtils.java (1)
core/src/main/java/io/questdb/std/MemoryTag.java (1)
MemoryTag(27-184)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (36)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-other)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-pgwire)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-cairo-sub)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-cairo-root)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-fuzz2)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-fuzz1)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-griffin-sub)
- GitHub Check: New pull request (SelfHosted Running tests with cover on linux-griffin-root)
- GitHub Check: New pull request (SelfHosted Other tests on linux-arm64)
- GitHub Check: New pull request (Rust Test and Lint on linux-jdk17)
- GitHub Check: New pull request (SelfHosted Other tests on linux-x64-zfs)
- GitHub Check: New pull request (SelfHosted Griffin tests on linux-x86-graal)
- GitHub Check: New pull request (SelfHosted Other tests on linux-x86-graal)
- GitHub Check: New pull request (Hosted Running tests on windows-other-2)
- GitHub Check: New pull request (Hosted Running tests on windows-other-1)
- GitHub Check: New pull request (Hosted Running tests on windows-pgwire)
- GitHub Check: New pull request (Hosted Running tests on windows-cairo-2)
- GitHub Check: New pull request (Hosted Running tests on windows-cairo-1)
- GitHub Check: New pull request (Hosted Running tests on windows-fuzz2)
- GitHub Check: New pull request (Hosted Running tests on windows-fuzz1)
- GitHub Check: New pull request (Hosted Running tests on windows-griffin-sub)
- GitHub Check: New pull request (Hosted Running tests on windows-griffin-base)
- GitHub Check: New pull request (Hosted Running tests on mac-other)
- GitHub Check: New pull request (Hosted Running tests on mac-pgwire)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo-fuzz)
- GitHub Check: New pull request (SelfHosted Griffin tests on linux-x64-zfs)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo)
- GitHub Check: New pull request (SelfHosted Cairo tests on linux-x86-graal)
- GitHub Check: New pull request (SelfHosted Griffin tests on linux-arm64)
- GitHub Check: New pull request (SelfHosted Cairo tests on linux-arm64)
- GitHub Check: New pull request (Hosted Running tests on mac-griffin)
- GitHub Check: New pull request (SelfHosted Cairo tests on linux-x64-zfs)
- GitHub Check: New pull request (Trigger Enterprise CI Trigger Enterprise Pipeline)
- GitHub Check: New pull request (Check Changes Check changes)
- GitHub Check: build
- GitHub Check: build
🔇 Additional comments (1)
core/src/main/java/io/questdb/cairo/TableUtils.java (1)
576-606: Fix is safe; no code infers view-ness from_metaabsenceViews are detected explicitly via
TableToken.isView(), the_viewdefinition file marker, or structural metadata. No legacy logic depends on_metaabsence for view detection. Writing_metafor views poses no compatibility risk.
[PR Coverage check]😍 pass : 5 / 5 (100.00%) file detail
|
When a view was altered, it became suspended because of missing metadata.
This PR fixes the issue by adding the metadata back.
Changed tests (alter view, checkpoint, view replication) to assert that views are not suspended.
We should explore how to get rid of the
_metafiles completely for views, but the sequencer, the writer, checkpoint/backup and replication all rely on its presence at least to some extent.required by https://github.com/questdb/questdb-enterprise/pull/853