org.apache.cassandra.db.commitlog

## Class CommitLogSegmentManagerCDC

- java.lang.Object
- - org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager
  - - org.apache.cassandra.db.commitlog.CommitLogSegmentManagerCDC

-     public class CommitLogSegmentManagerCDC
      extends AbstractCommitLogSegmentManager

- - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager

      `commitLog`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommitLogSegmentManagerCDC(CommitLog commitLog, java.lang.String storageDirectory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CommitLogSegment.Allocation` | `allocate(Mutation mutation, int size)` Reserve space in the current segment for the provided mutation or, if there isn't space available, create a new segment.
    `CommitLogSegment` | `createSegment()` On segment creation, flag whether the segment should accept CDC mutations or not based on the total currently allocated unflushed CDC segments and the contents of cdc_raw
    `void` | `discard(CommitLogSegment segment, boolean delete)` Indicates that a segment file has been flushed and is no longer needed.
    `void` | `shutdown()` Initiates the shutdown process for the management thread.
    `long` | `updateCDCTotalSize()` Only use for testing / validation that size tracker is working.

    - ### Methods inherited from class org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager

      `awaitTermination, getActiveSegments, onDiskSize, stopUnsafe, sync`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CommitLogSegmentManagerCDC

          public CommitLogSegmentManagerCDC(CommitLog commitLog,
                                            java.lang.String storageDirectory)

  - ### Method Detail

    - #### discard

          public void discard(CommitLogSegment segment,
                              boolean delete)

      Description copied from class: `AbstractCommitLogSegmentManager`
      Indicates that a segment file has been flushed and is no longer needed. Only perform as task submit to segment manager so it's performend on segment management thread, or perform while segment management thread is shutdown during testing resets.
      Parameters:
        `segment` - segment to be discarded
        `delete` - whether or not the segment is safe to be deleted.

    - #### shutdown

          public void shutdown()

      Initiates the shutdown process for the management thread. Also stops the cdc on-disk size calculator executor.
      Overrides:
        `shutdown` in class `AbstractCommitLogSegmentManager`

    - #### allocate

          public CommitLogSegment.Allocation allocate(Mutation mutation,
                                                      int size)
                                               throws WriteTimeoutException

      Reserve space in the current segment for the provided mutation or, if there isn't space available, create a new segment. For CDC mutations, allocation is expected to throw WTE if the segment disallows CDC mutations.
      Specified by:
        `allocate` in class `AbstractCommitLogSegmentManager`
      Parameters:
        `mutation` - Mutation to allocate in segment manager
        `size` - total size (overhead + serialized) of mutation
      Returns:
        the created Allocation object
      Throws:
        `WriteTimeoutException` - If segment disallows CDC mutations, we throw WTE

    - #### createSegment

          public CommitLogSegment createSegment()

      On segment creation, flag whether the segment should accept CDC mutations or not based on the total currently allocated unflushed CDC segments and the contents of cdc_raw

    - #### updateCDCTotalSize

          public long updateCDCTotalSize()

      Only use for testing / validation that size tracker is working. Not for production use.

Copyright © 2018 The Apache Software Foundation