yiguolei commented on code in PR #23464:
URL: https://github.com/apache/doris/pull/23464#discussion_r1305085346


##########
be/src/service/doris_main.cpp:
##########
@@ -409,25 +409,21 @@ int main(int argc, char** argv) {
                 .build(&file_cache_init_pool);
 
         std::vector<doris::Status> cache_status;
+        int i = 0;
+        cache_status.resize(cache_paths.size());
         for (auto& cache_path : cache_paths) {
             if (cache_path_set.find(cache_path.path) != cache_path_set.end()) {
+                i++;
                 LOG(WARNING) << fmt::format("cache path {} is duplicate", 
cache_path.path);
                 continue;
             }
 
-            cache_status.push_back(Status::OK());
             RETURN_IF_ERROR(file_cache_init_pool->submit_func(
                     std::bind(&doris::io::FileCacheFactory::create_file_cache,
                               &(doris::io::FileCacheFactory::instance()), 
cache_path.path,
-                              cache_path.init_settings(), 
&(cache_status.back()))));
+                              cache_path.init_settings(), 
&cache_status[i++])));

Review Comment:
   这个代码怎么改都很不好, 太靠别人对C++ 的实现的理解了。
   我们后面还是想办法把这个机制去掉吧。 我觉得我们依赖std future 都比这个靠谱啊。



##########
be/src/service/doris_main.cpp:
##########
@@ -409,25 +409,21 @@ int main(int argc, char** argv) {
                 .build(&file_cache_init_pool);
 
         std::vector<doris::Status> cache_status;
+        int i = 0;
+        cache_status.resize(cache_paths.size());
         for (auto& cache_path : cache_paths) {
             if (cache_path_set.find(cache_path.path) != cache_path_set.end()) {
+                i++;
                 LOG(WARNING) << fmt::format("cache path {} is duplicate", 
cache_path.path);
                 continue;
             }
 
-            cache_status.push_back(Status::OK());
             RETURN_IF_ERROR(file_cache_init_pool->submit_func(
                     std::bind(&doris::io::FileCacheFactory::create_file_cache,
                               &(doris::io::FileCacheFactory::instance()), 
cache_path.path,
-                              cache_path.init_settings(), 
&(cache_status.back()))));
+                              cache_path.init_settings(), 
&cache_status[i++])));

Review Comment:
   这个代码怎么改都很不好, 太靠别人对C++ 的实现的理解了。
   我们后面还是想办法把这个机制去掉吧。 我觉得我们依赖std future 都比这个靠谱啊。



-- 
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]

Reply via email to