Backup: release the held index cache writes also when the dump transaction fails to start

holdIndexCache() ran before beginTransaction(), outside the try, and the release came after
rollBack(); an exception from either left later cache writes queued for the rest of the run.
This commit is contained in:
2026-10-08 20:38:25 +02:00
parent 466cff8857
commit ab3265e42c
+3
View File
@@ -75,6 +75,7 @@ final class DbDumper {
// A pack that fills up during the dump is uploaded right away; its index cache row must // A pack that fills up during the dump is uploaded right away; its index cache row must
// wait until the read-only transaction is over. // wait until the read-only transaction is over.
$repo->holdIndexCache(); $repo->holdIndexCache();
try {
$this->db->setTransactionIsolation(TransactionIsolationLevel::REPEATABLE_READ); $this->db->setTransactionIsolation(TransactionIsolationLevel::REPEATABLE_READ);
$this->db->beginTransaction(); $this->db->beginTransaction();
try { try {
@@ -119,6 +120,8 @@ final class DbDumper {
} }
} finally { } finally {
$this->db->rollBack(); $this->db->rollBack();
}
} finally {
$repo->releaseIndexCache(); $repo->releaseIndexCache();
} }
$repo->flushPacks(); $repo->flushPacks();