Package io.debezium.connector.oracle
Class CommitScn
java.lang.Object
io.debezium.connector.oracle.CommitScn
- All Implemented Interfaces:
Comparable<Scn>
Represents either a single or a collection of commit
Scn positions that collectively
represents the high-watermark point for streaming changes.
In a standalone Oracle environment, a commit Scn would normally represent a single position or
system change number in the logs as there is only ever a single redo thread. However, in an Oracle RAC
environment where each node maintains its own redo, there are multiple redo threads which maintain
their own "commit" point in the logs that may differ.
This class is meant to encapsulate the Oracle RAC environment by exposing a "commit scn" as a single
representation that spans all nodes within the cluster as one logical unit, much like what we expect
when integrating with a standalone Oracle database.- Author:
- Chris Cranford
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a commitScnfor a specific redo thread. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet the commit scns associated with all redo threads.getCommitScnForRedoThread(int thread) Get the commit scn associated with a specific redo thread.Examines all redo threads and returns the maximum committed scn.getRedoThreadCommitScn(int thread) booleanChecks whether the transaction associated with the commit event has been handled.static CommitScnLoad the CommitScn values from the offsets.voidRecords the specified commit in the commit scnstatic org.apache.kafka.connect.data.SchemaBuilderschemaBuilder(org.apache.kafka.connect.data.SchemaBuilder schemaBuilder) voidsetCommitScnOnAllThreads(Scn commitScn) Set the commit scn across all redo threads.org.apache.kafka.connect.data.Structstore(SourceInfo sourceInfo, org.apache.kafka.connect.data.Struct sourceInfoStruct) Store the contents of the CommitScn in the source info struct.Store the contents of the CommitScn in the connector offsets.private StringReturns the commit scn as a comma-separated list of string values.Returns a loggable string representing the commit scntoString()static CommitScnParses a long-based representation of commit scn entries as a CommitScn instance.static CommitScnParses a string-based representation of commit scn entries as a CommitScn instance.
-
Field Details
-
ROLLBACK_SEGMENT_ID_KEY
- See Also:
-
SQL_SEQUENCE_NUMBER_KEY
- See Also:
-
REDO_THREAD_KEY
- See Also:
-
redoThreadCommitScns
-
-
Constructor Details
-
CommitScn
-
-
Method Details
-
getMaxCommittedScn
Examines all redo threads and returns the maximum committed scn.- Returns:
- the maximum recorded commit across all redo threads
-
getCommitScnForAllRedoThreads
Get the commit scns associated with all redo threads.- Returns:
- a map by redo thread with each commit system change number.
-
getCommitScnForRedoThread
Get the commit scn associated with a specific redo thread.- Parameters:
thread- the redo thread- Returns:
- the commit scn associated with redo thread
-
hasCommitAlreadyBeenHandled
Checks whether the transaction associated with the commit event has been handled.- Parameters:
row- the transaction commit event, should never benull- Returns:
- true if the commit has been handled, false if it has not
-
getRedoThreadCommitScn
-
recordCommit
Records the specified commit in the commit scn- Parameters:
row- the commit event, should never benull
-
setCommitScnOnAllThreads
Set the commit scn across all redo threads.- Parameters:
commitScn- the commit scn to be set, should not benull
-
compareTo
- Specified by:
compareToin interfaceComparable<Scn>
-
store
Store the contents of the CommitScn in the connector offsets.- Parameters:
offset- the offsets, should not benull- Returns:
- the adjusted offsets
-
store
public org.apache.kafka.connect.data.Struct store(SourceInfo sourceInfo, org.apache.kafka.connect.data.Struct sourceInfoStruct) Store the contents of the CommitScn in the source info struct.- Parameters:
sourceInfo- the connector's source info datasourceInfoStruct- the source info struct- Returns:
- the adjusted source info struct
-
toLoggableFormat
Returns a loggable string representing the commit scn -
toString
-
valueOf
Parses a string-based representation of commit scn entries as a CommitScn instance.- Parameters:
value- the commit scn entries, comma-separated- Returns:
- the commit scn instance, never null
-
valueOf
Parses a long-based representation of commit scn entries as a CommitScn instance.- Parameters:
value- the commit scn long value, should never benull- Returns:
- the commit scn instance, never null
-
load
Load the CommitScn values from the offsets.- Parameters:
offset- the connector offsets, should not benull- Returns:
- the commit scn instance, never
null
-
schemaBuilder
public static org.apache.kafka.connect.data.SchemaBuilder schemaBuilder(org.apache.kafka.connect.data.SchemaBuilder schemaBuilder) -
toCommaSeparatedValue
Returns the commit scn as a comma-separated list of string values.
-