From 83620503ac83e6dee0a9d9e2f899d2aceffa5818 Mon Sep 17 00:00:00 2001 From: caoxianfei1 Date: Fri, 17 Nov 2023 15:57:44 +0800 Subject: [PATCH] Revert "curvefs/client: make user agent configurable" This reverts commit 0346d8291eb31997ca8e251df42373d73a6d2be6. Signed-off-by: caoxianfei1 --- conf/s3.conf | 2 +- curvefs/conf/client.conf | 1 - curvefs/conf/mds.conf | 1 - curvefs/conf/metaserver.conf | 1 - curvefs/test/client/client_s3_test.cpp | 18 ++++-------------- curvefs/test/client/test_fuse_s3_client.cpp | 2 -- .../metaserver/s3compact/s3compact_test.cpp | 1 - src/common/s3_adapter.cpp | 5 +++-- src/common/s3_adapter.h | 3 --- 9 files changed, 8 insertions(+), 26 deletions(-) diff --git a/conf/s3.conf b/conf/s3.conf index cea743b75a..c0aa3ae6f1 100644 --- a/conf/s3.conf +++ b/conf/s3.conf @@ -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 diff --git a/curvefs/conf/client.conf b/curvefs/conf/client.conf index 755d624920..0db7ce33d9 100644 --- a/curvefs/conf/client.conf +++ b/curvefs/conf/client.conf @@ -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 diff --git a/curvefs/conf/mds.conf b/curvefs/conf/mds.conf index 0c28d89946..294e35cfe7 100644 --- a/curvefs/conf/mds.conf +++ b/curvefs/conf/mds.conf @@ -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 diff --git a/curvefs/conf/metaserver.conf b/curvefs/conf/metaserver.conf index a16fd4d101..11c4ee965e 100644 --- a/curvefs/conf/metaserver.conf +++ b/curvefs/conf/metaserver.conf @@ -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 diff --git a/curvefs/test/client/client_s3_test.cpp b/curvefs/test/client/client_s3_test.cpp index 0672cfe68f..9be0bc8d2f 100644 --- a/curvefs/test/client/client_s3_test.cpp +++ b/curvefs/test/client/client_s3_test.cpp @@ -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; @@ -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) { @@ -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) { @@ -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) { @@ -125,7 +115,7 @@ TEST_F(ClientS3Test, downloadAsync) { EXPECT_CALL(*s3Client_, GetObjectAsync(_)) .WillOnce(Return()); client_->DownloadAsync(context); - delete[] buf; + delete buf; } diff --git a/curvefs/test/client/test_fuse_s3_client.cpp b/curvefs/test/client/test_fuse_s3_client.cpp index dd71313917..7e55d6df77 100644 --- a/curvefs/test/client/test_fuse_s3_client.cpp +++ b/curvefs/test/client/test_fuse_s3_client.cpp @@ -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; @@ -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; diff --git a/curvefs/test/metaserver/s3compact/s3compact_test.cpp b/curvefs/test/metaserver/s3compact/s3compact_test.cpp index d8fed36dab..614411c32e 100644 --- a/curvefs/test/metaserver/s3compact/s3compact_test.cpp +++ b/curvefs/test/metaserver/s3compact/s3compact_test.cpp @@ -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; diff --git a/src/common/s3_adapter.cpp b/src/common/s3_adapter.cpp index e3b3d917a0..d2226147c9 100644 --- a/src/common/s3_adapter.cpp +++ b/src/common/s3_adapter.cpp @@ -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", @@ -150,7 +149,9 @@ void S3Adapter::Init(const S3AdapterOption &option) { clientCfg_ = Aws::New(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; diff --git a/src/common/s3_adapter.h b/src/common/s3_adapter.h index 2adbbfb3bc..f276784406 100644 --- a/src/common/s3_adapter.h +++ b/src/common/s3_adapter.h @@ -79,7 +79,6 @@ struct S3AdapterOption { std::string logPrefix; int scheme; bool verifySsl; - std::string userAgent; int maxConnections; int connectTimeout; int requestTimeout; @@ -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: