Log GetCurrentTime failures during Flush and Compaction
Summary: `GetCurrentTime()` is used to populate `creation_time` table property during flushes and compactions. It is safe to ignore `GetCurrentTime()` failures here but they should be logged. (Note that `creation_time` property was introduced as part of TTL-based FIFO compaction in #2480.) Tes Plan: `make check` Closes https://github.com/facebook/rocksdb/pull/3231 Differential Revision: D6501935 Pulled By: sagar0 fbshipit-source-id: 376adcf4ab801d3a43ec4453894b9a10909c8eb6
This commit is contained in:
parent
d51fcb21f4
commit
bbef8c3884
@ -1325,7 +1325,15 @@ Status CompactionJob::OpenCompactionOutputFile(
|
|||||||
sub_compact->compaction->MaxInputFileCreationTime();
|
sub_compact->compaction->MaxInputFileCreationTime();
|
||||||
if (output_file_creation_time == 0) {
|
if (output_file_creation_time == 0) {
|
||||||
int64_t _current_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<uint64_t>(_current_time);
|
output_file_creation_time = static_cast<uint64_t>(_current_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +299,15 @@ Status FlushJob::WriteLevel0Table() {
|
|||||||
TEST_SYNC_POINT_CALLBACK("FlushJob::WriteLevel0Table:output_compression",
|
TEST_SYNC_POINT_CALLBACK("FlushJob::WriteLevel0Table:output_compression",
|
||||||
&output_compression_);
|
&output_compression_);
|
||||||
int64_t _current_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());
|
||||||
|
}
|
||||||
const uint64_t current_time = static_cast<uint64_t>(_current_time);
|
const uint64_t current_time = static_cast<uint64_t>(_current_time);
|
||||||
|
|
||||||
uint64_t oldest_key_time =
|
uint64_t oldest_key_time =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user