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.
9 * Advanced Column Family Options which are mutable
11 * Taken from include/rocksdb/advanced_options.h
12 * and MutableCFOptions in util/cf_options.h
14 public interface AdvancedMutableColumnFamilyOptionsInterface
15 <T
extends AdvancedMutableColumnFamilyOptionsInterface
> {
18 * The maximum number of write buffers that are built up in memory.
19 * The default is 2, so that when 1 write buffer is being flushed to
20 * storage, new writes can continue to the other write buffer.
23 * @param maxWriteBufferNumber maximum number of write buffers.
24 * @return the instance of the current options.
26 T
setMaxWriteBufferNumber(
27 int maxWriteBufferNumber
);
30 * Returns maximum number of write buffers.
32 * @return maximum number of write buffers.
33 * @see #setMaxWriteBufferNumber(int)
35 int maxWriteBufferNumber();
38 * Number of locks used for inplace update
39 * Default: 10000, if inplace_update_support = true, else 0.
41 * @param inplaceUpdateNumLocks the number of locks used for
43 * @return the reference to the current options.
44 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
45 * while overflowing the underlying platform specific value.
47 T
setInplaceUpdateNumLocks(
48 long inplaceUpdateNumLocks
);
51 * Number of locks used for inplace update
52 * Default: 10000, if inplace_update_support = true, else 0.
54 * @return the number of locks used for inplace update.
56 long inplaceUpdateNumLocks();
59 * if prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0,
60 * create prefix bloom for memtable with the size of
61 * write_buffer_size * memtable_prefix_bloom_size_ratio.
62 * If it is larger than 0.25, it is santinized to 0.25.
64 * Default: 0 (disable)
66 * @param memtablePrefixBloomSizeRatio The ratio
67 * @return the reference to the current options.
69 T
setMemtablePrefixBloomSizeRatio(
70 double memtablePrefixBloomSizeRatio
);
73 * if prefix_extractor is set and memtable_prefix_bloom_size_ratio is not 0,
74 * create prefix bloom for memtable with the size of
75 * write_buffer_size * memtable_prefix_bloom_size_ratio.
76 * If it is larger than 0.25, it is santinized to 0.25.
78 * Default: 0 (disable)
82 double memtablePrefixBloomSizeRatio();
85 * Page size for huge page TLB for bloom in memtable. If ≤ 0, not allocate
86 * from huge page TLB but from malloc.
87 * Need to reserve huge pages for it to be allocated. For example:
88 * sysctl -w vm.nr_hugepages=20
89 * See linux doc Documentation/vm/hugetlbpage.txt
91 * @param memtableHugePageSize The page size of the huge
93 * @return the reference to the current options.
95 T
setMemtableHugePageSize(
96 long memtableHugePageSize
);
99 * Page size for huge page TLB for bloom in memtable. If ≤ 0, not allocate
100 * from huge page TLB but from malloc.
101 * Need to reserve huge pages for it to be allocated. For example:
102 * sysctl -w vm.nr_hugepages=20
103 * See linux doc Documentation/vm/hugetlbpage.txt
105 * @return The page size of the huge page tlb
107 long memtableHugePageSize();
110 * The size of one block in arena memory allocation.
111 * If ≤ 0, a proper value is automatically calculated (usually 1/10 of
112 * writer_buffer_size).
114 * There are two additional restriction of the The specified size:
115 * (1) size should be in the range of [4096, 2 << 30] and
116 * (2) be the multiple of the CPU word (which helps with the memory
119 * We'll automatically check and adjust the size number to make sure it
120 * conforms to the restrictions.
123 * @param arenaBlockSize the size of an arena block
124 * @return the reference to the current options.
125 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
126 * while overflowing the underlying platform specific value.
128 T
setArenaBlockSize(long arenaBlockSize
);
131 * The size of one block in arena memory allocation.
132 * If ≤ 0, a proper value is automatically calculated (usually 1/10 of
133 * writer_buffer_size).
135 * There are two additional restriction of the The specified size:
136 * (1) size should be in the range of [4096, 2 << 30] and
137 * (2) be the multiple of the CPU word (which helps with the memory
140 * We'll automatically check and adjust the size number to make sure it
141 * conforms to the restrictions.
144 * @return the size of an arena block
146 long arenaBlockSize();
149 * Soft limit on number of level-0 files. We start slowing down writes at this
150 * point. A value < 0 means that no writing slow down will be triggered by
151 * number of files in level-0.
153 * @param level0SlowdownWritesTrigger The soft limit on the number of
155 * @return the reference to the current options.
157 T
setLevel0SlowdownWritesTrigger(
158 int level0SlowdownWritesTrigger
);
161 * Soft limit on number of level-0 files. We start slowing down writes at this
162 * point. A value < 0 means that no writing slow down will be triggered by
163 * number of files in level-0.
165 * @return The soft limit on the number of
168 int level0SlowdownWritesTrigger();
171 * Maximum number of level-0 files. We stop writes at this point.
173 * @param level0StopWritesTrigger The maximum number of level-0 files
174 * @return the reference to the current options.
176 T
setLevel0StopWritesTrigger(
177 int level0StopWritesTrigger
);
180 * Maximum number of level-0 files. We stop writes at this point.
182 * @return The maximum number of level-0 files
184 int level0StopWritesTrigger();
187 * The target file size for compaction.
188 * This targetFileSizeBase determines a level-1 file size.
189 * Target file size for level L can be calculated by
190 * targetFileSizeBase * (targetFileSizeMultiplier ^ (L-1))
191 * For example, if targetFileSizeBase is 2MB and
192 * target_file_size_multiplier is 10, then each file on level-1 will
193 * be 2MB, and each file on level 2 will be 20MB,
194 * and each file on level-3 will be 200MB.
195 * by default targetFileSizeBase is 2MB.
197 * @param targetFileSizeBase the target size of a level-0 file.
198 * @return the reference to the current options.
200 * @see #setTargetFileSizeMultiplier(int)
202 T
setTargetFileSizeBase(
203 long targetFileSizeBase
);
206 * The target file size for compaction.
207 * This targetFileSizeBase determines a level-1 file size.
208 * Target file size for level L can be calculated by
209 * targetFileSizeBase * (targetFileSizeMultiplier ^ (L-1))
210 * For example, if targetFileSizeBase is 2MB and
211 * target_file_size_multiplier is 10, then each file on level-1 will
212 * be 2MB, and each file on level 2 will be 20MB,
213 * and each file on level-3 will be 200MB.
214 * by default targetFileSizeBase is 2MB.
216 * @return the target size of a level-0 file.
218 * @see #targetFileSizeMultiplier()
220 long targetFileSizeBase();
223 * targetFileSizeMultiplier defines the size ratio between a
224 * level-L file and level-(L+1) file.
225 * By default target_file_size_multiplier is 1, meaning
226 * files in different levels have the same target.
228 * @param multiplier the size ratio between a level-(L+1) file
230 * @return the reference to the current options.
232 T
setTargetFileSizeMultiplier(
236 * targetFileSizeMultiplier defines the size ratio between a
237 * level-(L+1) file and level-L file.
238 * By default targetFileSizeMultiplier is 1, meaning
239 * files in different levels have the same target.
241 * @return the size ratio between a level-(L+1) file and level-L file.
243 int targetFileSizeMultiplier();
246 * The ratio between the total size of level-(L+1) files and the total
247 * size of level-L files for all L.
250 * @param multiplier the ratio between the total size of level-(L+1)
251 * files and the total size of level-L files for all L.
252 * @return the reference to the current options.
254 * See {@link MutableColumnFamilyOptionsInterface#setMaxBytesForLevelBase(long)}
256 T
setMaxBytesForLevelMultiplier(double multiplier
);
259 * The ratio between the total size of level-(L+1) files and the total
260 * size of level-L files for all L.
263 * @return the ratio between the total size of level-(L+1) files and
264 * the total size of level-L files for all L.
266 * See {@link MutableColumnFamilyOptionsInterface#maxBytesForLevelBase()}
268 double maxBytesForLevelMultiplier();
271 * Different max-size multipliers for different levels.
272 * These are multiplied by max_bytes_for_level_multiplier to arrive
273 * at the max-size of each level.
277 * @param maxBytesForLevelMultiplierAdditional The max-size multipliers
279 * @return the reference to the current options.
281 T
setMaxBytesForLevelMultiplierAdditional(
282 int[] maxBytesForLevelMultiplierAdditional
);
285 * Different max-size multipliers for different levels.
286 * These are multiplied by max_bytes_for_level_multiplier to arrive
287 * at the max-size of each level.
291 * @return The max-size multipliers for each level
293 int[] maxBytesForLevelMultiplierAdditional();
296 * All writes will be slowed down to at least delayed_write_rate if estimated
297 * bytes needed to be compaction exceed this threshold.
301 * @param softPendingCompactionBytesLimit The soft limit to impose on
303 * @return the reference to the current options.
305 T
setSoftPendingCompactionBytesLimit(
306 long softPendingCompactionBytesLimit
);
309 * All writes will be slowed down to at least delayed_write_rate if estimated
310 * bytes needed to be compaction exceed this threshold.
314 * @return The soft limit to impose on compaction
316 long softPendingCompactionBytesLimit();
319 * All writes are stopped if estimated bytes needed to be compaction exceed
324 * @param hardPendingCompactionBytesLimit The hard limit to impose on
326 * @return the reference to the current options.
328 T
setHardPendingCompactionBytesLimit(
329 long hardPendingCompactionBytesLimit
);
332 * All writes are stopped if estimated bytes needed to be compaction exceed
337 * @return The hard limit to impose on compaction
339 long hardPendingCompactionBytesLimit();
342 * An iteration->Next() sequentially skips over keys with the same
343 * user-key unless this option is set. This number specifies the number
344 * of keys (with the same userkey) that will be sequentially
345 * skipped before a reseek is issued.
348 * @param maxSequentialSkipInIterations the number of keys could
349 * be skipped in a iteration.
350 * @return the reference to the current options.
352 T
setMaxSequentialSkipInIterations(
353 long maxSequentialSkipInIterations
);
356 * An iteration->Next() sequentially skips over keys with the same
357 * user-key unless this option is set. This number specifies the number
358 * of keys (with the same userkey) that will be sequentially
359 * skipped before a reseek is issued.
362 * @return the number of keys could be skipped in a iteration.
364 long maxSequentialSkipInIterations();
367 * Maximum number of successive merge operations on a key in the memtable.
369 * When a merge operation is added to the memtable and the maximum number of
370 * successive merges is reached, the value of the key will be calculated and
371 * inserted into the memtable instead of the merge operation. This will
372 * ensure that there are never more than max_successive_merges merge
373 * operations in the memtable.
375 * Default: 0 (disabled)
377 * @param maxSuccessiveMerges the maximum number of successive merges.
378 * @return the reference to the current options.
379 * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
380 * while overflowing the underlying platform specific value.
382 T
setMaxSuccessiveMerges(
383 long maxSuccessiveMerges
);
386 * Maximum number of successive merge operations on a key in the memtable.
388 * When a merge operation is added to the memtable and the maximum number of
389 * successive merges is reached, the value of the key will be calculated and
390 * inserted into the memtable instead of the merge operation. This will
391 * ensure that there are never more than max_successive_merges merge
392 * operations in the memtable.
394 * Default: 0 (disabled)
396 * @return the maximum number of successive merges.
398 long maxSuccessiveMerges();
401 * After writing every SST file, reopen it and read all the keys.
405 * @param paranoidFileChecks true to enable paranoid file checks
406 * @return the reference to the current options.
408 T
setParanoidFileChecks(
409 boolean paranoidFileChecks
);
412 * After writing every SST file, reopen it and read all the keys.
416 * @return true if paranoid file checks are enabled
418 boolean paranoidFileChecks();
421 * Measure IO stats in compactions and flushes, if true.
425 * @param reportBgIoStats true to enable reporting
426 * @return the reference to the current options.
428 T
setReportBgIoStats(
429 boolean reportBgIoStats
);
432 * Determine whether IO stats in compactions and flushes are being measured
434 * @return true if reporting is enabled
436 boolean reportBgIoStats();