Skip to content

Commit

Permalink
log update
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKian committed Jun 28, 2024
1 parent f8f9c9f commit d0ec907
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions hstream-store/cbits/logdevice/ld_health_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LdChecker {
auto duration =
std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
.count();
ld_warning("GetClusterState took %ld ms", duration);
ld_debug("GetClusterState took %ld ms", duration);

// getClusterState(*client_impl, *nodes_configuration);

Expand All @@ -69,7 +69,7 @@ class LdChecker {
if (!unhealthy_nodes_set.empty()) {
ld_warning("Cluster has %lu unhealthy nodes:",
unhealthy_nodes_set.size());
// printUnhealthyNodes(*nodes_configuration, unhealthy_nodes_set);
printUnhealthyNodes(*nodes_configuration, unhealthy_nodes_set);
}

return unhealthy_nodes_set.size() <= unhealthy_node_limit;
Expand Down Expand Up @@ -103,7 +103,7 @@ class LdChecker {
res.node_id, res.addr.c_str(), st, deadNodes.c_str(),
unhealthyNodes.c_str());
}
ld_warning("Check return unhealthy nodes: [%s]",
ld_warning("Check return unhealthy nodes index: [%s]",
folly::join(',', sets).c_str());
}

Expand Down
2 changes: 1 addition & 1 deletion hstream/src/HStream/Server/CacheStore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ appendHStoreWithRetry ldClient shardId payload cmpStrategy dumpState = do
loop cnt'
_ -> loop exitNum
| cnt == exitNum = do
Log.warning $ "Dump to shardId " <> Log.build shardId <> " failed because cache store is not dumping, will retry later."
Log.warning $ "Dump to shardId " <> Log.build shardId <> " failed because cache store is not in dumping state, will retry later."
return Nothing
| otherwise = do
Log.fatal $ "Dump to shardId " <> Log.build shardId <> " failed after exausting the retry attempts, drop the record."
Expand Down
22 changes: 10 additions & 12 deletions hstream/src/HStream/Server/HealthMonitor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ startMonitor :: ServerContext -> HealthMonitor -> Int -> IO ()
startMonitor sc hm delaySecond = forever $ do
threadDelay $ delaySecond * 1000 * 1000
start <- getCurrentTime
Log.debug $ "========== docheck start..." <> " in " <> Log.build (show start)
-- Log.debug $ "========== docheck start..." <> " in " <> Log.build (show start)
res <- try @SomeException $ docheck sc hm
end <- getCurrentTime
case res of
Expand All @@ -49,9 +49,9 @@ startMonitor sc hm delaySecond = forever $ do
let diff = nominalDiffTimeToSeconds $ diffUTCTime end start
when (diff > 1) $
Log.warning $ "Monitor check return slow, total use " <> Log.build (show diff) <> "s"
Log.debug $ "========== docheck end..." <> " in " <> Log.build (show end)
<> ", with start time: " <> Log.build (show start)
<> ", duration: " <> Log.build (show diff)
Log.debug $ "Health monitor finish check in " <> Log.build (show end)
<> ", with start time: " <> Log.build (show start)
<> ", duration: " <> Log.build (show diff)

docheck :: ServerContext -> HealthMonitor -> IO ()
docheck sc@ServerContext{..} hm = do
Expand Down Expand Up @@ -80,21 +80,19 @@ checkLdCluster HealthMonitor{..} = do
start <- getTime Monotonic
res <- S.isLdClusterHealthy ldChecker ldUnhealthyNodesLimit
end <- getTime Monotonic
let sDuration = toNanoSecs (diffTimeSpec end start) `div` 1000000
if sDuration > 1000
then Log.warning $ "CheckLdCluster slow, total time " <> Log.build sDuration <> "ms"
else Log.debug $ "Finish checkLdClusster, total time " <> Log.build sDuration <> "ms"
let msDuration = toNanoSecs (diffTimeSpec end start) `div` 1000000
when (msDuration > 1000) $
Log.warning $ "CheckLdCluster return slow, total time " <> Log.build msDuration <> "ms"
return res

checkMeta :: HealthMonitor -> IO Bool
checkMeta HealthMonitor{..} | ZKHandle c <- metaHandle = do
start <- getTime Monotonic
res <- checkRecoverable =<< unsafeGetZHandle c
end <- getTime Monotonic
let sDuration = toNanoSecs (diffTimeSpec end start) `div` 1000000
if sDuration > 1000
then Log.warning $ "CheckMeta slow, total time " <> Log.build sDuration <> "ms"
else Log.debug $ "Finish checkMeta, total time " <> Log.build sDuration <> "ms"
let msDuration = toNanoSecs (diffTimeSpec end start) `div` 1000000
when (msDuration > 1000) $
Log.warning $ "CheckMeta return slow, total time " <> Log.build msDuration <> "ms"
return res
checkMeta HealthMonitor{..} | _ <- metaHandle = do
return True

0 comments on commit d0ec907

Please sign in to comment.