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
.nio
.file
.Paths
;
9 import java
.util
.ArrayList
;
10 import java
.util
.Collection
;
11 import java
.util
.Collections
;
12 import java
.util
.List
;
15 * Options to control the behavior of a database. It will be used
16 * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
18 * If {@link #dispose()} function is not called, then it will be GC'd
19 * automaticallyand native resources will be released as part of the process.
21 public class Options
extends RocksObject
22 implements DBOptionsInterface
<Options
>, ColumnFamilyOptionsInterface
<Options
>,
23 MutableColumnFamilyOptionsInterface
<Options
> {
25 RocksDB
.loadLibrary();
29 * Construct options for opening a RocksDB.
31 * This constructor will create (by allocating a block of memory)
32 * an {@code rocksdb::Options} in the c++ side.
36 env_
= Env
.getDefault();
40 * Construct options for opening a RocksDB. Reusing database options
41 * and column family options.
43 * @param dbOptions {@link org.rocksdb.DBOptions} instance
44 * @param columnFamilyOptions {@link org.rocksdb.ColumnFamilyOptions}
47 public Options(final DBOptions dbOptions
,
48 final ColumnFamilyOptions columnFamilyOptions
) {
49 super(newOptions(dbOptions
.nativeHandle_
,
50 columnFamilyOptions
.nativeHandle_
));
51 env_
= Env
.getDefault();
55 * Copy constructor for ColumnFamilyOptions.
57 * NOTE: This does a shallow copy, which means comparator, merge_operator
58 * and other pointers will be cloned!
60 * @param other The Options to copy.
62 public Options(Options other
) {
63 super(copyOptions(other
.nativeHandle_
));
64 this.env_
= other
.env_
;
65 this.memTableConfig_
= other
.memTableConfig_
;
66 this.tableFormatConfig_
= other
.tableFormatConfig_
;
67 this.rateLimiter_
= other
.rateLimiter_
;
68 this.comparator_
= other
.comparator_
;
69 this.compactionOptionsUniversal_
= other
.compactionOptionsUniversal_
;
70 this.compactionOptionsFIFO_
= other
.compactionOptionsFIFO_
;
71 this.compressionOptions_
= other
.compressionOptions_
;
72 this.rowCache_
= other
.rowCache_
;
76 public Options
setIncreaseParallelism(final int totalThreads
) {
77 assert(isOwningHandle());
78 setIncreaseParallelism(nativeHandle_
, totalThreads
);
83 public Options
setCreateIfMissing(final boolean flag
) {
84 assert(isOwningHandle());
85 setCreateIfMissing(nativeHandle_
, flag
);
90 public Options
setCreateMissingColumnFamilies(final boolean flag
) {
91 assert(isOwningHandle());
92 setCreateMissingColumnFamilies(nativeHandle_
, flag
);
97 public Options
setEnv(final Env env
) {
98 assert(isOwningHandle());
99 setEnv(nativeHandle_
, env
.nativeHandle_
);
105 public Env
getEnv() {
110 * <p>Set appropriate parameters for bulk loading.
111 * The reason that this is a function that returns "this" instead of a
112 * constructor is to enable chaining of multiple similar calls in the future.
115 * <p>All data will be in level 0 without any automatic compaction.
116 * It's recommended to manually call CompactRange(NULL, NULL) before reading
117 * from the database, because otherwise the read can be very slow.</p>
119 * @return the instance of the current Options.
121 public Options
prepareForBulkLoad() {
122 prepareForBulkLoad(nativeHandle_
);
127 public boolean createIfMissing() {
128 assert(isOwningHandle());
129 return createIfMissing(nativeHandle_
);
133 public boolean createMissingColumnFamilies() {
134 assert(isOwningHandle());
135 return createMissingColumnFamilies(nativeHandle_
);
139 public Options
optimizeForSmallDb() {
140 optimizeForSmallDb(nativeHandle_
);
145 public Options
optimizeForPointLookup(
146 long blockCacheSizeMb
) {
147 optimizeForPointLookup(nativeHandle_
,
153 public Options
optimizeLevelStyleCompaction() {
154 optimizeLevelStyleCompaction(nativeHandle_
,
155 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET
);
160 public Options
optimizeLevelStyleCompaction(
161 long memtableMemoryBudget
) {
162 optimizeLevelStyleCompaction(nativeHandle_
,
163 memtableMemoryBudget
);
168 public Options
optimizeUniversalStyleCompaction() {
169 optimizeUniversalStyleCompaction(nativeHandle_
,
170 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET
);
175 public Options
optimizeUniversalStyleCompaction(
176 final long memtableMemoryBudget
) {
177 optimizeUniversalStyleCompaction(nativeHandle_
,
178 memtableMemoryBudget
);
183 public Options
setComparator(final BuiltinComparator builtinComparator
) {
184 assert(isOwningHandle());
185 setComparatorHandle(nativeHandle_
, builtinComparator
.ordinal());
190 public Options
setComparator(
191 final AbstractComparator
<?
extends AbstractSlice
<?
>> comparator
) {
192 assert(isOwningHandle());
193 setComparatorHandle(nativeHandle_
, comparator
.nativeHandle_
,
194 comparator
.getComparatorType().getValue());
195 comparator_
= comparator
;
200 public Options
setMergeOperatorName(final String name
) {
201 assert(isOwningHandle());
203 throw new IllegalArgumentException(
204 "Merge operator name must not be null.");
206 setMergeOperatorName(nativeHandle_
, name
);
211 public Options
setMergeOperator(final MergeOperator mergeOperator
) {
212 setMergeOperator(nativeHandle_
, mergeOperator
.nativeHandle_
);
217 public Options
setWriteBufferSize(final long writeBufferSize
) {
218 assert(isOwningHandle());
219 setWriteBufferSize(nativeHandle_
, writeBufferSize
);
224 public long writeBufferSize() {
225 assert(isOwningHandle());
226 return writeBufferSize(nativeHandle_
);
230 public Options
setMaxWriteBufferNumber(final int maxWriteBufferNumber
) {
231 assert(isOwningHandle());
232 setMaxWriteBufferNumber(nativeHandle_
, maxWriteBufferNumber
);
237 public int maxWriteBufferNumber() {
238 assert(isOwningHandle());
239 return maxWriteBufferNumber(nativeHandle_
);
243 public boolean errorIfExists() {
244 assert(isOwningHandle());
245 return errorIfExists(nativeHandle_
);
249 public Options
setErrorIfExists(final boolean errorIfExists
) {
250 assert(isOwningHandle());
251 setErrorIfExists(nativeHandle_
, errorIfExists
);
256 public boolean paranoidChecks() {
257 assert(isOwningHandle());
258 return paranoidChecks(nativeHandle_
);
262 public Options
setParanoidChecks(final boolean paranoidChecks
) {
263 assert(isOwningHandle());
264 setParanoidChecks(nativeHandle_
, paranoidChecks
);
269 public int maxOpenFiles() {
270 assert(isOwningHandle());
271 return maxOpenFiles(nativeHandle_
);
275 public Options
setMaxFileOpeningThreads(final int maxFileOpeningThreads
) {
276 assert(isOwningHandle());
277 setMaxFileOpeningThreads(nativeHandle_
, maxFileOpeningThreads
);
282 public int maxFileOpeningThreads() {
283 assert(isOwningHandle());
284 return maxFileOpeningThreads(nativeHandle_
);
288 public Options
setMaxTotalWalSize(final long maxTotalWalSize
) {
289 assert(isOwningHandle());
290 setMaxTotalWalSize(nativeHandle_
, maxTotalWalSize
);
295 public long maxTotalWalSize() {
296 assert(isOwningHandle());
297 return maxTotalWalSize(nativeHandle_
);
301 public Options
setMaxOpenFiles(final int maxOpenFiles
) {
302 assert(isOwningHandle());
303 setMaxOpenFiles(nativeHandle_
, maxOpenFiles
);
308 public boolean useFsync() {
309 assert(isOwningHandle());
310 return useFsync(nativeHandle_
);
314 public Options
setUseFsync(final boolean useFsync
) {
315 assert(isOwningHandle());
316 setUseFsync(nativeHandle_
, useFsync
);
321 public Options
setDbPaths(final Collection
<DbPath
> dbPaths
) {
322 assert(isOwningHandle());
324 final int len
= dbPaths
.size();
325 final String paths
[] = new String
[len
];
326 final long targetSizes
[] = new long[len
];
329 for(final DbPath dbPath
: dbPaths
) {
330 paths
[i
] = dbPath
.path
.toString();
331 targetSizes
[i
] = dbPath
.targetSize
;
334 setDbPaths(nativeHandle_
, paths
, targetSizes
);
339 public List
<DbPath
> dbPaths() {
340 final int len
= (int)dbPathsLen(nativeHandle_
);
342 return Collections
.emptyList();
344 final String paths
[] = new String
[len
];
345 final long targetSizes
[] = new long[len
];
347 dbPaths(nativeHandle_
, paths
, targetSizes
);
349 final List
<DbPath
> dbPaths
= new ArrayList
<>();
350 for(int i
= 0; i
< len
; i
++) {
351 dbPaths
.add(new DbPath(Paths
.get(paths
[i
]), targetSizes
[i
]));
358 public String
dbLogDir() {
359 assert(isOwningHandle());
360 return dbLogDir(nativeHandle_
);
364 public Options
setDbLogDir(final String dbLogDir
) {
365 assert(isOwningHandle());
366 setDbLogDir(nativeHandle_
, dbLogDir
);
371 public String
walDir() {
372 assert(isOwningHandle());
373 return walDir(nativeHandle_
);
377 public Options
setWalDir(final String walDir
) {
378 assert(isOwningHandle());
379 setWalDir(nativeHandle_
, walDir
);
384 public long deleteObsoleteFilesPeriodMicros() {
385 assert(isOwningHandle());
386 return deleteObsoleteFilesPeriodMicros(nativeHandle_
);
390 public Options
setDeleteObsoleteFilesPeriodMicros(
392 assert(isOwningHandle());
393 setDeleteObsoleteFilesPeriodMicros(nativeHandle_
, micros
);
398 public int maxBackgroundCompactions() {
399 assert(isOwningHandle());
400 return maxBackgroundCompactions(nativeHandle_
);
404 public Options
setStatistics(final Statistics statistics
) {
405 assert(isOwningHandle());
406 setStatistics(nativeHandle_
, statistics
.nativeHandle_
);
411 public Statistics
statistics() {
412 assert(isOwningHandle());
413 final long statisticsNativeHandle
= statistics(nativeHandle_
);
414 if(statisticsNativeHandle
== 0) {
417 return new Statistics(statisticsNativeHandle
);
422 public void setBaseBackgroundCompactions(
423 final int baseBackgroundCompactions
) {
424 assert(isOwningHandle());
425 setBaseBackgroundCompactions(nativeHandle_
, baseBackgroundCompactions
);
429 public int baseBackgroundCompactions() {
430 assert(isOwningHandle());
431 return baseBackgroundCompactions(nativeHandle_
);
435 public Options
setMaxBackgroundCompactions(
436 final int maxBackgroundCompactions
) {
437 assert(isOwningHandle());
438 setMaxBackgroundCompactions(nativeHandle_
, maxBackgroundCompactions
);
443 public void setMaxSubcompactions(final int maxSubcompactions
) {
444 assert(isOwningHandle());
445 setMaxSubcompactions(nativeHandle_
, maxSubcompactions
);
449 public int maxSubcompactions() {
450 assert(isOwningHandle());
451 return maxSubcompactions(nativeHandle_
);
455 public int maxBackgroundFlushes() {
456 assert(isOwningHandle());
457 return maxBackgroundFlushes(nativeHandle_
);
461 public Options
setMaxBackgroundFlushes(
462 final int maxBackgroundFlushes
) {
463 assert(isOwningHandle());
464 setMaxBackgroundFlushes(nativeHandle_
, maxBackgroundFlushes
);
469 public int maxBackgroundJobs() {
470 assert(isOwningHandle());
471 return maxBackgroundJobs(nativeHandle_
);
475 public Options
setMaxBackgroundJobs(final int maxBackgroundJobs
) {
476 assert(isOwningHandle());
477 setMaxBackgroundJobs(nativeHandle_
, maxBackgroundJobs
);
482 public long maxLogFileSize() {
483 assert(isOwningHandle());
484 return maxLogFileSize(nativeHandle_
);
488 public Options
setMaxLogFileSize(final long maxLogFileSize
) {
489 assert(isOwningHandle());
490 setMaxLogFileSize(nativeHandle_
, maxLogFileSize
);
495 public long logFileTimeToRoll() {
496 assert(isOwningHandle());
497 return logFileTimeToRoll(nativeHandle_
);
501 public Options
setLogFileTimeToRoll(final long logFileTimeToRoll
) {
502 assert(isOwningHandle());
503 setLogFileTimeToRoll(nativeHandle_
, logFileTimeToRoll
);
508 public long keepLogFileNum() {
509 assert(isOwningHandle());
510 return keepLogFileNum(nativeHandle_
);
514 public Options
setKeepLogFileNum(final long keepLogFileNum
) {
515 assert(isOwningHandle());
516 setKeepLogFileNum(nativeHandle_
, keepLogFileNum
);
522 public Options
setRecycleLogFileNum(final long recycleLogFileNum
) {
523 assert(isOwningHandle());
524 setRecycleLogFileNum(nativeHandle_
, recycleLogFileNum
);
529 public long recycleLogFileNum() {
530 assert(isOwningHandle());
531 return recycleLogFileNum(nativeHandle_
);
535 public long maxManifestFileSize() {
536 assert(isOwningHandle());
537 return maxManifestFileSize(nativeHandle_
);
541 public Options
setMaxManifestFileSize(
542 final long maxManifestFileSize
) {
543 assert(isOwningHandle());
544 setMaxManifestFileSize(nativeHandle_
, maxManifestFileSize
);
549 public Options
setMaxTableFilesSizeFIFO(
550 final long maxTableFilesSize
) {
551 assert(maxTableFilesSize
> 0); // unsigned native type
552 assert(isOwningHandle());
553 setMaxTableFilesSizeFIFO(nativeHandle_
, maxTableFilesSize
);
558 public long maxTableFilesSizeFIFO() {
559 return maxTableFilesSizeFIFO(nativeHandle_
);
563 public int tableCacheNumshardbits() {
564 assert(isOwningHandle());
565 return tableCacheNumshardbits(nativeHandle_
);
569 public Options
setTableCacheNumshardbits(
570 final int tableCacheNumshardbits
) {
571 assert(isOwningHandle());
572 setTableCacheNumshardbits(nativeHandle_
, tableCacheNumshardbits
);
577 public long walTtlSeconds() {
578 assert(isOwningHandle());
579 return walTtlSeconds(nativeHandle_
);
583 public Options
setWalTtlSeconds(final long walTtlSeconds
) {
584 assert(isOwningHandle());
585 setWalTtlSeconds(nativeHandle_
, walTtlSeconds
);
590 public long walSizeLimitMB() {
591 assert(isOwningHandle());
592 return walSizeLimitMB(nativeHandle_
);
596 public Options
setWalSizeLimitMB(final long sizeLimitMB
) {
597 assert(isOwningHandle());
598 setWalSizeLimitMB(nativeHandle_
, sizeLimitMB
);
603 public long manifestPreallocationSize() {
604 assert(isOwningHandle());
605 return manifestPreallocationSize(nativeHandle_
);
609 public Options
setManifestPreallocationSize(final long size
) {
610 assert(isOwningHandle());
611 setManifestPreallocationSize(nativeHandle_
, size
);
616 public Options
setUseDirectReads(final boolean useDirectReads
) {
617 assert(isOwningHandle());
618 setUseDirectReads(nativeHandle_
, useDirectReads
);
623 public boolean useDirectReads() {
624 assert(isOwningHandle());
625 return useDirectReads(nativeHandle_
);
629 public Options
setUseDirectIoForFlushAndCompaction(
630 final boolean useDirectIoForFlushAndCompaction
) {
631 assert(isOwningHandle());
632 setUseDirectIoForFlushAndCompaction(nativeHandle_
, useDirectIoForFlushAndCompaction
);
637 public boolean useDirectIoForFlushAndCompaction() {
638 assert(isOwningHandle());
639 return useDirectIoForFlushAndCompaction(nativeHandle_
);
643 public Options
setAllowFAllocate(final boolean allowFAllocate
) {
644 assert(isOwningHandle());
645 setAllowFAllocate(nativeHandle_
, allowFAllocate
);
650 public boolean allowFAllocate() {
651 assert(isOwningHandle());
652 return allowFAllocate(nativeHandle_
);
656 public boolean allowMmapReads() {
657 assert(isOwningHandle());
658 return allowMmapReads(nativeHandle_
);
662 public Options
setAllowMmapReads(final boolean allowMmapReads
) {
663 assert(isOwningHandle());
664 setAllowMmapReads(nativeHandle_
, allowMmapReads
);
669 public boolean allowMmapWrites() {
670 assert(isOwningHandle());
671 return allowMmapWrites(nativeHandle_
);
675 public Options
setAllowMmapWrites(final boolean allowMmapWrites
) {
676 assert(isOwningHandle());
677 setAllowMmapWrites(nativeHandle_
, allowMmapWrites
);
682 public boolean isFdCloseOnExec() {
683 assert(isOwningHandle());
684 return isFdCloseOnExec(nativeHandle_
);
688 public Options
setIsFdCloseOnExec(final boolean isFdCloseOnExec
) {
689 assert(isOwningHandle());
690 setIsFdCloseOnExec(nativeHandle_
, isFdCloseOnExec
);
695 public int statsDumpPeriodSec() {
696 assert(isOwningHandle());
697 return statsDumpPeriodSec(nativeHandle_
);
701 public Options
setStatsDumpPeriodSec(final int statsDumpPeriodSec
) {
702 assert(isOwningHandle());
703 setStatsDumpPeriodSec(nativeHandle_
, statsDumpPeriodSec
);
708 public boolean adviseRandomOnOpen() {
709 return adviseRandomOnOpen(nativeHandle_
);
713 public Options
setAdviseRandomOnOpen(final boolean adviseRandomOnOpen
) {
714 assert(isOwningHandle());
715 setAdviseRandomOnOpen(nativeHandle_
, adviseRandomOnOpen
);
720 public Options
setDbWriteBufferSize(final long dbWriteBufferSize
) {
721 assert(isOwningHandle());
722 setDbWriteBufferSize(nativeHandle_
, dbWriteBufferSize
);
727 public long dbWriteBufferSize() {
728 assert(isOwningHandle());
729 return dbWriteBufferSize(nativeHandle_
);
733 public Options
setAccessHintOnCompactionStart(final AccessHint accessHint
) {
734 assert(isOwningHandle());
735 setAccessHintOnCompactionStart(nativeHandle_
, accessHint
.getValue());
740 public AccessHint
accessHintOnCompactionStart() {
741 assert(isOwningHandle());
742 return AccessHint
.getAccessHint(accessHintOnCompactionStart(nativeHandle_
));
746 public Options
setNewTableReaderForCompactionInputs(
747 final boolean newTableReaderForCompactionInputs
) {
748 assert(isOwningHandle());
749 setNewTableReaderForCompactionInputs(nativeHandle_
,
750 newTableReaderForCompactionInputs
);
755 public boolean newTableReaderForCompactionInputs() {
756 assert(isOwningHandle());
757 return newTableReaderForCompactionInputs(nativeHandle_
);
761 public Options
setCompactionReadaheadSize(final long compactionReadaheadSize
) {
762 assert(isOwningHandle());
763 setCompactionReadaheadSize(nativeHandle_
, compactionReadaheadSize
);
768 public long compactionReadaheadSize() {
769 assert(isOwningHandle());
770 return compactionReadaheadSize(nativeHandle_
);
774 public Options
setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize
) {
775 assert(isOwningHandle());
776 setRandomAccessMaxBufferSize(nativeHandle_
, randomAccessMaxBufferSize
);
781 public long randomAccessMaxBufferSize() {
782 assert(isOwningHandle());
783 return randomAccessMaxBufferSize(nativeHandle_
);
787 public Options
setWritableFileMaxBufferSize(final long writableFileMaxBufferSize
) {
788 assert(isOwningHandle());
789 setWritableFileMaxBufferSize(nativeHandle_
, writableFileMaxBufferSize
);
794 public long writableFileMaxBufferSize() {
795 assert(isOwningHandle());
796 return writableFileMaxBufferSize(nativeHandle_
);
800 public boolean useAdaptiveMutex() {
801 assert(isOwningHandle());
802 return useAdaptiveMutex(nativeHandle_
);
806 public Options
setUseAdaptiveMutex(final boolean useAdaptiveMutex
) {
807 assert(isOwningHandle());
808 setUseAdaptiveMutex(nativeHandle_
, useAdaptiveMutex
);
813 public long bytesPerSync() {
814 return bytesPerSync(nativeHandle_
);
818 public Options
setBytesPerSync(final long bytesPerSync
) {
819 assert(isOwningHandle());
820 setBytesPerSync(nativeHandle_
, bytesPerSync
);
825 public Options
setWalBytesPerSync(final long walBytesPerSync
) {
826 assert(isOwningHandle());
827 setWalBytesPerSync(nativeHandle_
, walBytesPerSync
);
832 public long walBytesPerSync() {
833 assert(isOwningHandle());
834 return walBytesPerSync(nativeHandle_
);
838 public Options
setEnableThreadTracking(final boolean enableThreadTracking
) {
839 assert(isOwningHandle());
840 setEnableThreadTracking(nativeHandle_
, enableThreadTracking
);
845 public boolean enableThreadTracking() {
846 assert(isOwningHandle());
847 return enableThreadTracking(nativeHandle_
);
851 public Options
setDelayedWriteRate(final long delayedWriteRate
) {
852 assert(isOwningHandle());
853 setDelayedWriteRate(nativeHandle_
, delayedWriteRate
);
858 public long delayedWriteRate(){
859 return delayedWriteRate(nativeHandle_
);
863 public Options
setAllowConcurrentMemtableWrite(
864 final boolean allowConcurrentMemtableWrite
) {
865 setAllowConcurrentMemtableWrite(nativeHandle_
,
866 allowConcurrentMemtableWrite
);
871 public boolean allowConcurrentMemtableWrite() {
872 return allowConcurrentMemtableWrite(nativeHandle_
);
876 public Options
setEnableWriteThreadAdaptiveYield(
877 final boolean enableWriteThreadAdaptiveYield
) {
878 setEnableWriteThreadAdaptiveYield(nativeHandle_
,
879 enableWriteThreadAdaptiveYield
);
884 public boolean enableWriteThreadAdaptiveYield() {
885 return enableWriteThreadAdaptiveYield(nativeHandle_
);
889 public Options
setWriteThreadMaxYieldUsec(final long writeThreadMaxYieldUsec
) {
890 setWriteThreadMaxYieldUsec(nativeHandle_
, writeThreadMaxYieldUsec
);
895 public long writeThreadMaxYieldUsec() {
896 return writeThreadMaxYieldUsec(nativeHandle_
);
900 public Options
setWriteThreadSlowYieldUsec(final long writeThreadSlowYieldUsec
) {
901 setWriteThreadSlowYieldUsec(nativeHandle_
, writeThreadSlowYieldUsec
);
906 public long writeThreadSlowYieldUsec() {
907 return writeThreadSlowYieldUsec(nativeHandle_
);
911 public Options
setSkipStatsUpdateOnDbOpen(final boolean skipStatsUpdateOnDbOpen
) {
912 assert(isOwningHandle());
913 setSkipStatsUpdateOnDbOpen(nativeHandle_
, skipStatsUpdateOnDbOpen
);
918 public boolean skipStatsUpdateOnDbOpen() {
919 assert(isOwningHandle());
920 return skipStatsUpdateOnDbOpen(nativeHandle_
);
924 public Options
setWalRecoveryMode(final WALRecoveryMode walRecoveryMode
) {
925 assert(isOwningHandle());
926 setWalRecoveryMode(nativeHandle_
, walRecoveryMode
.getValue());
931 public WALRecoveryMode
walRecoveryMode() {
932 assert(isOwningHandle());
933 return WALRecoveryMode
.getWALRecoveryMode(walRecoveryMode(nativeHandle_
));
937 public Options
setAllow2pc(final boolean allow2pc
) {
938 assert(isOwningHandle());
939 setAllow2pc(nativeHandle_
, allow2pc
);
944 public boolean allow2pc() {
945 assert(isOwningHandle());
946 return allow2pc(nativeHandle_
);
950 public Options
setRowCache(final Cache rowCache
) {
951 assert(isOwningHandle());
952 setRowCache(nativeHandle_
, rowCache
.nativeHandle_
);
953 this.rowCache_
= rowCache
;
958 public Cache
rowCache() {
959 assert(isOwningHandle());
960 return this.rowCache_
;
964 public Options
setFailIfOptionsFileError(final boolean failIfOptionsFileError
) {
965 assert(isOwningHandle());
966 setFailIfOptionsFileError(nativeHandle_
, failIfOptionsFileError
);
971 public boolean failIfOptionsFileError() {
972 assert(isOwningHandle());
973 return failIfOptionsFileError(nativeHandle_
);
977 public Options
setDumpMallocStats(final boolean dumpMallocStats
) {
978 assert(isOwningHandle());
979 setDumpMallocStats(nativeHandle_
, dumpMallocStats
);
984 public boolean dumpMallocStats() {
985 assert(isOwningHandle());
986 return dumpMallocStats(nativeHandle_
);
990 public Options
setAvoidFlushDuringRecovery(final boolean avoidFlushDuringRecovery
) {
991 assert(isOwningHandle());
992 setAvoidFlushDuringRecovery(nativeHandle_
, avoidFlushDuringRecovery
);
997 public boolean avoidFlushDuringRecovery() {
998 assert(isOwningHandle());
999 return avoidFlushDuringRecovery(nativeHandle_
);
1003 public Options
setAvoidFlushDuringShutdown(final boolean avoidFlushDuringShutdown
) {
1004 assert(isOwningHandle());
1005 setAvoidFlushDuringShutdown(nativeHandle_
, avoidFlushDuringShutdown
);
1010 public boolean avoidFlushDuringShutdown() {
1011 assert(isOwningHandle());
1012 return avoidFlushDuringShutdown(nativeHandle_
);
1016 public MemTableConfig
memTableConfig() {
1017 return this.memTableConfig_
;
1021 public Options
setMemTableConfig(final MemTableConfig config
) {
1022 memTableConfig_
= config
;
1023 setMemTableFactory(nativeHandle_
, config
.newMemTableFactoryHandle());
1028 public Options
setRateLimiter(final RateLimiter rateLimiter
) {
1029 assert(isOwningHandle());
1030 rateLimiter_
= rateLimiter
;
1031 setRateLimiter(nativeHandle_
, rateLimiter
.nativeHandle_
);
1036 public Options
setSstFileManager(final SstFileManager sstFileManager
) {
1037 assert(isOwningHandle());
1038 setSstFileManager(nativeHandle_
, sstFileManager
.nativeHandle_
);
1043 public Options
setLogger(final Logger logger
) {
1044 assert(isOwningHandle());
1045 setLogger(nativeHandle_
, logger
.nativeHandle_
);
1050 public Options
setInfoLogLevel(final InfoLogLevel infoLogLevel
) {
1051 assert(isOwningHandle());
1052 setInfoLogLevel(nativeHandle_
, infoLogLevel
.getValue());
1057 public InfoLogLevel
infoLogLevel() {
1058 assert(isOwningHandle());
1059 return InfoLogLevel
.getInfoLogLevel(
1060 infoLogLevel(nativeHandle_
));
1064 public String
memTableFactoryName() {
1065 assert(isOwningHandle());
1066 return memTableFactoryName(nativeHandle_
);
1070 public TableFormatConfig
tableFormatConfig() {
1071 return this.tableFormatConfig_
;
1075 public Options
setTableFormatConfig(final TableFormatConfig config
) {
1076 tableFormatConfig_
= config
;
1077 setTableFactory(nativeHandle_
, config
.newTableFactoryHandle());
1082 public String
tableFactoryName() {
1083 assert(isOwningHandle());
1084 return tableFactoryName(nativeHandle_
);
1088 public Options
useFixedLengthPrefixExtractor(final int n
) {
1089 assert(isOwningHandle());
1090 useFixedLengthPrefixExtractor(nativeHandle_
, n
);
1095 public Options
useCappedPrefixExtractor(final int n
) {
1096 assert(isOwningHandle());
1097 useCappedPrefixExtractor(nativeHandle_
, n
);
1102 public CompressionType
compressionType() {
1103 return CompressionType
.getCompressionType(compressionType(nativeHandle_
));
1107 public Options
setCompressionPerLevel(
1108 final List
<CompressionType
> compressionLevels
) {
1109 final byte[] byteCompressionTypes
= new byte[
1110 compressionLevels
.size()];
1111 for (int i
= 0; i
< compressionLevels
.size(); i
++) {
1112 byteCompressionTypes
[i
] = compressionLevels
.get(i
).getValue();
1114 setCompressionPerLevel(nativeHandle_
, byteCompressionTypes
);
1119 public List
<CompressionType
> compressionPerLevel() {
1120 final byte[] byteCompressionTypes
=
1121 compressionPerLevel(nativeHandle_
);
1122 final List
<CompressionType
> compressionLevels
= new ArrayList
<>();
1123 for (final Byte byteCompressionType
: byteCompressionTypes
) {
1124 compressionLevels
.add(CompressionType
.getCompressionType(
1125 byteCompressionType
));
1127 return compressionLevels
;
1131 public Options
setCompressionType(CompressionType compressionType
) {
1132 setCompressionType(nativeHandle_
, compressionType
.getValue());
1138 public Options
setBottommostCompressionType(
1139 final CompressionType bottommostCompressionType
) {
1140 setBottommostCompressionType(nativeHandle_
,
1141 bottommostCompressionType
.getValue());
1146 public CompressionType
bottommostCompressionType() {
1147 return CompressionType
.getCompressionType(
1148 bottommostCompressionType(nativeHandle_
));
1152 public Options
setCompressionOptions(
1153 final CompressionOptions compressionOptions
) {
1154 setCompressionOptions(nativeHandle_
, compressionOptions
.nativeHandle_
);
1155 this.compressionOptions_
= compressionOptions
;
1160 public CompressionOptions
compressionOptions() {
1161 return this.compressionOptions_
;
1165 public CompactionStyle
compactionStyle() {
1166 return CompactionStyle
.values()[compactionStyle(nativeHandle_
)];
1170 public Options
setCompactionStyle(
1171 final CompactionStyle compactionStyle
) {
1172 setCompactionStyle(nativeHandle_
, compactionStyle
.getValue());
1177 public int numLevels() {
1178 return numLevels(nativeHandle_
);
1182 public Options
setNumLevels(int numLevels
) {
1183 setNumLevels(nativeHandle_
, numLevels
);
1188 public int levelZeroFileNumCompactionTrigger() {
1189 return levelZeroFileNumCompactionTrigger(nativeHandle_
);
1193 public Options
setLevelZeroFileNumCompactionTrigger(
1194 final int numFiles
) {
1195 setLevelZeroFileNumCompactionTrigger(
1196 nativeHandle_
, numFiles
);
1201 public int levelZeroSlowdownWritesTrigger() {
1202 return levelZeroSlowdownWritesTrigger(nativeHandle_
);
1206 public Options
setLevelZeroSlowdownWritesTrigger(
1207 final int numFiles
) {
1208 setLevelZeroSlowdownWritesTrigger(nativeHandle_
, numFiles
);
1213 public int levelZeroStopWritesTrigger() {
1214 return levelZeroStopWritesTrigger(nativeHandle_
);
1218 public Options
setLevelZeroStopWritesTrigger(
1219 final int numFiles
) {
1220 setLevelZeroStopWritesTrigger(nativeHandle_
, numFiles
);
1225 public long targetFileSizeBase() {
1226 return targetFileSizeBase(nativeHandle_
);
1230 public Options
setTargetFileSizeBase(long targetFileSizeBase
) {
1231 setTargetFileSizeBase(nativeHandle_
, targetFileSizeBase
);
1236 public int targetFileSizeMultiplier() {
1237 return targetFileSizeMultiplier(nativeHandle_
);
1241 public Options
setTargetFileSizeMultiplier(int multiplier
) {
1242 setTargetFileSizeMultiplier(nativeHandle_
, multiplier
);
1247 public Options
setMaxBytesForLevelBase(final long maxBytesForLevelBase
) {
1248 setMaxBytesForLevelBase(nativeHandle_
, maxBytesForLevelBase
);
1253 public long maxBytesForLevelBase() {
1254 return maxBytesForLevelBase(nativeHandle_
);
1258 public Options
setLevelCompactionDynamicLevelBytes(
1259 final boolean enableLevelCompactionDynamicLevelBytes
) {
1260 setLevelCompactionDynamicLevelBytes(nativeHandle_
,
1261 enableLevelCompactionDynamicLevelBytes
);
1266 public boolean levelCompactionDynamicLevelBytes() {
1267 return levelCompactionDynamicLevelBytes(nativeHandle_
);
1271 public double maxBytesForLevelMultiplier() {
1272 return maxBytesForLevelMultiplier(nativeHandle_
);
1276 public Options
setMaxBytesForLevelMultiplier(final double multiplier
) {
1277 setMaxBytesForLevelMultiplier(nativeHandle_
, multiplier
);
1282 public long maxCompactionBytes() {
1283 return maxCompactionBytes(nativeHandle_
);
1287 public Options
setMaxCompactionBytes(final long maxCompactionBytes
) {
1288 setMaxCompactionBytes(nativeHandle_
, maxCompactionBytes
);
1293 public long arenaBlockSize() {
1294 return arenaBlockSize(nativeHandle_
);
1298 public Options
setArenaBlockSize(final long arenaBlockSize
) {
1299 setArenaBlockSize(nativeHandle_
, arenaBlockSize
);
1304 public boolean disableAutoCompactions() {
1305 return disableAutoCompactions(nativeHandle_
);
1309 public Options
setDisableAutoCompactions(
1310 final boolean disableAutoCompactions
) {
1311 setDisableAutoCompactions(nativeHandle_
, disableAutoCompactions
);
1316 public long maxSequentialSkipInIterations() {
1317 return maxSequentialSkipInIterations(nativeHandle_
);
1321 public Options
setMaxSequentialSkipInIterations(
1322 final long maxSequentialSkipInIterations
) {
1323 setMaxSequentialSkipInIterations(nativeHandle_
,
1324 maxSequentialSkipInIterations
);
1329 public boolean inplaceUpdateSupport() {
1330 return inplaceUpdateSupport(nativeHandle_
);
1334 public Options
setInplaceUpdateSupport(
1335 final boolean inplaceUpdateSupport
) {
1336 setInplaceUpdateSupport(nativeHandle_
, inplaceUpdateSupport
);
1341 public long inplaceUpdateNumLocks() {
1342 return inplaceUpdateNumLocks(nativeHandle_
);
1346 public Options
setInplaceUpdateNumLocks(
1347 final long inplaceUpdateNumLocks
) {
1348 setInplaceUpdateNumLocks(nativeHandle_
, inplaceUpdateNumLocks
);
1353 public double memtablePrefixBloomSizeRatio() {
1354 return memtablePrefixBloomSizeRatio(nativeHandle_
);
1358 public Options
setMemtablePrefixBloomSizeRatio(final double memtablePrefixBloomSizeRatio
) {
1359 setMemtablePrefixBloomSizeRatio(nativeHandle_
, memtablePrefixBloomSizeRatio
);
1364 public int bloomLocality() {
1365 return bloomLocality(nativeHandle_
);
1369 public Options
setBloomLocality(final int bloomLocality
) {
1370 setBloomLocality(nativeHandle_
, bloomLocality
);
1375 public long maxSuccessiveMerges() {
1376 return maxSuccessiveMerges(nativeHandle_
);
1380 public Options
setMaxSuccessiveMerges(long maxSuccessiveMerges
) {
1381 setMaxSuccessiveMerges(nativeHandle_
, maxSuccessiveMerges
);
1386 public int minWriteBufferNumberToMerge() {
1387 return minWriteBufferNumberToMerge(nativeHandle_
);
1391 public Options
setMinWriteBufferNumberToMerge(
1392 final int minWriteBufferNumberToMerge
) {
1393 setMinWriteBufferNumberToMerge(nativeHandle_
, minWriteBufferNumberToMerge
);
1398 public Options
setOptimizeFiltersForHits(
1399 final boolean optimizeFiltersForHits
) {
1400 setOptimizeFiltersForHits(nativeHandle_
, optimizeFiltersForHits
);
1405 public boolean optimizeFiltersForHits() {
1406 return optimizeFiltersForHits(nativeHandle_
);
1411 setMemtableHugePageSize(
1412 long memtableHugePageSize
) {
1413 setMemtableHugePageSize(nativeHandle_
,
1414 memtableHugePageSize
);
1419 public long memtableHugePageSize() {
1420 return memtableHugePageSize(nativeHandle_
);
1424 public Options
setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit
) {
1425 setSoftPendingCompactionBytesLimit(nativeHandle_
,
1426 softPendingCompactionBytesLimit
);
1431 public long softPendingCompactionBytesLimit() {
1432 return softPendingCompactionBytesLimit(nativeHandle_
);
1436 public Options
setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit
) {
1437 setHardPendingCompactionBytesLimit(nativeHandle_
, hardPendingCompactionBytesLimit
);
1442 public long hardPendingCompactionBytesLimit() {
1443 return hardPendingCompactionBytesLimit(nativeHandle_
);
1447 public Options
setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger
) {
1448 setLevel0FileNumCompactionTrigger(nativeHandle_
, level0FileNumCompactionTrigger
);
1453 public int level0FileNumCompactionTrigger() {
1454 return level0FileNumCompactionTrigger(nativeHandle_
);
1458 public Options
setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger
) {
1459 setLevel0SlowdownWritesTrigger(nativeHandle_
, level0SlowdownWritesTrigger
);
1464 public int level0SlowdownWritesTrigger() {
1465 return level0SlowdownWritesTrigger(nativeHandle_
);
1469 public Options
setLevel0StopWritesTrigger(int level0StopWritesTrigger
) {
1470 setLevel0StopWritesTrigger(nativeHandle_
, level0StopWritesTrigger
);
1475 public int level0StopWritesTrigger() {
1476 return level0StopWritesTrigger(nativeHandle_
);
1480 public Options
setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional
) {
1481 setMaxBytesForLevelMultiplierAdditional(nativeHandle_
, maxBytesForLevelMultiplierAdditional
);
1486 public int[] maxBytesForLevelMultiplierAdditional() {
1487 return maxBytesForLevelMultiplierAdditional(nativeHandle_
);
1491 public Options
setParanoidFileChecks(boolean paranoidFileChecks
) {
1492 setParanoidFileChecks(nativeHandle_
, paranoidFileChecks
);
1497 public boolean paranoidFileChecks() {
1498 return paranoidFileChecks(nativeHandle_
);
1502 public Options
setMaxWriteBufferNumberToMaintain(
1503 final int maxWriteBufferNumberToMaintain
) {
1504 setMaxWriteBufferNumberToMaintain(
1505 nativeHandle_
, maxWriteBufferNumberToMaintain
);
1510 public int maxWriteBufferNumberToMaintain() {
1511 return maxWriteBufferNumberToMaintain(nativeHandle_
);
1515 public Options
setCompactionPriority(
1516 final CompactionPriority compactionPriority
) {
1517 setCompactionPriority(nativeHandle_
, compactionPriority
.getValue());
1522 public CompactionPriority
compactionPriority() {
1523 return CompactionPriority
.getCompactionPriority(
1524 compactionPriority(nativeHandle_
));
1528 public Options
setReportBgIoStats(final boolean reportBgIoStats
) {
1529 setReportBgIoStats(nativeHandle_
, reportBgIoStats
);
1534 public boolean reportBgIoStats() {
1535 return reportBgIoStats(nativeHandle_
);
1539 public Options
setCompactionOptionsUniversal(
1540 final CompactionOptionsUniversal compactionOptionsUniversal
) {
1541 setCompactionOptionsUniversal(nativeHandle_
,
1542 compactionOptionsUniversal
.nativeHandle_
);
1543 this.compactionOptionsUniversal_
= compactionOptionsUniversal
;
1548 public CompactionOptionsUniversal
compactionOptionsUniversal() {
1549 return this.compactionOptionsUniversal_
;
1553 public Options
setCompactionOptionsFIFO(final CompactionOptionsFIFO compactionOptionsFIFO
) {
1554 setCompactionOptionsFIFO(nativeHandle_
,
1555 compactionOptionsFIFO
.nativeHandle_
);
1556 this.compactionOptionsFIFO_
= compactionOptionsFIFO
;
1561 public CompactionOptionsFIFO
compactionOptionsFIFO() {
1562 return this.compactionOptionsFIFO_
;
1566 public Options
setForceConsistencyChecks(final boolean forceConsistencyChecks
) {
1567 setForceConsistencyChecks(nativeHandle_
, forceConsistencyChecks
);
1572 public boolean forceConsistencyChecks() {
1573 return forceConsistencyChecks(nativeHandle_
);
1576 private native static long newOptions();
1577 private native static long newOptions(long dbOptHandle
,
1579 private native static long copyOptions(long handle
);
1580 @Override protected final native void disposeInternal(final long handle
);
1581 private native void setEnv(long optHandle
, long envHandle
);
1582 private native void prepareForBulkLoad(long handle
);
1584 // DB native handles
1585 private native void setIncreaseParallelism(long handle
, int totalThreads
);
1586 private native void setCreateIfMissing(long handle
, boolean flag
);
1587 private native boolean createIfMissing(long handle
);
1588 private native void setCreateMissingColumnFamilies(
1589 long handle
, boolean flag
);
1590 private native boolean createMissingColumnFamilies(long handle
);
1591 private native void setErrorIfExists(long handle
, boolean errorIfExists
);
1592 private native boolean errorIfExists(long handle
);
1593 private native void setParanoidChecks(
1594 long handle
, boolean paranoidChecks
);
1595 private native boolean paranoidChecks(long handle
);
1596 private native void setRateLimiter(long handle
,
1597 long rateLimiterHandle
);
1598 private native void setSstFileManager(final long handle
,
1599 final long sstFileManagerHandle
);
1600 private native void setLogger(long handle
,
1602 private native void setInfoLogLevel(long handle
, byte logLevel
);
1603 private native byte infoLogLevel(long handle
);
1604 private native void setMaxOpenFiles(long handle
, int maxOpenFiles
);
1605 private native int maxOpenFiles(long handle
);
1606 private native void setMaxTotalWalSize(long handle
,
1607 long maxTotalWalSize
);
1608 private native void setMaxFileOpeningThreads(final long handle
,
1609 final int maxFileOpeningThreads
);
1610 private native int maxFileOpeningThreads(final long handle
);
1611 private native long maxTotalWalSize(long handle
);
1612 private native void setStatistics(final long handle
, final long statisticsHandle
);
1613 private native long statistics(final long handle
);
1614 private native boolean useFsync(long handle
);
1615 private native void setUseFsync(long handle
, boolean useFsync
);
1616 private native void setDbPaths(final long handle
, final String
[] paths
,
1617 final long[] targetSizes
);
1618 private native long dbPathsLen(final long handle
);
1619 private native void dbPaths(final long handle
, final String
[] paths
,
1620 final long[] targetSizes
);
1621 private native void setDbLogDir(long handle
, String dbLogDir
);
1622 private native String
dbLogDir(long handle
);
1623 private native void setWalDir(long handle
, String walDir
);
1624 private native String
walDir(long handle
);
1625 private native void setDeleteObsoleteFilesPeriodMicros(
1626 long handle
, long micros
);
1627 private native long deleteObsoleteFilesPeriodMicros(long handle
);
1628 private native void setBaseBackgroundCompactions(long handle
,
1629 int baseBackgroundCompactions
);
1630 private native int baseBackgroundCompactions(long handle
);
1631 private native void setMaxBackgroundCompactions(
1632 long handle
, int maxBackgroundCompactions
);
1633 private native int maxBackgroundCompactions(long handle
);
1634 private native void setMaxSubcompactions(long handle
, int maxSubcompactions
);
1635 private native int maxSubcompactions(long handle
);
1636 private native void setMaxBackgroundFlushes(
1637 long handle
, int maxBackgroundFlushes
);
1638 private native int maxBackgroundFlushes(long handle
);
1639 private native void setMaxBackgroundJobs(long handle
, int maxMaxBackgroundJobs
);
1640 private native int maxBackgroundJobs(long handle
);
1641 private native void setMaxLogFileSize(long handle
, long maxLogFileSize
)
1642 throws IllegalArgumentException
;
1643 private native long maxLogFileSize(long handle
);
1644 private native void setLogFileTimeToRoll(
1645 long handle
, long logFileTimeToRoll
) throws IllegalArgumentException
;
1646 private native long logFileTimeToRoll(long handle
);
1647 private native void setKeepLogFileNum(long handle
, long keepLogFileNum
)
1648 throws IllegalArgumentException
;
1649 private native long keepLogFileNum(long handle
);
1650 private native void setRecycleLogFileNum(long handle
, long recycleLogFileNum
);
1651 private native long recycleLogFileNum(long handle
);
1652 private native void setMaxManifestFileSize(
1653 long handle
, long maxManifestFileSize
);
1654 private native long maxManifestFileSize(long handle
);
1655 private native void setMaxTableFilesSizeFIFO(
1656 long handle
, long maxTableFilesSize
);
1657 private native long maxTableFilesSizeFIFO(long handle
);
1658 private native void setTableCacheNumshardbits(
1659 long handle
, int tableCacheNumshardbits
);
1660 private native int tableCacheNumshardbits(long handle
);
1661 private native void setWalTtlSeconds(long handle
, long walTtlSeconds
);
1662 private native long walTtlSeconds(long handle
);
1663 private native void setWalSizeLimitMB(long handle
, long sizeLimitMB
);
1664 private native long walSizeLimitMB(long handle
);
1665 private native void setManifestPreallocationSize(
1666 long handle
, long size
) throws IllegalArgumentException
;
1667 private native long manifestPreallocationSize(long handle
);
1668 private native void setUseDirectReads(long handle
, boolean useDirectReads
);
1669 private native boolean useDirectReads(long handle
);
1670 private native void setUseDirectIoForFlushAndCompaction(
1671 long handle
, boolean useDirectIoForFlushAndCompaction
);
1672 private native boolean useDirectIoForFlushAndCompaction(long handle
);
1673 private native void setAllowFAllocate(final long handle
,
1674 final boolean allowFAllocate
);
1675 private native boolean allowFAllocate(final long handle
);
1676 private native void setAllowMmapReads(
1677 long handle
, boolean allowMmapReads
);
1678 private native boolean allowMmapReads(long handle
);
1679 private native void setAllowMmapWrites(
1680 long handle
, boolean allowMmapWrites
);
1681 private native boolean allowMmapWrites(long handle
);
1682 private native void setIsFdCloseOnExec(
1683 long handle
, boolean isFdCloseOnExec
);
1684 private native boolean isFdCloseOnExec(long handle
);
1685 private native void setStatsDumpPeriodSec(
1686 long handle
, int statsDumpPeriodSec
);
1687 private native int statsDumpPeriodSec(long handle
);
1688 private native void setAdviseRandomOnOpen(
1689 long handle
, boolean adviseRandomOnOpen
);
1690 private native boolean adviseRandomOnOpen(long handle
);
1691 private native void setDbWriteBufferSize(final long handle
,
1692 final long dbWriteBufferSize
);
1693 private native long dbWriteBufferSize(final long handle
);
1694 private native void setAccessHintOnCompactionStart(final long handle
,
1695 final byte accessHintOnCompactionStart
);
1696 private native byte accessHintOnCompactionStart(final long handle
);
1697 private native void setNewTableReaderForCompactionInputs(final long handle
,
1698 final boolean newTableReaderForCompactionInputs
);
1699 private native boolean newTableReaderForCompactionInputs(final long handle
);
1700 private native void setCompactionReadaheadSize(final long handle
,
1701 final long compactionReadaheadSize
);
1702 private native long compactionReadaheadSize(final long handle
);
1703 private native void setRandomAccessMaxBufferSize(final long handle
,
1704 final long randomAccessMaxBufferSize
);
1705 private native long randomAccessMaxBufferSize(final long handle
);
1706 private native void setWritableFileMaxBufferSize(final long handle
,
1707 final long writableFileMaxBufferSize
);
1708 private native long writableFileMaxBufferSize(final long handle
);
1709 private native void setUseAdaptiveMutex(
1710 long handle
, boolean useAdaptiveMutex
);
1711 private native boolean useAdaptiveMutex(long handle
);
1712 private native void setBytesPerSync(
1713 long handle
, long bytesPerSync
);
1714 private native long bytesPerSync(long handle
);
1715 private native void setWalBytesPerSync(long handle
, long walBytesPerSync
);
1716 private native long walBytesPerSync(long handle
);
1717 private native void setEnableThreadTracking(long handle
,
1718 boolean enableThreadTracking
);
1719 private native boolean enableThreadTracking(long handle
);
1720 private native void setDelayedWriteRate(long handle
, long delayedWriteRate
);
1721 private native long delayedWriteRate(long handle
);
1722 private native void setAllowConcurrentMemtableWrite(long handle
,
1723 boolean allowConcurrentMemtableWrite
);
1724 private native boolean allowConcurrentMemtableWrite(long handle
);
1725 private native void setEnableWriteThreadAdaptiveYield(long handle
,
1726 boolean enableWriteThreadAdaptiveYield
);
1727 private native boolean enableWriteThreadAdaptiveYield(long handle
);
1728 private native void setWriteThreadMaxYieldUsec(long handle
,
1729 long writeThreadMaxYieldUsec
);
1730 private native long writeThreadMaxYieldUsec(long handle
);
1731 private native void setWriteThreadSlowYieldUsec(long handle
,
1732 long writeThreadSlowYieldUsec
);
1733 private native long writeThreadSlowYieldUsec(long handle
);
1734 private native void setSkipStatsUpdateOnDbOpen(final long handle
,
1735 final boolean skipStatsUpdateOnDbOpen
);
1736 private native boolean skipStatsUpdateOnDbOpen(final long handle
);
1737 private native void setWalRecoveryMode(final long handle
,
1738 final byte walRecoveryMode
);
1739 private native byte walRecoveryMode(final long handle
);
1740 private native void setAllow2pc(final long handle
,
1741 final boolean allow2pc
);
1742 private native boolean allow2pc(final long handle
);
1743 private native void setRowCache(final long handle
,
1744 final long row_cache_handle
);
1745 private native void setFailIfOptionsFileError(final long handle
,
1746 final boolean failIfOptionsFileError
);
1747 private native boolean failIfOptionsFileError(final long handle
);
1748 private native void setDumpMallocStats(final long handle
,
1749 final boolean dumpMallocStats
);
1750 private native boolean dumpMallocStats(final long handle
);
1751 private native void setAvoidFlushDuringRecovery(final long handle
,
1752 final boolean avoidFlushDuringRecovery
);
1753 private native boolean avoidFlushDuringRecovery(final long handle
);
1754 private native void setAvoidFlushDuringShutdown(final long handle
,
1755 final boolean avoidFlushDuringShutdown
);
1756 private native boolean avoidFlushDuringShutdown(final long handle
);
1758 // CF native handles
1759 private native void optimizeForSmallDb(final long handle
);
1760 private native void optimizeForPointLookup(long handle
,
1761 long blockCacheSizeMb
);
1762 private native void optimizeLevelStyleCompaction(long handle
,
1763 long memtableMemoryBudget
);
1764 private native void optimizeUniversalStyleCompaction(long handle
,
1765 long memtableMemoryBudget
);
1766 private native void setComparatorHandle(long handle
, int builtinComparator
);
1767 private native void setComparatorHandle(long optHandle
,
1768 long comparatorHandle
, byte comparatorType
);
1769 private native void setMergeOperatorName(
1770 long handle
, String name
);
1771 private native void setMergeOperator(
1772 long handle
, long mergeOperatorHandle
);
1773 private native void setWriteBufferSize(long handle
, long writeBufferSize
)
1774 throws IllegalArgumentException
;
1775 private native long writeBufferSize(long handle
);
1776 private native void setMaxWriteBufferNumber(
1777 long handle
, int maxWriteBufferNumber
);
1778 private native int maxWriteBufferNumber(long handle
);
1779 private native void setMinWriteBufferNumberToMerge(
1780 long handle
, int minWriteBufferNumberToMerge
);
1781 private native int minWriteBufferNumberToMerge(long handle
);
1782 private native void setCompressionType(long handle
, byte compressionType
);
1783 private native byte compressionType(long handle
);
1784 private native void setCompressionPerLevel(long handle
,
1785 byte[] compressionLevels
);
1786 private native byte[] compressionPerLevel(long handle
);
1787 private native void setBottommostCompressionType(long handle
,
1788 byte bottommostCompressionType
);
1789 private native byte bottommostCompressionType(long handle
);
1790 private native void setCompressionOptions(long handle
,
1791 long compressionOptionsHandle
);
1792 private native void useFixedLengthPrefixExtractor(
1793 long handle
, int prefixLength
);
1794 private native void useCappedPrefixExtractor(
1795 long handle
, int prefixLength
);
1796 private native void setNumLevels(
1797 long handle
, int numLevels
);
1798 private native int numLevels(long handle
);
1799 private native void setLevelZeroFileNumCompactionTrigger(
1800 long handle
, int numFiles
);
1801 private native int levelZeroFileNumCompactionTrigger(long handle
);
1802 private native void setLevelZeroSlowdownWritesTrigger(
1803 long handle
, int numFiles
);
1804 private native int levelZeroSlowdownWritesTrigger(long handle
);
1805 private native void setLevelZeroStopWritesTrigger(
1806 long handle
, int numFiles
);
1807 private native int levelZeroStopWritesTrigger(long handle
);
1808 private native void setTargetFileSizeBase(
1809 long handle
, long targetFileSizeBase
);
1810 private native long targetFileSizeBase(long handle
);
1811 private native void setTargetFileSizeMultiplier(
1812 long handle
, int multiplier
);
1813 private native int targetFileSizeMultiplier(long handle
);
1814 private native void setMaxBytesForLevelBase(
1815 long handle
, long maxBytesForLevelBase
);
1816 private native long maxBytesForLevelBase(long handle
);
1817 private native void setLevelCompactionDynamicLevelBytes(
1818 long handle
, boolean enableLevelCompactionDynamicLevelBytes
);
1819 private native boolean levelCompactionDynamicLevelBytes(
1821 private native void setMaxBytesForLevelMultiplier(long handle
, double multiplier
);
1822 private native double maxBytesForLevelMultiplier(long handle
);
1823 private native void setMaxCompactionBytes(long handle
, long maxCompactionBytes
);
1824 private native long maxCompactionBytes(long handle
);
1825 private native void setArenaBlockSize(
1826 long handle
, long arenaBlockSize
) throws IllegalArgumentException
;
1827 private native long arenaBlockSize(long handle
);
1828 private native void setDisableAutoCompactions(
1829 long handle
, boolean disableAutoCompactions
);
1830 private native boolean disableAutoCompactions(long handle
);
1831 private native void setCompactionStyle(long handle
, byte compactionStyle
);
1832 private native byte compactionStyle(long handle
);
1833 private native void setMaxSequentialSkipInIterations(
1834 long handle
, long maxSequentialSkipInIterations
);
1835 private native long maxSequentialSkipInIterations(long handle
);
1836 private native void setMemTableFactory(long handle
, long factoryHandle
);
1837 private native String
memTableFactoryName(long handle
);
1838 private native void setTableFactory(long handle
, long factoryHandle
);
1839 private native String
tableFactoryName(long handle
);
1840 private native void setInplaceUpdateSupport(
1841 long handle
, boolean inplaceUpdateSupport
);
1842 private native boolean inplaceUpdateSupport(long handle
);
1843 private native void setInplaceUpdateNumLocks(
1844 long handle
, long inplaceUpdateNumLocks
)
1845 throws IllegalArgumentException
;
1846 private native long inplaceUpdateNumLocks(long handle
);
1847 private native void setMemtablePrefixBloomSizeRatio(
1848 long handle
, double memtablePrefixBloomSizeRatio
);
1849 private native double memtablePrefixBloomSizeRatio(long handle
);
1850 private native void setBloomLocality(
1851 long handle
, int bloomLocality
);
1852 private native int bloomLocality(long handle
);
1853 private native void setMaxSuccessiveMerges(
1854 long handle
, long maxSuccessiveMerges
)
1855 throws IllegalArgumentException
;
1856 private native long maxSuccessiveMerges(long handle
);
1857 private native void setOptimizeFiltersForHits(long handle
,
1858 boolean optimizeFiltersForHits
);
1859 private native boolean optimizeFiltersForHits(long handle
);
1860 private native void setMemtableHugePageSize(long handle
,
1861 long memtableHugePageSize
);
1862 private native long memtableHugePageSize(long handle
);
1863 private native void setSoftPendingCompactionBytesLimit(long handle
,
1864 long softPendingCompactionBytesLimit
);
1865 private native long softPendingCompactionBytesLimit(long handle
);
1866 private native void setHardPendingCompactionBytesLimit(long handle
,
1867 long hardPendingCompactionBytesLimit
);
1868 private native long hardPendingCompactionBytesLimit(long handle
);
1869 private native void setLevel0FileNumCompactionTrigger(long handle
,
1870 int level0FileNumCompactionTrigger
);
1871 private native int level0FileNumCompactionTrigger(long handle
);
1872 private native void setLevel0SlowdownWritesTrigger(long handle
,
1873 int level0SlowdownWritesTrigger
);
1874 private native int level0SlowdownWritesTrigger(long handle
);
1875 private native void setLevel0StopWritesTrigger(long handle
,
1876 int level0StopWritesTrigger
);
1877 private native int level0StopWritesTrigger(long handle
);
1878 private native void setMaxBytesForLevelMultiplierAdditional(long handle
,
1879 int[] maxBytesForLevelMultiplierAdditional
);
1880 private native int[] maxBytesForLevelMultiplierAdditional(long handle
);
1881 private native void setParanoidFileChecks(long handle
,
1882 boolean paranoidFileChecks
);
1883 private native boolean paranoidFileChecks(long handle
);
1884 private native void setMaxWriteBufferNumberToMaintain(final long handle
,
1885 final int maxWriteBufferNumberToMaintain
);
1886 private native int maxWriteBufferNumberToMaintain(final long handle
);
1887 private native void setCompactionPriority(final long handle
,
1888 final byte compactionPriority
);
1889 private native byte compactionPriority(final long handle
);
1890 private native void setReportBgIoStats(final long handle
,
1891 final boolean reportBgIoStats
);
1892 private native boolean reportBgIoStats(final long handle
);
1893 private native void setCompactionOptionsUniversal(final long handle
,
1894 final long compactionOptionsUniversalHandle
);
1895 private native void setCompactionOptionsFIFO(final long handle
,
1896 final long compactionOptionsFIFOHandle
);
1897 private native void setForceConsistencyChecks(final long handle
,
1898 final boolean forceConsistencyChecks
);
1899 private native boolean forceConsistencyChecks(final long handle
);
1901 // instance variables
1902 // NOTE: If you add new member variables, please update the copy constructor above!
1904 private MemTableConfig memTableConfig_
;
1905 private TableFormatConfig tableFormatConfig_
;
1906 private RateLimiter rateLimiter_
;
1907 private AbstractComparator
<?
extends AbstractSlice
<?
>> comparator_
;
1908 private CompactionOptionsUniversal compactionOptionsUniversal_
;
1909 private CompactionOptionsFIFO compactionOptionsFIFO_
;
1910 private CompressionOptions compressionOptions_
;
1911 private Cache rowCache_
;