Skip to content

Commit

Permalink
undo redundant logging
Browse files Browse the repository at this point in the history
  • Loading branch information
chessai committed Jul 10, 2023
1 parent ffc69fe commit 9160de6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
25 changes: 4 additions & 21 deletions src/Chainweb/Pact/Backend/RelationalCheckpointer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import Control.Monad
import Control.Monad.Catch
import Control.Monad.IO.Class
import Control.Monad.State (gets)
import GHC.Stack (HasCallStack, prettyCallStack, withFrozenCallStack, callStack)

import Data.ByteString (ByteString, intercalate)
import qualified Data.ByteString.Short as BS
Expand Down Expand Up @@ -68,7 +67,6 @@ import Chainweb.Pact.Backend.Types
import Chainweb.Pact.Backend.Utils
import Chainweb.Pact.Backend.DbCache (updateCacheStats)
import Chainweb.Pact.Service.Types
import Chainweb.Pact.Types (logError_)
import Chainweb.Utils
import Chainweb.Utils.Serialization
import Chainweb.Version
Expand Down Expand Up @@ -125,7 +123,7 @@ initRelationalCheckpointer' bstate sqlenv loggr v cid = do
{ _cpeCheckpointer =
Checkpointer
{
_cpRestore = doRestore loggr v cid db
_cpRestore = doRestore v cid db
, _cpSave = doSave db
, _cpDiscard = doDiscard db
, _cpGetLatestBlock = doGetLatest db
Expand All @@ -144,8 +142,8 @@ initRelationalCheckpointer' bstate sqlenv loggr v cid = do

type Db = MVar (BlockEnv SQLiteEnv)

doRestore :: HasCallStack => Logger -> ChainwebVersion -> ChainId -> Db -> Maybe (BlockHeight, ParentHash) -> IO PactDbEnv'
doRestore _ v cid dbenv (Just (bh, hash)) = runBlockEnv dbenv $ do
doRestore :: ChainwebVersion -> ChainId -> Db -> Maybe (BlockHeight, ParentHash) -> IO PactDbEnv'
doRestore v cid dbenv (Just (bh, hash)) = runBlockEnv dbenv $ do
setModuleNameFix
setSortedKeys
setLowerCaseTables
Expand All @@ -169,22 +167,7 @@ doRestore _ _ dbenv Nothing = runBlockEnv dbenv $ do
exec_ db "DELETE FROM [SYS:Pacts];"
tblNames <- qry_ db "SELECT tablename FROM VersionedTableCreation;" [RText]
forM_ tblNames $ \tbl -> case tbl of
[SText t] -> do
let tblname = case t of { Utf8 x -> T.decodeUtf8 x; }
let interestingTables = [ "free.kdoge_token-table", "free.kadoge_token-table" ]
when (any (\interesting -> interesting `T.isInfixOf` tblname) interestingTables) $ do
stuff <- catch (qry_ db ("SELECT COUNT(*) FROM " <> t <> ";") [RInt]) $ \(SomeException e) -> do
withFrozenCallStack $ do
logError_ loggr $ T.unpack $ "tmp.chessai: When querying "
<> tblname <> " got an error: " <> sshow e
logError_ loggr $ "tmp.chessai: Callstack: " <> prettyCallStack callStack
throwM e
case stuff of
[[SInt count]] -> do
logError_ loggr $ T.unpack $ "tmp.chessai: " <> tblname <> " has " <> sshow count <> " entries."
_ -> do
internalError $ "Didn't get [[SInt count]] from `SELECT COUNT(*) FROM " <> tblname <> ";`"
exec_ db ("DROP TABLE [" <> t <> "];")
[SText t] -> exec_ db ("DROP TABLE [" <> t <> "];")
_ -> internalError "Something went wrong when resetting tables."
exec_ db "DELETE FROM VersionedTableCreation;"
exec_ db "DELETE FROM VersionedTableMutation;"
Expand Down
3 changes: 0 additions & 3 deletions src/Chainweb/Pact/PactService/Checkpointer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ withCheckpointerWithoutRewind target caller act = do
Nothing -> return ()

local (over psCheckpointerDepth succ) $ mask $ \restore -> do
logInfo $ T.unpack $ "withCheckpointerWithoutRewind"
<> ". checkpointerTarget: " <> sshow checkpointerTarget

cenv <- restore $ liftIO $! _cpRestore checkPointer checkpointerTarget

try (restore (act cenv)) >>= \case
Expand Down

0 comments on commit 9160de6

Please sign in to comment.