1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
8 import java
.util
.Collection
;
11 public interface DBOptionsInterface
<T
extends DBOptionsInterface
<T
>> {
13 * Use this if your DB is very small (like under 1GB) and you don't want to
14 * spend lots of memory for memtables.
16 * @return the instance of the current object.
18 T
optimizeForSmallDb();
21 * Use the specified object to interact with the environment,
22 * e.g. to read/write files, schedule background work, etc.
23 * Default: {@link Env#getDefault()}
25 * @param env {@link Env} instance.
26 * @return the instance of the current Options.
28 T
setEnv(final Env env
);
31 * Returns the set RocksEnv instance.
33 * @return {@link RocksEnv} instance set in the options.
38 * <p>By default, RocksDB uses only one background thread for flush and
39 * compaction. Calling this function will set it up such that total of
40 * `total_threads` is used.</p>
42 * <p>You almost definitely want to call this function if your system is
43 * bottlenecked by RocksDB.</p>
45 * @param totalThreads The total number of threads to be used by RocksDB.
46 * A good value is the number of cores.
48 * @return the instance of the current Options
50 T
setIncreaseParallelism(int totalThreads
);
53 * If this value is set to true, then the database will be created
54 * if it is missing during {@code RocksDB.open()}.
57 * @param flag a flag indicating whether to create a database the
58 * specified database in {@link RocksDB#open(org.rocksdb.Options, String)} operation
60 * @return the instance of the current Options
61 * @see RocksDB#open(org.rocksdb.Options, String)
63 T
setCreateIfMissing(boolean flag
);
66 * Return true if the create_if_missing flag is set to true.
67 * If true, the database will be created if it is missing.
69 * @return true if the createIfMissing option is set to true.
70 * @see #setCreateIfMissing(boolean)
72 boolean createIfMissing();
75 * <p>If true, missing column families will be automatically created</p>
77 * <p>Default: false</p>
79 * @param flag a flag indicating if missing column families shall be
80 * created automatically.
81 * @return true if missing column families shall be created automatically
84 T
setCreateMissingColumnFamilies(boolean flag
);
87 * Return true if the create_missing_column_families flag is set
88 * to true. If true column families be created if missing.
90 * @return true if the createMissingColumnFamilies is set to
92 * @see #setCreateMissingColumnFamilies(boolean)
94 boolean createMissingColumnFamilies();
97 * If true, an error will be thrown during RocksDB.open() if the
98 * database already exists.
101 * @param errorIfExists if true, an exception will be thrown
102 * during {@code RocksDB.open()} if the database already exists.
103 * @return the reference to the current option.
104 * @see RocksDB#open(org.rocksdb.Options, String)
106 T
setErrorIfExists(boolean errorIfExists
);
109 * If true, an error will be thrown during RocksDB.open() if the
110 * database already exists.
112 * @return if true, an error is raised when the specified database
113 * already exists before open.
115 boolean errorIfExists();
118 * If true, the implementation will do aggressive checking of the
119 * data it is processing and will stop early if it detects any
120 * errors. This may have unforeseen ramifications: for example, a
121 * corruption of one DB entry may cause a large number of entries to
122 * become unreadable or for the entire DB to become unopenable.
123 * If any of the writes to the database fails (Put, Delete, Merge, Write),
124 * the database will switch to read-only mode and fail all other
128 * @param paranoidChecks a flag to indicate whether paranoid-check
130 * @return the reference to the current option.
132 T
setParanoidChecks(boolean paranoidChecks
);
135 * If true, the implementation will do aggressive checking of the
136 * data it is processing and will stop early if it detects any
137 * errors. This may have unforeseen ramifications: for example, a
138 * corruption of one DB entry may cause a large number of entries to
139 * become unreadable or for the entire DB to become unopenable.
140 * If any of the writes to the database fails (Put, Delete, Merge, Write),
141 * the database will switch to read-only mode and fail all other
144 * @return a boolean indicating whether paranoid-check is on.
146 boolean paranoidChecks();
149 * Use to control write rate of flush and compaction. Flush has higher
150 * priority than compaction. Rate limiting is disabled if nullptr.
153 * @param rateLimiter {@link org.rocksdb.RateLimiter} instance.
154 * @return the instance of the current object.
158 T
setRateLimiter(RateLimiter rateLimiter
);
161 * Use to track SST files and control their file deletion rate.
164 * - Throttle the deletion rate of the SST files.
165 * - Keep track the total size of all SST files.
166 * - Set a maximum allowed space limit for SST files that when reached
167 * the DB wont do any further flushes or compactions and will set the
169 * - Can be shared between multiple dbs.
172 * - Only track and throttle deletes of SST files in
173 * first db_path (db_name if db_paths is empty).
175 * @param sstFileManager The SST File Manager for the db.
176 * @return the instance of the current object.
178 T
setSstFileManager(SstFileManager sstFileManager
);
181 * <p>Any internal progress/error information generated by
182 * the db will be written to the Logger if it is non-nullptr,
183 * or to a file stored in the same directory as the DB
184 * contents if info_log is nullptr.</p>
186 * <p>Default: nullptr</p>
188 * @param logger {@link Logger} instance.
189 * @return the instance of the current object.
191 T
setLogger(Logger logger
);
194 * <p>Sets the RocksDB log level. Default level is INFO</p>
196 * @param infoLogLevel log level to set.
197 * @return the instance of the current object.
199 T
setInfoLogLevel(InfoLogLevel infoLogLevel
);
202 * <p>Returns currently set log level.</p>
203 * @return {@link org.rocksdb.InfoLogLevel} instance.
205 InfoLogLevel
infoLogLevel();
208 * If {@link MutableDBOptionsInterface#maxOpenFiles()} is -1, DB will open
209 * all files on DB::Open(). You can use this option to increase the number
210 * of threads used to open the files.
214 * @param maxFileOpeningThreads the maximum number of threads to use to
217 * @return the reference to the current options.
219 T
setMaxFileOpeningThreads(int maxFileOpeningThreads
);
222 * If {@link MutableDBOptionsInterface#maxOpenFiles()} is -1, DB will open all
223 * files on DB::Open(). You can use this option to increase the number of
224 * threads used to open the files.
228 * @return the maximum number of threads to use to open files
230 int maxFileOpeningThreads();
233 * <p>Sets the statistics object which collects metrics about database operations.
234 * Statistics objects should not be shared between DB instances as
235 * it does not use any locks to prevent concurrent updates.</p>
237 * @param statistics The statistics to set
239 * @return the instance of the current object.
241 * @see RocksDB#open(org.rocksdb.Options, String)
243 T
setStatistics(final Statistics statistics
);
246 * <p>Returns statistics object.</p>
248 * @return the instance of the statistics object or null if there is no
251 * @see #setStatistics(Statistics)
253 Statistics
statistics();
256 * <p>If true, then every store to stable storage will issue a fsync.</p>
257 * <p>If false, then every store to stable storage will issue a fdatasync.
258 * This parameter should be set to true while storing data to
259 * filesystem like ext3 that can lose files after a reboot.</p>
260 * <p>Default: false</p>
262 * @param useFsync a boolean flag to specify whether to use fsync
263 * @return the instance of the current object.
265 T
setUseFsync(boolean useFsync
);
268 * <p>If true, then every store to stable storage will issue a fsync.</p>
269 * <p>If false, then every store to stable storage will issue a fdatasync.
270 * This parameter should be set to true while storing data to
271 * filesystem like ext3 that can lose files after a reboot.</p>
273 * @return boolean value indicating if fsync is used.
278 * A list of paths where SST files can be put into, with its target size.
279 * Newer data is placed into paths specified earlier in the vector while
280 * older data gradually moves to paths specified later in the vector.
282 * For example, you have a flash device with 10GB allocated for the DB,
283 * as well as a hard drive of 2TB, you should config it to be:
284 * [{"/flash_path", 10GB}, {"/hard_drive", 2TB}]
286 * The system will try to guarantee data under each path is close to but
287 * not larger than the target size. But current and future file sizes used
288 * by determining where to place a file are based on best-effort estimation,
289 * which means there is a chance that the actual size under the directory
290 * is slightly more than target size under some workloads. User should give
291 * some buffer room for those cases.
293 * If none of the paths has sufficient room to place a file, the file will
294 * be placed to the last path anyway, despite to the target size.
296 * Placing newer data to earlier paths is also best-efforts. User should
297 * expect user files to be placed in higher levels in some extreme cases.
299 * If left empty, only one path will be used, which is db_name passed when
304 * @param dbPaths the paths and target sizes
306 * @return the reference to the current options
308 T
setDbPaths(final Collection
<DbPath
> dbPaths
);
311 * A list of paths where SST files can be put into, with its target size.
312 * Newer data is placed into paths specified earlier in the vector while
313 * older data gradually moves to paths specified later in the vector.
315 * For example, you have a flash device with 10GB allocated for the DB,
316 * as well as a hard drive of 2TB, you should config it to be:
317 * [{"/flash_path", 10GB}, {"/hard_drive", 2TB}]
319 * The system will try to guarantee data under each path is close to but
320 * not larger than the target size. But current and future file sizes used
321 * by determining where to place a file are based on best-effort estimation,
322 * which means there is a chance that the actual size under the directory
323 * is slightly more than target size under some workloads. User should give
324 * some buffer room for those cases.
326 * If none of the paths has sufficient room to place a file, the file will
327 * be placed to the last path anyway, despite to the target size.
329 * Placing newer data to earlier paths is also best-efforts. User should
330 * expect user files to be placed in higher levels in some extreme cases.
332 * If left empty, only one path will be used, which is db_name passed when
335 * Default: {@link java.util.Collections#emptyList()}
337 * @return dbPaths the paths and target sizes
339 List
<DbPath
> dbPaths();
342 * This specifies the info LOG dir.
343 * If it is empty, the log files will be in the same dir as data.
344 * If it is non empty, the log files will be in the specified dir,
345 * and the db data dir's absolute path will be used as the log file
348 * @param dbLogDir the path to the info log directory
349 * @return the instance of the current object.
351 T
setDbLogDir(String dbLogDir
);
354 * Returns the directory of info log.
356 * If it is empty, the log files will be in the same dir as data.
357 * If it is non empty, the log files will be in the specified dir,
358 * and the db data dir's absolute path will be used as the log file
361 * @return the path to the info log directory
366 * This specifies the absolute dir path for write-ahead logs (WAL).
367 * If it is empty, the log files will be in the same dir as data,
368 * dbname is used as the data dir by default
369 * If it is non empty, the log files will be in kept the specified dir.
370 * When destroying the db,
371 * all log files in wal_dir and the dir itself is deleted
373 * @param walDir the path to the write-ahead-log directory.
374 * @return the instance of the current object.
376 T
setWalDir(String walDir
);
379 * Returns the path to the write-ahead-logs (WAL) directory.
381 * If it is empty, the log files will be in the same dir as data,
382 * dbname is used as the data dir by default
383 * If it is non empty, the log files will be in kept the specified dir.
384 * When destroying the db,
385 * all log files in wal_dir and the dir itself is deleted
387 * @return the path to the write-ahead-logs (WAL) directory.
392 * The periodicity when obsolete files get deleted. The default
393 * value is 6 hours. The files that get out of scope by compaction
394 * process will still get automatically delete on every compaction,
395 * regardless of this setting
397 * @param micros the time interval in micros
398 * @return the instance of the current object.
400 T
setDeleteObsoleteFilesPeriodMicros(long micros
);
403 * The periodicity when obsolete files get deleted. The default
404 * value is 6 hours. The files that get out of scope by compaction
405 * process will still get automatically delete on every compaction,
406 * regardless of this setting
408 * @return the time interval in micros when obsolete files will be deleted.
410 long deleteObsoleteFilesPeriodMicros();
413 * This value represents the maximum number of threads that will
414 * concurrently perform a compaction job by breaking it into multiple,
415 * smaller ones that are run simultaneously.
416 * Default: 1 (i.e. no subcompactions)
418 * @param maxSubcompactions The maximum number of threads that will
419 * concurrently perform a compaction job
421 * @return the instance of the current object.
423 T
setMaxSubcompactions(int maxSubcompactions
);
426 * This value represents the maximum number of threads that will
427 * concurrently perform a compaction job by breaking it into multiple,
428 * smaller ones that are run simultaneously.
429 * Default: 1 (i.e. no subcompactions)
431 * @return The maximum number of threads that will concurrently perform a
434 int maxSubcompactions();
437 * NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
438 * value of max_background_jobs. For backwards compatibility we will set
439 * `max_background_jobs = max_background_compactions + max_background_flushes`
440 * in the case where user sets at least one of `max_background_compactions` or
441 * `max_background_flushes`.
443 * Specifies the maximum number of concurrent background flush jobs.
444 * If you're increasing this, also consider increasing number of threads in
445 * HIGH priority thread pool. For more information, see
448 * @param maxBackgroundFlushes number of max concurrent flush jobs
449 * @return the instance of the current object.
451 * @see RocksEnv#setBackgroundThreads(int)
452 * @see RocksEnv#setBackgroundThreads(int, Priority)
453 * @see MutableDBOptionsInterface#maxBackgroundCompactions()
455 * @deprecated Use {@link MutableDBOptionsInterface#setMaxBackgroundJobs(int)}
458 T
setMaxBackgroundFlushes(int maxBackgroundFlushes
);
461 * NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
462 * value of max_background_jobs. For backwards compatibility we will set
463 * `max_background_jobs = max_background_compactions + max_background_flushes`
464 * in the case where user sets at least one of `max_background_compactions` or
465 * `max_background_flushes`.
467 * Returns the maximum number of concurrent background flush jobs.
468 * If you're increasing this, also consider increasing number of threads in
469 * HIGH priority thread pool. For more information, see
472 * @return the maximum number of concurrent background flush jobs.
473 * @see RocksEnv#setBackgroundThreads(int)
474 * @see RocksEnv#setBackgroundThreads(int, Priority)
477 int maxBackgroundFlushes();
480 * Specifies the maximum size of a info log file. If the current log file
481 * is larger than `max_log_file_size`, a new info log file will
483 * If 0, all logs will be written to one log file.
485 * @param maxLogFileSize the maximum size of a info log file.
486 * @return the instance of the current object.
487 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
488 * while overflowing the underlying platform specific value.
490 T
setMaxLogFileSize(long maxLogFileSize
);
493 * Returns the maximum size of a info log file. If the current log file
494 * is larger than this size, a new info log file will be created.
495 * If 0, all logs will be written to one log file.
497 * @return the maximum size of the info log file.
499 long maxLogFileSize();
502 * Specifies the time interval for the info log file to roll (in seconds).
503 * If specified with non-zero value, log file will be rolled
504 * if it has been active longer than `log_file_time_to_roll`.
505 * Default: 0 (disabled)
507 * @param logFileTimeToRoll the time interval in seconds.
508 * @return the instance of the current object.
509 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
510 * while overflowing the underlying platform specific value.
512 T
setLogFileTimeToRoll(long logFileTimeToRoll
);
515 * Returns the time interval for the info log file to roll (in seconds).
516 * If specified with non-zero value, log file will be rolled
517 * if it has been active longer than `log_file_time_to_roll`.
518 * Default: 0 (disabled)
520 * @return the time interval in seconds.
522 long logFileTimeToRoll();
525 * Specifies the maximum number of info log files to be kept.
528 * @param keepLogFileNum the maximum number of info log files to be kept.
529 * @return the instance of the current object.
530 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
531 * while overflowing the underlying platform specific value.
533 T
setKeepLogFileNum(long keepLogFileNum
);
536 * Returns the maximum number of info log files to be kept.
539 * @return the maximum number of info log files to be kept.
541 long keepLogFileNum();
546 * If non-zero, we will reuse previously written log files for new
547 * logs, overwriting the old data. The value indicates how many
548 * such files we will keep around at any point in time for later
551 * This is more efficient because the blocks are already
552 * allocated and fdatasync does not need to update the inode after
557 * @param recycleLogFileNum the number of log files to keep for recycling
559 * @return the reference to the current options
561 T
setRecycleLogFileNum(long recycleLogFileNum
);
566 * If non-zero, we will reuse previously written log files for new
567 * logs, overwriting the old data. The value indicates how many
568 * such files we will keep around at any point in time for later
571 * This is more efficient because the blocks are already
572 * allocated and fdatasync does not need to update the inode after
577 * @return the number of log files kept for recycling
579 long recycleLogFileNum();
582 * Manifest file is rolled over on reaching this limit.
583 * The older manifest file be deleted.
584 * The default value is 1GB so that the manifest file can grow, but not
585 * reach the limit of storage capacity.
587 * @param maxManifestFileSize the size limit of a manifest file.
588 * @return the instance of the current object.
590 T
setMaxManifestFileSize(long maxManifestFileSize
);
593 * Manifest file is rolled over on reaching this limit.
594 * The older manifest file be deleted.
595 * The default value is 1GB so that the manifest file can grow, but not
596 * reach the limit of storage capacity.
598 * @return the size limit of a manifest file.
600 long maxManifestFileSize();
603 * Number of shards used for table cache.
605 * @param tableCacheNumshardbits the number of chards
606 * @return the instance of the current object.
608 T
setTableCacheNumshardbits(int tableCacheNumshardbits
);
611 * Number of shards used for table cache.
613 * @return the number of shards used for table cache.
615 int tableCacheNumshardbits();
618 * {@link #walTtlSeconds()} and {@link #walSizeLimitMB()} affect how archived logs
621 * <li>If both set to 0, logs will be deleted asap and will not get into
623 * <li>If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0,
624 * WAL files will be checked every 10 min and if total size is greater
625 * then WAL_size_limit_MB, they will be deleted starting with the
626 * earliest until size_limit is met. All empty files will be deleted.</li>
627 * <li>If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then
628 * WAL files will be checked every WAL_ttl_seconds / 2 and those that
629 * are older than WAL_ttl_seconds will be deleted.</li>
630 * <li>If both are not 0, WAL files will be checked every 10 min and both
631 * checks will be performed with ttl being first.</li>
634 * @param walTtlSeconds the ttl seconds
635 * @return the instance of the current object.
636 * @see #setWalSizeLimitMB(long)
638 T
setWalTtlSeconds(long walTtlSeconds
);
641 * WalTtlSeconds() and walSizeLimitMB() affect how archived logs
644 * <li>If both set to 0, logs will be deleted asap and will not get into
646 * <li>If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0,
647 * WAL files will be checked every 10 min and if total size is greater
648 * then WAL_size_limit_MB, they will be deleted starting with the
649 * earliest until size_limit is met. All empty files will be deleted.</li>
650 * <li>If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then
651 * WAL files will be checked every WAL_ttl_seconds / 2 and those that
652 * are older than WAL_ttl_seconds will be deleted.</li>
653 * <li>If both are not 0, WAL files will be checked every 10 min and both
654 * checks will be performed with ttl being first.</li>
657 * @return the wal-ttl seconds
658 * @see #walSizeLimitMB()
660 long walTtlSeconds();
663 * WalTtlSeconds() and walSizeLimitMB() affect how archived logs
666 * <li>If both set to 0, logs will be deleted asap and will not get into
668 * <li>If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0,
669 * WAL files will be checked every 10 min and if total size is greater
670 * then WAL_size_limit_MB, they will be deleted starting with the
671 * earliest until size_limit is met. All empty files will be deleted.</li>
672 * <li>If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then
673 * WAL files will be checked every WAL_ttl_secondsi / 2 and those that
674 * are older than WAL_ttl_seconds will be deleted.</li>
675 * <li>If both are not 0, WAL files will be checked every 10 min and both
676 * checks will be performed with ttl being first.</li>
679 * @param sizeLimitMB size limit in mega-bytes.
680 * @return the instance of the current object.
681 * @see #setWalSizeLimitMB(long)
683 T
setWalSizeLimitMB(long sizeLimitMB
);
686 * {@link #walTtlSeconds()} and {@code #walSizeLimitMB()} affect how archived logs
689 * <li>If both set to 0, logs will be deleted asap and will not get into
691 * <li>If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0,
692 * WAL files will be checked every 10 min and if total size is greater
693 * then WAL_size_limit_MB, they will be deleted starting with the
694 * earliest until size_limit is met. All empty files will be deleted.</li>
695 * <li>If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then
696 * WAL files will be checked every WAL_ttl_seconds i / 2 and those that
697 * are older than WAL_ttl_seconds will be deleted.</li>
698 * <li>If both are not 0, WAL files will be checked every 10 min and both
699 * checks will be performed with ttl being first.</li>
701 * @return size limit in mega-bytes.
702 * @see #walSizeLimitMB()
704 long walSizeLimitMB();
707 * The maximum limit of number of bytes that are written in a single batch
708 * of WAL or memtable write. It is followed when the leader write size
709 * is larger than 1/8 of this limit.
713 * @param maxWriteBatchGroupSizeBytes the maximum limit of number of bytes, see description.
714 * @return the instance of the current object.
716 T
setMaxWriteBatchGroupSizeBytes(final long maxWriteBatchGroupSizeBytes
);
719 * The maximum limit of number of bytes that are written in a single batch
720 * of WAL or memtable write. It is followed when the leader write size
721 * is larger than 1/8 of this limit.
725 * @return the maximum limit of number of bytes, see description.
727 long maxWriteBatchGroupSizeBytes();
730 * Number of bytes to preallocate (via fallocate) the manifest
731 * files. Default is 4mb, which is reasonable to reduce random IO
732 * as well as prevent overallocation for mounts that preallocate
733 * large amounts of data (such as xfs's allocsize option).
735 * @param size the size in byte
736 * @return the instance of the current object.
737 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
738 * while overflowing the underlying platform specific value.
740 T
setManifestPreallocationSize(long size
);
743 * Number of bytes to preallocate (via fallocate) the manifest
744 * files. Default is 4mb, which is reasonable to reduce random IO
745 * as well as prevent overallocation for mounts that preallocate
746 * large amounts of data (such as xfs's allocsize option).
748 * @return size in bytes.
750 long manifestPreallocationSize();
753 * Enable the OS to use direct I/O for reading sst tables.
756 * @param useDirectReads if true, then direct read is enabled
757 * @return the instance of the current object.
759 T
setUseDirectReads(boolean useDirectReads
);
762 * Enable the OS to use direct I/O for reading sst tables.
765 * @return if true, then direct reads are enabled
767 boolean useDirectReads();
770 * Enable the OS to use direct reads and writes in flush and
774 * @param useDirectIoForFlushAndCompaction if true, then direct
775 * I/O will be enabled for background flush and compactions
776 * @return the instance of the current object.
778 T
setUseDirectIoForFlushAndCompaction(boolean useDirectIoForFlushAndCompaction
);
781 * Enable the OS to use direct reads and writes in flush and
784 * @return if true, then direct I/O is enabled for flush and
787 boolean useDirectIoForFlushAndCompaction();
790 * Whether fallocate calls are allowed
792 * @param allowFAllocate false if fallocate() calls are bypassed
794 * @return the reference to the current options.
796 T
setAllowFAllocate(boolean allowFAllocate
);
799 * Whether fallocate calls are allowed
801 * @return false if fallocate() calls are bypassed
803 boolean allowFAllocate();
806 * Allow the OS to mmap file for reading sst tables.
809 * @param allowMmapReads true if mmap reads are allowed.
810 * @return the instance of the current object.
812 T
setAllowMmapReads(boolean allowMmapReads
);
815 * Allow the OS to mmap file for reading sst tables.
818 * @return true if mmap reads are allowed.
820 boolean allowMmapReads();
823 * Allow the OS to mmap file for writing. Default: false
825 * @param allowMmapWrites true if mmap writes are allowd.
826 * @return the instance of the current object.
828 T
setAllowMmapWrites(boolean allowMmapWrites
);
831 * Allow the OS to mmap file for writing. Default: false
833 * @return true if mmap writes are allowed.
835 boolean allowMmapWrites();
838 * Disable child process inherit open files. Default: true
840 * @param isFdCloseOnExec true if child process inheriting open
842 * @return the instance of the current object.
844 T
setIsFdCloseOnExec(boolean isFdCloseOnExec
);
847 * Disable child process inherit open files. Default: true
849 * @return true if child process inheriting open files is disabled.
851 boolean isFdCloseOnExec();
854 * If set true, will hint the underlying file system that the file
855 * access pattern is random, when a sst file is opened.
858 * @param adviseRandomOnOpen true if hinting random access is on.
859 * @return the instance of the current object.
861 T
setAdviseRandomOnOpen(boolean adviseRandomOnOpen
);
864 * If set true, will hint the underlying file system that the file
865 * access pattern is random, when a sst file is opened.
868 * @return true if hinting random access is on.
870 boolean adviseRandomOnOpen();
873 * Amount of data to build up in memtables across all column
874 * families before writing to disk.
876 * This is distinct from {@link ColumnFamilyOptions#writeBufferSize()},
877 * which enforces a limit for a single memtable.
879 * This feature is disabled by default. Specify a non-zero value
882 * Default: 0 (disabled)
884 * @param dbWriteBufferSize the size of the write buffer
886 * @return the reference to the current options.
888 T
setDbWriteBufferSize(long dbWriteBufferSize
);
891 * Use passed {@link WriteBufferManager} to control memory usage across
892 * multiple column families and/or DB instances.
894 * Check <a href="https://github.com/facebook/rocksdb/wiki/Write-Buffer-Manager">
895 * https://github.com/facebook/rocksdb/wiki/Write-Buffer-Manager</a>
896 * for more details on when to use it
898 * @param writeBufferManager The WriteBufferManager to use
899 * @return the reference of the current options.
901 T
setWriteBufferManager(final WriteBufferManager writeBufferManager
);
904 * Reference to {@link WriteBufferManager} used by it. <br>
906 * Default: null (Disabled)
908 * @return a reference to WriteBufferManager
910 WriteBufferManager
writeBufferManager();
913 * Amount of data to build up in memtables across all column
914 * families before writing to disk.
916 * This is distinct from {@link ColumnFamilyOptions#writeBufferSize()},
917 * which enforces a limit for a single memtable.
919 * This feature is disabled by default. Specify a non-zero value
922 * Default: 0 (disabled)
924 * @return the size of the write buffer
926 long dbWriteBufferSize();
929 * Specify the file access pattern once a compaction is started.
930 * It will be applied to all input files of a compaction.
932 * Default: {@link AccessHint#NORMAL}
934 * @param accessHint The access hint
936 * @return the reference to the current options.
938 T
setAccessHintOnCompactionStart(final AccessHint accessHint
);
941 * Specify the file access pattern once a compaction is started.
942 * It will be applied to all input files of a compaction.
944 * Default: {@link AccessHint#NORMAL}
946 * @return The access hint
948 AccessHint
accessHintOnCompactionStart();
951 * This is a maximum buffer size that is used by WinMmapReadableFile in
952 * unbuffered disk I/O mode. We need to maintain an aligned buffer for
953 * reads. We allow the buffer to grow until the specified value and then
954 * for bigger requests allocate one shot buffers. In unbuffered mode we
955 * always bypass read-ahead buffer at ReadaheadRandomAccessFile
956 * When read-ahead is required we then make use of
957 * {@link MutableDBOptionsInterface#compactionReadaheadSize()} value and
958 * always try to read ahead.
959 * With read-ahead we always pre-allocate buffer to the size instead of
960 * growing it up to a limit.
962 * This option is currently honored only on Windows
966 * Special value: 0 - means do not maintain per instance buffer. Allocate
967 * per request buffer and avoid locking.
969 * @param randomAccessMaxBufferSize the maximum size of the random access
972 * @return the reference to the current options.
974 T
setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize
);
977 * This is a maximum buffer size that is used by WinMmapReadableFile in
978 * unbuffered disk I/O mode. We need to maintain an aligned buffer for
979 * reads. We allow the buffer to grow until the specified value and then
980 * for bigger requests allocate one shot buffers. In unbuffered mode we
981 * always bypass read-ahead buffer at ReadaheadRandomAccessFile
982 * When read-ahead is required we then make use of
983 * {@link MutableDBOptionsInterface#compactionReadaheadSize()} value and
984 * always try to read ahead. With read-ahead we always pre-allocate buffer
985 * to the size instead of growing it up to a limit.
987 * This option is currently honored only on Windows
991 * Special value: 0 - means do not maintain per instance buffer. Allocate
992 * per request buffer and avoid locking.
994 * @return the maximum size of the random access buffer
996 long randomAccessMaxBufferSize();
999 * Use adaptive mutex, which spins in the user space before resorting
1000 * to kernel. This could reduce context switch when the mutex is not
1001 * heavily contended. However, if the mutex is hot, we could end up
1002 * wasting spin time.
1005 * @param useAdaptiveMutex true if adaptive mutex is used.
1006 * @return the instance of the current object.
1008 T
setUseAdaptiveMutex(boolean useAdaptiveMutex
);
1011 * Use adaptive mutex, which spins in the user space before resorting
1012 * to kernel. This could reduce context switch when the mutex is not
1013 * heavily contended. However, if the mutex is hot, we could end up
1014 * wasting spin time.
1017 * @return true if adaptive mutex is used.
1019 boolean useAdaptiveMutex();
1022 * Sets the {@link EventListener}s whose callback functions
1023 * will be called when specific RocksDB event happens.
1025 * Note: the RocksJava API currently only supports EventListeners implemented in Java.
1026 * It could be extended in future to also support adding/removing EventListeners implemented in
1029 * @param listeners the listeners who should be notified on various events.
1031 * @return the instance of the current object.
1033 T
setListeners(final List
<AbstractEventListener
> listeners
);
1036 * Sets the {@link EventListener}s whose callback functions
1037 * will be called when specific RocksDB event happens.
1039 * Note: the RocksJava API currently only supports EventListeners implemented in Java.
1040 * It could be extended in future to also support adding/removing EventListeners implemented in
1043 * @return the instance of the current object.
1045 List
<AbstractEventListener
> listeners();
1048 * If true, then the status of the threads involved in this DB will
1049 * be tracked and available via GetThreadList() API.
1053 * @param enableThreadTracking true to enable tracking
1055 * @return the reference to the current options.
1057 T
setEnableThreadTracking(boolean enableThreadTracking
);
1060 * If true, then the status of the threads involved in this DB will
1061 * be tracked and available via GetThreadList() API.
1065 * @return true if tracking is enabled
1067 boolean enableThreadTracking();
1070 * By default, a single write thread queue is maintained. The thread gets
1071 * to the head of the queue becomes write batch group leader and responsible
1072 * for writing to WAL and memtable for the batch group.
1074 * If {@link #enablePipelinedWrite()} is true, separate write thread queue is
1075 * maintained for WAL write and memtable write. A write thread first enter WAL
1076 * writer queue and then memtable writer queue. Pending thread on the WAL
1077 * writer queue thus only have to wait for previous writers to finish their
1078 * WAL writing but not the memtable writing. Enabling the feature may improve
1079 * write throughput and reduce latency of the prepare phase of two-phase
1084 * @param enablePipelinedWrite true to enabled pipelined writes
1086 * @return the reference to the current options.
1088 T
setEnablePipelinedWrite(final boolean enablePipelinedWrite
);
1091 * Returns true if pipelined writes are enabled.
1092 * See {@link #setEnablePipelinedWrite(boolean)}.
1094 * @return true if pipelined writes are enabled, false otherwise.
1096 boolean enablePipelinedWrite();
1099 * Setting {@link #unorderedWrite()} to true trades higher write throughput with
1100 * relaxing the immutability guarantee of snapshots. This violates the
1101 * repeatability one expects from ::Get from a snapshot, as well as
1102 * ::MultiGet and Iterator's consistent-point-in-time view property.
1103 * If the application cannot tolerate the relaxed guarantees, it can implement
1104 * its own mechanisms to work around that and yet benefit from the higher
1105 * throughput. Using TransactionDB with WRITE_PREPARED write policy and
1106 * {@link #twoWriteQueues()} true is one way to achieve immutable snapshots despite
1109 * By default, i.e., when it is false, rocksdb does not advance the sequence
1110 * number for new snapshots unless all the writes with lower sequence numbers
1111 * are already finished. This provides the immutability that we except from
1112 * snapshots. Moreover, since Iterator and MultiGet internally depend on
1113 * snapshots, the snapshot immutability results into Iterator and MultiGet
1114 * offering consistent-point-in-time view. If set to true, although
1115 * Read-Your-Own-Write property is still provided, the snapshot immutability
1116 * property is relaxed: the writes issued after the snapshot is obtained (with
1117 * larger sequence numbers) will be still not visible to the reads from that
1118 * snapshot, however, there still might be pending writes (with lower sequence
1119 * number) that will change the state visible to the snapshot after they are
1120 * landed to the memtable.
1122 * @param unorderedWrite true to enabled unordered write
1124 * @return the reference to the current options.
1126 T
setUnorderedWrite(final boolean unorderedWrite
);
1129 * Returns true if unordered write are enabled.
1130 * See {@link #setUnorderedWrite(boolean)}.
1132 * @return true if unordered write are enabled, false otherwise.
1134 boolean unorderedWrite();
1137 * If true, allow multi-writers to update mem tables in parallel.
1138 * Only some memtable factorys support concurrent writes; currently it
1139 * is implemented only for SkipListFactory. Concurrent memtable writes
1140 * are not compatible with inplace_update_support or filter_deletes.
1141 * It is strongly recommended to set
1142 * {@link #setEnableWriteThreadAdaptiveYield(boolean)} if you are going to use
1146 * @param allowConcurrentMemtableWrite true to enable concurrent writes
1149 * @return the reference to the current options.
1151 T
setAllowConcurrentMemtableWrite(boolean allowConcurrentMemtableWrite
);
1154 * If true, allow multi-writers to update mem tables in parallel.
1155 * Only some memtable factorys support concurrent writes; currently it
1156 * is implemented only for SkipListFactory. Concurrent memtable writes
1157 * are not compatible with inplace_update_support or filter_deletes.
1158 * It is strongly recommended to set
1159 * {@link #setEnableWriteThreadAdaptiveYield(boolean)} if you are going to use
1163 * @return true if concurrent writes are enabled for the memtable
1165 boolean allowConcurrentMemtableWrite();
1168 * If true, threads synchronizing with the write batch group leader will
1169 * wait for up to {@link #writeThreadMaxYieldUsec()} before blocking on a
1170 * mutex. This can substantially improve throughput for concurrent workloads,
1171 * regardless of whether {@link #allowConcurrentMemtableWrite()} is enabled.
1174 * @param enableWriteThreadAdaptiveYield true to enable adaptive yield for the
1177 * @return the reference to the current options.
1179 T
setEnableWriteThreadAdaptiveYield(
1180 boolean enableWriteThreadAdaptiveYield
);
1183 * If true, threads synchronizing with the write batch group leader will
1184 * wait for up to {@link #writeThreadMaxYieldUsec()} before blocking on a
1185 * mutex. This can substantially improve throughput for concurrent workloads,
1186 * regardless of whether {@link #allowConcurrentMemtableWrite()} is enabled.
1189 * @return true if adaptive yield is enabled
1190 * for the writing threads
1192 boolean enableWriteThreadAdaptiveYield();
1195 * The maximum number of microseconds that a write operation will use
1196 * a yielding spin loop to coordinate with other write threads before
1197 * blocking on a mutex. (Assuming {@link #writeThreadSlowYieldUsec()} is
1198 * set properly) increasing this value is likely to increase RocksDB
1199 * throughput at the expense of increased CPU usage.
1202 * @param writeThreadMaxYieldUsec maximum number of microseconds
1204 * @return the reference to the current options.
1206 T
setWriteThreadMaxYieldUsec(long writeThreadMaxYieldUsec
);
1209 * The maximum number of microseconds that a write operation will use
1210 * a yielding spin loop to coordinate with other write threads before
1211 * blocking on a mutex. (Assuming {@link #writeThreadSlowYieldUsec()} is
1212 * set properly) increasing this value is likely to increase RocksDB
1213 * throughput at the expense of increased CPU usage.
1216 * @return the maximum number of microseconds
1218 long writeThreadMaxYieldUsec();
1221 * The latency in microseconds after which a std::this_thread::yield
1222 * call (sched_yield on Linux) is considered to be a signal that
1223 * other processes or threads would like to use the current core.
1224 * Increasing this makes writer threads more likely to take CPU
1225 * by spinning, which will show up as an increase in the number of
1226 * involuntary context switches.
1229 * @param writeThreadSlowYieldUsec the latency in microseconds
1231 * @return the reference to the current options.
1233 T
setWriteThreadSlowYieldUsec(long writeThreadSlowYieldUsec
);
1236 * The latency in microseconds after which a std::this_thread::yield
1237 * call (sched_yield on Linux) is considered to be a signal that
1238 * other processes or threads would like to use the current core.
1239 * Increasing this makes writer threads more likely to take CPU
1240 * by spinning, which will show up as an increase in the number of
1241 * involuntary context switches.
1244 * @return writeThreadSlowYieldUsec the latency in microseconds
1246 long writeThreadSlowYieldUsec();
1249 * If true, then DB::Open() will not update the statistics used to optimize
1250 * compaction decision by loading table properties from many files.
1251 * Turning off this feature will improve DBOpen time especially in
1256 * @param skipStatsUpdateOnDbOpen true if updating stats will be skipped
1258 * @return the reference to the current options.
1260 T
setSkipStatsUpdateOnDbOpen(boolean skipStatsUpdateOnDbOpen
);
1263 * If true, then DB::Open() will not update the statistics used to optimize
1264 * compaction decision by loading table properties from many files.
1265 * Turning off this feature will improve DBOpen time especially in
1270 * @return true if updating stats will be skipped
1272 boolean skipStatsUpdateOnDbOpen();
1275 * If true, then {@link RocksDB#open(String)} will not fetch and check sizes of all sst files.
1276 * This may significantly speed up startup if there are many sst files,
1277 * especially when using non-default Env with expensive GetFileSize().
1278 * We'll still check that all required sst files exist.
1279 * If {@code paranoid_checks} is false, this option is ignored, and sst files are
1280 * not checked at all.
1284 * @param skipCheckingSstFileSizesOnDbOpen if true, then SST file sizes will not be checked
1285 * when calling {@link RocksDB#open(String)}.
1286 * @return the reference to the current options.
1288 T
setSkipCheckingSstFileSizesOnDbOpen(final boolean skipCheckingSstFileSizesOnDbOpen
);
1291 * If true, then {@link RocksDB#open(String)} will not fetch and check sizes of all sst files.
1292 * This may significantly speed up startup if there are many sst files,
1293 * especially when using non-default Env with expensive GetFileSize().
1294 * We'll still check that all required sst files exist.
1295 * If {@code paranoid_checks} is false, this option is ignored, and sst files are
1296 * not checked at all.
1300 * @return true, if file sizes will not be checked when calling {@link RocksDB#open(String)}.
1302 boolean skipCheckingSstFileSizesOnDbOpen();
1305 * Recovery mode to control the consistency while replaying WAL
1307 * Default: {@link WALRecoveryMode#PointInTimeRecovery}
1309 * @param walRecoveryMode The WAL recover mode
1311 * @return the reference to the current options.
1313 T
setWalRecoveryMode(WALRecoveryMode walRecoveryMode
);
1316 * Recovery mode to control the consistency while replaying WAL
1318 * Default: {@link WALRecoveryMode#PointInTimeRecovery}
1320 * @return The WAL recover mode
1322 WALRecoveryMode
walRecoveryMode();
1325 * if set to false then recovery will fail when a prepared
1326 * transaction is encountered in the WAL
1330 * @param allow2pc true if two-phase-commit is enabled
1332 * @return the reference to the current options.
1334 T
setAllow2pc(boolean allow2pc
);
1337 * if set to false then recovery will fail when a prepared
1338 * transaction is encountered in the WAL
1342 * @return true if two-phase-commit is enabled
1347 * A global cache for table-level rows.
1349 * Default: null (disabled)
1351 * @param rowCache The global row cache
1353 * @return the reference to the current options.
1355 T
setRowCache(final Cache rowCache
);
1358 * A global cache for table-level rows.
1360 * Default: null (disabled)
1362 * @return The global row cache
1367 * A filter object supplied to be invoked while processing write-ahead-logs
1368 * (WALs) during recovery. The filter provides a way to inspect log
1369 * records, ignoring a particular record or skipping replay.
1370 * The filter is invoked at startup and is invoked from a single-thread
1373 * @param walFilter the filter for processing WALs during recovery.
1375 * @return the reference to the current options.
1377 T
setWalFilter(final AbstractWalFilter walFilter
);
1380 * Get's the filter for processing WALs during recovery.
1381 * See {@link #setWalFilter(AbstractWalFilter)}.
1383 * @return the filter used for processing WALs during recovery.
1385 WalFilter
walFilter();
1388 * If true, then DB::Open / CreateColumnFamily / DropColumnFamily
1389 * / SetOptions will fail if options file is not detected or properly
1394 * @param failIfOptionsFileError true if we should fail if there is an error
1395 * in the options file
1397 * @return the reference to the current options.
1399 T
setFailIfOptionsFileError(boolean failIfOptionsFileError
);
1402 * If true, then DB::Open / CreateColumnFamily / DropColumnFamily
1403 * / SetOptions will fail if options file is not detected or properly
1408 * @return true if we should fail if there is an error in the options file
1410 boolean failIfOptionsFileError();
1413 * If true, then print malloc stats together with rocksdb.stats
1414 * when printing to LOG.
1418 * @param dumpMallocStats true if malloc stats should be printed to LOG
1420 * @return the reference to the current options.
1422 T
setDumpMallocStats(boolean dumpMallocStats
);
1425 * If true, then print malloc stats together with rocksdb.stats
1426 * when printing to LOG.
1430 * @return true if malloc stats should be printed to LOG
1432 boolean dumpMallocStats();
1435 * By default RocksDB replay WAL logs and flush them on DB open, which may
1436 * create very small SST files. If this option is enabled, RocksDB will try
1437 * to avoid (but not guarantee not to) flush during recovery. Also, existing
1438 * WAL logs will be kept, so that if crash happened before flush, we still
1439 * have logs to recover from.
1443 * @param avoidFlushDuringRecovery true to try to avoid (but not guarantee
1444 * not to) flush during recovery
1446 * @return the reference to the current options.
1448 T
setAvoidFlushDuringRecovery(boolean avoidFlushDuringRecovery
);
1451 * By default RocksDB replay WAL logs and flush them on DB open, which may
1452 * create very small SST files. If this option is enabled, RocksDB will try
1453 * to avoid (but not guarantee not to) flush during recovery. Also, existing
1454 * WAL logs will be kept, so that if crash happened before flush, we still
1455 * have logs to recover from.
1459 * @return true to try to avoid (but not guarantee not to) flush during
1462 boolean avoidFlushDuringRecovery();
1465 * Set this option to true during creation of database if you want
1466 * to be able to ingest behind (call IngestExternalFile() skipping keys
1467 * that already exist, rather than overwriting matching keys).
1468 * Setting this option to true will affect 2 things:
1469 * 1) Disable some internal optimizations around SST file compression
1470 * 2) Reserve bottom-most level for ingested files only.
1471 * 3) Note that num_levels should be >= 3 if this option is turned on.
1475 * @param allowIngestBehind true to allow ingest behind, false to disallow.
1477 * @return the reference to the current options.
1479 T
setAllowIngestBehind(final boolean allowIngestBehind
);
1482 * Returns true if ingest behind is allowed.
1483 * See {@link #setAllowIngestBehind(boolean)}.
1485 * @return true if ingest behind is allowed, false otherwise.
1487 boolean allowIngestBehind();
1490 * If enabled it uses two queues for writes, one for the ones with
1491 * disable_memtable and one for the ones that also write to memtable. This
1492 * allows the memtable writes not to lag behind other writes. It can be used
1493 * to optimize MySQL 2PC in which only the commits, which are serial, write to
1498 * @param twoWriteQueues true to enable two write queues, false otherwise.
1500 * @return the reference to the current options.
1502 T
setTwoWriteQueues(final boolean twoWriteQueues
);
1505 * Returns true if two write queues are enabled.
1507 * @return true if two write queues are enabled, false otherwise.
1509 boolean twoWriteQueues();
1512 * If true WAL is not flushed automatically after each write. Instead it
1513 * relies on manual invocation of FlushWAL to write the WAL buffer to its
1518 * @param manualWalFlush true to set disable automatic WAL flushing,
1521 * @return the reference to the current options.
1523 T
setManualWalFlush(final boolean manualWalFlush
);
1526 * Returns true if automatic WAL flushing is disabled.
1527 * See {@link #setManualWalFlush(boolean)}.
1529 * @return true if automatic WAL flushing is disabled, false otherwise.
1531 boolean manualWalFlush();
1534 * If true, RocksDB supports flushing multiple column families and committing
1535 * their results atomically to MANIFEST. Note that it is not
1536 * necessary to set atomic_flush to true if WAL is always enabled since WAL
1537 * allows the database to be restored to the last persistent state in WAL.
1538 * This option is useful when there are column families with writes NOT
1540 * For manual flush, application has to specify which column families to
1541 * flush atomically in {@link RocksDB#flush(FlushOptions, List)}.
1542 * For auto-triggered flush, RocksDB atomically flushes ALL column families.
1544 * Currently, any WAL-enabled writes after atomic flush may be replayed
1545 * independently if the process crashes later and tries to recover.
1547 * @param atomicFlush true to enable atomic flush of multiple column families.
1549 * @return the reference to the current options.
1551 T
setAtomicFlush(final boolean atomicFlush
);
1554 * Determine if atomic flush of multiple column families is enabled.
1556 * See {@link #setAtomicFlush(boolean)}.
1558 * @return true if atomic flush is enabled.
1560 boolean atomicFlush();
1563 * If true, working thread may avoid doing unnecessary and long-latency
1564 * operation (such as deleting obsolete files directly or deleting memtable)
1565 * and will instead schedule a background job to do it.
1566 * Use it if you're latency-sensitive.
1567 * If set to true, takes precedence over
1568 * {@link ReadOptions#setBackgroundPurgeOnIteratorCleanup(boolean)}.
1570 * @param avoidUnnecessaryBlockingIO If true, working thread may avoid doing unnecessary
1572 * @return the reference to the current options.
1574 T
setAvoidUnnecessaryBlockingIO(final boolean avoidUnnecessaryBlockingIO
);
1577 * If true, working thread may avoid doing unnecessary and long-latency
1578 * operation (such as deleting obsolete files directly or deleting memtable)
1579 * and will instead schedule a background job to do it.
1580 * Use it if you're latency-sensitive.
1581 * If set to true, takes precedence over
1582 * {@link ReadOptions#setBackgroundPurgeOnIteratorCleanup(boolean)}.
1584 * @return true, if working thread may avoid doing unnecessary operation.
1586 boolean avoidUnnecessaryBlockingIO();
1589 * If true, automatically persist stats to a hidden column family (column
1590 * family name: ___rocksdb_stats_history___) every
1591 * stats_persist_period_sec seconds; otherwise, write to an in-memory
1592 * struct. User can query through `GetStatsHistory` API.
1593 * If user attempts to create a column family with the same name on a DB
1594 * which have previously set persist_stats_to_disk to true, the column family
1595 * creation will fail, but the hidden column family will survive, as well as
1596 * the previously persisted statistics.
1597 * When peristing stats to disk, the stat name will be limited at 100 bytes.
1600 * @param persistStatsToDisk true if stats should be persisted to hidden column family.
1601 * @return the instance of the current object.
1603 T
setPersistStatsToDisk(final boolean persistStatsToDisk
);
1606 * If true, automatically persist stats to a hidden column family (column
1607 * family name: ___rocksdb_stats_history___) every
1608 * stats_persist_period_sec seconds; otherwise, write to an in-memory
1609 * struct. User can query through `GetStatsHistory` API.
1610 * If user attempts to create a column family with the same name on a DB
1611 * which have previously set persist_stats_to_disk to true, the column family
1612 * creation will fail, but the hidden column family will survive, as well as
1613 * the previously persisted statistics.
1614 * When peristing stats to disk, the stat name will be limited at 100 bytes.
1617 * @return true if stats should be persisted to hidden column family.
1619 boolean persistStatsToDisk();
1622 * Historically DB ID has always been stored in Identity File in DB folder.
1623 * If this flag is true, the DB ID is written to Manifest file in addition
1624 * to the Identity file. By doing this 2 problems are solved
1625 * 1. We don't checksum the Identity file where as Manifest file is.
1626 * 2. Since the source of truth for DB is Manifest file DB ID will sit with
1627 * the source of truth. Previously the Identity file could be copied
1628 * independent of Manifest and that can result in wrong DB ID.
1629 * We recommend setting this flag to true.
1632 * @param writeDbidToManifest if true, then DB ID will be written to Manifest file.
1633 * @return the instance of the current object.
1635 T
setWriteDbidToManifest(final boolean writeDbidToManifest
);
1638 * Historically DB ID has always been stored in Identity File in DB folder.
1639 * If this flag is true, the DB ID is written to Manifest file in addition
1640 * to the Identity file. By doing this 2 problems are solved
1641 * 1. We don't checksum the Identity file where as Manifest file is.
1642 * 2. Since the source of truth for DB is Manifest file DB ID will sit with
1643 * the source of truth. Previously the Identity file could be copied
1644 * independent of Manifest and that can result in wrong DB ID.
1645 * We recommend setting this flag to true.
1648 * @return true, if DB ID will be written to Manifest file.
1650 boolean writeDbidToManifest();
1653 * The number of bytes to prefetch when reading the log. This is mostly useful
1654 * for reading a remotely located log, as it can save the number of
1655 * round-trips. If 0, then the prefetching is disabled.
1659 * @param logReadaheadSize the number of bytes to prefetch when reading the log.
1660 * @return the instance of the current object.
1662 T
setLogReadaheadSize(final long logReadaheadSize
);
1665 * The number of bytes to prefetch when reading the log. This is mostly useful
1666 * for reading a remotely located log, as it can save the number of
1667 * round-trips. If 0, then the prefetching is disabled.
1671 * @return the number of bytes to prefetch when reading the log.
1673 long logReadaheadSize();
1676 * By default, RocksDB recovery fails if any table file referenced in
1677 * MANIFEST are missing after scanning the MANIFEST.
1678 * Best-efforts recovery is another recovery mode that
1679 * tries to restore the database to the most recent point in time without
1681 * Currently not compatible with atomic flush. Furthermore, WAL files will
1682 * not be used for recovery if best_efforts_recovery is true.
1685 * @param bestEffortsRecovery if true, RocksDB will use best-efforts mode when recovering.
1686 * @return the instance of the current object.
1688 T
setBestEffortsRecovery(final boolean bestEffortsRecovery
);
1691 * By default, RocksDB recovery fails if any table file referenced in
1692 * MANIFEST are missing after scanning the MANIFEST.
1693 * Best-efforts recovery is another recovery mode that
1694 * tries to restore the database to the most recent point in time without
1696 * Currently not compatible with atomic flush. Furthermore, WAL files will
1697 * not be used for recovery if best_efforts_recovery is true.
1700 * @return true, if RocksDB uses best-efforts mode when recovering.
1702 boolean bestEffortsRecovery();
1705 * It defines how many times db resume is called by a separate thread when
1706 * background retryable IO Error happens. When background retryable IO
1707 * Error happens, SetBGError is called to deal with the error. If the error
1708 * can be auto-recovered (e.g., retryable IO Error during Flush or WAL write),
1709 * then db resume is called in background to recover from the error. If this
1710 * value is 0 or negative, db resume will not be called.
1714 * @param maxBgerrorResumeCount maximum number of times db resume should be called when IO Error
1716 * @return the instance of the current object.
1718 T
setMaxBgErrorResumeCount(final int maxBgerrorResumeCount
);
1721 * It defines how many times db resume is called by a separate thread when
1722 * background retryable IO Error happens. When background retryable IO
1723 * Error happens, SetBGError is called to deal with the error. If the error
1724 * can be auto-recovered (e.g., retryable IO Error during Flush or WAL write),
1725 * then db resume is called in background to recover from the error. If this
1726 * value is 0 or negative, db resume will not be called.
1730 * @return maximum number of times db resume should be called when IO Error happens.
1732 int maxBgerrorResumeCount();
1735 * If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.
1736 * This option decides how long to wait to retry the next resume if the
1737 * previous resume fails and satisfy redo resume conditions.
1739 * Default: 1000000 (microseconds).
1741 * @param bgerrorResumeRetryInterval how many microseconds to wait between DB resume attempts.
1742 * @return the instance of the current object.
1744 T
setBgerrorResumeRetryInterval(final long bgerrorResumeRetryInterval
);
1747 * If max_bgerror_resume_count is ≥ 2, db resume is called multiple times.
1748 * This option decides how long to wait to retry the next resume if the
1749 * previous resume fails and satisfy redo resume conditions.
1751 * Default: 1000000 (microseconds).
1753 * @return the instance of the current object.
1755 long bgerrorResumeRetryInterval();