Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log GetCurrentTime failures during Flush and Compaction #3231

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion db/compaction_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth to be on warning level?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention in the log the time is for getting creation_time in compactions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good points. Updated the patch with these suggestions.

"Failed to get current time. Status: %s", status.ToString().c_str());
}
output_file_creation_time = static_cast<uint64_t>(_current_time);
}

Expand Down
7 changes: 6 additions & 1 deletion db/flush_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

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<uint64_t>(_current_time);

uint64_t oldest_key_time =
Expand Down