Skip to content

Commit

Permalink
fix(bulkload) Follow acelyc111's advice, remove get_f_meta variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
lupengfan1 committed Jul 24, 2024
1 parent acf7dec commit 41739da
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/replica/bulk_load/replica_bulk_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,19 +543,14 @@ void replica_bulk_loader::download_sst_file(const std::string &remote_dir,
return;
}
file_meta f_meta;
bool get_f_meta = true;
{
zauto_read_lock l(_lock);
if (file_index < _metadata.files.size()) {
f_meta = _metadata.files[file_index];
} else {
get_f_meta = false;
}
}
if (!get_f_meta) {
LOG_WARNING_PREFIX("sst file index {} exceeds number of bulkload sst files, Cancel "
"download_sst_file task.",
file_index);
if (f_meta.name.empty()) {
LOG_WARNING_PREFIX("Cannot get file_meta of {}, cancel download_sst_file task.", file_index);
return;
}
uint64_t f_size = 0;
Expand Down Expand Up @@ -613,16 +608,13 @@ void replica_bulk_loader::download_sst_file(const std::string &remote_dir,
METRIC_VAR_INCREMENT_BY(bulk_load_download_file_bytes, f_size);

// download next file
get_f_meta = true;
{
zauto_read_lock l(_lock);
if (file_index + 1 < _metadata.files.size()) {
f_meta = _metadata.files[file_index + 1];
} else {
get_f_meta = false;
}
}
if (get_f_meta) {
if (!f_meta.name.empty()) {
_download_files_task[f_meta.name] =
tasking::enqueue(LPC_BACKGROUND_BULK_LOAD,
tracker(),
Expand Down

0 comments on commit 41739da

Please sign in to comment.