diff --git a/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java b/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java index b0edb3b..7ca4ff4 100644 --- a/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java +++ b/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java @@ -11,7 +11,6 @@ import java.sql.Savepoint; import java.sql.Statement; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -32,7 +31,6 @@ import io.debezium.relational.Tables; import io.debezium.schema.SchemaChangeEvent; import io.debezium.snapshot.SnapshotterService; -import io.debezium.spi.snapshot.Snapshotter; import io.debezium.util.Clock; public class Db2SnapshotChangeEventSource extends RelationalSnapshotChangeEventSource { @@ -90,7 +88,7 @@ else if (connectorConfig.getSnapshotIsolationMode() == SnapshotIsolationMode.EXC } Optional lockingStatement = snapshotterService.getSnapshotLock().tableLockingStatement(connectorConfig.snapshotLockTimeout(), - Set.of(quoteTableName(tableId))); + quoteTableName(tableId)); if (lockingStatement.isPresent()) { LOGGER.info("Locking table {}", tableId); diff --git a/src/main/java/io/debezium/connector/db2/snapshot/lock/ExclusiveSnapshotLock.java b/src/main/java/io/debezium/connector/db2/snapshot/lock/ExclusiveSnapshotLock.java index dbd08a0..2f58272 100644 --- a/src/main/java/io/debezium/connector/db2/snapshot/lock/ExclusiveSnapshotLock.java +++ b/src/main/java/io/debezium/connector/db2/snapshot/lock/ExclusiveSnapshotLock.java @@ -8,7 +8,6 @@ import java.time.Duration; import java.util.Map; import java.util.Optional; -import java.util.Set; import io.debezium.connector.db2.Db2ConnectorConfig; import io.debezium.snapshot.spi.SnapshotLock; @@ -26,9 +25,7 @@ public void configure(Map properties) { } @Override - public Optional tableLockingStatement(Duration lockTimeout, Set tableIds) { - - String tableId = tableIds.iterator().next(); // For Db2 we expect just one table at time. + public Optional tableLockingStatement(Duration lockTimeout, String tableId) { return Optional.of("SELECT * FROM " + tableId + " WHERE 0=1 WITH CS"); } diff --git a/src/main/java/io/debezium/connector/db2/snapshot/lock/NoSnapshotLock.java b/src/main/java/io/debezium/connector/db2/snapshot/lock/NoSnapshotLock.java index 2a1d1a1..ab4294d 100644 --- a/src/main/java/io/debezium/connector/db2/snapshot/lock/NoSnapshotLock.java +++ b/src/main/java/io/debezium/connector/db2/snapshot/lock/NoSnapshotLock.java @@ -8,7 +8,6 @@ import java.time.Duration; import java.util.Map; import java.util.Optional; -import java.util.Set; import io.debezium.connector.db2.Db2ConnectorConfig; import io.debezium.snapshot.spi.SnapshotLock; @@ -26,7 +25,7 @@ public void configure(Map properties) { } @Override - public Optional tableLockingStatement(Duration lockTimeout, Set tableIds) { + public Optional tableLockingStatement(Duration lockTimeout, String tableId) { return Optional.empty(); }