@@ -44,28 +44,25 @@ using std::shared_ptr;
44
44
enum CompressionType : char {
45
45
// NOTE: do not change the values of existing entries, as these are
46
46
// part of the persistent format on disk.
47
- kNoCompression = 0x0 ,
47
+ kNoCompression = 0x0 ,
48
48
kSnappyCompression = 0x1 ,
49
49
kZlibCompression = 0x2 ,
50
50
kBZip2Compression = 0x3
51
51
};
52
52
53
53
enum CompactionStyle : char {
54
- kCompactionStyleLevel = 0x0 , // level based compaction style
55
- kCompactionStyleUniversal = 0x1 // Universal compaction style
54
+ kCompactionStyleLevel = 0x0 , // level based compaction style
55
+ kCompactionStyleUniversal = 0x1 // Universal compaction style
56
56
};
57
57
58
58
// Compression options for different compression algorithms like Zlib
59
59
struct CompressionOptions {
60
60
int window_bits;
61
61
int level;
62
62
int strategy;
63
- CompressionOptions ():window_bits(-14 ),
64
- level (-1 ),
65
- strategy(0 ){}
66
- CompressionOptions (int wbits, int lev, int strategy):window_bits(wbits),
67
- level(lev),
68
- strategy(strategy){}
63
+ CompressionOptions () : window_bits(-14 ), level(-1 ), strategy(0 ) {}
64
+ CompressionOptions (int wbits, int lev, int strategy)
65
+ : window_bits(wbits), level(lev), strategy(strategy) {}
69
66
};
70
67
71
68
// Options to control the behavior of a database (passed to DB::Open)
@@ -216,7 +213,6 @@ struct Options {
216
213
// Default: 16
217
214
int block_restart_interval;
218
215
219
-
220
216
// Compress blocks using the specified compression algorithm. This
221
217
// parameter can be changed dynamically.
222
218
//
@@ -247,7 +243,7 @@ struct Options {
247
243
// java/C api hard to construct.
248
244
std::vector<CompressionType> compression_per_level;
249
245
250
- // different options for compression algorithms
246
+ // different options for compression algorithms
251
247
CompressionOptions compression_opts;
252
248
253
249
// If non-nullptr, use the specified filter policy to reduce disk reads.
@@ -326,7 +322,6 @@ struct Options {
326
322
// will be 20MB, total file size for level-2 will be 200MB,
327
323
// and total file size for level-3 will be 2GB.
328
324
329
-
330
325
// by default 'max_bytes_for_level_base' is 10MB.
331
326
uint64_t max_bytes_for_level_base;
332
327
// by default 'max_bytes_for_level_base' is 10.
@@ -484,10 +479,19 @@ struct Options {
484
479
// order.
485
480
int table_cache_remove_scan_count_limit;
486
481
487
- // size of one block in arena memory allocation.
488
- // If <= 0, a proper value is automatically calculated (usually 1/10 of
482
+ // Size of one block in arena memory allocation.
483
+ //
484
+ // If <= 0, a proper value is automatically calculated (usually about 1/10 of
489
485
// writer_buffer_size).
490
486
//
487
+ // There are two additonal restriction of the The specified size:
488
+ // (1) size should be in the range of [4096, 2 << 30] and
489
+ // (2) be the multiple of the CPU word (which helps with the memory
490
+ // alignment).
491
+ //
492
+ // We'll automatically check and adjust the size number to make sure it
493
+ // conforms to the restrictions.
494
+ //
491
495
// Default: 0
492
496
size_t arena_block_size;
493
497
@@ -572,7 +576,12 @@ struct Options {
572
576
// Specify the file access pattern once a compaction is started.
573
577
// It will be applied to all input files of a compaction.
574
578
// Default: NORMAL
575
- enum { NONE, NORMAL, SEQUENTIAL, WILLNEED } access_hint_on_compaction_start;
579
+ enum {
580
+ NONE,
581
+ NORMAL,
582
+ SEQUENTIAL,
583
+ WILLNEED
584
+ } access_hint_on_compaction_start;
576
585
577
586
// Use adaptive mutex, which spins in the user space before resorting
578
587
// to kernel. This could reduce context switch when the mutex is not
@@ -622,7 +631,7 @@ struct Options {
622
631
// Default: emtpy vector -- no user-defined statistics collection will be
623
632
// performed.
624
633
std::vector<std::shared_ptr<TablePropertiesCollector>>
625
- table_properties_collectors;
634
+ table_properties_collectors;
626
635
627
636
// Allows thread-safe inplace updates. Requires Updates iff
628
637
// * key exists in current memtable
@@ -644,7 +653,7 @@ struct Options {
644
653
// the block cache. It will not page in data from the OS cache or data that
645
654
// resides in storage.
646
655
enum ReadTier {
647
- kReadAllTier = 0x0 , // data in memtable, block cache, OS cache or storage
656
+ kReadAllTier = 0x0 , // data in memtable, block cache, OS cache or storage
648
657
kBlockCacheTier = 0x1 // data in memtable or block cache
649
658
};
650
659
@@ -697,13 +706,14 @@ struct ReadOptions {
697
706
prefix_seek(false ),
698
707
snapshot(nullptr ),
699
708
prefix(nullptr ),
700
- read_tier(kReadAllTier ) {
701
- }
702
- ReadOptions (bool cksum, bool cache) :
703
- verify_checksums(cksum), fill_cache(cache),
704
- prefix_seek(false ), snapshot(nullptr ), prefix(nullptr ),
705
- read_tier(kReadAllTier ) {
706
- }
709
+ read_tier(kReadAllTier ) {}
710
+ ReadOptions (bool cksum, bool cache)
711
+ : verify_checksums(cksum),
712
+ fill_cache(cache),
713
+ prefix_seek(false ),
714
+ snapshot(nullptr ),
715
+ prefix(nullptr ),
716
+ read_tier(kReadAllTier ) {}
707
717
};
708
718
709
719
// Options that control write operations
@@ -730,10 +740,7 @@ struct WriteOptions {
730
740
// and the write may got lost after a crash.
731
741
bool disableWAL;
732
742
733
- WriteOptions ()
734
- : sync(false ),
735
- disableWAL (false ) {
736
- }
743
+ WriteOptions () : sync(false ), disableWAL(false ) {}
737
744
};
738
745
739
746
// Options that control flush operations
@@ -742,9 +749,7 @@ struct FlushOptions {
742
749
// Default: true
743
750
bool wait;
744
751
745
- FlushOptions ()
746
- : wait(true ) {
747
- }
752
+ FlushOptions () : wait(true ) {}
748
753
};
749
754
750
755
} // namespace rocksdb
0 commit comments