From 83fee1cbfc98d90be1b7551a2802688193a2c1e2 Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Fri, 22 Jan 2021 15:35:28 -0500 Subject: [PATCH] DBZ-2949 Guard against LAST_DDL_TIME with value of 0 --- .../oracle/OracleSnapshotChangeEventSource.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/OracleSnapshotChangeEventSource.java b/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/OracleSnapshotChangeEventSource.java index 564bd9718..ea7fe00e2 100644 --- a/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/OracleSnapshotChangeEventSource.java +++ b/debezium-connector-oracle/src/main/java/io/debezium/connector/oracle/OracleSnapshotChangeEventSource.java @@ -184,7 +184,15 @@ private Optional getLatestTableDdlScn(RelationalSnapshotContext ctx) throw throw new IllegalStateException("Couldn't get latest table DDL SCN"); } - return Optional.of(rs.getLong(1)); + // Guard against LAST_DDL_TIME with value of 0. + // This case should be treated as if we were unable to determine a value for LAST_DDL_TIME. + // This forces later calculations to be based upon the current SCN. + Long latestDdlTime = rs.getLong(1); + if (latestDdlTime != null && latestDdlTime == 0L) { + return Optional.empty(); + } + + return Optional.of(latestDdlTime); } catch (SQLException e) { if (e.getErrorCode() == 8180) {