@@ -196,6 +196,7 @@ mkTableConfigRun GlobalOpts{diskCachePolicy} RunOpts {mode} conf =
196196 Sequential -> LSM. confMergeBatchSize conf
197197 Pipelined -> LSM. MergeBatchSize 1
198198 LookupOnly -> LSM. confMergeBatchSize conf
199+ UpdateOnly -> LSM. confMergeBatchSize conf
199200 }
200201
201202mkTableConfigOverride :: GlobalOpts -> RunOpts -> LSM. TableConfigOverride
@@ -207,6 +208,7 @@ mkTableConfigOverride GlobalOpts{diskCachePolicy} RunOpts {mode} =
207208 Sequential -> Nothing
208209 Pipelined -> Just $ LSM. MergeBatchSize 1
209210 LookupOnly -> Nothing
211+ UpdateOnly -> Nothing
210212 }
211213
212214mkTracer :: GlobalOpts -> Tracer IO LSM. LSMTreeTrace
@@ -273,7 +275,7 @@ runOptsP = pure RunOpts
273275 <*> O. switch (O. long " check" <> O. help " Check generated key distribution" )
274276 <*> O. option O. auto (O. long " seed" <> O. value 1337 <> O. showDefault <> O. help " Random seed" )
275277 <*> O. option O. auto (O. long " mode" <> O. value Sequential <> O. showDefault
276- <> O. help " Mode [Sequential | Pipelined | LookupOnly]" )
278+ <> O. help " Mode [Sequential | Pipelined | LookupOnly | UpdateOnly ]" )
277279
278280-- | The run mode affects the method of performing
279281data RunMode =
@@ -285,6 +287,9 @@ data RunMode =
285287 -- | Use lookup-only sequential mode: like sequential mode, but only perform
286288 -- the lookups and not the updates.
287289 | LookupOnly
290+ -- | Use update-only sequential mode: like sequential mode, but only perform
291+ -- the updates and not the lookups.
292+ | UpdateOnly
288293 deriving stock (Show , Eq , Read )
289294
290295deriving stock instance Read LSM. DiskCachePolicy
@@ -628,7 +633,7 @@ doRun gopts opts =
628633 checkvar <- newIORef $ pureReference
629634 (initialSize gopts) (batchSize opts)
630635 (batchCount opts) (seed opts)
631- let fcheck | not (check opts) = \ _ _ -> pure ()
636+ let fcheck | not (check opts) || mode opts == UpdateOnly = \ _ _ -> pure ()
632637 | otherwise = \ b y -> do
633638 (x: xs) <- readIORef checkvar
634639 unless (x == y) $
@@ -639,6 +644,7 @@ doRun gopts opts =
639644 Sequential -> sequentialIterations h
640645 Pipelined -> pipelinedIterations h
641646 LookupOnly -> sequentialIterationsLO
647+ UpdateOnly -> sequentialIterationsUO
642648 ! progressInterval = max 1 ((batchCount opts) `div` 100 )
643649 madeProgress b = b `mod` progressInterval == 0
644650 (time, _, _) <- timed_ $ do
@@ -688,7 +694,6 @@ sequentialIteration h output !initialSize !batchSize !tbl !b !g =
688694 -- continue to the next batch
689695 pure g'
690696
691-
692697sequentialIterations :: LatencyHandle
693698 -> (Int -> LookupResults -> IO () )
694699 -> Int -> Int -> Int -> Word64
@@ -730,6 +735,38 @@ sequentialIterationsLO output !initialSize !batchSize !batchCount !seed !tbl =
730735 where
731736 g0 = initGen initialSize batchSize batchCount seed
732737
738+ {-# INLINE sequentialIterationUO #-}
739+ sequentialIterationUO ::
740+ (Int -> LookupResults -> IO () )
741+ -> Int
742+ -> Int
743+ -> LSM. Table IO K V B
744+ -> Int
745+ -> MCG. MCG
746+ -> IO MCG. MCG
747+ sequentialIterationUO output ! initialSize ! batchSize ! tbl ! b ! g = do
748+ let (! g', _ls, is) = generateBatch initialSize batchSize g b
749+
750+ -- lookups
751+ output b V. empty
752+
753+ -- deletes and inserts
754+ _ <- LSM. updates tbl is
755+
756+ -- continue to the next batch
757+ pure g'
758+
759+ sequentialIterationsUO ::
760+ (Int -> LookupResults -> IO () )
761+ -> Int -> Int -> Int -> Word64
762+ -> LSM. Table IO K V B
763+ -> IO ()
764+ sequentialIterationsUO output ! initialSize ! batchSize ! batchCount ! seed ! tbl = do
765+ void $ forFoldM_ g0 [ 0 .. batchCount - 1 ] $ \ b g ->
766+ sequentialIterationUO output initialSize batchSize tbl b g
767+ where
768+ g0 = initGen initialSize batchSize batchCount seed
769+
733770-------------------------------------------------------------------------------
734771-- pipelined
735772-------------------------------------------------------------------------------
0 commit comments