Skip to content

fix(query): preserve last-write-wins across query plans - #27598

Open
1fanwang wants to merge 1 commit into
influxdata:mainfrom
1fanwang:fix-queryable-buffer-row-order
Open

1fanwang wants to merge 1 commit into
influxdata:mainfrom
1fanwang:fix-queryable-buffer-row-order

Conversation

@1fanwang

Copy link
Copy Markdown

Closes #27548

After a point was overwritten, equivalent SQL queries could disagree about which generation was current. In the reported workload, component-tag and IN reads returned all 12 corrected rows while a plant-wide read returned 6. A snapshot could then persist the stale half.

Buffered generations shared one __chunk_order, leaving equal sort keys with no recency tie-breaker. Buffer chunks now expose their append order as a row range. Deduplication sees a total order, so the latest fields win across query plans, WAL replay, snapshots, and mixed buffered/parquet reads.

Testing

cargo test --locked -p influxdb3_query_executor overwrite_returns_latest_values_for_all_query_shapes -- --nocapture

Regression output
Before (693b1fd1b96cdcb980cf76a1004c0b3f1b46db48):
Diff < left / right > :
<6
>12
test tests::overwrite_returns_latest_values_for_all_query_shapes ... FAILED

After:
test tests::overwrite_returns_latest_values_for_all_query_shapes ... ok
test result: ok. 1 passed; 0 failed

Checks

  • cargo test --locked -p iox_query

  • cargo test --locked -p influxdb3_write

  • cargo clippy --locked --all-targets -p iox_query -p influxdb3_write -p influxdb3_query_executor -- -D warnings

  • cargo fmt --all --check

  • I've read the contributing section of the project README.

  • Signed CLA (if not already signed).

Equivalent queries could return different generations of an overwritten point because buffered duplicates had no total recency order. Snapshotting could then persist the stale winner instead of the latest write.

Refs: influxdata#27548
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant