DBZ-1440 Use ServerVersion values instead of integers
This commit is contained in:
parent
135e66dd0d
commit
e7dc1dfb62
@ -23,6 +23,7 @@
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.apache.kafka.connect.errors.ConnectException;
|
import org.apache.kafka.connect.errors.ConnectException;
|
||||||
|
import org.postgresql.core.ServerVersion;
|
||||||
import org.postgresql.jdbc.PgConnection;
|
import org.postgresql.jdbc.PgConnection;
|
||||||
import org.postgresql.replication.LogSequenceNumber;
|
import org.postgresql.replication.LogSequenceNumber;
|
||||||
import org.postgresql.replication.PGReplicationStream;
|
import org.postgresql.replication.PGReplicationStream;
|
||||||
@ -204,7 +205,7 @@ else if (shouldCreateSlot || !slotInfo.hasValidFlushedLsn()) {
|
|||||||
|
|
||||||
// Temporary replication slots is a new feature of PostgreSQL 10
|
// Temporary replication slots is a new feature of PostgreSQL 10
|
||||||
private boolean useTemporarySlot() throws SQLException {
|
private boolean useTemporarySlot() throws SQLException {
|
||||||
return dropSlotOnClose && pgConnection().haveMinimumServerVersion(100000);
|
return dropSlotOnClose && pgConnection().haveMinimumServerVersion(ServerVersion.v10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,7 +272,7 @@ public Optional<SlotCreationResult> createReplicationSlot() throws SQLException
|
|||||||
LOGGER.debug("Creating new replication slot '{}' for plugin '{}'", slotName, plugin);
|
LOGGER.debug("Creating new replication slot '{}' for plugin '{}'", slotName, plugin);
|
||||||
String tempPart = "";
|
String tempPart = "";
|
||||||
// Exported snapshots are supported in PostgreSQL 9.4+
|
// Exported snapshots are supported in PostgreSQL 9.4+
|
||||||
Boolean canExportSnapshot = pgConnection().haveMinimumServerVersion(90400);
|
Boolean canExportSnapshot = pgConnection().haveMinimumServerVersion(ServerVersion.v9_4);
|
||||||
if ((dropSlotOnClose || exportSnapshot) && !canExportSnapshot) {
|
if ((dropSlotOnClose || exportSnapshot) && !canExportSnapshot) {
|
||||||
LOGGER.warn("A slot marked as temporary or with an exported snapshot was created, " +
|
LOGGER.warn("A slot marked as temporary or with an exported snapshot was created, " +
|
||||||
"but not on a supported version of Postgres, ignoring!");
|
"but not on a supported version of Postgres, ignoring!");
|
||||||
|
Loading…
Reference in New Issue
Block a user