Skip to content

Commit

Permalink
Revert "curvefs/client: make user agent configurable"
Browse files Browse the repository at this point in the history
This reverts commit 0346d82.

Signed-off-by: caoxianfei1 <caoxianfei@corp.netease.com>
  • Loading branch information
caoxianfei1 committed Nov 20, 2023
1 parent b918d45 commit 8362050
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 26 deletions.
2 changes: 1 addition & 1 deletion conf/s3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ s3.region=us-east-1
# http = 0, https = 1
s3.http_scheme=0
s3.verify_SSL=false
s3.user_agent=S3 Browser
s3.user_agent_conf=S3 Browser
s3.maxConnections=32
s3.connectTimeout=60000
s3.requestTimeout=10000
Expand Down
1 change: 0 additions & 1 deletion curvefs/conf/client.conf
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ s3.bigIoRetryIntervalUs=100
# http = 0, https = 1
s3.http_scheme=0
s3.verify_SSL=False
s3.user_agent=S3 Browser
s3.region=us-east-1
s3.maxConnections=500
s3.connectTimeout=60000
Expand Down
1 change: 0 additions & 1 deletion curvefs/conf/mds.conf
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ mds.fsmanager.client.timeoutSec=20
# http = 0, https = 1
s3.http_scheme=0
s3.verify_SSL=False
s3.user_agent=S3 Browser
s3.region=us-east-1
s3.maxConnections=32
s3.connectTimeout=60000
Expand Down
1 change: 0 additions & 1 deletion curvefs/conf/metaserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ s3.enableBatchDelete=False
# http = 0, https = 1
s3.http_scheme=0
s3.verify_SSL=False
s3.user_agent=S3 Browser
s3.region=us-east-1
s3.maxConnections=32
s3.connectTimeout=60000
Expand Down
18 changes: 4 additions & 14 deletions curvefs/test/client/client_s3_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ class ClientS3Test : public testing::Test {
Aws::SDKOptions awsOptions_;
};

TEST_F(ClientS3Test, init_s3Adapter_userAgent) {
std::string userAgent = "S3 Browser";
curve::common::S3AdapterOption option;
option.userAgent = userAgent;

curve::common::S3Adapter s3Adapter;
s3Adapter.Init(option);
ASSERT_STREQ(userAgent.c_str(), s3Adapter.GetConfig()->userAgent.c_str());
}

