DBZ-7446 Reduce string creation during SQL_REDO column read

Oracle Connector can create a new string when reading SQL_REDO column only if CSF column value is 1.
This commit is contained in:
jchipmunk 2024-02-04 19:03:40 +03:00 committed by Chris Cranford
parent d0e4ad7e14
commit 04b8597239

View File

@ -208,21 +208,18 @@ private Scn getScn(ResultSet rs) throws SQLException {
}
private String getSqlRedo(ResultSet rs) throws SQLException {
String redoSql = rs.getString(SQL_REDO);
if (redoSql == null) {
return null;
}
StringBuilder result = new StringBuilder(redoSql);
int csf = rs.getInt(CSF);
int operationCode = rs.getInt(OPERATION_CODE);
// 0 - indicates SQL_REDO is contained within the same row
if (csf == 0) {
return rs.getString(SQL_REDO);
}
int operationCode = rs.getInt(OPERATION_CODE);
StringBuilder result = new StringBuilder(rs.getString(SQL_REDO));
long sqlLimitCounter = 0;
// 1 - indicates that either SQL_REDO is greater than 4000 bytes in size and is continued in
// the next row returned by the ResultSet
long sqlLimitCounter = 0;
while (csf == 1) {
rs.next();
sqlLimitCounter++;
@ -251,10 +248,9 @@ else if (sqlLimitCounter > Integer.MAX_VALUE) {
throw new LogMinerEventRowTooLargeException(tableName, sqlLimitCounter * 4000, scn);
}
redoSql = rs.getString(SQL_REDO);
result.append(redoSql);
csf = rs.getInt(CSF);
operationCode = rs.getInt(OPERATION_CODE);
result.append(rs.getString(SQL_REDO));
}
return result.toString();