Skip to content

Commit

Permalink
[opt] curvefs: Change the confusing configuration name
Browse files Browse the repository at this point in the history
Signed-off-by: swj <[email protected]>
  • Loading branch information
201341 authored and wuhongsong committed Aug 4, 2023
1 parent 63d3bda commit 9d48ce9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions curvefs/conf/metaserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ trash.scanPeriodSec=600
trash.expiredAfterSec=604800

# s3
# if s3.enableDeleteObjects set True, batch size limit the object num of delete count per delete request
# if s3.enableBatchDelete set True, batch size limit the object num of delete count per delete request
s3.batchsize=100
# if s3 sdk support batch delete objects, set True; other set False
s3.enableDeleteObjects=False
s3.enableBatchDelete=False
# http = 0, https = 1
s3.http_scheme=0
s3.verify_SSL=False
Expand Down
4 changes: 2 additions & 2 deletions curvefs/src/metaserver/metaserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ void Metaserver::InitLocalFileSystem() {
void InitS3Option(const std::shared_ptr<Configuration>& conf,
S3ClientAdaptorOption* s3Opt) {
LOG_IF(FATAL, !conf->GetUInt64Value("s3.batchsize", &s3Opt->batchSize));
LOG_IF(FATAL, !conf->GetBoolValue("s3.enableDeleteObjects",
&s3Opt->enableDeleteObjects));
LOG_IF(FATAL, !conf->GetBoolValue("s3.enableBatchDelete",
&s3Opt->enableBatchDelete));
}

void Metaserver::InitPartitionOption(std::shared_ptr<S3ClientAdaptor> s3Adaptor,
Expand Down
8 changes: 4 additions & 4 deletions curvefs/src/metaserver/s3/metaserver_s3_adaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void S3ClientAdaptorImpl::Init(const S3ClientAdaptorOption &option,
blockSize_ = option.blockSize;
chunkSize_ = option.chunkSize;
batchSize_ = option.batchSize;
enableDeleteObjects_ = option.enableDeleteObjects;
enableBatchDelete_ = option.enableBatchDelete;
objectPrefix_ = option.objectPrefix;
client_ = client;
}
Expand All @@ -43,13 +43,13 @@ void S3ClientAdaptorImpl::Reinit(const S3ClientAdaptorOption& option,
blockSize_ = option.blockSize;
chunkSize_ = option.chunkSize;
batchSize_ = option.batchSize;
enableDeleteObjects_ = option.enableDeleteObjects;
enableBatchDelete_ = option.enableBatchDelete;
objectPrefix_ = option.objectPrefix;
client_->Reinit(ak, sk, endpoint, bucketName);
}

int S3ClientAdaptorImpl::Delete(const Inode &inode) {
if (enableDeleteObjects_) {
if (enableBatchDelete_) {
return DeleteInodeByDeleteBatchChunk(inode);
} else {
return DeleteInodeByDeleteSingleChunk(inode);
Expand Down Expand Up @@ -212,7 +212,7 @@ void S3ClientAdaptorImpl::GetS3ClientAdaptorOption(
option->blockSize = blockSize_;
option->chunkSize = chunkSize_;
option->batchSize = batchSize_;
option->enableDeleteObjects = enableDeleteObjects_;
option->enableBatchDelete = enableBatchDelete_;
option->objectPrefix = objectPrefix_;
}

Expand Down
4 changes: 2 additions & 2 deletions curvefs/src/metaserver/s3/metaserver_s3_adaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct S3ClientAdaptorOption {
uint64_t chunkSize;
uint64_t batchSize;
uint32_t objectPrefix;
bool enableDeleteObjects;
bool enableBatchDelete;
};

class S3ClientAdaptor {
Expand Down Expand Up @@ -150,7 +150,7 @@ class S3ClientAdaptorImpl : public S3ClientAdaptor {
uint64_t chunkSize_;
uint64_t batchSize_;
uint32_t objectPrefix_;
bool enableDeleteObjects_;
bool enableBatchDelete_;
};
} // namespace metaserver
} // namespace curvefs
Expand Down
8 changes: 4 additions & 4 deletions curvefs/test/metaserver/metaserver_s3_adaptor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MetaserverS3AdaptorTest : public testing::Test {
option.chunkSize = 4 * 1024 * 1024;
option.batchSize = 5;
option.objectPrefix = 0;
option.enableDeleteObjects = false;
option.enableBatchDelete = false;
mockMetaserverS3Client_ = new MockS3Client();
metaserverS3ClientAdaptor_ = new S3ClientAdaptorImpl();

Expand Down Expand Up @@ -208,7 +208,7 @@ TEST_F(MetaserverS3AdaptorTest, test_delete_batch_chunks) {
option.chunkSize = 4 * 1024 * 1024;
option.batchSize = 5;
option.objectPrefix = 0;
option.enableDeleteObjects = true;
option.enableBatchDelete = true;
metaserverS3ClientAdaptor_->Init(option, mockMetaserverS3Client_);

// Init
Expand Down Expand Up @@ -237,7 +237,7 @@ TEST_F(MetaserverS3AdaptorTest, test_delete_batch_idempotence) {
option.chunkSize = 4 * 1024 * 1024;
option.batchSize = 5;
option.objectPrefix = 0;
option.enableDeleteObjects = true;
option.enableBatchDelete = true;
metaserverS3ClientAdaptor_->Init(option, mockMetaserverS3Client_);

// Init
Expand Down Expand Up @@ -283,7 +283,7 @@ TEST_F(MetaserverS3AdaptorTest, test_delete_batch_deleted) {
option.chunkSize = 4 * 1024 * 1024;
option.batchSize = 5;
option.objectPrefix = 0;
option.enableDeleteObjects = true;
option.enableBatchDelete = true;
metaserverS3ClientAdaptor_->Init(option, mockMetaserverS3Client_);

// Init
Expand Down

0 comments on commit 9d48ce9

Please sign in to comment.