DBZ-5351 Add warning for LogMiner rows with unsupported op type

This commit is contained in:
Chris Cranford 2022-07-06 09:51:12 -04:00 committed by Chris Cranford
parent 9cca260197
commit 28c26741d6
3 changed files with 20 additions and 3 deletions

View File

@ -98,7 +98,9 @@ public static String build(OracleConnectorConfig connectorConfig, OracleDatabase
query.append(") OR (OPERATION_CODE IN (1,2,3,9,10,11,29) ");
}
else {
query.append(") OR (OPERATION_CODE IN (1,2,3) ");
// Only capture UNSUPPORTED operations (255) when LOB is disabled to avoid
// the logging handler writing duplicate entries due to re-mining strategy
query.append(") OR (OPERATION_CODE IN (1,2,3,255) ");
}
if (pdbPredicate != null) {
// Restrict Insert, Update, Delete, and optionally SelectLob, LobWrite, LobTrim, and LobErase by PDB
@ -118,7 +120,9 @@ public static String build(OracleConnectorConfig connectorConfig, OracleDatabase
query.append("(OPERATION_CODE IN (1,2,3,9,10,11,29) ");
}
else {
query.append("(OPERATION_CODE IN (1,2,3) ");
// Only capture UNSUPPORTED operations (255) when LOB is disabled to avoid
// the logging handler writing duplicate entries due to re-mining strategy
query.append("(OPERATION_CODE IN (1,2,3,255) ");
}
// In this mode, the connector will filter DDL operations based on the table inclusion/exclusion lists
// We pass "null" to the DDL predicate because we will have added the predicate earlier as a part of

View File

@ -291,6 +291,9 @@ protected void processRow(OraclePartition partition, LogMinerEventRow row) throw
case DELETE:
handleDataEvent(row);
break;
case UNSUPPORTED:
handleUnsupportedEvent(row);
break;
}
}
@ -767,6 +770,16 @@ protected void handleDataEvent(LogMinerEventRow row) throws SQLException, Interr
metrics.incrementRegisteredDmlCount();
}
protected void handleUnsupportedEvent(LogMinerEventRow row) {
if (!Strings.isNullOrEmpty(row.getTableName())) {
LOGGER.warn("An unsupported operation detected for table '{}' in transaction {} with SCN {} on redo thread {}.",
row.getTableId(),
row.getTransactionId(),
row.getScn(),
row.getThread());
}
}
/**
* Checks to see whether the offset's {@code scn} is remaining the same across multiple mining sessions
* while the offset's {@code commit_scn} is changing between sessions.

View File

@ -52,7 +52,7 @@ public class LogMinerQueryBuilderTest {
public TestRule skipRule = new SkipTestDependingOnAdapterNameRule();
private static final String OPERATION_CODES_LOB_ENABLED = "(1,2,3,9,10,11,29)";
private static final String OPERATION_CODES_LOB_DISABLED = "(1,2,3)";
private static final String OPERATION_CODES_LOB_DISABLED = "(1,2,3,255)";
private OracleDatabaseSchema schema;