DBZ-8125 Make ORA-00600 errors related to krvrdGetUID retriable

This commit is contained in:
Chris Cranford 2024-08-08 09:17:25 -04:00 committed by Chris Cranford
parent dac968cdd1
commit 497d791436

View File

@ -6,6 +6,7 @@
package io.debezium.connector.oracle;
import java.io.IOException;
import java.sql.SQLException;
import java.sql.SQLRecoverableException;
import java.util.Set;
@ -52,6 +53,16 @@ public class OracleErrorHandler extends ErrorHandler {
"failed to exclusively lock system dictionary" // nested ORA-01327
);
/**
* Contents of this set will be applied if and only if the error is ORA-00600.
* These are special cases where an internal error was thrown and we need to
* evaluate the argument contents.
*/
@Immutable
private static final Set<String> RETRIABLE_ORA600_ERROR_MESSAGES = Collect.unmodifiableSet(
"krvrdGetUID" // Changes made to object identifier (schema change)
);
public OracleErrorHandler(OracleConnectorConfig connectorConfig, ChangeEventQueue<?> queue, ErrorHandler replacedErrorHandler) {
super(OracleConnector.class, connectorConfig, queue, replacedErrorHandler);
}
@ -64,6 +75,21 @@ protected boolean isRetriable(Throwable throwable) {
return true;
}
// Specifically checks the SQLException ORA-00600 use cases separately.
// We do this because we want to specifically check these parameter arguments, but
// only when the SQL error code is 600 for (ORA-00600).
if (throwable instanceof SQLException) {
final SQLException sqlException = (SQLException) throwable;
final String message = sqlException.getMessage();
if (sqlException.getErrorCode() == 600 || (message != null && message.startsWith("ORA-00600"))) {
for (String match : RETRIABLE_ORA600_ERROR_MESSAGES) {
if (message.contains(match)) {
return true;
}
}
}
}
// If message is provided, run checks against it
final String message = throwable.getMessage();
if (message != null && message.length() > 0) {