Skip to content

Commit 4852f79

Browse files
authored
Time bound logging for writing snapshots to file descriptors (#7410)
1 parent 0e4402b commit 4852f79

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/snapshots/snapshot_manager.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,15 @@ namespace snapshots
186186
{
187187
const auto& snapshot = it->second.snapshot;
188188

189-
THROW_ON_ERROR(
190-
write(snapshot_fd, snapshot->data(), snapshot->size()),
191-
file_name);
192-
THROW_ON_ERROR(
193-
write(snapshot_fd, receipt_data, receipt_size), file_name);
189+
{
190+
asynchost::TimeBoundLogger log_write_if_slow(
191+
fmt::format("Writing snapshot to {}", file_name));
192+
THROW_ON_ERROR(
193+
write(snapshot_fd, snapshot->data(), snapshot->size()),
194+
file_name);
195+
THROW_ON_ERROR(
196+
write(snapshot_fd, receipt_data, receipt_size), file_name);
197+
}
194198

195199
LOG_INFO_FMT(
196200
"New snapshot file written to {} [{} bytes] (unsynced)",

0 commit comments

Comments
 (0)