@@ -142,6 +142,7 @@ import Development.IDE.Graph.Database (ShakeDatabase,
142142 instantiateDelayedAction ,
143143 mkDelayedAction ,
144144 shakeComputeToPreserve ,
145+ shakeDatabaseSize ,
145146 shakeGetActionQueueLength ,
146147 shakeGetBuildStep ,
147148 shakeGetDatabaseKeys ,
@@ -211,7 +212,7 @@ import Data.Foldable (foldl')
211212data Log
212213 = LogCreateHieDbExportsMapStart
213214 | LogCreateHieDbExportsMapFinish ! Int
214- | LogBuildSessionRestart ! ShakeRestartArgs ! [DelayedActionInternal ] ! KeySet ! Seconds ! Seconds ! Int ! (Maybe FilePath ) ! Int ! [DeliverStatus ] ! Seconds ! [Key ]
215+ | LogBuildSessionRestart ! ShakeRestartArgs ! [DelayedActionInternal ] ! KeySet ! Seconds ! Seconds ! Int ! (Maybe FilePath ) ! Int ! [DeliverStatus ] ! Seconds ! [Key ] ! Int
215216 | LogBuildSessionRestartTakingTooLong ! Seconds
216217 | LogDelayedAction ! (DelayedAction () ) ! Seconds
217218 | LogBuildSessionFinish ! Step ! (Either SomeException [Either SomeException () ])
@@ -255,7 +256,7 @@ instance Pretty Log where
255256 " Initializing exports map from hiedb"
256257 LogCreateHieDbExportsMapFinish exportsMapSize ->
257258 " Done initializing exports map from hiedb. Size:" <+> pretty exportsMapSize
258- LogBuildSessionRestart restartArgs actionQueue _keyBackLog abortDuration computeToPreserveTime lookupNums shakeProfilePath step _delivers prepare _oldUpSweepDirties ->
259+ LogBuildSessionRestart restartArgs actionQueue _keyBackLog abortDuration computeToPreserveTime lookupNums shakeProfilePath step _delivers prepare _oldUpSweepDirties dbSize ->
259260 vcat
260261 [ " Restarting build session due to" <+> pretty (sraReason restartArgs)
261262 , " Restarts num:" <+> pretty (sraCount $ restartArgs)
@@ -264,9 +265,10 @@ instance Pretty Log where
264265 -- , "Keys:" <+> pretty (length $ toListKeySet keyBackLog)
265266 -- , "Deliveries still alive:" <+> pretty delivers
266267 , " Current step:" <+> pretty (show step)
267- , " Aborting previous build session took" <+> pretty (showDuration abortDuration) <+> " (" <> pretty (showDuration computeToPreserveTime) <+> " to compute preserved keys," <+> pretty lookupNums <+> " lookups)"
268+ , " Aborting previous build session took" <+> pretty (showDuration abortDuration) <+> " (" <> pretty (showDuration computeToPreserveTime) <+> " to compute preserved keys," <+> pretty lookupNums <+> " / " <+> pretty dbSize <+> " lookups)"
268269 <+> pretty shakeProfilePath
269270 , " prepare new session took" <+> pretty (showDuration prepare)
271+ , " Database size:" <+> pretty dbSize
270272 -- , "old upsweep dirties:" <+> pretty (oldUpSweepDirties)
271273 ]
272274 LogBuildSessionRestartTakingTooLong seconds ->
@@ -984,6 +986,7 @@ runRestartTask recorder ideStateVar shakeRestartArgs = do
984986 logErrorAfter 10 $ can dirties
985987 return (toUpSweepKeys, computePreserveTime, lookupsNum, oldUpSweepDirties)
986988 survivedDelivers <- shakePeekAsyncsDelivers shakeDb
989+ dbSize <- shakeDatabaseSize shakeDb
987990 -- it is every important to update the dirty keys after we enter the critical section
988991 -- see Note [Housekeeping rule cache and dirty key outside of hls-graph]
989992 atomically $ modifyTVar' (dirtyKeys shakeExtras) $ \ x -> foldl' (flip insertKeySet) x newDirtyKeys
@@ -995,7 +998,7 @@ runRestartTask recorder ideStateVar shakeRestartArgs = do
995998 step <- shakeGetBuildStep shakeDb
996999
9971000 -- let logRestart x = logWith recorder Info $ LogBuildSessionRestart shakeRestartArgs queue backlog stopTime computePreserveTime lookupsNum res step survivedDelivers x $ preservekvs
998- let logRestart x = logWith recorder Info $ LogBuildSessionRestart shakeRestartArgs queue backlog stopTime computePreserveTime lookupsNum res step survivedDelivers x oldUpSweepDirties
1001+ let logRestart x = logWith recorder Info $ LogBuildSessionRestart shakeRestartArgs queue backlog stopTime computePreserveTime lookupsNum res step survivedDelivers x oldUpSweepDirties dbSize
9991002 return (shakeRestartArgs, toUpSweepKeys, fromListKeySet $ map deliverKey survivedDelivers, logRestart)
10001003 )
10011004 -- It is crucial to be masked here, otherwise we can get killed
0 commit comments