@@ -191,7 +191,22 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
191191 if extraOptions .MaxConcurrentCompactions == nil {
192192 extraOptions .MaxConcurrentCompactions = func () int { return runtime .NumCPU () }
193193 }
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+ }
195210 opt := & pebble.Options {
196211 // Pebble has a single combined cache area and the write
197212 // 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
216231
217232 // Per-level extraOptions. Options for at least one level must be specified. The
218233 // 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 ,
228235 ReadOnly : readonly ,
229236 EventListener : & pebble.EventListener {
230237 CompactionBegin : db .onCompactionBegin ,
0 commit comments