You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "yiguolei (via GitHub)" <gi...@apache.org> on 2023/06/13 11:19:57 UTC

[GitHub] [doris] yiguolei commented on a diff in pull request #20732: [Bug](topn opt) Fix Two-Phase read when some rowset swept

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