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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]