Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBZ-PGYB][yugabyte/yugabyte-db#25716] Set GUC to disable catalog version check for connections #169

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,35 @@ protected Optional<String> getSnapshotSelect(RelationalSnapshotContext<PostgresP
return snapshotter.buildSnapshotQuery(tableId, columns);
}

protected void disableCatalogVersionCheck() throws SQLException {
final String disableCatalogVersionCheckStmt =
"DO " +
"LANGUAGE plpgsql $$ " +
"BEGIN " +
"SET yb_disable_catalog_version_check = true; " +
"EXCEPTION " +
"WHEN sqlstate '42704' THEN "+
"RAISE EXCEPTION 'GUC not found'; " +
"WHEN OTHERS THEN " +
"CALL disable_catalog_version_check(); " +
"END $$;";

LOGGER.info("Disabling catalog version check with statement: {}", disableCatalogVersionCheckStmt);
try {
jdbcConnection.execute(disableCatalogVersionCheckStmt);
} catch (SQLException sqle) {
if (sqle.getMessage().contains("GUC not found")) {
LOGGER.warn("GUC not present: yb_disable_catalog_version_check");
jdbcConnection.execute("ABORT;");
} else {
throw sqle;
}
}
}
protected void setSnapshotTransactionIsolationLevel(boolean isOnDemand) throws SQLException {
if (!YugabyteDBServer.isEnabled() || connectorConfig.isYbConsistentSnapshotEnabled()) {
disableCatalogVersionCheck();

LOGGER.info("Setting isolation level");
String transactionStatement = snapshotter.snapshotTransactionIsolationLevelStatement(slotCreatedInfo, isOnDemand);
LOGGER.info("Opening transaction with statement {}", transactionStatement);
Expand Down
Loading