Skip to content

Commit

Permalink
Revert "validation: Only run BlockTx validation when DB fully synced"
Browse files Browse the repository at this point in the history
If the validation runs grindingly slow, then it is likely that
the generation of table indices is missing.

This reverts commit 1a8dbc9.
  • Loading branch information
erikd committed May 22, 2020
1 parent bf1b61b commit 2ae2b1c
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions cardano-db/app/Cardano/Db/App/Validate/BlockTxs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import qualified System.Random as Random

validateEpochBlockTxs :: IO ()
validateEpochBlockTxs = do
fullySynced <- runDbNoLogging queryIsFullySynced
mLatestEpoch <- runDbNoLogging queryLatestCachedEpochNo
case mLatestEpoch of
Nothing -> putStrLn "Epoch table is empty"
Just latest -> validateLatestBlockTxs fullySynced latest
Just latest -> validateLatestBlockTxs latest

-- -----------------------------------------------------------------------------

Expand All @@ -38,15 +37,10 @@ data ValidateError = ValidateError
, veTxCountExpected :: !Word64
}

validateLatestBlockTxs :: Bool -> Word64 -> IO ()
validateLatestBlockTxs fullySynced latestEpoch = do
if not fullySynced
then putStrLn "Not fully synced so not running BlockTx validation"
else do
-- This validation seems to be quite DB intensive, so only run it
-- when the DB is fully synced.
validateBlockTxs latestEpoch
validateBlockTxs =<< Random.randomRIO (0, latestEpoch - 1)
validateLatestBlockTxs :: Word64 -> IO ()
validateLatestBlockTxs latestEpoch = do
validateBlockTxs latestEpoch
validateBlockTxs =<< Random.randomRIO (0, latestEpoch - 1)

validateBlockTxs :: Word64 -> IO ()
validateBlockTxs epoch = do
Expand Down

0 comments on commit 2ae2b1c

Please sign in to comment.