model-writtenrun 1739 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Dimitrios Apostolou proposed replacing short seeks with reads during custom-format archive scanning, reporting that archives without stored data offsets could otherwise pause parallel restoration for nearly an hour; his initial threshold was 1 MB #1.
- Nathan Bossart questioned how the threshold was chosen #3, and Dimitrios explained that it was a rough disk-throughput estimate rather than a measured crossover #4; the next submission only corrected comment formatting #5.
- Tom Lane explained that feature freeze delayed consideration #7, and Dimitrios subsequently rebased for the next development cycle #8 #9.
- Nathan's Linux and macOS experiments suggested testing smaller thresholds #10, but Dimitrios noted that a realistic benchmark must read after seeking #13; Thomas Munro separately suggested controlling stdio buffering with setvbuf() #16.
- Dimitrios traced uncompressed archives to roughly row-sized blocks and repeated seeks within each 4 KB stdio buffer, reported a benefit from a 1 MB stdio buffer, and asked whether pg_dump could emit larger blocks #18 #20.
- Tom investigated the producer side and found that LZ4 and Zstandard flushed tiny outputs instead of retaining them across calls; he started a separate buffering series and proposed reassessing seek behavior after repairing archive generation #21.
- Tom extended the buffering fix to Zstandard's stream API and proposed approximately 128 KB blocks for all compression methods, following Zstandard's recommended output-buffer size rather than overriding it #22.
- While testing compression changes, Tom restored coverage of LZ4Stream_gets() by reinstating manual compression of blobs.toc files in eac2b1697d; this change was committed without a matching attachment.
- Further testing exposed quadratic copying when reading an LZ4-compressed toc.dat and a failure when Gzip_read received a zero-byte request; Tom expanded the series with an LZ4 decompression rewrite and gzip/Zstandard zero-byte handling fixes #23.
- Chao Li reproduced the LZ4 slowdown and gzip failure, verified the fixes, and reviewed the series #24; Tom declined his optional flush-helper refactoring suggestion because it would not improve readability #28.
- Tom committed the gzip-only portion of #23 as 1518b7d76a, the compression buffering changes together with the Zstandard zero-byte optimization as fe8192a95e, and the unchanged LZ4 decompression rewrite as 1f8062dd96.
- The remaining series added buffering for --compress=none so every compression choice would produce predictably large blocks, plus tests for uncompressed archives, manually compressed toc.dat files, and larger rows; the larger-row test initially increased test runtime by about 12 percent #28.
- Chao reviewed the remaining implementation and tests #29, then confirmed the block-size improvement after Tom corrected the benchmark to generate archives through a pipe, preventing pg_dump from storing offsets #32 #33.
- Tom addressed the test-runtime cost by extracting compression tests into 006_pg_dump_compress.pl and consolidating the new coverage, keeping the total runtime approximately unchanged #34.
- The three components of #34 landed with unchanged code as the block-size alignment 66ec01dc41, test-file split 9dcf7f1172, and additional coverage 20ec995892; Tom then requested fresh measurements of the original seek proposal #35.
- Dimitrios reported substantial improvements with newly generated archives but still measured a reduction from roughly 25 minutes to five minutes on his HDD when applying the rebased 1 MB seek-avoidance patch #37.
- Dimitrios also questioned the new uncompressed-buffer flush condition #38, but Tom explained its defensive invariant and retained the implementation #41.
- Tom's larger benchmark showed the seek patch slowing restoration on a Linux SATA SSD #40 but substantially accelerating it on a Mac Mini #43, establishing that reading entire 128 KB blocks had hardware-dependent tradeoffs.
- Dimitrios submitted a separate, explicitly unfinished 1 MB setvbuf() experiment that combined reads but leaked its allocated buffers #45, then narrowed the original seek proposal to 32 KB to benefit older archives containing tiny blocks #46.
- In the final message, Tom confirmed redundant seeks on multiple libc implementations and chose a conservative 4 KB threshold, deferring larger thresholds and stdio buffers because they needed more platform testing #47.
- The original optimization subsequently landed from #46 as fba60a1b10, modified to read blocks smaller than 4 KB, use size_t for the buffer length, and allocate at least 4 KB; the compression and test work had landed, while the larger-buffer experiment remained unfinished.