Skip to content

Commit 14ba88d

Browse files
committed
Add support for LinkFile() in AwsEnv
This helps avoid copying the file when ingesting external file with move_files set to true.
1 parent 43fd237 commit 14ba88d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

cloud/aws/aws_env.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,14 @@ Status AwsEnv::RenameFile(const std::string& logical_src,
14401440
return st;
14411441
}
14421442

1443+
Status AwsEnv::LinkFile(const std::string& src, const std::string& target) {
1444+
// We only know how to link file if both src and dest buckets are empty
1445+
if (has_dest_bucket_ || has_src_bucket_) {
1446+
return Status::NotSupported();
1447+
}
1448+
return base_env_->LinkFile(src, target);
1449+
}
1450+
14431451
//
14441452
// Copy my IDENTITY file to cloud storage. Update dbid registry.
14451453
//

cloud/aws/aws_env.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,8 @@ class AwsEnv : public CloudEnvImpl {
155155
virtual Status RenameFile(const std::string& src,
156156
const std::string& target) override;
157157

158-
virtual Status LinkFile(const std::string& /*src*/,
159-
const std::string& /*target*/) override {
160-
return Status::NotSupported(); // not supported
161-
}
158+
virtual Status LinkFile(const std::string& src,
159+
const std::string& target) override;
162160

163161
virtual Status LockFile(const std::string& fname, FileLock** lock) override;
164162

0 commit comments

Comments
 (0)