DefaultCompactionWriter (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db.compaction.writers

## Class DefaultCompactionWriter

- java.lang.Object
- - org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional
  - - org.apache.cassandra.db.compaction.writers.CompactionAwareWriter
    - - org.apache.cassandra.db.compaction.writers.DefaultCompactionWriter

- All Implemented Interfaces:
    java.lang.AutoCloseable, Transactional

      public class DefaultCompactionWriter
      extends CompactionAwareWriter

  The default compaction writer - creates one output file in L0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional

      `Transactional.AbstractTransactional.State`

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional

      `Transactional.AbstractTransactional`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `logger`

    - ### Fields inherited from class org.apache.cassandra.db.compaction.writers.CompactionAwareWriter

      `cfs, directories, estimatedTotalKeys, maxAge, minRepairedAt, nonExpiredSSTables, sstableWriter, txn`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCompactionWriter(ColumnFamilyStore cfs, Directories directories, LifecycleTransaction txn, java.util.Set<SSTableReader> nonExpiredSSTables)`
    `DefaultCompactionWriter(ColumnFamilyStore cfs, Directories directories, LifecycleTransaction txn, java.util.Set<SSTableReader> nonExpiredSSTables, boolean offline, boolean keepOriginals, int sstableLevel)` Deprecated.
    `DefaultCompactionWriter(ColumnFamilyStore cfs, Directories directories, LifecycleTransaction txn, java.util.Set<SSTableReader> nonExpiredSSTables, boolean keepOriginals, int sstableLevel)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `estimatedKeys()` estimated number of keys we should write
    `boolean` | `realAppend(UnfilteredRowIterator partition)`
    `void` | `switchCompactionLocation(Directories.DataDirectory directory)` Implementations of this method should finish the current sstable writer and start writing to this directory.

    - ### Methods inherited from class org.apache.cassandra.db.compaction.writers.CompactionAwareWriter

      `append, doAbort, doCommit, doPostCleanup, doPrepare, finish, getDirectories, getWriteDirectory, maybeSwitchWriter, setRepairedAt`

    - ### Methods inherited from class org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional

      `abort, abort, close, commit, commit, doPreCleanup, permitRedundantTransitions, prepareToCommit, state`

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

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

    - ### Methods inherited from interface org.apache.cassandra.utils.concurrent.Transactional

      `abort, close, commit, prepareToCommit`

- - ### Field Detail

    - #### logger

          protected static final org.slf4j.Logger logger

  - ### Constructor Detail

    - #### DefaultCompactionWriter

          public DefaultCompactionWriter(ColumnFamilyStore cfs,
                                         Directories directories,
                                         LifecycleTransaction txn,
                                         java.util.Set<SSTableReader> nonExpiredSSTables)

    - #### DefaultCompactionWriter

          @Deprecated
          public DefaultCompactionWriter(ColumnFamilyStore cfs,
                                                     Directories directories,
                                                     LifecycleTransaction txn,
                                                     java.util.Set<SSTableReader> nonExpiredSSTables,
                                                     boolean offline,
                                                     boolean keepOriginals,
                                                     int sstableLevel)

      Deprecated.

    - #### DefaultCompactionWriter

          public DefaultCompactionWriter(ColumnFamilyStore cfs,
                                         Directories directories,
                                         LifecycleTransaction txn,
                                         java.util.Set<SSTableReader> nonExpiredSSTables,
                                         boolean keepOriginals,
                                         int sstableLevel)

  - ### Method Detail

    - #### realAppend

          public boolean realAppend(UnfilteredRowIterator partition)

      Specified by:
        `realAppend` in class `CompactionAwareWriter`

    - #### switchCompactionLocation

          public void switchCompactionLocation(Directories.DataDirectory directory)

      Description copied from class: `CompactionAwareWriter`
      Implementations of this method should finish the current sstable writer and start writing to this directory. Called once before starting to append and then whenever we see a need to start writing to another directory.
      Specified by:
        `switchCompactionLocation` in class `CompactionAwareWriter`

    - #### estimatedKeys

          public long estimatedKeys()

      Description copied from class: `CompactionAwareWriter`
      estimated number of keys we should write
      Overrides:
        `estimatedKeys` in class `CompactionAwareWriter`

Copyright © 2018 The Apache Software Foundation