diff --git a/cloud/cloud_file_system_impl.cc b/cloud/cloud_file_system_impl.cc index cfaffe8d212..74e2ae8accc 100644 --- a/cloud/cloud_file_system_impl.cc +++ b/cloud/cloud_file_system_impl.cc @@ -2077,6 +2077,18 @@ IOStatus CloudFileSystemImpl::UploadCloudManifest( if (!cloud_fs_options.is_master) { return IOStatus::OK(); } + + if (cloud_fs_options.upload_meta_func) { + bool success = cloud_fs_options.upload_meta_func(MakeCloudManifestFile(local_dbname, cookie), + GetDestBucketName(), MakeCloudManifestFile(GetDestObjectPath(), cookie)); + if (!success) { + Log(InfoLogLevel::WARN_LEVEL, info_log_, + "[%s] UploadCloudManifest, user-defined upload failed", Name()); + return IOStatus::IOError("user defined upload failed"); + } + return IOStatus::OK(); + } + // upload the cloud manifest file corresponds to cookie (i.e., // CLOUDMANIFEST-cookie) auto st = GetStorageProvider()->PutCloudObject( diff --git a/include/rocksdb/cloud/cloud_file_system.h b/include/rocksdb/cloud/cloud_file_system.h index 7548d875042..0ddf9d4b5a6 100644 --- a/include/rocksdb/cloud/cloud_file_system.h +++ b/include/rocksdb/cloud/cloud_file_system.h @@ -301,6 +301,12 @@ class CloudFileSystemOptions { // if rocksdb works in master process bool is_master; + // user defined meta upload function + // used to garantee only one server to update remote meta + std::function upload_meta_func; + // Experimental option! // This option only affects how resync_on_open works. If resync_on_open is true, // and resync_manifest_on_open is true, besides fetching CLOUDMANFIEST from s3,