public class CommitLogReadHandlerImpl extends Object implements org.apache.cassandra.db.commitlog.CommitLogReadHandler
CommitLogReadHandler interface provided by Cassandra source code.
This handler implementation processes each Mutation and invokes one of the registered partition handler
for each PartitionUpdate in the Mutation (a mutation could have multiple partitions if it is a batch update),
which in turn makes one or more record via the RecordMaker and enqueue the record into the ChangeEventQueue.| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
CommitLogReadHandlerImpl.PartitionType
A PartitionType represents the type of a PartitionUpdate.
|
(package private) static class |
CommitLogReadHandlerImpl.RowType
A RowType represents different types of
Row-level modifications in a Cassandra table. |
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOGGER |
private static boolean |
MARK_OFFSET |
private CommitLogProcessorMetrics |
metrics |
private OffsetWriter |
offsetWriter |
private io.debezium.connector.base.ChangeEventQueue<Event> |
queue |
private RecordMaker |
recordMaker |
private SchemaHolder |
schemaHolder |
| Constructor and Description |
|---|
CommitLogReadHandlerImpl(SchemaHolder schemaHolder,
io.debezium.connector.base.ChangeEventQueue<Event> queue,
OffsetWriter offsetWriter,
RecordMaker recordMaker,
CommitLogProcessorMetrics metrics) |
| Modifier and Type | Method and Description |
|---|---|
private static List<Object> |
getPartitionKeys(org.apache.cassandra.db.partitions.PartitionUpdate pu)
Given a PartitionUpdate, deserialize the partition key byte buffer
into a list of partition key values.
|
void |
handleMutation(org.apache.cassandra.db.Mutation mutation,
int size,
int entryLocation,
org.apache.cassandra.db.commitlog.CommitLogDescriptor descriptor) |
private void |
handlePartitionDeletion(org.apache.cassandra.db.partitions.PartitionUpdate pu,
OffsetPosition offsetPosition,
KeyspaceTable keyspaceTable)
Handle a valid deletion event resulted from a partition-level deletion by converting Cassandra representation
of this event into a
Record object and queue the record to ChangeEventQueue. |
private void |
handleRowModifications(org.apache.cassandra.db.rows.Row row,
CommitLogReadHandlerImpl.RowType rowType,
org.apache.cassandra.db.partitions.PartitionUpdate pu,
OffsetPosition offsetPosition,
KeyspaceTable keyspaceTable)
Handle a valid event resulted from a row-level modification by converting Cassandra representation of
this event into a
Record object and queue the record to ChangeEventQueue. |
void |
handleUnrecoverableError(org.apache.cassandra.db.commitlog.CommitLogReadHandler.CommitLogReadException exception) |
private void |
populateClusteringColumns(RowData after,
org.apache.cassandra.db.rows.Row row,
org.apache.cassandra.db.partitions.PartitionUpdate pu) |
private void |
populatePartitionColumns(RowData after,
org.apache.cassandra.db.partitions.PartitionUpdate pu) |
private void |
populateRegularColumns(RowData after,
org.apache.cassandra.db.rows.Row row,
CommitLogReadHandlerImpl.RowType rowType,
SchemaHolder.KeyValueSchema schema) |
private void |
process(org.apache.cassandra.db.partitions.PartitionUpdate pu,
OffsetPosition offsetPosition,
KeyspaceTable keyspaceTable)
Method which processes a partition update if it's valid (either a single-row partition-level
deletion or a row-level modification) or throw an exception if it isn't.
|
boolean |
shouldSkipSegmentOnError(org.apache.cassandra.db.commitlog.CommitLogReadHandler.CommitLogReadException exception) |
private static final org.slf4j.Logger LOGGER
private static final boolean MARK_OFFSET
private final io.debezium.connector.base.ChangeEventQueue<Event> queue
private final RecordMaker recordMaker
private final OffsetWriter offsetWriter
private final SchemaHolder schemaHolder
private final CommitLogProcessorMetrics metrics
CommitLogReadHandlerImpl(SchemaHolder schemaHolder, io.debezium.connector.base.ChangeEventQueue<Event> queue, OffsetWriter offsetWriter, RecordMaker recordMaker, CommitLogProcessorMetrics metrics)
public void handleMutation(org.apache.cassandra.db.Mutation mutation,
int size,
int entryLocation,
org.apache.cassandra.db.commitlog.CommitLogDescriptor descriptor)
handleMutation in interface org.apache.cassandra.db.commitlog.CommitLogReadHandlerpublic void handleUnrecoverableError(org.apache.cassandra.db.commitlog.CommitLogReadHandler.CommitLogReadException exception)
throws IOException
handleUnrecoverableError in interface org.apache.cassandra.db.commitlog.CommitLogReadHandlerIOExceptionpublic boolean shouldSkipSegmentOnError(org.apache.cassandra.db.commitlog.CommitLogReadHandler.CommitLogReadException exception)
throws IOException
shouldSkipSegmentOnError in interface org.apache.cassandra.db.commitlog.CommitLogReadHandlerIOExceptionprivate void process(org.apache.cassandra.db.partitions.PartitionUpdate pu,
OffsetPosition offsetPosition,
KeyspaceTable keyspaceTable)
Record and enqueued to the ChangeEventQueue.private void handlePartitionDeletion(org.apache.cassandra.db.partitions.PartitionUpdate pu,
OffsetPosition offsetPosition,
KeyspaceTable keyspaceTable)
Record object and queue the record to ChangeEventQueue. A valid deletion
event means a partition only has a single row, this implies there are no clustering keys.
The steps are:
(1) Populate the "source" field for this event
(2) Fetch the cached key/value schemas from SchemaHolder
(3) Populate the "after" field for this event
a. populate partition columns
b. populate regular columns with null values
(4) Assemble a Record object from the populated data and queue the recordprivate void handleRowModifications(org.apache.cassandra.db.rows.Row row,
CommitLogReadHandlerImpl.RowType rowType,
org.apache.cassandra.db.partitions.PartitionUpdate pu,
OffsetPosition offsetPosition,
KeyspaceTable keyspaceTable)
Record object and queue the record to ChangeEventQueue. A valid event
implies this must be an insert, update, or delete.
The steps are:
(1) Populate the "source" field for this event
(2) Fetch the cached key/value schemas from SchemaHolder
(3) Populate the "after" field for this event
a. populate partition columns
b. populate clustering columns
c. populate regular columns
d. for deletions, populate regular columns with null values
(4) Assemble a Record object from the populated data and queue the recordprivate void populatePartitionColumns(RowData after, org.apache.cassandra.db.partitions.PartitionUpdate pu)
private void populateClusteringColumns(RowData after, org.apache.cassandra.db.rows.Row row, org.apache.cassandra.db.partitions.PartitionUpdate pu)
private void populateRegularColumns(RowData after, org.apache.cassandra.db.rows.Row row, CommitLogReadHandlerImpl.RowType rowType, SchemaHolder.KeyValueSchema schema)
Copyright © 2021 JBoss by Red Hat. All rights reserved.