diff --git a/db/compaction_job.cc b/db/compaction_job.cc index c9c71d60c1ff6550d9169530b0fe54bfe1590b67..8886e18c4695f220ca233ee754b1b345b2497498 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -1325,7 +1325,15 @@ 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_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 41a97f5870482d2c4c914fc87cb3bbdd1abe60df..044248600e79af7350e813ebdc0d2f756ee9b9e4 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -299,7 +299,15 @@ 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_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); uint64_t oldest_key_time =