citusdata / citus

Distributed PostgreSQL as an extension
https://www.citusdata.com
GNU Affero General Public License v3.0
10.63k stars 670 forks source link

PG17 compatibility - Check if there are blocks left in columnar_scan_analyze_next_block #7738

Closed naisila closed 4 days ago

naisila commented 1 week ago

In PG17, the outer loop in acquire_sample_rows() changed from while (BlockSampler_HasMore(&bs)) to while (table_scan_analyze_next_block(scan, stream))

Relevant PG commit: 041b96802efa33d2bc9456f2ad946976b92b5ae1 https://github.com/postgres/postgres/commit/041b96802efa33d2bc9456f2ad946976b92b5ae1

It is expected that the scan_analyze_next_block function will check if there are any blocks left. So we add that check in columnar_scan_analyze_next_block

Without this fix, we will have an indefinite loop causing timeout. Specifically, in our test schedules, multi schedule stuck at drop_column_partitioned_table test multi-mx schedule stuck at start_stop_metadata_sync test columnar schedule stuck at columnar_create test

Note to reviewer: First three commits are for PG17 testing purposes. Only the last commit will be merged.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (release-13.0@32a2a31). Learn more about missing BASE report.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## release-13.0 #7738 +/- ## =============================================== Coverage ? 89.63% =============================================== Files ? 274 Lines ? 59583 Branches ? 7436 =============================================== Hits ? 53409 Misses ? 4040 Partials ? 2134 ```