-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curvefs/Multiple s3 support #1132
Conversation
67f336b
to
87fe451
Compare
curvefs/src/mds/fs_manager.cpp
Outdated
@@ -182,6 +183,18 @@ FSStatusCode FsManager::CreateFs(const std::string& fsName, FSType fsType, | |||
} | |||
} | |||
|
|||
// check s3info | |||
if (detail.has_s3info()) { | |||
auto s3Info = detail.s3info(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto& s3Info = ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto& s3Info = ...
fix
curvefs/src/mds/s3/mds_s3.h
Outdated
S3ClientImpl() : S3Client() {} | ||
virtual ~S3ClientImpl() {} | ||
|
||
void SetAdaptor(std::shared_ptr<curve::common::S3Adapter> s3Adapter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not pass it in constructor ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not pass it in constructor ?
just do it like curvefs/src/client/s3/client_s3.h.
But I think it should be mocked for unit testing
curvefs/src/client/curve_fuse_op.cpp
Outdated
} | ||
|
||
void FuseOpInit(void *userdata, struct fuse_conn_info *conn) { | ||
CURVEFS_ERROR ret = g_ClientInstance->FuseOpInit(userdata, conn); | ||
if (ret != CURVEFS_ERROR::OK) { | ||
LOG(FATAL) << "FuseOpInit failed, ret = " << ret; | ||
LOG(ERROR) << "FuseOpInit failed, ret = " << ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change log level to ERROR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change log level to ERROR?
fix
curvefs/src/client/curve_fuse_op.cpp
Outdated
@@ -90,7 +94,30 @@ int InitGlog(const char *confPath, const char *argv0) { | |||
return 0; | |||
} | |||
|
|||
int InitFuseClient(const char *confPath, const char *fsType) { | |||
int GetFsInfo(const char *fsName, std::shared_ptr<FsInfo> fsInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static or put this function into anonymous namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this function into anonymous namespace
fix
curvefs/src/client/curve_fuse_op.cpp
Outdated
} else if (fsTypeStr == "s3") { | ||
g_ClientInstance = new FuseS3Client(); | ||
// set fsS3Option | ||
const auto& s3Info = fsInfo->detail().s3info(); | ||
::curve::common::FsS3Option fsS3Option; | ||
::curvefs::client::common::S3Info2FsS3Option(s3Info, &fsS3Option); | ||
SetFuseClientS3Option(g_fuseClientOption, fsS3Option); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just put these in fuse_s3_client ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just put these in fuse_s3_client ?
good,idea! fix
curvefs/conf/mds.conf
Outdated
#### s3 | ||
# the max size that fuse send | ||
s3.fuseMaxSize=131072 | ||
s3.pagesize=65536 | ||
# prefetch blocks that disk cache use | ||
s3.prefetchBlocks=1 | ||
# prefetch threads | ||
s3.prefetchExecQueueNum=1 | ||
# start sleep when mem cache use ratio is greater than nearfullRatio, | ||
# sleep time increase follow with mem cache use raito, baseSleepUs is baseline. | ||
s3.nearfullRatio=70 | ||
s3.baseSleepUs=500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these fields are useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these fields are useless.
this for init but i will try for delete this
::curve::client::RPCExcutorRetryPolicy rpcexcutor_; | ||
::curve::client::MetaServerOption mdsOpt_; | ||
|
||
MDSClientMetric mdsClientMetric_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metric is also unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metric is also unnecessary
fix
@@ -36,6 +36,9 @@ class S3Client { | |||
virtual void Init(const curve::common::S3AdapterOption& option) = 0; | |||
virtual int Delete(const std::string& name) = 0; | |||
virtual int DeleteBatch(const std::list<std::string>& nameList) = 0; | |||
virtual void Reinit(const std::string& ak, const std::string& sk, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a superset of s3client in mds_s3.h, you should reduce duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a superset of s3client in mds_s3.h, you should reduce duplication.
this is different from mds_s3, mds_s3 work for check s3 info available, this work for delete s3 object.
There is no inheritance relationship between these two s3.
src/common/s3_adapter.h
Outdated
struct FsS3Option { | ||
// should get from mds | ||
std::string ak; | ||
std::string sk; | ||
std::string s3Address; | ||
std::string bucketName; | ||
uint64_t blockSize; | ||
uint64_t chunkSize; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't put this option in here, I think s3 adapter is just put object to s3 or get object from s3, it shouldn't care about what is fs option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't put this option in here, I think s3 adapter is just put object to s3 or get object from s3, it shouldn't care about what is fs option.
this just for init, maybe the name is not well ,it should be like S3InfoOption?
src/common/s3_adapter.h
Outdated
uint64_t chunkSize; | ||
}; | ||
|
||
void InitS3AdaptorOptionExceptFsS3Option(Configuration* conf, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
fix
curvefs/src/mds/fs_manager.cpp
Outdated
s3Client_->Reinit(s3Info.ak(), s3Info.sk(), s3Info.endpoint(), | ||
s3Info.bucketname()); | ||
if (!s3Client_->BucketExist()) { | ||
LOG(ERROR) << "s3info for fs is not available, s3info is " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output should be aligned and add fsName.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output should be aligned and add fsName.
fix
curvefs/src/mds/mds.cpp
Outdated
@@ -150,9 +151,17 @@ void MDS::Init() { | |||
FsManagerOption fsManagerOption; | |||
InitFsManagerOptions(&fsManagerOption); | |||
|
|||
auto s3Client = std::make_shared<S3ClientImpl>(); | |||
s3Client->SetAdaptor(std::make_shared<curve::common::S3Adapter>()); | |||
s3Client_ = s3Client; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto s3Client = std::make_shared();
s3Client->SetAdaptor(std::make_sharedcurve::common::S3Adapter());
s3Client_ = s3Client;
s3Client_ = std::make_shared();
s3Client_->SetAdaptor(std::make_sharedcurve::common::S3Adapter());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto s3Client = std::make_shared(); s3Client->SetAdaptor(std::make_sharedcurve::common::S3Adapter()); s3Client_ = s3Client;
s3Client_ = std::make_shared(); s3Client_->SetAdaptor(std::make_sharedcurve::common::S3Adapter());
fix
curvefs/src/mds/s3/mds_s3.h
Outdated
|
||
namespace curvefs { | ||
namespace mds { | ||
class S3Client { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class S3Client in mds can use S3Adapter replace directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class S3Client in mds can use S3Adapter replace directly.
This s3client doesn't need so many functions, just for check s3info available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class S3Client in mds can use S3Adapter replace directly.
This s3client doesn't need so many functions, just for check s3info available.
I means the S3Client doesn't need, it just a simple wrapper of S3Adaper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class S3Client in mds can use S3Adapter replace directly.
This s3client doesn't need so many functions, just for check s3info available.
I means the S3Client doesn't need, it just a simple wrapper of S3Adaper.
Compared with using the S3 Adaptor directly, the client seems to be able to better indicate the s3 functions used by mds, or the role of s3 in mds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class S3Client in mds can use S3Adapter replace directly.
This s3client doesn't need so many functions, just for check s3info available.
I means the S3Client doesn't need, it just a simple wrapper of S3Adaper.
fix
using ::curvefs::mds::GetFsInfoResponse; | ||
using ::curvefs::client::rpcclient::MDSBaseClient; | ||
|
||
class MdsClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can reuse MdsClient in client, put the MdsClient to common or some other ways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can reuse MdsClient in client, put the MdsClient to common or some other ways?
This mdsclient doesn't need so many functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can reuse MdsClient in client, put the MdsClient to common or some other ways?
This mdsclient doesn't need so many functions
Yes, but mdsclient is everywhere in client, mds, metaserver. That is similar to S3 info is everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can reuse MdsClient in client, put the MdsClient to common or some other ways?
This mdsclient doesn't need so many functions
Yes, but mdsclient is everywhere in client, mds, metaserver. That is similar to S3 info is everywhere.
ok, fix
bb1691e
to
0856091
Compare
virtual void Init(const curve::common::S3AdapterOption& option) = 0; | ||
virtual int Delete(const std::string& name) = 0; | ||
virtual int DeleteBatch(const std::list<std::string>& nameList) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why we have this S3Client
because it's just a wrapper of S3Adapter
, and what it does is forward the function call to S3Adapter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why we have this
S3Client
because it's just a wrapper ofS3Adapter
, and what it does is forward the function call to S3Adapter.
yep
dd8dd50
to
377a147
Compare
1. client get s3Info from mds by fsId, and use s3Info to set s3Adapter; 2. metaserver get s3info from mds by fsId, and use s3Info to set s3Adaptor; 3. mds check s3info available by check bucketName before create fs.
What problem does this PR solve?
Issue Number: close #1119 #1120 #1037 #1038
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List