Class IngestExternalFileOptions
- All Implemented Interfaces:
AutoCloseable
RocksDB.ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions).-
Field Summary
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_ -
Constructor Summary
ConstructorsConstructorDescriptionIngestExternalFileOptions(boolean moveFiles, boolean snapshotConsistency, boolean allowGlobalSeqNo, boolean allowBlockingFlush) -
Method Summary
Modifier and TypeMethodDescriptionbooleanIf set to false and the file key range overlaps with the memtable key range (memtable flush required), IngestExternalFile will fail.booleanIf set to false,RocksDB.ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions)will fail if the file key range overlaps with existing keys or tombstones in the DB.protected final voiddisposeInternal(long handle) booleanReturns true if duplicate keys in the file being ingested are to be skipped rather than overwriting existing data under that key.booleanCan be set to true to move the files instead of copying them.setAllowBlockingFlush(boolean allowBlockingFlush) If set to false and the file key range overlaps with the memtable key range (memtable flush required), IngestExternalFile will fail.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.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.setMoveFiles(boolean moveFiles) Can be set to true to move the files instead of copying them.setSnapshotConsistency(boolean snapshotConsistency) If set to false, an ingested file keys could appear in existing snapshots that where created before the file was ingested.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.booleanIf set to false, an ingested file keys could appear in existing snapshots that where created before the file was ingested.booleanReturns true write if the global_seqno is written to a given offset in the external SST file for backward compatibility.Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Constructor Details
-
IngestExternalFileOptions
public IngestExternalFileOptions() -
IngestExternalFileOptions
public IngestExternalFileOptions(boolean moveFiles, boolean snapshotConsistency, boolean allowGlobalSeqNo, boolean allowBlockingFlush) - Parameters:
moveFiles-setMoveFiles(boolean)snapshotConsistency-setSnapshotConsistency(boolean)allowGlobalSeqNo-setAllowGlobalSeqNo(boolean)allowBlockingFlush-setAllowBlockingFlush(boolean)
-
-
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
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
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
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
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
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.- Returns:
- true if the global_seqno is written to a given offset, false otherwise.
-
setWriteGlobalSeqno
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:
disposeInternalin classRocksObject
-