8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 13:23:02 +01:00

Use fixed format for timing. Make the verbose logging a bit less verbose.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dmitry Yemanov 2023-07-21 20:11:28 +03:00
parent 8e8eff1c95
commit add663f435

View File

@ -560,19 +560,10 @@ namespace
(SINT64) finish.value().timestamp_time / 10; (SINT64) finish.value().timestamp_time / 10;
const SINT64 delta = finishMsec - startMsec; const SINT64 delta = finishMsec - startMsec;
const double seconds = (double) delta / 1000;
string value; string value;
value.printf("%.3lfs", seconds);
if (delta < 1000) // less than 1 second
value.printf("%u ms", (unsigned) delta);
else if (delta < 60 * 1000) // less than 1 minute
value.printf("%u second(s)", (unsigned) (delta / 1000));
else if (delta < 60 * 60 * 1000) // less than 1 hour
value.printf("%u minute(s)", (unsigned) (delta / 1000 / 60));
else if (delta < 24 * 60 * 60 * 1000) // less than 1 day
value.printf("%u hour(s)", (unsigned) (delta / 1000 / 60 / 60));
else
value.printf("%u day(s)", (unsigned) (delta / 1000 / 60 / 60 / 24));
return value; return value;
} }
@ -756,12 +747,11 @@ namespace
if (queue.isEmpty()) if (queue.isEmpty())
{ {
target->verbose("No new segments found, suspending for %u seconds", target->verbose("No new segments found, suspending");
config->applyIdleTimeout);
return ret; return ret;
} }
target->verbose("Added %u segment(s) to the processing queue", (ULONG) queue.getCount()); target->verbose("Added %u segment(s) to the queue", (ULONG) queue.getCount());
// Second pass: replicate the chain of contiguous segments // Second pass: replicate the chain of contiguous segments
@ -772,12 +762,11 @@ namespace
FB_UINT64 next_sequence = 0; FB_UINT64 next_sequence = 0;
const bool restart = target->isShutdown(); const bool restart = target->isShutdown();
for (Segment** iter = queue.begin(); iter != queue.end(); ++iter) for (auto segment : queue)
{ {
if (shutdownFlag) if (shutdownFlag)
return PROCESS_SHUTDOWN; return PROCESS_SHUTDOWN;
Segment* const segment = *iter;
const FB_UINT64 sequence = segment->header.hdr_sequence; const FB_UINT64 sequence = segment->header.hdr_sequence;
const Guid& guid = segment->header.hdr_guid; const Guid& guid = segment->header.hdr_guid;
@ -810,8 +799,7 @@ namespace
// then there's no point in replaying the whole sequence // then there's no point in replaying the whole sequence
if (max_sequence == last_sequence && !last_offset) if (max_sequence == last_sequence && !last_offset)
{ {
target->verbose("No new segments found, suspending for %u seconds", target->verbose("No new segments found, suspending");
config->applyIdleTimeout);
return ret; return ret;
} }
@ -912,12 +900,12 @@ namespace
if (oldest) if (oldest)
{ {
const TraNumber oldest_trans = oldest->tra_id; const TraNumber oldest_trans = oldest->tra_id;
extra.printf("preserving the file due to %u active transaction(s) (oldest: %" UQUADFORMAT " in segment %" UQUADFORMAT ")", extra.printf("preserving (OAT: %" UQUADFORMAT " in segment %" UQUADFORMAT ")",
(unsigned) transactions.getCount(), oldest_trans, oldest_sequence); oldest_trans, oldest_sequence);
} }
else else
{ {
extra += "deleting the file"; extra = "deleting";
} }
target->verbose("Segment %" UQUADFORMAT " (%u bytes) is replicated in %s, %s", target->verbose("Segment %" UQUADFORMAT " (%u bytes) is replicated in %s, %s",
@ -971,7 +959,7 @@ namespace
target->logError(message); target->logError(message);
target->verbose("Suspending for %u seconds", config->applyErrorTimeout); target->verbose("Disconnecting and suspending");
ret = PROCESS_ERROR; ret = PROCESS_ERROR;
} }