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


##########
be/src/runtime/query_context.h:
##########
@@ -222,6 +228,14 @@ class QueryContext {
     taskgroup::TaskGroupPtr _task_group;
     std::unique_ptr<RuntimeFilterMgr> _runtime_filter_mgr;
     const TQueryOptions _query_options;
+
+    // When querying, certain structures need to be delayed in their release.
+    // Placing these structures in _reference_holder can extend their lifespan 
until the query is completed,
+    // and they are automatically released. For example, in two-phase delayed 
materialization queries,
+    // Rowsets need to be released after the query is finished to avoid 
premature release during the query process,
+    // which could lead to query exceptions.
+    std::vector<std::shared_ptr<void>> _reference_holder;

Review Comment:
   Do not use a very abstract structure. I think you could use std::shared_ptr< 
Rowset > and then the maintainer could understand very clear that the query 
context hold some rowset. Or there maybe some memory leak for example, if some 
other people add olap scan node to query context. The olap scan node maybe a 
shared ptr, it owns query context and query context owns olap scannode .



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