From 401ebd00e13bc335a48160825f76605ce5049615 Mon Sep 17 00:00:00 2001 From: Sagar Vemuri Date: Wed, 6 Dec 2017 13:32:07 -0800 Subject: [PATCH 1/2] Log GetCurrentTime failures during Flush and Compaction --- db/compaction_job.cc | 7 ++++++- db/flush_job.cc | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index c9c71d60c1f..7e2ca590a13 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -1325,7 +1325,12 @@ Status CompactionJob::OpenCompactionOutputFile( sub_compact->compaction->MaxInputFileCreationTime(); if (output_file_creation_time == 0) { int64_t _current_time = 0; - db_options_.env->GetCurrentTime(&_current_time); // ignore error + auto status = db_options_.env->GetCurrentTime(&_current_time); + // Safe to proceed even if GetCurrentTime fails. So, log and proceed. + if (!status.ok()) { + ROCKS_LOG_DEBUG(db_options_.info_log, + "Failed to get current time. Status: %s", status.ToString().c_str()); + } output_file_creation_time = static_cast(_current_time); } diff --git a/db/flush_job.cc b/db/flush_job.cc index 41a97f58704..68dcb42ff98 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -299,7 +299,12 @@ Status FlushJob::WriteLevel0Table() { TEST_SYNC_POINT_CALLBACK("FlushJob::WriteLevel0Table:output_compression", &output_compression_); int64_t _current_time = 0; - db_options_.env->GetCurrentTime(&_current_time); // ignore error + auto status = db_options_.env->GetCurrentTime(&_current_time); + // Safe to proceed even if GetCurrentTime fails. So, log and proceed. + if (!status.ok()) { + ROCKS_LOG_DEBUG(db_options_.info_log, + "Failed to get current time. Status: %s", status.ToString().c_str()); + } const uint64_t current_time = static_cast(_current_time); uint64_t oldest_key_time = From ab348188ca1669324137e4b5ea505231b0e49208 Mon Sep 17 00:00:00 2001 From: Sagar Vemuri Date: Wed, 6 Dec 2017 14:31:07 -0800 Subject: [PATCH 2/2] Upgrade log message to warning. --- db/compaction_job.cc | 7 +++++-- db/flush_job.cc | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 7e2ca590a13..8886e18c469 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -1328,8 +1328,11 @@ Status CompactionJob::OpenCompactionOutputFile( auto status = db_options_.env->GetCurrentTime(&_current_time); // Safe to proceed even if GetCurrentTime fails. So, log and proceed. if (!status.ok()) { - ROCKS_LOG_DEBUG(db_options_.info_log, - "Failed to get current time. Status: %s", status.ToString().c_str()); + ROCKS_LOG_WARN( + db_options_.info_log, + "Failed to get current time to populate creation_time property. " + "Status: %s", + status.ToString().c_str()); } output_file_creation_time = static_cast(_current_time); } diff --git a/db/flush_job.cc b/db/flush_job.cc index 68dcb42ff98..044248600e7 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -302,8 +302,11 @@ Status FlushJob::WriteLevel0Table() { auto status = db_options_.env->GetCurrentTime(&_current_time); // Safe to proceed even if GetCurrentTime fails. So, log and proceed. if (!status.ok()) { - ROCKS_LOG_DEBUG(db_options_.info_log, - "Failed to get current time. Status: %s", status.ToString().c_str()); + ROCKS_LOG_WARN( + db_options_.info_log, + "Failed to get current time to populate creation_time property. " + "Status: %s", + status.ToString().c_str()); } const uint64_t current_time = static_cast(_current_time);