Package org.rocksdb

Class IngestExternalFileOptions

All Implemented Interfaces:
AutoCloseable

public class IngestExternalFileOptions extends RocksObject
  • Constructor Details

  • Method Details

    • moveFiles

      public boolean moveFiles()
      Can be set to true to move the files instead of copying them.
      Returns:
      true if files will be moved
    • setMoveFiles

      public IngestExternalFileOptions setMoveFiles(boolean moveFiles)
      Can be set to true to move the files instead of copying them.
      Parameters:
      moveFiles - true if files should be moved instead of copied
      Returns:
      the reference to the current IngestExternalFileOptions.
    • snapshotConsistency

      public boolean snapshotConsistency()
      If set to false, an ingested file keys could appear in existing snapshots that where created before the file was ingested.
      Returns:
      true if snapshot consistency is assured
    • setSnapshotConsistency

      public IngestExternalFileOptions setSnapshotConsistency(boolean snapshotConsistency)
      If set to false, an ingested file keys could appear in existing snapshots that where created before the file was ingested.
      Parameters:
      snapshotConsistency - true if snapshot consistency is required
      Returns:
      the reference to the current IngestExternalFileOptions.
    • allowGlobalSeqNo

      public boolean allowGlobalSeqNo()
      If set to false, RocksDB.ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions) will fail if the file key range overlaps with existing keys or tombstones in the DB.
      Returns:
      true if global seq numbers are assured
    • setAllowGlobalSeqNo

      public IngestExternalFileOptions setAllowGlobalSeqNo(boolean allowGlobalSeqNo)
      If set to false, RocksDB.ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions) will fail if the file key range overlaps with existing keys or tombstones in the DB.
      Parameters:
      allowGlobalSeqNo - true if global seq numbers are required
      Returns:
      the reference to the current IngestExternalFileOptions.
    • allowBlockingFlush

      public boolean allowBlockingFlush()
      If set to false and the file key range overlaps with the memtable key range (memtable flush required), IngestExternalFile will fail.
      Returns:
      true if blocking flushes may occur
    • setAllowBlockingFlush

      public IngestExternalFileOptions setAllowBlockingFlush(boolean allowBlockingFlush)
      If set to false and the file key range overlaps with the memtable key range (memtable flush required), IngestExternalFile will fail.
      Parameters:
      allowBlockingFlush - true if blocking flushes are allowed
      Returns:
      the reference to the current IngestExternalFileOptions.
    • ingestBehind

      public boolean ingestBehind()
      Returns true if duplicate keys in the file being ingested are to be skipped rather than overwriting existing data under that key.
      Returns:
      true if duplicate keys in the file being ingested are to be skipped, false otherwise.
    • setIngestBehind

      public IngestExternalFileOptions setIngestBehind(boolean ingestBehind)
      Set to true if you would like duplicate keys in the file being ingested to be skipped rather than overwriting existing data under that key.

      Usecase: back-fill of some historical data in the database without over-writing existing newer version of data.

      This option could only be used if the DB has been running with DBOptions#allowIngestBehind() == true since the dawn of time.

      All files will be ingested at the bottommost level with seqno=0.

      Default: false

      Parameters:
      ingestBehind - true if you would like duplicate keys in the file being ingested to be skipped.
      Returns:
      the reference to the current IngestExternalFileOptions.
    • writeGlobalSeqno

      public boolean writeGlobalSeqno()
      Returns true write if the global_seqno is written to a given offset in the external SST file for backward compatibility.

      See setWriteGlobalSeqno(boolean).

      Returns:
      true if the global_seqno is written to a given offset, false otherwise.
    • setWriteGlobalSeqno

      public IngestExternalFileOptions setWriteGlobalSeqno(boolean writeGlobalSeqno)
      Set to true if you would like to write the global_seqno to a given offset in the external SST file for backward compatibility.

      Older versions of RocksDB write the global_seqno to a given offset within the ingested SST files, and new versions of RocksDB do not.

      If you ingest an external SST using new version of RocksDB and would like to be able to downgrade to an older version of RocksDB, you should set writeGlobalSeqno() to true.

      If your service is just starting to use the new RocksDB, we recommend that you set this option to false, which brings two benefits: 1. No extra random write for global_seqno during ingestion. 2. Without writing external SST file, it's possible to do checksum.

      We have a plan to set this option to false by default in the future.

      Default: true

      Parameters:
      writeGlobalSeqno - true to write the gloal_seqno to a given offset, false otherwise
      Returns:
      the reference to the current IngestExternalFileOptions.
    • disposeInternal

      protected final void disposeInternal(long handle)
      Specified by:
      disposeInternal in class RocksObject