fix(agentctl): re-lock write txn after schema DDL for claim CAS
This commit is contained in:
+7
-2
@@ -588,13 +588,18 @@ class Repo:
|
||||
db.execute('PRAGMA busy_timeout=5000')
|
||||
if write:
|
||||
db.execute('PRAGMA synchronous=FULL')
|
||||
# DDL inside ensure_schema implicitly commits any open txn; take the
|
||||
# exclusive lock only after schema is stable so claim/lease CAS holds.
|
||||
db.execute('BEGIN IMMEDIATE')
|
||||
ensure_schema(db)
|
||||
if db.in_transaction:
|
||||
db.execute('COMMIT')
|
||||
db.execute('BEGIN IMMEDIATE')
|
||||
yield db
|
||||
if write:
|
||||
if write and db.in_transaction:
|
||||
db.commit()
|
||||
except BaseException:
|
||||
if write:
|
||||
if write and db.in_transaction:
|
||||
db.rollback()
|
||||
raise
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user