From 391eb03bab55f724c9ac296868dcb10cf60a7676 Mon Sep 17 00:00:00 2001 From: mfvitale Date: Mon, 18 Mar 2024 16:47:30 +0100 Subject: [PATCH] DBZ-7308 Move getSnapshottingTask to RelationalSnapshotChangeEventSource --- .../db2/Db2SnapshotChangeEventSource.java | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java b/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java index 8b23a1e..b0edb3b 100644 --- a/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java +++ b/src/main/java/io/debezium/connector/db2/Db2SnapshotChangeEventSource.java @@ -51,41 +51,6 @@ public Db2SnapshotChangeEventSource(Db2ConnectorConfig connectorConfig, MainConn this.jdbcConnection = connectionFactory.mainConnection(); } - @Override - public SnapshottingTask getSnapshottingTask(Db2Partition partition, Db2OffsetContext previousOffset) { - - final Snapshotter snapshotter = snapshotterService.getSnapshotter(); - - List dataCollectionsToBeSnapshotted = connectorConfig.getDataCollectionsToBeSnapshotted(); - Map snapshotSelectOverridesByTable = connectorConfig.getSnapshotSelectOverridesByTable().entrySet().stream() - .collect(Collectors.toMap(e -> e.getKey().identifier(), Map.Entry::getValue)); - - boolean offsetExists = previousOffset != null; - boolean snapshotInProgress = false; - - if (offsetExists) { - snapshotInProgress = previousOffset.isSnapshotRunning(); - } - - if (offsetExists && !previousOffset.isSnapshotRunning()) { - LOGGER.info("A previous offset indicating a completed snapshot has been found. Neither schema nor data will be snapshotted."); - } - - boolean shouldSnapshotSchema = snapshotter.shouldSnapshotSchema(offsetExists, snapshotInProgress); - boolean shouldSnapshotData = snapshotter.shouldSnapshotData(offsetExists, snapshotInProgress); - - if (shouldSnapshotData && shouldSnapshotSchema) { - LOGGER.info("According to the connector configuration both schema and data will be snapshot."); - } - else if (shouldSnapshotSchema) { - LOGGER.info("According to the connector configuration only schema will be snapshot."); - } - - return new SnapshottingTask(shouldSnapshotSchema, shouldSnapshotData, - dataCollectionsToBeSnapshotted, snapshotSelectOverridesByTable, - false); - } - @Override protected SnapshotContext prepare(Db2Partition partition, boolean onDemand) { return new Db2SnapshotContext(partition, jdbcConnection.getRealDatabaseName(), onDemand);