1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same 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 public Options
setIncreaseParallelism(final int totalThreads
) {
56 assert(isOwningHandle());
57 setIncreaseParallelism(nativeHandle_
, totalThreads
);
62 public Options
setCreateIfMissing(final boolean flag
) {
63 assert(isOwningHandle());
64 setCreateIfMissing(nativeHandle_
, flag
);
69 public Options
setCreateMissingColumnFamilies(final boolean flag
) {
70 assert(isOwningHandle());
71 setCreateMissingColumnFamilies(nativeHandle_
, flag
);
76 public Options
setEnv(final Env env
) {
77 assert(isOwningHandle());
78 setEnv(nativeHandle_
, env
.nativeHandle_
);
89 * <p>Set appropriate parameters for bulk loading.
90 * The reason that this is a function that returns "this" instead of a
91 * constructor is to enable chaining of multiple similar calls in the future.
94 * <p>All data will be in level 0 without any automatic compaction.
95 * It's recommended to manually call CompactRange(NULL, NULL) before reading
96 * from the database, because otherwise the read can be very slow.</p>
98 * @return the instance of the current Options.
100 public Options
prepareForBulkLoad() {
101 prepareForBulkLoad(nativeHandle_
);
106 public boolean createIfMissing() {
107 assert(isOwningHandle());
108 return createIfMissing(nativeHandle_
);
112 public boolean createMissingColumnFamilies() {
113 assert(isOwningHandle());
114 return createMissingColumnFamilies(nativeHandle_
);
118 public Options
optimizeForSmallDb() {
119 optimizeForSmallDb(nativeHandle_
);
124 public Options
optimizeForPointLookup(
125 long blockCacheSizeMb
) {
126 optimizeForPointLookup(nativeHandle_
,
132 public Options
optimizeLevelStyleCompaction() {
133 optimizeLevelStyleCompaction(nativeHandle_
,
134 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET
);
139 public Options
optimizeLevelStyleCompaction(
140 long memtableMemoryBudget
) {
141 optimizeLevelStyleCompaction(nativeHandle_
,
142 memtableMemoryBudget
);
147 public Options
optimizeUniversalStyleCompaction() {
148 optimizeUniversalStyleCompaction(nativeHandle_
,
149 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET
);
154 public Options
optimizeUniversalStyleCompaction(
155 final long memtableMemoryBudget
) {
156 optimizeUniversalStyleCompaction(nativeHandle_
,
157 memtableMemoryBudget
);
162 public Options
setComparator(final BuiltinComparator builtinComparator
) {
163 assert(isOwningHandle());
164 setComparatorHandle(nativeHandle_
, builtinComparator
.ordinal());
169 public Options
setComparator(
170 final AbstractComparator
<?
extends AbstractSlice
<?
>> comparator
) {
171 assert(isOwningHandle());
172 setComparatorHandle(nativeHandle_
, comparator
.getNativeHandle());
173 comparator_
= comparator
;
178 public Options
setMergeOperatorName(final String name
) {
179 assert(isOwningHandle());
181 throw new IllegalArgumentException(
182 "Merge operator name must not be null.");
184 setMergeOperatorName(nativeHandle_
, name
);
189 public Options
setMergeOperator(final MergeOperator mergeOperator
) {
190 setMergeOperator(nativeHandle_
, mergeOperator
.nativeHandle_
);
195 public Options
setWriteBufferSize(final long writeBufferSize
) {
196 assert(isOwningHandle());
197 setWriteBufferSize(nativeHandle_
, writeBufferSize
);
202 public long writeBufferSize() {
203 assert(isOwningHandle());
204 return writeBufferSize(nativeHandle_
);
208 public Options
setMaxWriteBufferNumber(final int maxWriteBufferNumber
) {
209 assert(isOwningHandle());
210 setMaxWriteBufferNumber(nativeHandle_
, maxWriteBufferNumber
);
215 public int maxWriteBufferNumber() {
216 assert(isOwningHandle());
217 return maxWriteBufferNumber(nativeHandle_
);
221 public boolean errorIfExists() {
222 assert(isOwningHandle());
223 return errorIfExists(nativeHandle_
);
227 public Options
setErrorIfExists(final boolean errorIfExists
) {
228 assert(isOwningHandle());
229 setErrorIfExists(nativeHandle_
, errorIfExists
);
234 public boolean paranoidChecks() {
235 assert(isOwningHandle());
236 return paranoidChecks(nativeHandle_
);
240 public Options
setParanoidChecks(final boolean paranoidChecks
) {
241 assert(isOwningHandle());
242 setParanoidChecks(nativeHandle_
, paranoidChecks
);
247 public int maxOpenFiles() {
248 assert(isOwningHandle());
249 return maxOpenFiles(nativeHandle_
);
253 public Options
setMaxFileOpeningThreads(final int maxFileOpeningThreads
) {
254 assert(isOwningHandle());
255 setMaxFileOpeningThreads(nativeHandle_
, maxFileOpeningThreads
);
260 public int maxFileOpeningThreads() {
261 assert(isOwningHandle());
262 return maxFileOpeningThreads(nativeHandle_
);
266 public Options
setMaxTotalWalSize(final long maxTotalWalSize
) {
267 assert(isOwningHandle());
268 setMaxTotalWalSize(nativeHandle_
, maxTotalWalSize
);
273 public long maxTotalWalSize() {
274 assert(isOwningHandle());
275 return maxTotalWalSize(nativeHandle_
);
279 public Options
setMaxOpenFiles(final int maxOpenFiles
) {
280 assert(isOwningHandle());
281 setMaxOpenFiles(nativeHandle_
, maxOpenFiles
);
286 public boolean useFsync() {
287 assert(isOwningHandle());
288 return useFsync(nativeHandle_
);
292 public Options
setUseFsync(final boolean useFsync
) {
293 assert(isOwningHandle());
294 setUseFsync(nativeHandle_
, useFsync
);
299 public Options
setDbPaths(final Collection
<DbPath
> dbPaths
) {
300 assert(isOwningHandle());
302 final int len
= dbPaths
.size();
303 final String paths
[] = new String
[len
];
304 final long targetSizes
[] = new long[len
];
307 for(final DbPath dbPath
: dbPaths
) {
308 paths
[i
] = dbPath
.path
.toString();
309 targetSizes
[i
] = dbPath
.targetSize
;
312 setDbPaths(nativeHandle_
, paths
, targetSizes
);
317 public List
<DbPath
> dbPaths() {
318 final int len
= (int)dbPathsLen(nativeHandle_
);
320 return Collections
.emptyList();
322 final String paths
[] = new String
[len
];
323 final long targetSizes
[] = new long[len
];
325 dbPaths(nativeHandle_
, paths
, targetSizes
);
327 final List
<DbPath
> dbPaths
= new ArrayList
<>();
328 for(int i
= 0; i
< len
; i
++) {
329 dbPaths
.add(new DbPath(Paths
.get(paths
[i
]), targetSizes
[i
]));
336 public String
dbLogDir() {
337 assert(isOwningHandle());
338 return dbLogDir(nativeHandle_
);
342 public Options
setDbLogDir(final String dbLogDir
) {
343 assert(isOwningHandle());
344 setDbLogDir(nativeHandle_
, dbLogDir
);
349 public String
walDir() {
350 assert(isOwningHandle());
351 return walDir(nativeHandle_
);
355 public Options
setWalDir(final String walDir
) {
356 assert(isOwningHandle());
357 setWalDir(nativeHandle_
, walDir
);
362 public long deleteObsoleteFilesPeriodMicros() {
363 assert(isOwningHandle());
364 return deleteObsoleteFilesPeriodMicros(nativeHandle_
);
368 public Options
setDeleteObsoleteFilesPeriodMicros(
370 assert(isOwningHandle());
371 setDeleteObsoleteFilesPeriodMicros(nativeHandle_
, micros
);
376 public int maxBackgroundCompactions() {
377 assert(isOwningHandle());
378 return maxBackgroundCompactions(nativeHandle_
);
382 public Options
createStatistics() {
383 assert(isOwningHandle());
384 createStatistics(nativeHandle_
);
389 public Statistics
statisticsPtr() {
390 assert(isOwningHandle());
392 long statsPtr
= statisticsPtr(nativeHandle_
);
395 statsPtr
= statisticsPtr(nativeHandle_
);
398 return new Statistics(statsPtr
);
402 public void setBaseBackgroundCompactions(
403 final int baseBackgroundCompactions
) {
404 assert(isOwningHandle());
405 setBaseBackgroundCompactions(nativeHandle_
, baseBackgroundCompactions
);
409 public int baseBackgroundCompactions() {
410 assert(isOwningHandle());
411 return baseBackgroundCompactions(nativeHandle_
);
415 public Options
setMaxBackgroundCompactions(
416 final int maxBackgroundCompactions
) {
417 assert(isOwningHandle());
418 setMaxBackgroundCompactions(nativeHandle_
, maxBackgroundCompactions
);
423 public void setMaxSubcompactions(final int maxSubcompactions
) {
424 assert(isOwningHandle());
425 setMaxSubcompactions(nativeHandle_
, maxSubcompactions
);
429 public int maxSubcompactions() {
430 assert(isOwningHandle());
431 return maxSubcompactions(nativeHandle_
);
435 public int maxBackgroundFlushes() {
436 assert(isOwningHandle());
437 return maxBackgroundFlushes(nativeHandle_
);
441 public Options
setMaxBackgroundFlushes(
442 final int maxBackgroundFlushes
) {
443 assert(isOwningHandle());
444 setMaxBackgroundFlushes(nativeHandle_
, maxBackgroundFlushes
);
449 public long maxLogFileSize() {
450 assert(isOwningHandle());
451 return maxLogFileSize(nativeHandle_
);
455 public Options
setMaxLogFileSize(final long maxLogFileSize
) {
456 assert(isOwningHandle());
457 setMaxLogFileSize(nativeHandle_
, maxLogFileSize
);
462 public long logFileTimeToRoll() {
463 assert(isOwningHandle());
464 return logFileTimeToRoll(nativeHandle_
);
468 public Options
setLogFileTimeToRoll(final long logFileTimeToRoll
) {
469 assert(isOwningHandle());
470 setLogFileTimeToRoll(nativeHandle_
, logFileTimeToRoll
);
475 public long keepLogFileNum() {
476 assert(isOwningHandle());
477 return keepLogFileNum(nativeHandle_
);
481 public Options
setKeepLogFileNum(final long keepLogFileNum
) {
482 assert(isOwningHandle());
483 setKeepLogFileNum(nativeHandle_
, keepLogFileNum
);
489 public Options
setRecycleLogFileNum(final long recycleLogFileNum
) {
490 assert(isOwningHandle());
491 setRecycleLogFileNum(nativeHandle_
, recycleLogFileNum
);
496 public long recycleLogFileNum() {
497 assert(isOwningHandle());
498 return recycleLogFileNum(nativeHandle_
);
502 public long maxManifestFileSize() {
503 assert(isOwningHandle());
504 return maxManifestFileSize(nativeHandle_
);
508 public Options
setMaxManifestFileSize(
509 final long maxManifestFileSize
) {
510 assert(isOwningHandle());
511 setMaxManifestFileSize(nativeHandle_
, maxManifestFileSize
);
516 public Options
setMaxTableFilesSizeFIFO(
517 final long maxTableFilesSize
) {
518 assert(maxTableFilesSize
> 0); // unsigned native type
519 assert(isOwningHandle());
520 setMaxTableFilesSizeFIFO(nativeHandle_
, maxTableFilesSize
);
525 public long maxTableFilesSizeFIFO() {
526 return maxTableFilesSizeFIFO(nativeHandle_
);
530 public int tableCacheNumshardbits() {
531 assert(isOwningHandle());
532 return tableCacheNumshardbits(nativeHandle_
);
536 public Options
setTableCacheNumshardbits(
537 final int tableCacheNumshardbits
) {
538 assert(isOwningHandle());
539 setTableCacheNumshardbits(nativeHandle_
, tableCacheNumshardbits
);
544 public long walTtlSeconds() {
545 assert(isOwningHandle());
546 return walTtlSeconds(nativeHandle_
);
550 public Options
setWalTtlSeconds(final long walTtlSeconds
) {
551 assert(isOwningHandle());
552 setWalTtlSeconds(nativeHandle_
, walTtlSeconds
);
557 public long walSizeLimitMB() {
558 assert(isOwningHandle());
559 return walSizeLimitMB(nativeHandle_
);
563 public Options
setWalSizeLimitMB(final long sizeLimitMB
) {
564 assert(isOwningHandle());
565 setWalSizeLimitMB(nativeHandle_
, sizeLimitMB
);
570 public long manifestPreallocationSize() {
571 assert(isOwningHandle());
572 return manifestPreallocationSize(nativeHandle_
);
576 public Options
setManifestPreallocationSize(final long size
) {
577 assert(isOwningHandle());
578 setManifestPreallocationSize(nativeHandle_
, size
);
583 public Options
setUseDirectReads(final boolean useDirectReads
) {
584 assert(isOwningHandle());
585 setUseDirectReads(nativeHandle_
, useDirectReads
);
590 public boolean useDirectReads() {
591 assert(isOwningHandle());
592 return useDirectReads(nativeHandle_
);
596 public Options
setUseDirectIoForFlushAndCompaction(
597 final boolean useDirectIoForFlushAndCompaction
) {
598 assert(isOwningHandle());
599 setUseDirectIoForFlushAndCompaction(nativeHandle_
, useDirectIoForFlushAndCompaction
);
604 public boolean useDirectIoForFlushAndCompaction() {
605 assert(isOwningHandle());
606 return useDirectIoForFlushAndCompaction(nativeHandle_
);
610 public Options
setAllowFAllocate(final boolean allowFAllocate
) {
611 assert(isOwningHandle());
612 setAllowFAllocate(nativeHandle_
, allowFAllocate
);
617 public boolean allowFAllocate() {
618 assert(isOwningHandle());
619 return allowFAllocate(nativeHandle_
);
623 public boolean allowMmapReads() {
624 assert(isOwningHandle());
625 return allowMmapReads(nativeHandle_
);
629 public Options
setAllowMmapReads(final boolean allowMmapReads
) {
630 assert(isOwningHandle());
631 setAllowMmapReads(nativeHandle_
, allowMmapReads
);
636 public boolean allowMmapWrites() {
637 assert(isOwningHandle());
638 return allowMmapWrites(nativeHandle_
);
642 public Options
setAllowMmapWrites(final boolean allowMmapWrites
) {
643 assert(isOwningHandle());
644 setAllowMmapWrites(nativeHandle_
, allowMmapWrites
);
649 public boolean isFdCloseOnExec() {
650 assert(isOwningHandle());
651 return isFdCloseOnExec(nativeHandle_
);
655 public Options
setIsFdCloseOnExec(final boolean isFdCloseOnExec
) {
656 assert(isOwningHandle());
657 setIsFdCloseOnExec(nativeHandle_
, isFdCloseOnExec
);
662 public int statsDumpPeriodSec() {
663 assert(isOwningHandle());
664 return statsDumpPeriodSec(nativeHandle_
);
668 public Options
setStatsDumpPeriodSec(final int statsDumpPeriodSec
) {
669 assert(isOwningHandle());
670 setStatsDumpPeriodSec(nativeHandle_
, statsDumpPeriodSec
);
675 public boolean adviseRandomOnOpen() {
676 return adviseRandomOnOpen(nativeHandle_
);
680 public Options
setAdviseRandomOnOpen(final boolean adviseRandomOnOpen
) {
681 assert(isOwningHandle());
682 setAdviseRandomOnOpen(nativeHandle_
, adviseRandomOnOpen
);
687 public Options
setDbWriteBufferSize(final long dbWriteBufferSize
) {
688 assert(isOwningHandle());
689 setDbWriteBufferSize(nativeHandle_
, dbWriteBufferSize
);
694 public long dbWriteBufferSize() {
695 assert(isOwningHandle());
696 return dbWriteBufferSize(nativeHandle_
);
700 public Options
setAccessHintOnCompactionStart(final AccessHint accessHint
) {
701 assert(isOwningHandle());
702 setAccessHintOnCompactionStart(nativeHandle_
, accessHint
.getValue());
707 public AccessHint
accessHintOnCompactionStart() {
708 assert(isOwningHandle());
709 return AccessHint
.getAccessHint(accessHintOnCompactionStart(nativeHandle_
));
713 public Options
setNewTableReaderForCompactionInputs(
714 final boolean newTableReaderForCompactionInputs
) {
715 assert(isOwningHandle());
716 setNewTableReaderForCompactionInputs(nativeHandle_
,
717 newTableReaderForCompactionInputs
);
722 public boolean newTableReaderForCompactionInputs() {
723 assert(isOwningHandle());
724 return newTableReaderForCompactionInputs(nativeHandle_
);
728 public Options
setCompactionReadaheadSize(final long compactionReadaheadSize
) {
729 assert(isOwningHandle());
730 setCompactionReadaheadSize(nativeHandle_
, compactionReadaheadSize
);
735 public long compactionReadaheadSize() {
736 assert(isOwningHandle());
737 return compactionReadaheadSize(nativeHandle_
);
741 public Options
setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize
) {
742 assert(isOwningHandle());
743 setRandomAccessMaxBufferSize(nativeHandle_
, randomAccessMaxBufferSize
);
748 public long randomAccessMaxBufferSize() {
749 assert(isOwningHandle());
750 return randomAccessMaxBufferSize(nativeHandle_
);
754 public Options
setWritableFileMaxBufferSize(final long writableFileMaxBufferSize
) {
755 assert(isOwningHandle());
756 setWritableFileMaxBufferSize(nativeHandle_
, writableFileMaxBufferSize
);
761 public long writableFileMaxBufferSize() {
762 assert(isOwningHandle());
763 return writableFileMaxBufferSize(nativeHandle_
);
767 public boolean useAdaptiveMutex() {
768 assert(isOwningHandle());
769 return useAdaptiveMutex(nativeHandle_
);
773 public Options
setUseAdaptiveMutex(final boolean useAdaptiveMutex
) {
774 assert(isOwningHandle());
775 setUseAdaptiveMutex(nativeHandle_
, useAdaptiveMutex
);
780 public long bytesPerSync() {
781 return bytesPerSync(nativeHandle_
);
785 public Options
setBytesPerSync(final long bytesPerSync
) {
786 assert(isOwningHandle());
787 setBytesPerSync(nativeHandle_
, bytesPerSync
);
792 public Options
setWalBytesPerSync(final long walBytesPerSync
) {
793 assert(isOwningHandle());
794 setWalBytesPerSync(nativeHandle_
, walBytesPerSync
);
799 public long walBytesPerSync() {
800 assert(isOwningHandle());
801 return walBytesPerSync(nativeHandle_
);
805 public Options
setEnableThreadTracking(final boolean enableThreadTracking
) {
806 assert(isOwningHandle());
807 setEnableThreadTracking(nativeHandle_
, enableThreadTracking
);
812 public boolean enableThreadTracking() {
813 assert(isOwningHandle());
814 return enableThreadTracking(nativeHandle_
);
818 public Options
setDelayedWriteRate(final long delayedWriteRate
) {
819 assert(isOwningHandle());
820 setDelayedWriteRate(nativeHandle_
, delayedWriteRate
);
825 public long delayedWriteRate(){
826 return delayedWriteRate(nativeHandle_
);
830 public Options
setAllowConcurrentMemtableWrite(
831 final boolean allowConcurrentMemtableWrite
) {
832 setAllowConcurrentMemtableWrite(nativeHandle_
,
833 allowConcurrentMemtableWrite
);
838 public boolean allowConcurrentMemtableWrite() {
839 return allowConcurrentMemtableWrite(nativeHandle_
);
843 public Options
setEnableWriteThreadAdaptiveYield(
844 final boolean enableWriteThreadAdaptiveYield
) {
845 setEnableWriteThreadAdaptiveYield(nativeHandle_
,
846 enableWriteThreadAdaptiveYield
);
851 public boolean enableWriteThreadAdaptiveYield() {
852 return enableWriteThreadAdaptiveYield(nativeHandle_
);
856 public Options
setWriteThreadMaxYieldUsec(final long writeThreadMaxYieldUsec
) {
857 setWriteThreadMaxYieldUsec(nativeHandle_
, writeThreadMaxYieldUsec
);
862 public long writeThreadMaxYieldUsec() {
863 return writeThreadMaxYieldUsec(nativeHandle_
);
867 public Options
setWriteThreadSlowYieldUsec(final long writeThreadSlowYieldUsec
) {
868 setWriteThreadSlowYieldUsec(nativeHandle_
, writeThreadSlowYieldUsec
);
873 public long writeThreadSlowYieldUsec() {
874 return writeThreadSlowYieldUsec(nativeHandle_
);
878 public Options
setSkipStatsUpdateOnDbOpen(final boolean skipStatsUpdateOnDbOpen
) {
879 assert(isOwningHandle());
880 setSkipStatsUpdateOnDbOpen(nativeHandle_
, skipStatsUpdateOnDbOpen
);
885 public boolean skipStatsUpdateOnDbOpen() {
886 assert(isOwningHandle());
887 return skipStatsUpdateOnDbOpen(nativeHandle_
);
891 public Options
setWalRecoveryMode(final WALRecoveryMode walRecoveryMode
) {
892 assert(isOwningHandle());
893 setWalRecoveryMode(nativeHandle_
, walRecoveryMode
.getValue());
898 public WALRecoveryMode
walRecoveryMode() {
899 assert(isOwningHandle());
900 return WALRecoveryMode
.getWALRecoveryMode(walRecoveryMode(nativeHandle_
));
904 public Options
setAllow2pc(final boolean allow2pc
) {
905 assert(isOwningHandle());
906 setAllow2pc(nativeHandle_
, allow2pc
);
911 public boolean allow2pc() {
912 assert(isOwningHandle());
913 return allow2pc(nativeHandle_
);
917 public Options
setRowCache(final Cache rowCache
) {
918 assert(isOwningHandle());
919 setRowCache(nativeHandle_
, rowCache
.nativeHandle_
);
920 this.rowCache_
= rowCache
;
925 public Cache
rowCache() {
926 assert(isOwningHandle());
927 return this.rowCache_
;
931 public Options
setFailIfOptionsFileError(final boolean failIfOptionsFileError
) {
932 assert(isOwningHandle());
933 setFailIfOptionsFileError(nativeHandle_
, failIfOptionsFileError
);
938 public boolean failIfOptionsFileError() {
939 assert(isOwningHandle());
940 return failIfOptionsFileError(nativeHandle_
);
944 public Options
setDumpMallocStats(final boolean dumpMallocStats
) {
945 assert(isOwningHandle());
946 setDumpMallocStats(nativeHandle_
, dumpMallocStats
);
951 public boolean dumpMallocStats() {
952 assert(isOwningHandle());
953 return dumpMallocStats(nativeHandle_
);
957 public Options
setAvoidFlushDuringRecovery(final boolean avoidFlushDuringRecovery
) {
958 assert(isOwningHandle());
959 setAvoidFlushDuringRecovery(nativeHandle_
, avoidFlushDuringRecovery
);
964 public boolean avoidFlushDuringRecovery() {
965 assert(isOwningHandle());
966 return avoidFlushDuringRecovery(nativeHandle_
);
970 public Options
setAvoidFlushDuringShutdown(final boolean avoidFlushDuringShutdown
) {
971 assert(isOwningHandle());
972 setAvoidFlushDuringShutdown(nativeHandle_
, avoidFlushDuringShutdown
);
977 public boolean avoidFlushDuringShutdown() {
978 assert(isOwningHandle());
979 return avoidFlushDuringShutdown(nativeHandle_
);
983 public MemTableConfig
memTableConfig() {
984 return this.memTableConfig_
;
988 public Options
setMemTableConfig(final MemTableConfig config
) {
989 memTableConfig_
= config
;
990 setMemTableFactory(nativeHandle_
, config
.newMemTableFactoryHandle());
995 public Options
setRateLimiter(final RateLimiter rateLimiter
) {
996 assert(isOwningHandle());
997 rateLimiter_
= rateLimiter
;
998 setRateLimiter(nativeHandle_
, rateLimiter
.nativeHandle_
);
1003 public Options
setLogger(final Logger logger
) {
1004 assert(isOwningHandle());
1005 setLogger(nativeHandle_
, logger
.nativeHandle_
);
1010 public Options
setInfoLogLevel(final InfoLogLevel infoLogLevel
) {
1011 assert(isOwningHandle());
1012 setInfoLogLevel(nativeHandle_
, infoLogLevel
.getValue());
1017 public InfoLogLevel
infoLogLevel() {
1018 assert(isOwningHandle());
1019 return InfoLogLevel
.getInfoLogLevel(
1020 infoLogLevel(nativeHandle_
));
1024 public String
memTableFactoryName() {
1025 assert(isOwningHandle());
1026 return memTableFactoryName(nativeHandle_
);
1030 public TableFormatConfig
tableFormatConfig() {
1031 return this.tableFormatConfig_
;
1035 public Options
setTableFormatConfig(final TableFormatConfig config
) {
1036 tableFormatConfig_
= config
;
1037 setTableFactory(nativeHandle_
, config
.newTableFactoryHandle());
1042 public String
tableFactoryName() {
1043 assert(isOwningHandle());
1044 return tableFactoryName(nativeHandle_
);
1048 public Options
useFixedLengthPrefixExtractor(final int n
) {
1049 assert(isOwningHandle());
1050 useFixedLengthPrefixExtractor(nativeHandle_
, n
);
1055 public Options
useCappedPrefixExtractor(final int n
) {
1056 assert(isOwningHandle());
1057 useCappedPrefixExtractor(nativeHandle_
, n
);
1062 public CompressionType
compressionType() {
1063 return CompressionType
.getCompressionType(compressionType(nativeHandle_
));
1067 public Options
setCompressionPerLevel(
1068 final List
<CompressionType
> compressionLevels
) {
1069 final byte[] byteCompressionTypes
= new byte[
1070 compressionLevels
.size()];
1071 for (int i
= 0; i
< compressionLevels
.size(); i
++) {
1072 byteCompressionTypes
[i
] = compressionLevels
.get(i
).getValue();
1074 setCompressionPerLevel(nativeHandle_
, byteCompressionTypes
);
1079 public List
<CompressionType
> compressionPerLevel() {
1080 final byte[] byteCompressionTypes
=
1081 compressionPerLevel(nativeHandle_
);
1082 final List
<CompressionType
> compressionLevels
= new ArrayList
<>();
1083 for (final Byte byteCompressionType
: byteCompressionTypes
) {
1084 compressionLevels
.add(CompressionType
.getCompressionType(
1085 byteCompressionType
));
1087 return compressionLevels
;
1091 public Options
setCompressionType(CompressionType compressionType
) {
1092 setCompressionType(nativeHandle_
, compressionType
.getValue());
1098 public Options
setBottommostCompressionType(
1099 final CompressionType bottommostCompressionType
) {
1100 setBottommostCompressionType(nativeHandle_
,
1101 bottommostCompressionType
.getValue());
1106 public CompressionType
bottommostCompressionType() {
1107 return CompressionType
.getCompressionType(
1108 bottommostCompressionType(nativeHandle_
));
1112 public Options
setCompressionOptions(
1113 final CompressionOptions compressionOptions
) {
1114 setCompressionOptions(nativeHandle_
, compressionOptions
.nativeHandle_
);
1115 this.compressionOptions_
= compressionOptions
;
1120 public CompressionOptions
compressionOptions() {
1121 return this.compressionOptions_
;
1125 public CompactionStyle
compactionStyle() {
1126 return CompactionStyle
.values()[compactionStyle(nativeHandle_
)];
1130 public Options
setCompactionStyle(
1131 final CompactionStyle compactionStyle
) {
1132 setCompactionStyle(nativeHandle_
, compactionStyle
.getValue());
1137 public int numLevels() {
1138 return numLevels(nativeHandle_
);
1142 public Options
setNumLevels(int numLevels
) {
1143 setNumLevels(nativeHandle_
, numLevels
);
1148 public int levelZeroFileNumCompactionTrigger() {
1149 return levelZeroFileNumCompactionTrigger(nativeHandle_
);
1153 public Options
setLevelZeroFileNumCompactionTrigger(
1154 final int numFiles
) {
1155 setLevelZeroFileNumCompactionTrigger(
1156 nativeHandle_
, numFiles
);
1161 public int levelZeroSlowdownWritesTrigger() {
1162 return levelZeroSlowdownWritesTrigger(nativeHandle_
);
1166 public Options
setLevelZeroSlowdownWritesTrigger(
1167 final int numFiles
) {
1168 setLevelZeroSlowdownWritesTrigger(nativeHandle_
, numFiles
);
1173 public int levelZeroStopWritesTrigger() {
1174 return levelZeroStopWritesTrigger(nativeHandle_
);
1178 public Options
setLevelZeroStopWritesTrigger(
1179 final int numFiles
) {
1180 setLevelZeroStopWritesTrigger(nativeHandle_
, numFiles
);
1185 public long targetFileSizeBase() {
1186 return targetFileSizeBase(nativeHandle_
);
1190 public Options
setTargetFileSizeBase(long targetFileSizeBase
) {
1191 setTargetFileSizeBase(nativeHandle_
, targetFileSizeBase
);
1196 public int targetFileSizeMultiplier() {
1197 return targetFileSizeMultiplier(nativeHandle_
);
1201 public Options
setTargetFileSizeMultiplier(int multiplier
) {
1202 setTargetFileSizeMultiplier(nativeHandle_
, multiplier
);
1207 public Options
setMaxBytesForLevelBase(final long maxBytesForLevelBase
) {
1208 setMaxBytesForLevelBase(nativeHandle_
, maxBytesForLevelBase
);
1213 public long maxBytesForLevelBase() {
1214 return maxBytesForLevelBase(nativeHandle_
);
1218 public Options
setLevelCompactionDynamicLevelBytes(
1219 final boolean enableLevelCompactionDynamicLevelBytes
) {
1220 setLevelCompactionDynamicLevelBytes(nativeHandle_
,
1221 enableLevelCompactionDynamicLevelBytes
);
1226 public boolean levelCompactionDynamicLevelBytes() {
1227 return levelCompactionDynamicLevelBytes(nativeHandle_
);
1231 public double maxBytesForLevelMultiplier() {
1232 return maxBytesForLevelMultiplier(nativeHandle_
);
1236 public Options
setMaxBytesForLevelMultiplier(final double multiplier
) {
1237 setMaxBytesForLevelMultiplier(nativeHandle_
, multiplier
);
1242 public long maxCompactionBytes() {
1243 return maxCompactionBytes(nativeHandle_
);
1247 public Options
setMaxCompactionBytes(final long maxCompactionBytes
) {
1248 setMaxCompactionBytes(nativeHandle_
, maxCompactionBytes
);
1253 public long arenaBlockSize() {
1254 return arenaBlockSize(nativeHandle_
);
1258 public Options
setArenaBlockSize(final long arenaBlockSize
) {
1259 setArenaBlockSize(nativeHandle_
, arenaBlockSize
);
1264 public boolean disableAutoCompactions() {
1265 return disableAutoCompactions(nativeHandle_
);
1269 public Options
setDisableAutoCompactions(
1270 final boolean disableAutoCompactions
) {
1271 setDisableAutoCompactions(nativeHandle_
, disableAutoCompactions
);
1276 public long maxSequentialSkipInIterations() {
1277 return maxSequentialSkipInIterations(nativeHandle_
);
1281 public Options
setMaxSequentialSkipInIterations(
1282 final long maxSequentialSkipInIterations
) {
1283 setMaxSequentialSkipInIterations(nativeHandle_
,
1284 maxSequentialSkipInIterations
);
1289 public boolean inplaceUpdateSupport() {
1290 return inplaceUpdateSupport(nativeHandle_
);
1294 public Options
setInplaceUpdateSupport(
1295 final boolean inplaceUpdateSupport
) {
1296 setInplaceUpdateSupport(nativeHandle_
, inplaceUpdateSupport
);
1301 public long inplaceUpdateNumLocks() {
1302 return inplaceUpdateNumLocks(nativeHandle_
);
1306 public Options
setInplaceUpdateNumLocks(
1307 final long inplaceUpdateNumLocks
) {
1308 setInplaceUpdateNumLocks(nativeHandle_
, inplaceUpdateNumLocks
);
1313 public double memtablePrefixBloomSizeRatio() {
1314 return memtablePrefixBloomSizeRatio(nativeHandle_
);
1318 public Options
setMemtablePrefixBloomSizeRatio(final double memtablePrefixBloomSizeRatio
) {
1319 setMemtablePrefixBloomSizeRatio(nativeHandle_
, memtablePrefixBloomSizeRatio
);
1324 public int bloomLocality() {
1325 return bloomLocality(nativeHandle_
);
1329 public Options
setBloomLocality(final int bloomLocality
) {
1330 setBloomLocality(nativeHandle_
, bloomLocality
);
1335 public long maxSuccessiveMerges() {
1336 return maxSuccessiveMerges(nativeHandle_
);
1340 public Options
setMaxSuccessiveMerges(long maxSuccessiveMerges
) {
1341 setMaxSuccessiveMerges(nativeHandle_
, maxSuccessiveMerges
);
1346 public int minWriteBufferNumberToMerge() {
1347 return minWriteBufferNumberToMerge(nativeHandle_
);
1351 public Options
setMinWriteBufferNumberToMerge(
1352 final int minWriteBufferNumberToMerge
) {
1353 setMinWriteBufferNumberToMerge(nativeHandle_
, minWriteBufferNumberToMerge
);
1358 public Options
setOptimizeFiltersForHits(
1359 final boolean optimizeFiltersForHits
) {
1360 setOptimizeFiltersForHits(nativeHandle_
, optimizeFiltersForHits
);
1365 public boolean optimizeFiltersForHits() {
1366 return optimizeFiltersForHits(nativeHandle_
);
1371 setMemtableHugePageSize(
1372 long memtableHugePageSize
) {
1373 setMemtableHugePageSize(nativeHandle_
,
1374 memtableHugePageSize
);
1379 public long memtableHugePageSize() {
1380 return memtableHugePageSize(nativeHandle_
);
1384 public Options
setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit
) {
1385 setSoftPendingCompactionBytesLimit(nativeHandle_
,
1386 softPendingCompactionBytesLimit
);
1391 public long softPendingCompactionBytesLimit() {
1392 return softPendingCompactionBytesLimit(nativeHandle_
);
1396 public Options
setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit
) {
1397 setHardPendingCompactionBytesLimit(nativeHandle_
, hardPendingCompactionBytesLimit
);
1402 public long hardPendingCompactionBytesLimit() {
1403 return hardPendingCompactionBytesLimit(nativeHandle_
);
1407 public Options
setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger
) {
1408 setLevel0FileNumCompactionTrigger(nativeHandle_
, level0FileNumCompactionTrigger
);
1413 public int level0FileNumCompactionTrigger() {
1414 return level0FileNumCompactionTrigger(nativeHandle_
);
1418 public Options
setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger
) {
1419 setLevel0SlowdownWritesTrigger(nativeHandle_
, level0SlowdownWritesTrigger
);
1424 public int level0SlowdownWritesTrigger() {
1425 return level0SlowdownWritesTrigger(nativeHandle_
);
1429 public Options
setLevel0StopWritesTrigger(int level0StopWritesTrigger
) {
1430 setLevel0StopWritesTrigger(nativeHandle_
, level0StopWritesTrigger
);
1435 public int level0StopWritesTrigger() {
1436 return level0StopWritesTrigger(nativeHandle_
);
1440 public Options
setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional
) {
1441 setMaxBytesForLevelMultiplierAdditional(nativeHandle_
, maxBytesForLevelMultiplierAdditional
);
1446 public int[] maxBytesForLevelMultiplierAdditional() {
1447 return maxBytesForLevelMultiplierAdditional(nativeHandle_
);
1451 public Options
setParanoidFileChecks(boolean paranoidFileChecks
) {
1452 setParanoidFileChecks(nativeHandle_
, paranoidFileChecks
);
1457 public boolean paranoidFileChecks() {
1458 return paranoidFileChecks(nativeHandle_
);
1462 public Options
setMaxWriteBufferNumberToMaintain(
1463 final int maxWriteBufferNumberToMaintain
) {
1464 setMaxWriteBufferNumberToMaintain(
1465 nativeHandle_
, maxWriteBufferNumberToMaintain
);
1470 public int maxWriteBufferNumberToMaintain() {
1471 return maxWriteBufferNumberToMaintain(nativeHandle_
);
1475 public Options
setCompactionPriority(
1476 final CompactionPriority compactionPriority
) {
1477 setCompactionPriority(nativeHandle_
, compactionPriority
.getValue());
1482 public CompactionPriority
compactionPriority() {
1483 return CompactionPriority
.getCompactionPriority(
1484 compactionPriority(nativeHandle_
));
1488 public Options
setReportBgIoStats(final boolean reportBgIoStats
) {
1489 setReportBgIoStats(nativeHandle_
, reportBgIoStats
);
1494 public boolean reportBgIoStats() {
1495 return reportBgIoStats(nativeHandle_
);
1499 public Options
setCompactionOptionsUniversal(
1500 final CompactionOptionsUniversal compactionOptionsUniversal
) {
1501 setCompactionOptionsUniversal(nativeHandle_
,
1502 compactionOptionsUniversal
.nativeHandle_
);
1503 this.compactionOptionsUniversal_
= compactionOptionsUniversal
;
1508 public CompactionOptionsUniversal
compactionOptionsUniversal() {
1509 return this.compactionOptionsUniversal_
;
1513 public Options
setCompactionOptionsFIFO(final CompactionOptionsFIFO compactionOptionsFIFO
) {
1514 setCompactionOptionsFIFO(nativeHandle_
,
1515 compactionOptionsFIFO
.nativeHandle_
);
1516 this.compactionOptionsFIFO_
= compactionOptionsFIFO
;
1521 public CompactionOptionsFIFO
compactionOptionsFIFO() {
1522 return this.compactionOptionsFIFO_
;
1526 public Options
setForceConsistencyChecks(final boolean forceConsistencyChecks
) {
1527 setForceConsistencyChecks(nativeHandle_
, forceConsistencyChecks
);
1532 public boolean forceConsistencyChecks() {
1533 return forceConsistencyChecks(nativeHandle_
);
1536 private native static long newOptions();
1537 private native static long newOptions(long dbOptHandle
,
1539 @Override protected final native void disposeInternal(final long handle
);
1540 private native void setEnv(long optHandle
, long envHandle
);
1541 private native void prepareForBulkLoad(long handle
);
1543 // DB native handles
1544 private native void setIncreaseParallelism(long handle
, int totalThreads
);
1545 private native void setCreateIfMissing(long handle
, boolean flag
);
1546 private native boolean createIfMissing(long handle
);
1547 private native void setCreateMissingColumnFamilies(
1548 long handle
, boolean flag
);
1549 private native boolean createMissingColumnFamilies(long handle
);
1550 private native void setErrorIfExists(long handle
, boolean errorIfExists
);
1551 private native boolean errorIfExists(long handle
);
1552 private native void setParanoidChecks(
1553 long handle
, boolean paranoidChecks
);
1554 private native boolean paranoidChecks(long handle
);
1555 private native void setRateLimiter(long handle
,
1556 long rateLimiterHandle
);
1557 private native void setLogger(long handle
,
1559 private native void setInfoLogLevel(long handle
, byte logLevel
);
1560 private native byte infoLogLevel(long handle
);
1561 private native void setMaxOpenFiles(long handle
, int maxOpenFiles
);
1562 private native int maxOpenFiles(long handle
);
1563 private native void setMaxTotalWalSize(long handle
,
1564 long maxTotalWalSize
);
1565 private native void setMaxFileOpeningThreads(final long handle
,
1566 final int maxFileOpeningThreads
);
1567 private native int maxFileOpeningThreads(final long handle
);
1568 private native long maxTotalWalSize(long handle
);
1569 private native void createStatistics(long optHandle
);
1570 private native long statisticsPtr(long optHandle
);
1571 private native boolean useFsync(long handle
);
1572 private native void setUseFsync(long handle
, boolean useFsync
);
1573 private native void setDbPaths(final long handle
, final String
[] paths
,
1574 final long[] targetSizes
);
1575 private native long dbPathsLen(final long handle
);
1576 private native void dbPaths(final long handle
, final String
[] paths
,
1577 final long[] targetSizes
);
1578 private native void setDbLogDir(long handle
, String dbLogDir
);
1579 private native String
dbLogDir(long handle
);
1580 private native void setWalDir(long handle
, String walDir
);
1581 private native String
walDir(long handle
);
1582 private native void setDeleteObsoleteFilesPeriodMicros(
1583 long handle
, long micros
);
1584 private native long deleteObsoleteFilesPeriodMicros(long handle
);
1585 private native void setBaseBackgroundCompactions(long handle
,
1586 int baseBackgroundCompactions
);
1587 private native int baseBackgroundCompactions(long handle
);
1588 private native void setMaxBackgroundCompactions(
1589 long handle
, int maxBackgroundCompactions
);
1590 private native int maxBackgroundCompactions(long handle
);
1591 private native void setMaxSubcompactions(long handle
, int maxSubcompactions
);
1592 private native int maxSubcompactions(long handle
);
1593 private native void setMaxBackgroundFlushes(
1594 long handle
, int maxBackgroundFlushes
);
1595 private native int maxBackgroundFlushes(long handle
);
1596 private native void setMaxLogFileSize(long handle
, long maxLogFileSize
)
1597 throws IllegalArgumentException
;
1598 private native long maxLogFileSize(long handle
);
1599 private native void setLogFileTimeToRoll(
1600 long handle
, long logFileTimeToRoll
) throws IllegalArgumentException
;
1601 private native long logFileTimeToRoll(long handle
);
1602 private native void setKeepLogFileNum(long handle
, long keepLogFileNum
)
1603 throws IllegalArgumentException
;
1604 private native long keepLogFileNum(long handle
);
1605 private native void setRecycleLogFileNum(long handle
, long recycleLogFileNum
);
1606 private native long recycleLogFileNum(long handle
);
1607 private native void setMaxManifestFileSize(
1608 long handle
, long maxManifestFileSize
);
1609 private native long maxManifestFileSize(long handle
);
1610 private native void setMaxTableFilesSizeFIFO(
1611 long handle
, long maxTableFilesSize
);
1612 private native long maxTableFilesSizeFIFO(long handle
);
1613 private native void setTableCacheNumshardbits(
1614 long handle
, int tableCacheNumshardbits
);
1615 private native int tableCacheNumshardbits(long handle
);
1616 private native void setWalTtlSeconds(long handle
, long walTtlSeconds
);
1617 private native long walTtlSeconds(long handle
);
1618 private native void setWalSizeLimitMB(long handle
, long sizeLimitMB
);
1619 private native long walSizeLimitMB(long handle
);
1620 private native void setManifestPreallocationSize(
1621 long handle
, long size
) throws IllegalArgumentException
;
1622 private native long manifestPreallocationSize(long handle
);
1623 private native void setUseDirectReads(long handle
, boolean useDirectReads
);
1624 private native boolean useDirectReads(long handle
);
1625 private native void setUseDirectIoForFlushAndCompaction(
1626 long handle
, boolean useDirectIoForFlushAndCompaction
);
1627 private native boolean useDirectIoForFlushAndCompaction(long handle
);
1628 private native void setAllowFAllocate(final long handle
,
1629 final boolean allowFAllocate
);
1630 private native boolean allowFAllocate(final long handle
);
1631 private native void setAllowMmapReads(
1632 long handle
, boolean allowMmapReads
);
1633 private native boolean allowMmapReads(long handle
);
1634 private native void setAllowMmapWrites(
1635 long handle
, boolean allowMmapWrites
);
1636 private native boolean allowMmapWrites(long handle
);
1637 private native void setIsFdCloseOnExec(
1638 long handle
, boolean isFdCloseOnExec
);
1639 private native boolean isFdCloseOnExec(long handle
);
1640 private native void setStatsDumpPeriodSec(
1641 long handle
, int statsDumpPeriodSec
);
1642 private native int statsDumpPeriodSec(long handle
);
1643 private native void setAdviseRandomOnOpen(
1644 long handle
, boolean adviseRandomOnOpen
);
1645 private native boolean adviseRandomOnOpen(long handle
);
1646 private native void setDbWriteBufferSize(final long handle
,
1647 final long dbWriteBufferSize
);
1648 private native long dbWriteBufferSize(final long handle
);
1649 private native void setAccessHintOnCompactionStart(final long handle
,
1650 final byte accessHintOnCompactionStart
);
1651 private native byte accessHintOnCompactionStart(final long handle
);
1652 private native void setNewTableReaderForCompactionInputs(final long handle
,
1653 final boolean newTableReaderForCompactionInputs
);
1654 private native boolean newTableReaderForCompactionInputs(final long handle
);
1655 private native void setCompactionReadaheadSize(final long handle
,
1656 final long compactionReadaheadSize
);
1657 private native long compactionReadaheadSize(final long handle
);
1658 private native void setRandomAccessMaxBufferSize(final long handle
,
1659 final long randomAccessMaxBufferSize
);
1660 private native long randomAccessMaxBufferSize(final long handle
);
1661 private native void setWritableFileMaxBufferSize(final long handle
,
1662 final long writableFileMaxBufferSize
);
1663 private native long writableFileMaxBufferSize(final long handle
);
1664 private native void setUseAdaptiveMutex(
1665 long handle
, boolean useAdaptiveMutex
);
1666 private native boolean useAdaptiveMutex(long handle
);
1667 private native void setBytesPerSync(
1668 long handle
, long bytesPerSync
);
1669 private native long bytesPerSync(long handle
);
1670 private native void setWalBytesPerSync(long handle
, long walBytesPerSync
);
1671 private native long walBytesPerSync(long handle
);
1672 private native void setEnableThreadTracking(long handle
,
1673 boolean enableThreadTracking
);
1674 private native boolean enableThreadTracking(long handle
);
1675 private native void setDelayedWriteRate(long handle
, long delayedWriteRate
);
1676 private native long delayedWriteRate(long handle
);
1677 private native void setAllowConcurrentMemtableWrite(long handle
,
1678 boolean allowConcurrentMemtableWrite
);
1679 private native boolean allowConcurrentMemtableWrite(long handle
);
1680 private native void setEnableWriteThreadAdaptiveYield(long handle
,
1681 boolean enableWriteThreadAdaptiveYield
);
1682 private native boolean enableWriteThreadAdaptiveYield(long handle
);
1683 private native void setWriteThreadMaxYieldUsec(long handle
,
1684 long writeThreadMaxYieldUsec
);
1685 private native long writeThreadMaxYieldUsec(long handle
);
1686 private native void setWriteThreadSlowYieldUsec(long handle
,
1687 long writeThreadSlowYieldUsec
);
1688 private native long writeThreadSlowYieldUsec(long handle
);
1689 private native void setSkipStatsUpdateOnDbOpen(final long handle
,
1690 final boolean skipStatsUpdateOnDbOpen
);
1691 private native boolean skipStatsUpdateOnDbOpen(final long handle
);
1692 private native void setWalRecoveryMode(final long handle
,
1693 final byte walRecoveryMode
);
1694 private native byte walRecoveryMode(final long handle
);
1695 private native void setAllow2pc(final long handle
,
1696 final boolean allow2pc
);
1697 private native boolean allow2pc(final long handle
);
1698 private native void setRowCache(final long handle
,
1699 final long row_cache_handle
);
1700 private native void setFailIfOptionsFileError(final long handle
,
1701 final boolean failIfOptionsFileError
);
1702 private native boolean failIfOptionsFileError(final long handle
);
1703 private native void setDumpMallocStats(final long handle
,
1704 final boolean dumpMallocStats
);
1705 private native boolean dumpMallocStats(final long handle
);
1706 private native void setAvoidFlushDuringRecovery(final long handle
,
1707 final boolean avoidFlushDuringRecovery
);
1708 private native boolean avoidFlushDuringRecovery(final long handle
);
1709 private native void setAvoidFlushDuringShutdown(final long handle
,
1710 final boolean avoidFlushDuringShutdown
);
1711 private native boolean avoidFlushDuringShutdown(final long handle
);
1713 // CF native handles
1714 private native void optimizeForSmallDb(final long handle
);
1715 private native void optimizeForPointLookup(long handle
,
1716 long blockCacheSizeMb
);
1717 private native void optimizeLevelStyleCompaction(long handle
,
1718 long memtableMemoryBudget
);
1719 private native void optimizeUniversalStyleCompaction(long handle
,
1720 long memtableMemoryBudget
);
1721 private native void setComparatorHandle(long handle
, int builtinComparator
);
1722 private native void setComparatorHandle(long optHandle
,
1723 long comparatorHandle
);
1724 private native void setMergeOperatorName(
1725 long handle
, String name
);
1726 private native void setMergeOperator(
1727 long handle
, long mergeOperatorHandle
);
1728 private native void setWriteBufferSize(long handle
, long writeBufferSize
)
1729 throws IllegalArgumentException
;
1730 private native long writeBufferSize(long handle
);
1731 private native void setMaxWriteBufferNumber(
1732 long handle
, int maxWriteBufferNumber
);
1733 private native int maxWriteBufferNumber(long handle
);
1734 private native void setMinWriteBufferNumberToMerge(
1735 long handle
, int minWriteBufferNumberToMerge
);
1736 private native int minWriteBufferNumberToMerge(long handle
);
1737 private native void setCompressionType(long handle
, byte compressionType
);
1738 private native byte compressionType(long handle
);
1739 private native void setCompressionPerLevel(long handle
,
1740 byte[] compressionLevels
);
1741 private native byte[] compressionPerLevel(long handle
);
1742 private native void setBottommostCompressionType(long handle
,
1743 byte bottommostCompressionType
);
1744 private native byte bottommostCompressionType(long handle
);
1745 private native void setCompressionOptions(long handle
,
1746 long compressionOptionsHandle
);
1747 private native void useFixedLengthPrefixExtractor(
1748 long handle
, int prefixLength
);
1749 private native void useCappedPrefixExtractor(
1750 long handle
, int prefixLength
);
1751 private native void setNumLevels(
1752 long handle
, int numLevels
);
1753 private native int numLevels(long handle
);
1754 private native void setLevelZeroFileNumCompactionTrigger(
1755 long handle
, int numFiles
);
1756 private native int levelZeroFileNumCompactionTrigger(long handle
);
1757 private native void setLevelZeroSlowdownWritesTrigger(
1758 long handle
, int numFiles
);
1759 private native int levelZeroSlowdownWritesTrigger(long handle
);
1760 private native void setLevelZeroStopWritesTrigger(
1761 long handle
, int numFiles
);
1762 private native int levelZeroStopWritesTrigger(long handle
);
1763 private native void setTargetFileSizeBase(
1764 long handle
, long targetFileSizeBase
);
1765 private native long targetFileSizeBase(long handle
);
1766 private native void setTargetFileSizeMultiplier(
1767 long handle
, int multiplier
);
1768 private native int targetFileSizeMultiplier(long handle
);
1769 private native void setMaxBytesForLevelBase(
1770 long handle
, long maxBytesForLevelBase
);
1771 private native long maxBytesForLevelBase(long handle
);
1772 private native void setLevelCompactionDynamicLevelBytes(
1773 long handle
, boolean enableLevelCompactionDynamicLevelBytes
);
1774 private native boolean levelCompactionDynamicLevelBytes(
1776 private native void setMaxBytesForLevelMultiplier(long handle
, double multiplier
);
1777 private native double maxBytesForLevelMultiplier(long handle
);
1778 private native void setMaxCompactionBytes(long handle
, long maxCompactionBytes
);
1779 private native long maxCompactionBytes(long handle
);
1780 private native void setArenaBlockSize(
1781 long handle
, long arenaBlockSize
) throws IllegalArgumentException
;
1782 private native long arenaBlockSize(long handle
);
1783 private native void setDisableAutoCompactions(
1784 long handle
, boolean disableAutoCompactions
);
1785 private native boolean disableAutoCompactions(long handle
);
1786 private native void setCompactionStyle(long handle
, byte compactionStyle
);
1787 private native byte compactionStyle(long handle
);
1788 private native void setMaxSequentialSkipInIterations(
1789 long handle
, long maxSequentialSkipInIterations
);
1790 private native long maxSequentialSkipInIterations(long handle
);
1791 private native void setMemTableFactory(long handle
, long factoryHandle
);
1792 private native String
memTableFactoryName(long handle
);
1793 private native void setTableFactory(long handle
, long factoryHandle
);
1794 private native String
tableFactoryName(long handle
);
1795 private native void setInplaceUpdateSupport(
1796 long handle
, boolean inplaceUpdateSupport
);
1797 private native boolean inplaceUpdateSupport(long handle
);
1798 private native void setInplaceUpdateNumLocks(
1799 long handle
, long inplaceUpdateNumLocks
)
1800 throws IllegalArgumentException
;
1801 private native long inplaceUpdateNumLocks(long handle
);
1802 private native void setMemtablePrefixBloomSizeRatio(
1803 long handle
, double memtablePrefixBloomSizeRatio
);
1804 private native double memtablePrefixBloomSizeRatio(long handle
);
1805 private native void setBloomLocality(
1806 long handle
, int bloomLocality
);
1807 private native int bloomLocality(long handle
);
1808 private native void setMaxSuccessiveMerges(
1809 long handle
, long maxSuccessiveMerges
)
1810 throws IllegalArgumentException
;
1811 private native long maxSuccessiveMerges(long handle
);
1812 private native void setOptimizeFiltersForHits(long handle
,
1813 boolean optimizeFiltersForHits
);
1814 private native boolean optimizeFiltersForHits(long handle
);
1815 private native void setMemtableHugePageSize(long handle
,
1816 long memtableHugePageSize
);
1817 private native long memtableHugePageSize(long handle
);
1818 private native void setSoftPendingCompactionBytesLimit(long handle
,
1819 long softPendingCompactionBytesLimit
);
1820 private native long softPendingCompactionBytesLimit(long handle
);
1821 private native void setHardPendingCompactionBytesLimit(long handle
,
1822 long hardPendingCompactionBytesLimit
);
1823 private native long hardPendingCompactionBytesLimit(long handle
);
1824 private native void setLevel0FileNumCompactionTrigger(long handle
,
1825 int level0FileNumCompactionTrigger
);
1826 private native int level0FileNumCompactionTrigger(long handle
);
1827 private native void setLevel0SlowdownWritesTrigger(long handle
,
1828 int level0SlowdownWritesTrigger
);
1829 private native int level0SlowdownWritesTrigger(long handle
);
1830 private native void setLevel0StopWritesTrigger(long handle
,
1831 int level0StopWritesTrigger
);
1832 private native int level0StopWritesTrigger(long handle
);
1833 private native void setMaxBytesForLevelMultiplierAdditional(long handle
,
1834 int[] maxBytesForLevelMultiplierAdditional
);
1835 private native int[] maxBytesForLevelMultiplierAdditional(long handle
);
1836 private native void setParanoidFileChecks(long handle
,
1837 boolean paranoidFileChecks
);
1838 private native boolean paranoidFileChecks(long handle
);
1839 private native void setMaxWriteBufferNumberToMaintain(final long handle
,
1840 final int maxWriteBufferNumberToMaintain
);
1841 private native int maxWriteBufferNumberToMaintain(final long handle
);
1842 private native void setCompactionPriority(final long handle
,
1843 final byte compactionPriority
);
1844 private native byte compactionPriority(final long handle
);
1845 private native void setReportBgIoStats(final long handle
,
1846 final boolean reportBgIoStats
);
1847 private native boolean reportBgIoStats(final long handle
);
1848 private native void setCompactionOptionsUniversal(final long handle
,
1849 final long compactionOptionsUniversalHandle
);
1850 private native void setCompactionOptionsFIFO(final long handle
,
1851 final long compactionOptionsFIFOHandle
);
1852 private native void setForceConsistencyChecks(final long handle
,
1853 final boolean forceConsistencyChecks
);
1854 private native boolean forceConsistencyChecks(final long handle
);
1856 // instance variables
1858 private MemTableConfig memTableConfig_
;
1859 private TableFormatConfig tableFormatConfig_
;
1860 private RateLimiter rateLimiter_
;
1861 private AbstractComparator
<?
extends AbstractSlice
<?
>> comparator_
;
1862 private CompactionOptionsUniversal compactionOptionsUniversal_
;
1863 private CompactionOptionsFIFO compactionOptionsFIFO_
;
1864 private CompressionOptions compressionOptions_
;
1865 private Cache rowCache_
;