Class Cassandra3CommitLogReadHandlerImpl

java.lang.Object
io.debezium.connector.cassandra.Cassandra3CommitLogReadHandlerImpl
All Implemented Interfaces:
org.apache.cassandra.db.commitlog.CommitLogReadHandler

public class Cassandra3CommitLogReadHandlerImpl extends Object implements org.apache.cassandra.db.commitlog.CommitLogReadHandler
Handler that implements 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.

  • Field Details

  • Constructor Details

  • Method Details

    • handleMutation

      public void handleMutation(org.apache.cassandra.db.Mutation mutation, int size, int entryLocation, org.apache.cassandra.db.commitlog.CommitLogDescriptor descriptor)
      Specified by:
      handleMutation in interface org.apache.cassandra.db.commitlog.CommitLogReadHandler
    • handleUnrecoverableError

      public void handleUnrecoverableError(org.apache.cassandra.db.commitlog.CommitLogReadHandler.CommitLogReadException exception)
      Specified by:
      handleUnrecoverableError in interface org.apache.cassandra.db.commitlog.CommitLogReadHandler
    • shouldSkipSegmentOnError

      public boolean shouldSkipSegmentOnError(org.apache.cassandra.db.commitlog.CommitLogReadHandler.CommitLogReadException exception)
      Specified by:
      shouldSkipSegmentOnError in interface org.apache.cassandra.db.commitlog.CommitLogReadHandler
    • process

      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. The valid partition update is then converted into a Record and enqueued to the ChangeEventQueue.
    • handleRowIterator

      private void handleRowIterator(org.apache.cassandra.db.partitions.PartitionUpdate pu, OffsetPosition offsetPosition, KeyspaceTable keyspaceTable)
    • handlePartitionDeletion

      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. 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 clustering columns if any b. populate regular columns with null values (4) Assemble a Record object from the populated data and queue the record
    • handleRowModifications

      private void handleRowModifications(org.apache.cassandra.db.rows.Row row, Cassandra3CommitLogReadHandlerImpl.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. 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 record
    • handleRangeTombstoneBoundMarker

      private void handleRangeTombstoneBoundMarker(org.apache.cassandra.db.rows.RangeTombstoneBoundMarker rangeTombstoneMarker, Cassandra3CommitLogReadHandlerImpl.RowType rowType, org.apache.cassandra.db.partitions.PartitionUpdate pu, OffsetPosition offsetPosition, KeyspaceTable keyspaceTable)
    • populateRangeData

      private CassandraSchemaFactory.RangeData populateRangeData(org.apache.cassandra.db.ClusteringBound cb, String name, org.apache.cassandra.config.CFMetaData metaData)
    • populatePartitionColumns

      private void populatePartitionColumns(CassandraSchemaFactory.RowData after, org.apache.cassandra.db.partitions.PartitionUpdate pu)
    • populateClusteringColumns

      private void populateClusteringColumns(CassandraSchemaFactory.RowData after, org.apache.cassandra.db.rows.Row row, org.apache.cassandra.db.partitions.PartitionUpdate pu)
    • populateRegularColumns

      private void populateRegularColumns(CassandraSchemaFactory.RowData after, org.apache.cassandra.db.rows.Row row, Cassandra3CommitLogReadHandlerImpl.RowType rowType, KeyValueSchema schema)
    • getComplexColumnDataByteBufferList

      private List<ByteBuffer> getComplexColumnDataByteBufferList(org.apache.cassandra.db.marshal.AbstractType<?> abstractType, org.apache.cassandra.db.rows.ComplexColumnData ccd)
    • getPartitionKeys

      private 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.