fix: skip the fork lock when a fork creation has no storage to purge (#11842)

* fix: skip the fork lock when a fork creation has no storage to purge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: word the fork lock skip for both purge callers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-10-17 08:29:14 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 89f36a73d1
commit 0b54ebc73d
@@ -2399,6 +2399,11 @@ pub(crate) async fn purge_fork_storages_unless_live(
w_id: &str,
prepared: Vec<PreparedForkStoragePurge>,
) -> Result<Vec<String>> {
// The lock only orders a purge against a same-id fork write; with nothing to purge, waiting
// on it would only hold fork creation's answer behind such a write.
if prepared.is_empty() {
return Ok(vec![]);
}
let mut lock = db.begin().await?;
sqlx::query("SELECT pg_advisory_xact_lock(hashtext('fork:' || $1))")
.bind(w_id)