TEST_F(ClientS3Test, upload) {
const std::string obj("test");
uint64_t len = 1024;
Expand All @@ -79,7 +69,7 @@ TEST_F(ClientS3Test, upload) {
.WillOnce(Return(-1));
ASSERT_EQ(0, client_->Upload(obj, buf, len));
ASSERT_EQ(-1, client_->Upload(obj, buf, len));
delete[] buf;
delete buf;
}

TEST_F(ClientS3Test, download) {
Expand All @@ -100,7 +90,7 @@ TEST_F(ClientS3Test, download) {
ASSERT_EQ(0, client_->Download(obj, buf, offset, len));
ASSERT_EQ(-1, client_->Download(obj, buf, offset, len));
ASSERT_EQ(-2, client_->Download(obj, buf, offset, len));
delete[] buf;
delete buf;
}

TEST_F(ClientS3Test, uploadync) {
Expand All @@ -112,7 +102,7 @@ TEST_F(ClientS3Test, uploadync) {
EXPECT_CALL(*s3Client_, PutObjectAsync(_))
.WillOnce(Return());
client_->UploadAsync(context);
delete[] buf;
delete buf;
}

TEST_F(ClientS3Test, downloadAsync) {
Expand All @@ -125,7 +115,7 @@ TEST_F(ClientS3Test, downloadAsync) {
EXPECT_CALL(*s3Client_, GetObjectAsync(_))
.WillOnce(Return());
client_->DownloadAsync(context);
delete[] buf;
delete buf;
}


Expand Down
2 changes: 0 additions & 2 deletions curvefs/test/client/test_fuse_s3_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ class TestFuseS3Client : public ::testing::Test {
InitOptionBasic(&fuseClientOption_);
InitFSInfo(client_);
fuseClientOption_.s3Opt.s3AdaptrOpt.asyncThreadNum = 1;
fuseClientOption_.s3Opt.s3AdaptrOpt.userAgent = "S3 Browser";
fuseClientOption_.dummyServerStartPort = 5000;
fuseClientOption_.fileSystemOption.maxNameLength = 20u;
fuseClientOption_.listDentryThreads = 2;
Expand Down Expand Up @@ -208,7 +207,6 @@ class TestFuseS3Client : public ::testing::Test {
opt->s3Opt.s3ClientAdaptorOpt.readCacheThreads = 2;
opt->s3Opt.s3ClientAdaptorOpt.writeCacheMaxByte = 838860800;
opt->s3Opt.s3AdaptrOpt.asyncThreadNum = 1;
opt->s3Opt.s3AdaptrOpt.userAgent = "S3 Browser";
opt->dummyServerStartPort = 5000;
opt->fileSystemOption.maxNameLength = 20u;
opt->listDentryThreads = 2;
Expand Down
1 change: 0 additions & 1 deletion curvefs/test/metaserver/s3compact/s3compact_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ TEST_F(S3CompactTest, test_S3AdapterManager) {
opt.bucketName = "";
opt.scheme = 0;
opt.verifySsl = false;
opt.userAgent = "S3 Browser";
opt.maxConnections = 32;
opt.connectTimeout = 60000;
opt.requestTimeout = 10000;
Expand Down
5 changes: 3 additions & 2 deletions src/common/s3_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void InitS3AdaptorOptionExceptS3InfoOption(Configuration* conf,
LOG_IF(FATAL, !conf->GetStringValue("s3.logPrefix", &s3Opt->logPrefix));
LOG_IF(FATAL, !conf->GetIntValue("s3.http_scheme", &s3Opt->scheme));
LOG_IF(FATAL, !conf->GetBoolValue("s3.verify_SSL", &s3Opt->verifySsl));
LOG_IF(FATAL, !conf->GetStringValue("s3.user_agent", &s3Opt->userAgent));
LOG_IF(FATAL, !conf->GetIntValue("s3.maxConnections",
&s3Opt->maxConnections));
LOG_IF(FATAL, !conf->GetIntValue("s3.connectTimeout",
Expand Down Expand Up @@ -150,7 +149,9 @@ void S3Adapter::Init(const S3AdapterOption &option) {
clientCfg_ = Aws::New<Aws::Client::ClientConfiguration>(AWS_ALLOCATE_TAG);
clientCfg_->scheme = Aws::Http::Scheme(option.scheme);
clientCfg_->verifySSL = option.verifySsl;
clientCfg_->userAgent = option.userAgent.c_str();
// clientCfg_->userAgent =
// conf_.GetStringValue("s3.user_agent_conf").c_str(); //NOLINT
clientCfg_->userAgent = "S3 Browser";
clientCfg_->region = option.region.c_str();
clientCfg_->maxConnections = option.maxConnections;
clientCfg_->connectTimeoutMs = option.connectTimeout;
Expand Down
3 changes: 0 additions & 3 deletions src/common/s3_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ struct S3AdapterOption {
std::string logPrefix;
int scheme;
bool verifySsl;
std::string userAgent;
int maxConnections;
int connectTimeout;
int requestTimeout;
Expand Down Expand Up @@ -352,8 +351,6 @@ class S3Adapter {
void SetBucketName(const Aws::String &name) { bucketName_ = name; }
Aws::String GetBucketName() { return bucketName_; }

Aws::Client::ClientConfiguration *GetConfig() { return clientCfg_; }

private:
class AsyncRequestInflightBytesThrottle {
public:
Expand Down

0 comments on commit 8362050

Please sign in to comment.