Skip to content

fix(core): fix potential table suspended when replace commit is used on a table with a column top#6026

Merged
bluestreak01 merged 4 commits intomasterfrom
fix-mv-suspend-storage-error
Aug 6, 2025
Merged

fix(core): fix potential table suspended when replace commit is used on a table with a column top#6026
bluestreak01 merged 4 commits intomasterfrom
fix-mv-suspend-storage-error

Conversation

@ideoma
Copy link
Copy Markdown
Collaborator

@ideoma ideoma commented Aug 5, 2025

Found by a fuzz test, a replace commit fails on a column with a column top.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 5, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes include renaming a static method in the O3OpenColumnJob class and updating its invocations, clarifying prefix state management in the O3PartitionJob class to avoid ambiguity, and adding a new test in WalWriterReplaceRangeTest to verify correct behavior when columns are added mid-partition and a replace range operation is performed.

Changes

Cohort / File(s) Change Summary
Method Rename in O3OpenColumnJob
core/src/main/java/io/questdb/cairo/O3OpenColumnJob.java
Renamed static method o3PartitionMerge to mergeVarColumn and updated all internal calls accordingly.
Prefix State Handling in O3PartitionJob
core/src/main/java/io/questdb/cairo/O3PartitionJob.java
Added explicit resetting of prefixLo and prefixHi when prefixType is set to O3_BLOCK_NONE to avoid ambiguity.
New Test for Replace Range with Added Columns
core/src/test/java/io/questdb/test/cairo/wal/WalWriterReplaceRangeTest.java
Added a test method to verify replace range behavior when columns are added after partition population.

Sequence Diagram(s)

sequenceDiagram
    participant Test as WalWriterReplaceRangeTest
    participant Table as WAL Table
    participant Writer as WalWriter
    participant Reader as TableReader

    Test->>Table: Create WAL table (partitioned by day)
    Test->>Writer: Insert 500 rows (fill partition)
    Test->>Table: Add new columns (int, string)
    Test->>Writer: Start replace range (cover full partition)
    Writer->>Writer: Insert single row with all columns
    Writer->>Writer: Commit replace range
    Test->>Reader: Read and verify replaced and subsequent rows
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-mv-suspend-storage-error

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bluestreak01
Copy link
Copy Markdown
Member

@coderabbitai please review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 6, 2025

@bluestreak01: I'll review the changes in this PR that fixes the potential table suspension issue when replace commit is used on a table with a column top.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Member

@bluestreak01 bluestreak01 left a comment

Choose a reason for hiding this comment

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

great job @ideoma 👍

@glasstiger
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 4 / 6 (66.67%)

file detail

path covered line new line coverage
🔵 io/questdb/cairo/O3PartitionJob.java 2 4 50.00%
🔵 io/questdb/cairo/O3OpenColumnJob.java 2 2 100.00%

@bluestreak01 bluestreak01 merged commit 41dc027 into master Aug 6, 2025
35 checks passed
@bluestreak01 bluestreak01 deleted the fix-mv-suspend-storage-error branch August 6, 2025 17:57
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.

3 participants