@@ -10,6 +10,7 @@ use super::refcount;
10
10
// took from
11
11
// https://github.com/tikv/tikv/blob/d60c7fb6f3657dc5f3c83b0e3fc6ac75636e1a48/src/config/mod.rs#L170
12
12
// todo: need to benchmark and update if it's not optimal
13
+ const DEFAULT_BLOB_FILE_SIZE : u64 = bytesize:: GIB ;
13
14
const DEFAULT_MIN_BLOB_SIZE : u64 = bytesize:: KIB * 32 ;
14
15
15
16
/// Stores generic node parameters
@@ -49,7 +50,12 @@ impl ColumnFamilyOptions<Caches> for ArchiveBlockIds {
49
50
opts. set_merge_operator_associative ( "archive_data_merge" , archive_data_merge) ;
50
51
// data is hardly compressible and dataset is small
51
52
opts. set_compression_type ( DBCompressionType :: None ) ;
52
- with_blob_db ( opts, DEFAULT_MIN_BLOB_SIZE , DBCompressionType :: None ) ;
53
+ with_blob_db (
54
+ opts,
55
+ DEFAULT_BLOB_FILE_SIZE ,
56
+ DEFAULT_MIN_BLOB_SIZE ,
57
+ DBCompressionType :: None ,
58
+ ) ;
53
59
}
54
60
}
55
61
@@ -73,7 +79,12 @@ impl ColumnFamilyOptions<Caches> for Archives {
73
79
74
80
// data is already compressed
75
81
opts. set_compression_type ( DBCompressionType :: None ) ;
76
- with_blob_db ( opts, DEFAULT_MIN_BLOB_SIZE , DBCompressionType :: None ) ;
82
+ with_blob_db (
83
+ opts,
84
+ DEFAULT_BLOB_FILE_SIZE ,
85
+ DEFAULT_MIN_BLOB_SIZE ,
86
+ DBCompressionType :: None ,
87
+ ) ;
77
88
78
89
opts. set_max_write_buffer_number ( 8 ) ; // 8 * 512MB = 4GB;
79
90
opts. set_write_buffer_size ( 512 * 1024 * 1024 ) ; // 512 per memtable
@@ -165,7 +176,12 @@ impl ColumnFamilyOptions<Caches> for PackageEntries {
165
176
opts. set_write_buffer_size ( 512 * 1024 * 1024 ) ; // 512 per memtable
166
177
opts. set_min_write_buffer_number_to_merge ( 2 ) ; // allow early flush
167
178
168
- with_blob_db ( opts, DEFAULT_MIN_BLOB_SIZE , DBCompressionType :: Zstd ) ;
179
+ with_blob_db (
180
+ opts,
181
+ DEFAULT_BLOB_FILE_SIZE ,
182
+ DEFAULT_MIN_BLOB_SIZE ,
183
+ DBCompressionType :: Zstd ,
184
+ ) ;
169
185
170
186
// This flag specifies that the implementation should optimize the filters
171
187
// mainly for cases where keys are found rather than also optimize for keys
@@ -204,7 +220,12 @@ impl ColumnFamilyOptions<Caches> for BlockDataEntries {
204
220
205
221
// data is already compressed
206
222
opts. set_compression_type ( DBCompressionType :: None ) ;
207
- with_blob_db ( opts, DEFAULT_MIN_BLOB_SIZE , DBCompressionType :: None ) ;
223
+ with_blob_db (
224
+ opts,
225
+ DEFAULT_BLOB_FILE_SIZE ,
226
+ DEFAULT_MIN_BLOB_SIZE ,
227
+ DBCompressionType :: None ,
228
+ ) ;
208
229
}
209
230
}
210
231
@@ -405,7 +426,12 @@ impl ColumnFamily for ShardInternalMessages {
405
426
impl ColumnFamilyOptions < Caches > for ShardInternalMessages {
406
427
fn options ( opts : & mut Options , caches : & mut Caches ) {
407
428
internal_queue_options ( opts, caches) ;
408
- with_blob_db ( opts, DEFAULT_MIN_BLOB_SIZE , DBCompressionType :: None ) ;
429
+ with_blob_db (
430
+ opts,
431
+ DEFAULT_BLOB_FILE_SIZE ,
432
+ DEFAULT_MIN_BLOB_SIZE ,
433
+ DBCompressionType :: None ,
434
+ ) ;
409
435
}
410
436
}
411
437
@@ -665,7 +691,12 @@ impl ColumnFamilyOptions<Caches> for Transactions {
665
691
fn options ( opts : & mut Options , caches : & mut Caches ) {
666
692
zstd_block_based_table_factory ( opts, caches) ;
667
693
opts. set_compression_type ( DBCompressionType :: Zstd ) ;
668
- with_blob_db ( opts, DEFAULT_MIN_BLOB_SIZE , DBCompressionType :: Zstd ) ;
694
+ with_blob_db (
695
+ opts,
696
+ DEFAULT_BLOB_FILE_SIZE ,
697
+ DEFAULT_MIN_BLOB_SIZE ,
698
+ DBCompressionType :: Zstd ,
699
+ ) ;
669
700
}
670
701
}
671
702
@@ -807,10 +838,17 @@ fn zstd_block_based_table_factory(opts: &mut Options, caches: &Caches) {
807
838
opts. set_compression_type ( DBCompressionType :: Zstd ) ;
808
839
}
809
840
810
- fn with_blob_db ( opts : & mut Options , min_value_size : u64 , compression_type : DBCompressionType ) {
841
+ fn with_blob_db (
842
+ opts : & mut Options ,
843
+ file_size : u64 ,
844
+ min_value_size : u64 ,
845
+ compression_type : DBCompressionType ,
846
+ ) {
811
847
opts. set_enable_blob_files ( true ) ;
848
+ opts. set_blob_file_size ( file_size) ;
849
+ opts. set_min_blob_size ( min_value_size) ;
850
+
812
851
opts. set_enable_blob_gc ( true ) ;
813
852
814
- opts. set_min_blob_size ( min_value_size) ;
815
853
opts. set_blob_compression_type ( compression_type) ;
816
854
}
0 commit comments