Skip to content

Commit

Permalink
[DBZ-PGYB] Set transaction isolation level before executing snapshot …
Browse files Browse the repository at this point in the history
…query (#164)

This PR makes the changes to set the transaction isolation level to
`SERIALIZABLE, READ ONLY, DEFERRABLE` before executing the snapshot read
query.
  • Loading branch information
vaibhav-yb authored Nov 12, 2024
1 parent 4e55ebd commit a464b45
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ protected void setSnapshotTransactionIsolationLevel(boolean isOnDemand) throws S
} else {
LOGGER.info("Skipping setting snapshot time, snapshot data will not be consistent");
}

// Regardless of whether consistent snapshot is enabled or not, we need to set the
// transaction isolation level.
String transactionIsolationLevelStatement = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY, DEFERRABLE;";
LOGGER.info("Setting transaction isolation levels with statement {}", transactionIsolationLevelStatement);
jdbcConnection.executeWithoutCommitting(transactionIsolationLevelStatement);
}

/**
Expand Down

0 comments on commit a464b45

Please sign in to comment.