chore(core): prevent authorization error immediately after table created#6337
chore(core): prevent authorization error immediately after table created#6337bluestreak01 merged 1 commit intomasterfrom
Conversation
WalkthroughThe changes refactor the table and materialized view creation flow by moving DDL listener notification responsibility from callers into the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
core/src/main/java/io/questdb/cairo/CairoEngine.java(4 hunks)core/src/test/java/io/questdb/test/cutlass/http/line/LineHttpSenderTest.java(3 hunks)
⏰ 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). (28)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-x64-zfs)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-arm64)
- GitHub Check: New pull request (SelfHosted Other tests on linux-arm64)
- GitHub Check: New pull request (SelfHosted Other tests on linux-x64-zfs)
- GitHub Check: New pull request (Hosted Running tests on windows-other)
- GitHub Check: New pull request (Hosted Running tests on windows-pgwire)
- GitHub Check: New pull request (Hosted Running tests on windows-cairo)
- 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)
- 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 And Fuzz tests Start X64Zfs Agent)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests Start ARM Agent)
- GitHub Check: New pull request (SelfHosted Other tests Start ARM Agent)
- GitHub Check: New pull request (Rust Test and Lint on linux-jdk17)
- GitHub Check: New pull request (SelfHosted Other tests Start X64Zfs Agent)
- GitHub Check: New pull request (Hosted Running tests on mac-griffin)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-other)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-pgwire)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-cairo)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-fuzz)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-griffin)
- GitHub Check: New pull request (Check Changes Check changes)
- GitHub Check: build
- GitHub Check: build
🔇 Additional comments (5)
core/src/main/java/io/questdb/cairo/CairoEngine.java (3)
571-571: LGTM!The updated call correctly passes both
securityContextandtableKindparameters to the refactored method.
1658-1668: LGTM!The method signature correctly adds
SecurityContextandtableKindparameters to support internal DDL listener notification with proper context.
1715-1716: LGTM - DDL notification timing is intentional.The DDL listener is notified before the table is registered in the name registry (line 1716). This ensures authorization setup completes before the table becomes visible to other threads, preventing the authorization errors mentioned in the PR objectives. The table remains locked during this period for thread safety.
core/src/test/java/io/questdb/test/cutlass/http/line/LineHttpSenderTest.java (2)
32-32: LGTM!The new imports (DefaultDdlListener, SecurityContext, AtomicBoolean) are necessary for the new test and properly utilized.
Also applies to: 35-35, 67-67
880-922: Well-designed test validating DDL listener timing.The test correctly validates that the DDL listener is invoked before the table becomes visible to other threads, which is the core behavior change. The assertions confirm:
- Table metadata is correct during the callback
- Table is not yet registered (
getTableTokenIfExistsreturns null)- Table name cannot be locked by competing threads
Minor consideration: Line 891 uses
getCurrentId()which assumes no concurrent table creation. This is likely safe in the test environment but could be fragile if test isolation changes.
[PR Coverage check]😍 pass : 3 / 3 (100.00%) file detail
|
See issue description in https://github.com/questdb/questdb-enterprise/pull/768
Required by https://github.com/questdb/questdb-enterprise/pull/768