Repository navigation
Vacuum the write-loop timing test's tables without parallel workers, so a pooled session's shared memory doesn't starve a later vector-index build - #436
Merged
Conversation
…so a pooled session's shared memory doesn't starve a later vector-index build test_compiled_write_loop_time ran VACUUM ANALYZE drivine_edge over 20k dead edges, which Postgres did in parallel, and left drivine_node at some 8 MB of dead rows, so a later index on it was built in parallel. Each pooled session that ran something in parallel kept a dynamic shared memory segment until it ended, and with two of them a parallel HNSW build couldn't get its 64 MB of a 64 MB /dev/shm: main failed on Python 3.14. The VACUUM now runs with PARALLEL 0, and the test vacuums its emptied tables after it.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes main, which is red on Python 3.14 since #428's merge (b33e2fd), in CI run 42118394771. The sync vector-index tests fail there with
DiskFull: could not resize shared memory segment … to 63999616 bytes: No space left on device.Cause
tests/*/sql/test_compiled_write_loop_time.pyleaves pooled Postgres sessions holding/dev/shm. The first time a backend runs anything in parallel, it keeps a dynamic shared memory segment of about 1.2 MB until it disconnects, and the pool keeps backends connected. A parallel HNSW build asks for 63,999,616 bytes, which leaves about 3.1 MB of the 64 MB free. So the build fits while one session holds a segment, and fails once two do.The test made two sessions hold one:
min_parallel_index_scan_size, and its final DELETE leaves 20,000 dead edges. The sync twin'sVACUUM ANALYZE drivine_edgethen vacuums those indexes in parallel. Across that statement,/dev/shmwent from 1,075,552 to 2,320,864 bytes, and the pooled backend that ran it held the segment through the sync schema tests.drivine_nodewith about 8 MB of dead rows, which is overmin_parallel_table_scan_size. A later range-index build on it ran in parallel, and that build's backend held a second segment. The same table size is what makes the HNSW build parallel at all.These were found by listing
/dev/shmaround each test withpg_ls_dirandpg_stat_file, and mapping each segment to its backend through/proc/<pid>/maps.Whether the failure shows depends on autovacuum clearing the dead rows in time, which is why only some runs fail.
Fix
The fix is in the tests only:
VACUUM (PARALLEL 0, ANALYZE) drivine_edge. The table is still vacuumed empty there, so the case still drives A compiled MERGE of many relationships is quadratic on Postgres once the edge table is vacuumed empty #420's cause.VACUUM (PARALLEL 0) drivine_node, drivine_edge, which truncates the emptied tables.With both, no backend held an extra segment at any point in a full run. Before every sync
test_schematest,/dev/shmheld only Postgres's own two segments. No shm size was raised, and nothing was skipped or marked xfail.Follow-ups (next train)
Gate
ruff check,ruff format --check,pyrightandunasync --check.