From 0ac052c63421fa7c2504eb7a2cf9e339b33e6b77 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Wed, 23 Jul 2025 15:00:59 +0300 Subject: [PATCH] wip --- hbs2-storage-ncq/lib/HBS2/Storage/NCQ2.hs | 2 +- hbs2-storage-ncq/lib/HBS2/Storage/NCQ2/Internal/Probes.hs | 7 ++++--- hbs2-tests/test/TestNCQ.hs | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2.hs b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2.hs index dfb1827d..57eefdb5 100644 --- a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2.hs +++ b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2.hs @@ -89,7 +89,7 @@ ncqStorageOpen2 fp upd = do let ncqWriteBlock = max 128 $ ncqWriteQLen `div` 2 let ncqMaxCached = 128 let ncqIdleThrsh = 50.00 - let ncqPostponeMerge = 600.00 + let ncqPostponeMerge = 30.00 let ncqPostponeSweep = 2 * ncqPostponeMerge let ncqLuckyNum = 2 diff --git a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2/Internal/Probes.hs b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2/Internal/Probes.hs index e5c53f32..aaf24a15 100644 --- a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2/Internal/Probes.hs +++ b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ2/Internal/Probes.hs @@ -57,9 +57,10 @@ ncqKeyNumIntersectionProbe me@NCQStorage2{..} = useVersion me $ const $ void $ r n <- liftIO $ do ref <- newTVarIO 0 - nwayHashScanAll n1 bs1 $ \_ k _ -> do - here <- ncqLookupIndex (coerce k) (bs2,n2) - when (isJust here) $ atomically $ modifyTVar' ref (+1) + nwayHashScanAll n1 bs1 $ \_ k _ -> when (k /= ncqEmptyKey ) do + here <- ncqLookupIndex (coerce k) (bs2,n2) + when (isJust here) $ atomically $ modifyTVar' ref (+1) + readTVarIO ref debug $ yellow "ncqKeyNumIntersectionProbe" diff --git a/hbs2-tests/test/TestNCQ.hs b/hbs2-tests/test/TestNCQ.hs index 0b071205..a116f46f 100644 --- a/hbs2-tests/test/TestNCQ.hs +++ b/hbs2-tests/test/TestNCQ.hs @@ -1787,8 +1787,8 @@ main = do runTest $ \TestEnv{..} -> do g <- liftIO MWC.createSystemRandom let dir = testEnvDir - let n = 30000 - let p = 0.25 + let n = 100000 + let p = 0.45 sizes <- replicateM n (uniformRM (4096, 256*1024) g) @@ -1798,7 +1798,7 @@ main = do notice $ "write" <+> pretty (List.length sizes) <+> pretty "random blocks" ContT $ withAsync $ forever do - pause @'Seconds 0.5 + pause @'Seconds 0.10 p1 <- uniformRM (0,1) g when (p1 <= p) do hss <- readTVarIO hashes