Skip to content

Commit

Permalink
add new
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyuecai committed Jul 11, 2024
1 parent b193d4e commit 65e0d43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cloud/cloud_file_system_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ IOStatus CloudFileSystemImpl::ExistsCloudObject(const std::string& fname) {
}

IOStatus CloudFileSystemImpl::GetCloudObject(const std::string& fname) {
auto startTs = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
std::cout << "【CloudFileSystemImpl::GetCloudObject】dowoload file: " << fname << std::endl;

auto st = IOStatus::NotFound();
Expand All @@ -78,6 +79,8 @@ IOStatus CloudFileSystemImpl::GetCloudObject(const std::string& fname) {
st = GetStorageProvider()->GetCloudObject(GetSrcBucketName(),
srcname(fname), fname);
}
auto gapTs = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()).time_since_epoch().count() - startTs;
std::cout << "【CostStatis】【CloudFileSystemImpl::GetCloudObject】【all】 costs: " << gapTs << "ms" << std::endl;
return st;
}

Expand Down
2 changes: 1 addition & 1 deletion db/version_edit_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ Status VersionEditHandler::MaybeCreateVersion(const VersionEdit& /*edit*/,
// Install new version
v->PrepareAppend(
*cfd->GetLatestMutableCFOptions(),
!(version_set_->db_options_->skip_stats_update_on_db_open));
!(version_set_->db_options_->skip_stats_update_on_db_open)); // skip_stats_update_on_db_open 可以控制跳过检查
version_set_->AppendVersion(cfd, v);
} else {
delete v;
Expand Down
8 changes: 5 additions & 3 deletions db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1579,11 +1579,11 @@ Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
file_name = *fname;
} else {
file_name =
TableFileName(ioptions->cf_paths, file_meta->fd.GetNumber(),
TableFileName(ioptions->cf_paths, file_meta->fd.GetNumber(), // 这个方法返回 SST 文件的文件名
file_meta->fd.GetPathId());
}
s = ioptions->fs->NewRandomAccessFile(file_name, file_options_, &file,
nullptr);
nullptr); // 这里会从 S3 上拉取数据
if (!s.ok()) {
return s;
}
Expand Down Expand Up @@ -2967,7 +2967,7 @@ bool Version::MaybeInitializeFileMetaData(FileMetaData* file_meta) {
return false;
}
std::shared_ptr<const TableProperties> tp;
Status s = GetTableProperties(&tp, file_meta);
Status s = GetTableProperties(&tp, file_meta); // 这里会从 S3 上拉取数据
file_meta->init_stats_from_file = true;
if (!s.ok()) {
ROCKS_LOG_ERROR(vset_->db_options_->info_log,
Expand Down Expand Up @@ -3013,6 +3013,8 @@ void VersionStorageInfo::RemoveCurrentStats(FileMetaData* file_meta) {
}

void Version::UpdateAccumulatedStats() {
auto startTs = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()).time_since_epoch().count();

// maximum number of table properties loaded from files.
const int kMaxInitCount = 20;
int init_count = 0;
Expand Down

0 comments on commit 65e0d43

Please sign in to comment.