Skip to content

Commit 2983f21

Browse files
author
wangshaoyi
committed
add parameter to specify user defined cloudmanifest upload function
1 parent 422341f commit 2983f21

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

cloud/cloud_file_system_impl.cc

+12
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,18 @@ IOStatus CloudFileSystemImpl::UploadCloudManifest(
20772077
if (!cloud_fs_options.is_master) {
20782078
return IOStatus::OK();
20792079
}
2080+
2081+
if (cloud_fs_options.upload_meta_func) {
2082+
bool success = cloud_fs_options.upload_meta_func(MakeCloudManifestFile(local_dbname, cookie),
2083+
GetDestBucketName(), MakeCloudManifestFile(GetDestObjectPath(), cookie));
2084+
if (!success) {
2085+
Log(InfoLogLevel::WARN_LEVEL, info_log_,
2086+
"[%s] UploadCloudManifest, user-defined upload failed", Name());
2087+
return IOStatus::IOError("user defined upload failed");
2088+
}
2089+
return IOStatus::OK();
2090+
}
2091+
20802092
// upload the cloud manifest file corresponds to cookie (i.e.,
20812093
// CLOUDMANIFEST-cookie)
20822094
auto st = GetStorageProvider()->PutCloudObject(

include/rocksdb/cloud/cloud_file_system.h

+6
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ class CloudFileSystemOptions {
301301
// if rocksdb works in master process
302302
bool is_master;
303303

304+
// user defined meta upload function
305+
// used to garantee only one server to update remote meta
306+
std::function<bool(const std::string& local_path,
307+
const std::string& bucket_name,
308+
const std::string& object_path)> upload_meta_func;
309+
304310
// Experimental option!
305311
// This option only affects how resync_on_open works. If resync_on_open is true,
306312
// and resync_manifest_on_open is true, besides fetching CLOUDMANFIEST from s3,

0 commit comments

Comments
 (0)