From d03273fa3ea801c911334438e57a9d959215d836 Mon Sep 17 00:00:00 2001 From: voidlizard Date: Mon, 26 May 2025 09:14:18 +0300 Subject: [PATCH] wip --- hbs2-log-structured/lib/HBS2/Data/Log/Structured/NCQ.hs | 4 +++- hbs2-storage-ncq/lib/HBS2/Storage/NCQ.hs | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hbs2-log-structured/lib/HBS2/Data/Log/Structured/NCQ.hs b/hbs2-log-structured/lib/HBS2/Data/Log/Structured/NCQ.hs index 466dd3f3..4bb8dd42 100644 --- a/hbs2-log-structured/lib/HBS2/Data/Log/Structured/NCQ.hs +++ b/hbs2-log-structured/lib/HBS2/Data/Log/Structured/NCQ.hs @@ -214,7 +214,9 @@ nwayWriteBatch :: MonadUnliftIO m -> [(ByteString, ByteString)] -> m FilePath -nwayWriteBatch nwa@NWayHashAlloc{..} path tpl items = do +nwayWriteBatch nwa@NWayHashAlloc{..} path tpl items' = do + + let items = HM.fromList items' & HM.toList let ks = nwayAllocKeySize diff --git a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ.hs b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ.hs index 54a6a22f..753dcbb5 100644 --- a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ.hs +++ b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ.hs @@ -429,7 +429,7 @@ ncqStorageRun ncq@NCQStorage{..} = flip runContT pure do cap <- getNumCapabilities reader <- ContT $ withAsync $ untilStopped do - debug "I'm READER THREAD" + trace "I'm READER THREAD" reqs <- atomically do xs <- stateTVar ncqCurrentReadReq (Seq.splitAt cap) @@ -438,7 +438,8 @@ ncqStorageRun ncq@NCQStorage{..} = flip runContT pure do for_ reqs $ \(fd,off,l,answ) -> liftIO do - debug $ "READER: PROCEED REQUEST" <+> viaShow fd <+> pretty off + -- FIXME: probe-requests-count + trace $ "READER: PROCEED REQUEST" <+> viaShow fd <+> pretty off atomically $ modifyTVar ncqCurrentUsage (IntMap.adjust pred (fromIntegral fd)) fdSeek fd AbsoluteSeek (fromIntegral $ 4 + 32 + off) bs <- Posix.fdRead fd (fromIntegral l)