DBZ-3665 Provide better error description when enabling archive log only mode

This commit is contained in:
Chris Cranford 2021-06-28 06:54:06 -04:00 committed by Gunnar Morling
parent b5e377402e
commit b9a79dcdd0

View File

@ -462,6 +462,12 @@ public static void setLogFilesForMining(OracleConnection connection, Scn lastPro
List<LogFile> logFilesForMining = getLogFilesForOffsetScn(connection, lastProcessedScn, archiveLogRetention, archiveLogOnlyMode);
if (!logFilesForMining.stream().anyMatch(l -> l.getFirstScn().compareTo(lastProcessedScn) <= 0)) {
Scn minScn = logFilesForMining.stream().map(LogFile::getFirstScn).min(Scn::compareTo).orElse(Scn.NULL);
if ((minScn.isNull() || logFilesForMining.size() == 0) && archiveLogOnlyMode) {
throw new DebeziumException("The log.mining.archive.log.only mode was recently enabled and the offset SCN " +
lastProcessedScn + "is not yet in any available archive logs. " +
"Please perform an Oracle log switch and restart the connector.");
}
throw new IllegalStateException("None of log files contains offset SCN: " + lastProcessedScn + ", re-snapshot is required.");
}