w41ter commented on code in PR #33318:
URL: https://github.com/apache/doris/pull/33318#discussion_r1555149969


##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -583,18 +584,11 @@ void 
MetaServiceImpl::create_tablets(::google::protobuf::RpcController* controll
             break;
         }
 
-        // The S3 vault would be stored inside the instance.obj_info
-        auto s3_obj = std::find_if(instance.obj_info().begin(), 
instance.obj_info().end(),
-                                   [&](const ObjectStoreInfoPB& obj) {
-                                       if (!obj.has_name()) {
-                                           return false;
-                                       }
-                                       return obj.name() == name;
-                                   });
-
-        if (s3_obj != instance.obj_info().end()) {
-            response->set_storage_vault_id(s3_obj->id());
-            response->set_storage_vault_name(s3_obj->name());
+        // The obj info stores the legacy obj info for Cloud and stage.
+        // All the obj info stored in obj_info is sorted in descending order 
by id
+        // In legacy compatible cloud instances we use the latest obj info's 
id as default vault id
+        if(size_t idx = instance.obj_info().size() - 1; idx > 0) {

Review Comment:
   `size_t` is unsigned, what happens if the `obj_info` is empty?



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to