Skip to content

Commit 77c4bb4

Browse files
committed
check invariant after supplying credits
1 parent 6f15601 commit 77c4bb4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prototypes/ScheduledMerges.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,12 @@ update tr (LSMHandle scr lsmr) k op = do
440440
LSMContent wb ls <- readSTRef lsmr
441441
modifySTRef' scr (+1)
442442
supplyCredits 1 ls
443+
invariant ls
443444
let wb' = Map.insert k op wb
444445
if bufferSize wb' >= maxBufferSize
445446
then do
446447
ls' <- increment tr sc (bufferToRun wb') ls
448+
invariant ls'
447449
writeSTRef lsmr (LSMContent Map.empty ls')
448450
else
449451
writeSTRef lsmr (LSMContent wb' ls)
@@ -531,9 +533,7 @@ data EventDetail =
531533
increment :: forall s. Tracer (ST s) Event
532534
-> Counter -> Run -> Levels s -> ST s (Levels s)
533535
increment tr sc = \r ls -> do
534-
ls' <- go 1 [r] ls
535-
invariant ls'
536-
return ls'
536+
go 1 [r] ls
537537
where
538538
go :: Int -> [Run] -> Levels s -> ST s (Levels s)
539539
go !ln incoming [] = do

0 commit comments

Comments
 (0)