Skip to content

Commit 8516b36

Browse files
authored
Merge pull request facebook#4 from pikiwidb/feature/support_delete_cloud_file
cloud_file_system_impl support delete cloudobject immediately
2 parents 5f152f0 + 563bd09 commit 8516b36

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

cloud/aws/aws_s3.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ IOStatus S3StorageProvider::CopyCloudObject(
819819
Aws::String src_object = ToAwsString(object_path_src);
820820
Aws::String dest_object = ToAwsString(object_path_dest);
821821

822-
Aws::String src_url = src_bucket + src_object;
822+
Aws::String src_url = src_bucket + "/" + src_object;
823823

824824
// create copy request
825825
Aws::S3::Model::CopyObjectRequest request;

cloud/cloud_file_system_impl.cc

+9-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ IOStatus CloudFileSystemImpl::DeleteCloudFileFromDest(
832832
return;
833833
}
834834
//TODO(wangshaoyi): temporary debug log
835-
Log(InfoLogLevel::INFO_LEVEL, info_log, "[%s] DeleteCloudFileFromDest, is_master: %d",
835+
Log(InfoLogLevel::INFO_LEVEL, info_log, "DeleteCloudFileFromDest, is_master: %d",
836836
is_master);
837837
if (!is_master) {
838838
return;
@@ -2290,6 +2290,14 @@ IOStatus CloudFileSystemImpl::DeleteDbid(const std::string& bucket,
22902290
return st;
22912291
}
22922292

2293+
IOStatus CloudFileSystemImpl::DeleteCloudObject(const std::string& bucket,
2294+
const std::string& objectpath) {
2295+
Log(InfoLogLevel::INFO_LEVEL, info_log_, "[%s] deletecloudobject, bucket: %s, objectpath: %s",
2296+
Name(), bucket.c_str(), objectpath.c_str());
2297+
auto st = GetStorageProvider()->DeleteCloudObject(bucket, objectpath);
2298+
return st;
2299+
}
2300+
22932301
IOStatus CloudFileSystemImpl::LockFile(const std::string& /*fname*/,
22942302
const IOOptions& /*opts*/,
22952303
FileLock** lock,

cloud/cloud_file_system_impl.h

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ class CloudFileSystemImpl : public CloudFileSystem {
135135
IOStatus DeleteDbid(const std::string& bucket,
136136
const std::string& dbid) override;
137137

138+
virtual IOStatus DeleteCloudObject(const std::string& bucket,
139+
const std::string& objectpath) override;
140+
138141
IOStatus SanitizeDirectory(const DBOptions& options,
139142
const std::string& clone_name, bool read_only);
140143
IOStatus LoadCloudManifest(const std::string& local_dbname, bool read_only);

include/rocksdb/cloud/cloud_file_system.h

+3
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ class CloudFileSystem : public FileSystem {
575575
virtual IOStatus DeleteDbid(const std::string& bucket_prefix,
576576
const std::string& dbid) = 0;
577577

578+
virtual IOStatus DeleteCloudObject(const std::string& bucket,
579+
const std::string& objectpath) = 0;
580+
578581
Logger* GetLogger() const { return info_log_.get(); }
579582
const std::shared_ptr<CloudStorageProvider>& GetStorageProvider() const {
580583
return cloud_fs_options.storage_provider;

0 commit comments

Comments
 (0)