SSTableSimpleUnsortedWriter (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.io.sstable

## Class SSTableSimpleUnsortedWriter

- java.lang.Object
- - org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter
  - - org.apache.cassandra.io.sstable.SSTableSimpleUnsortedWriter

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

      public class SSTableSimpleUnsortedWriter
      extends AbstractSSTableSimpleWriter

  A SSTable writer that doesn't assume rows are in sorted order. This writer buffers rows in memory and then write them all in sorted order. To avoid loading the entire data set in memory, the amount of rows buffered is configurable. Each time the threshold is met, one SSTable will be created (and the buffer be reseted).
  See Also:
    `AbstractSSTableSimpleWriter`

- - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter

      `columnFamily, counterid, currentKey, currentSuperColumn, directory, metadata`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SSTableSimpleUnsortedWriter(java.io.File directory, CFMetaData metadata, IPartitioner partitioner, long bufferSizeInMB)`
    `SSTableSimpleUnsortedWriter(java.io.File directory, IPartitioner partitioner, java.lang.String keyspace, java.lang.String columnFamily, AbstractType<?> comparator, AbstractType<?> subComparator, int bufferSizeInMB)`
    `SSTableSimpleUnsortedWriter(java.io.File directory, IPartitioner partitioner, java.lang.String keyspace, java.lang.String columnFamily, AbstractType<?> comparator, AbstractType<?> subComparator, int bufferSizeInMB, CompressionParameters compressParameters)` Create a new buffering writer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addColumn(Cell cell)`
    `void` | `close()`
    `protected void` | `countColumn(Cell cell)`
    `protected ColumnFamily` | `createColumnFamily()`
    `protected ColumnFamily` | `getColumnFamily()`
    `protected void` | `writeRow(DecoratedKey key, ColumnFamily columnFamily)`

    - ### Methods inherited from class org.apache.cassandra.io.sstable.AbstractSSTableSimpleWriter

      `addColumn, addCounterColumn, addExpiringColumn, getWriter, makeFilename, newRow, newSuperColumn`

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

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

- - ### Constructor Detail

    - #### SSTableSimpleUnsortedWriter

          public SSTableSimpleUnsortedWriter(java.io.File directory,
                                     IPartitioner partitioner,
                                     java.lang.String keyspace,
                                     java.lang.String columnFamily,
                                     AbstractType<?> comparator,
                                     AbstractType<?> subComparator,
                                     int bufferSizeInMB,
                                     CompressionParameters compressParameters)

      Create a new buffering writer.
      Parameters:
        `directory` - the directory where to write the sstables
        `partitioner` - the partitioner
        `keyspace` - the keyspace name
        `columnFamily` - the column family name
        `comparator` - the column family comparator
        `subComparator` - the column family subComparator or null if not a Super column family.
        `bufferSizeInMB` - the data size in MB before which a sstable is written and the buffer reseted. This correspond roughly to the written data size (i.e. the size of the create sstable). The actual size used in memory will be higher (by how much depends on the size of the columns you add). For 1GB of heap, a 128 bufferSizeInMB is probably a reasonable choice. If you experience OOM, this value should be lowered.

    - #### SSTableSimpleUnsortedWriter

          public SSTableSimpleUnsortedWriter(java.io.File directory,
                                     IPartitioner partitioner,
                                     java.lang.String keyspace,
                                     java.lang.String columnFamily,
                                     AbstractType<?> comparator,
                                     AbstractType<?> subComparator,
                                     int bufferSizeInMB)

    - #### SSTableSimpleUnsortedWriter

          public SSTableSimpleUnsortedWriter(java.io.File directory,
                                     CFMetaData metadata,
                                     IPartitioner partitioner,
                                     long bufferSizeInMB)

  - ### Method Detail

    - #### writeRow

          protected void writeRow(DecoratedKey key,
                      ColumnFamily columnFamily)
                           throws java.io.IOException

      Specified by:
        `writeRow` in class `AbstractSSTableSimpleWriter`
      Throws:
        `java.io.IOException`

    - #### addColumn

          protected void addColumn(Cell cell)
                            throws java.io.IOException

      Overrides:
        `addColumn` in class `AbstractSSTableSimpleWriter`
      Throws:
        `java.io.IOException`

    - #### countColumn

          protected void countColumn(Cell cell)
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getColumnFamily

          protected ColumnFamily getColumnFamily()
                                          throws java.io.IOException

      Specified by:
        `getColumnFamily` in class `AbstractSSTableSimpleWriter`
      Throws:
        `java.io.IOException`

    - #### createColumnFamily

          protected ColumnFamily createColumnFamily()
                                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### close

          public void close()
                     throws java.io.IOException

      Throws:
        `java.io.IOException`

Copyright © 2014 The Apache Software Foundation