@@ -191,7 +191,22 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
191
191
if extraOptions .MaxConcurrentCompactions == nil {
192
192
extraOptions .MaxConcurrentCompactions = func () int { return runtime .NumCPU () }
193
193
}
194
-
194
+ var levels []pebble.LevelOptions
195
+ if len (extraOptions .Levels ) == 0 {
196
+ levels = []pebble.LevelOptions {
197
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
198
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
199
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
200
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
201
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
202
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
203
+ {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
204
+ }
205
+ } else {
206
+ for _ , level := range extraOptions .Levels {
207
+ levels = append (levels , pebble.LevelOptions {TargetFileSize : level .TargetFileSize , FilterPolicy : bloom .FilterPolicy (10 )})
208
+ }
209
+ }
195
210
opt := & pebble.Options {
196
211
// Pebble has a single combined cache area and the write
197
212
// buffers are taken from this too. Assign all available
@@ -216,15 +231,7 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
216
231
217
232
// Per-level extraOptions. Options for at least one level must be specified. The
218
233
// extraOptions for the last level are used for all subsequent levels.
219
- Levels : []pebble.LevelOptions {
220
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
221
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
222
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
223
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
224
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
225
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
226
- {TargetFileSize : 2 * 1024 * 1024 , FilterPolicy : bloom .FilterPolicy (10 )},
227
- },
234
+ Levels : levels ,
228
235
ReadOnly : readonly ,
229
236
EventListener : & pebble.EventListener {
230
237
CompactionBegin : db .onCompactionBegin ,
0 commit comments