Skip to content

Commit

Permalink
Move openTransactionCount around
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmlee101 committed Dec 11, 2024
1 parent a7df55e commit 9473d76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sqlitecluster/SQLite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,13 @@ bool SQLite::beginTransaction(TRANSACTION_TYPE type) {
// Reset before the query, as it's possible the query sets these.
_autoRolledBack = false;

SINFO("[concurrent] Beginning transaction - open transaction count: " << (_sharedData.openTransactionCount + 1));
uint64_t before = STimeNow();
_insideTransaction = !SQuery(_db, "starting db transaction", "BEGIN CONCURRENT");

// We actively track transaction counts incrementing and decrementing to log the number of active open transactions at any given moment.
_sharedData.openTransactionCount++;

SINFO("[concurrent] Beginning transaction - open transaction count: " << (_sharedData.openTransactionCount));
uint64_t before = STimeNow();
_insideTransaction = !SQuery(_db, "starting db transaction", "BEGIN CONCURRENT");

// Because some other thread could commit once we've run `BEGIN CONCURRENT`, this value can be slightly behind
// where we're actually able to start such that we know we shouldn't get a conflict if this commits successfully on
// leader. However, this is perfectly safe, it just adds the possibility that threads on followers wait for an
Expand Down

0 comments on commit 9473d76

Please sign in to comment.