@@ -153,6 +153,7 @@ data GlobalOpts = GlobalOpts
153153
154154data SetupOpts = SetupOpts {
155155 bloomFilterAlloc :: ! LSM. BloomFilterAlloc
156+ , writeBufferAlloc :: ! LSM. WriteBufferAlloc
156157 }
157158 deriving stock Show
158159
@@ -178,9 +179,15 @@ data Cmd
178179 deriving stock Show
179180
180181mkTableConfigSetup :: GlobalOpts -> SetupOpts -> LSM. TableConfig -> LSM. TableConfig
181- mkTableConfigSetup GlobalOpts {diskCachePolicy} SetupOpts {bloomFilterAlloc} conf = conf {
182- LSM. confDiskCachePolicy = diskCachePolicy
182+ mkTableConfigSetup GlobalOpts {diskCachePolicy}
183+ SetupOpts {
184+ bloomFilterAlloc,
185+ writeBufferAlloc
186+ } conf =
187+ conf {
188+ LSM. confDiskCachePolicy = diskCachePolicy
183189 , LSM. confBloomFilterAlloc = bloomFilterAlloc
190+ , LSM. confWriteBufferAlloc = writeBufferAlloc
184191 }
185192
186193mkTableConfigRun :: GlobalOpts -> RunOpts -> LSM. TableConfig -> LSM. TableConfig
@@ -239,8 +246,24 @@ cmdP = O.subparser $ mconcat
239246 ]
240247
241248setupOptsP :: O. Parser SetupOpts
242- setupOptsP = pure SetupOpts
243- <*> O. option O. auto (O. long " bloom-filter-alloc" <> O. value (LSM. confBloomFilterAlloc LSM. defaultTableConfig) <> O. showDefault <> O. help " Bloom filter allocation method [AllocFixed n | AllocRequestFPR d]" )
249+ setupOptsP =
250+ pure SetupOpts
251+ <*> O. option
252+ O. auto
253+ (O. long " bloom-filter-alloc" <>
254+ O. value (LSM. confBloomFilterAlloc LSM. defaultTableConfig) <>
255+ O. showDefault <>
256+ O. help " Bloom filter allocation method [AllocFixed n | AllocRequestFPR d]" )
257+
258+ <*> LSM. AllocNumEntries `fmap` O. option
259+ (O. auto)
260+ (O. long " write-buffer-alloc" <>
261+ O. value defaultAllocNumEntries <>
262+ O. showDefault <>
263+ O. help " Write buffer size" )
264+ where
265+ LSM. AllocNumEntries defaultAllocNumEntries =
266+ LSM. confWriteBufferAlloc LSM. defaultTableConfig
244267
245268runOptsP :: O. Parser RunOpts
246269runOptsP = pure RunOpts
0 commit comments