files partitions: no deadlock, four ahead, and a failure no longer stops the GC sweep
Creating a partition deadlocked with file inserts 11 times in an hour, and each failure ended the GC sweep before its deletes. The parent is now locked first (lock_timeout 10 s), four partitions are kept ahead, and an error is logged while the sweep goes on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e3e3ecc93d
commit
f8ee7e8662
3 files changed
+29
-10
No files matched your search
@@ -39,10 +39,11 @@ test.group('files partitions', (group) => {
|
||||
)
|
||||
return Number(rows[0].upper)
|
||||
}
|
||||
await FilePartitions.ensure()
|
||||
const before = await upper()
|
||||
assert.deepEqual(await FilePartitions.ensure(), [])
|
||||
// A file near the end of the covered ids: one more partition is needed.
|
||||
await db.rawQuery(`SELECT setval('files_id_seq', ?, false)`, [before - FILE_PARTITION_SIZE - 10])
|
||||
// Ids handed out up to just inside the four partitions kept ahead: one more is needed.
|
||||
await db.rawQuery(`SELECT setval('files_id_seq', ?, false)`, [before - 4 * FILE_PARTITION_SIZE + 10])
|
||||
await FileStore.insert([file('e'.repeat(40), 'late.bin')])
|
||||
assert.deepEqual(await FilePartitions.ensure(), [`files_p${before}`])
|
||||
assert.equal(await upper(), before + FILE_PARTITION_SIZE)
|
||||
|
||||
Reference in new issue
Block a user