You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/21 16:21:42 UTC

[GitHub] [doris] morningman commented on a diff in pull request #11026: [fix] Move s3 fs connect outside the lock critical area

morningman commented on code in PR #11026:
URL: https://github.com/apache/doris/pull/11026#discussion_r926878863


##########
be/src/olap/storage_policy_mgr.cpp:
##########
@@ -24,43 +24,60 @@
 
 namespace doris {
 
-void StoragePolicyMgr::update(const std::string& name, StoragePolicyPtr policy) {
-    std::lock_guard<std::mutex> l(_mutex);
-    auto it = _policy_map.find(name);
-    if (it != _policy_map.end()) {
-        // just support change ak, sk, cooldown_ttl, cooldown_datetime
-        LOG(INFO) << "update storage policy name: " << name;
-        auto s3_fs = std::dynamic_pointer_cast<io::S3FileSystem>(
-                io::FileSystemMap::instance()->get(name));
-        DCHECK(s3_fs);
-        s3_fs->set_ak(policy->s3_ak);
-        s3_fs->set_sk(policy->s3_sk);
-        s3_fs->connect();
-        it->second = std::move(policy);
-    } else {
-        // can't find name's policy, so do nothing.
+void StoragePolicyMgr::update(const std::string& name, const StoragePolicyPtr& policy) {

Review Comment:
   Looks like the `update` and `refresh` policy process may be called concurrently?
   If so, it is not safe to update `s3_fs` outside the lock



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org