DBZ-2552 Refactored getting current redo log filenames

This commit is contained in:
Chris Cranford 2021-06-26 03:56:28 -04:00 committed by Jiri Pechanec
parent 60a90851c6
commit e49e3f9211
2 changed files with 19 additions and 19 deletions

View File

@ -11,7 +11,6 @@
import java.sql.SQLException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@ -50,23 +49,6 @@ public enum DATATYPE {
FLOAT
}
/**
* This method query the database to get CURRENT online redo log file(s). Multiple is applicable for RAC systems.
* @param connection connection to reuse
* @return full redo log file name(s), including path
* @throws SQLException if anything unexpected happens
*/
static Set<String> getCurrentRedoLogFiles(OracleConnection connection) throws SQLException {
final Set<String> fileNames = new HashSet<>();
connection.query(SqlUtils.currentRedoNameQuery(), rs -> {
while (rs.next()) {
fileNames.add(rs.getString(1));
}
});
LOGGER.trace(" Current Redo log fileNames: {} ", fileNames);
return fileNames;
}
/**
* This method validates the supplemental logging configuration for the source database.
*

View File

@ -6,7 +6,6 @@
package io.debezium.connector.oracle.logminer;
import static io.debezium.connector.oracle.logminer.LogMinerHelper.checkSupplementalLogging;
import static io.debezium.connector.oracle.logminer.LogMinerHelper.getCurrentRedoLogFiles;
import static io.debezium.connector.oracle.logminer.LogMinerHelper.logError;
import static io.debezium.connector.oracle.logminer.LogMinerHelper.setLogFilesForMining;
@ -350,6 +349,25 @@ private boolean hasLogSwitchOccurred() throws SQLException {
return false;
}
/**
* Get a list of all the CURRENT redo log file names. For Oracle RAC clusters, multiple filenames
* will be returned, one for each node that participates in the cluster.
*
* @param connection database connection, should not be {@code null}
* @return unique set of all current redo log file names, with full paths, never {@code null}
* @throws SQLException if a database exception occurred
*/
private Set<String> getCurrentRedoLogFiles(OracleConnection connection) throws SQLException {
final Set<String> fileNames = new HashSet<>();
connection.query(SqlUtils.currentRedoNameQuery(), rs -> {
while (rs.next()) {
fileNames.add(rs.getString(1));
}
});
LOGGER.trace("Current redo log filenames: {}", fileNames);
return fileNames;
}
/**
* Get the current redo log sequence(s).
*