You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/03/09 13:43:04 UTC

[GitHub] [incubator-doris] stdpain opened a new pull request #5491: Fix Memory Leak in SchemaChange And Fix some DCHECK error

stdpain opened a new pull request #5491:
URL: https://github.com/apache/incubator-doris/pull/5491


   ## Proposed changes
   
   Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [] Bugfix (non-breaking change which fixes an issue)
   - [] New feature (non-breaking change which adds functionality)
   - [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [] Documentation Update (if none of the other choices apply)
   - [] Code refactor (Modify the code structure, format the code, etc...)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [] I have created an issue on (Fix #ISSUE) and described the bug/feature there in detail
   - [] Compiling and unit tests pass locally with my changes
   - [] I have added tests that prove my fix is effective or that my feature works
   - [] If these changes need document changes, I have updated the document
   - [] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...
   


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

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


[GitHub] [incubator-doris] stdpain commented on a change in pull request #5491: [BUG] Fix Memory Leak in SchemaChange And Fix some DCHECK error

Posted by GitBox <gi...@apache.org>.
stdpain commented on a change in pull request #5491:
URL: https://github.com/apache/incubator-doris/pull/5491#discussion_r592512646



##########
File path: be/src/exec/olap_utils.h
##########
@@ -207,6 +207,9 @@ inline SQLFilterOp to_olap_filter_type(TExprOpcode::type type, bool opposite) {
     case TExprOpcode::NE:
         return opposite ? FILTER_IN : FILTER_NOT_IN;
 
+    case TExprOpcode::EQ_FOR_NULL:

Review comment:
       It's OK. 
   case 1:
   ```sql
   select * from t1 where k1 <=> 1;
   ```
   It's equals to EQ
   
   case 2:
   ```
   select * from t1 where k1 <=> null;
   ```
   type  of k1 will not equals to LITERAL_NULL,  so storage engine will not use this conjunct 




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

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


[GitHub] [incubator-doris] morningman merged pull request #5491: [BUG] Fix Memory Leak in SchemaChange And Fix some DCHECK error

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #5491:
URL: https://github.com/apache/incubator-doris/pull/5491


   


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

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #5491: [BUG] Fix Memory Leak in SchemaChange And Fix some DCHECK error

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #5491:
URL: https://github.com/apache/incubator-doris/pull/5491#discussion_r592385567



##########
File path: be/src/exec/analytic_eval_node.cpp
##########
@@ -753,7 +753,8 @@ Status AnalyticEvalNode::get_next_output_batch(RuntimeState* state, RowBatch* ou
         // CopyRow works as expected: input_batch tuples form a prefix of output_batch
         // tuples.
         TupleRow* dest = output_batch->get_row(output_batch->add_row());
-        input_batch.copy_row(input_batch.get_row(i), dest);
+        input_batch.get_row(i)->deep_copy(dest, child(0)->row_desc().tuple_descriptors(),

Review comment:
       What is different between copy_row and deep_copy?
   modify the comment explain why

##########
File path: be/src/exec/olap_utils.h
##########
@@ -207,6 +207,9 @@ inline SQLFilterOp to_olap_filter_type(TExprOpcode::type type, bool opposite) {
     case TExprOpcode::NE:
         return opposite ? FILTER_IN : FILTER_NOT_IN;
 
+    case TExprOpcode::EQ_FOR_NULL:

Review comment:
       Can the storage engine handle `EQ_FOR_NULL` correctly with `FILTER_IN`?

##########
File path: be/src/olap/aggregate_func.h
##########
@@ -461,10 +461,9 @@ struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_HLL_UNION, OLAP_FIELD_TYPE_HLL
         // we use zero size represent this slice is a agg object
         dst_slice->size = 0;
         auto* hll = new HyperLogLog(*src_slice);
+        
         dst_slice->data = reinterpret_cast<char*>(hll);
 
-        mem_pool->mem_tracker()->Consume(sizeof(HyperLogLog));

Review comment:
       Why remove this?

##########
File path: be/src/runtime/tablets_channel.cpp
##########
@@ -260,7 +260,6 @@ Status TabletsChannel::cancel() {
     for (auto& it : _tablet_writers) {
         it.second->cancel();
     }
-    DCHECK_EQ(_mem_tracker->consumption(), 0);

Review comment:
       Why remove this?

##########
File path: be/src/exec/partitioned_aggregation_node.cc
##########
@@ -345,9 +345,12 @@ Status PartitionedAggregationNode::open(RuntimeState* state) {
 }
 
 Status PartitionedAggregationNode::get_next(RuntimeState* state, RowBatch* row_batch, bool* eos) {
-    int first_row_idx = row_batch->num_rows();
-    RETURN_IF_ERROR(GetNextInternal(state, row_batch, eos));
-    RETURN_IF_ERROR(HandleOutputStrings(row_batch, first_row_idx));
+    DCHECK_EQ(row_batch->num_rows(), 0);
+    RowBatch batch(row_batch->row_desc(), row_batch->capacity(), _mem_tracker.get());
+    int first_row_idx = batch.num_rows();
+    RETURN_IF_ERROR(GetNextInternal(state, &batch, eos));
+    RETURN_IF_ERROR(HandleOutputStrings(&batch, first_row_idx));
+    batch.deep_copy_to(row_batch);

Review comment:
       Add comment to explain why we need deep copy here




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

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


[GitHub] [incubator-doris] stdpain commented on a change in pull request #5491: [BUG] Fix Memory Leak in SchemaChange And Fix some DCHECK error

Posted by GitBox <gi...@apache.org>.
stdpain commented on a change in pull request #5491:
URL: https://github.com/apache/incubator-doris/pull/5491#discussion_r592426836



##########
File path: be/src/runtime/tablets_channel.cpp
##########
@@ -260,7 +260,6 @@ Status TabletsChannel::cancel() {
     for (auto& it : _tablet_writers) {
         it.second->cancel();
     }
-    DCHECK_EQ(_mem_tracker->consumption(), 0);

Review comment:
       We can't guarantee that by the time we get here, TabletsChannel::add_batch have been executed, TabletsChannel::add_batch's RowBatch may  not have been destroyed and tracker's consumption may greater than zero

##########
File path: be/src/olap/aggregate_func.h
##########
@@ -461,10 +461,9 @@ struct AggregateFuncTraits<OLAP_FIELD_AGGREGATION_HLL_UNION, OLAP_FIELD_TYPE_HLL
         // we use zero size represent this slice is a agg object
         dst_slice->size = 0;
         auto* hll = new HyperLogLog(*src_slice);
+        
         dst_slice->data = reinterpret_cast<char*>(hll);
 
-        mem_pool->mem_tracker()->Consume(sizeof(HyperLogLog));

Review comment:
       we don't have to record 4 bytes in the tracker,if we want to tracker it, If we want to record it, we need a wrapper and release it at the time of deconstruction. This process requires additional memory overhead and lock application. I don't think it's worth doing it.
   
   ```c++
           auto* hll = new HyperLogLog(*src_slice);
           dst_slice->data = reinterpret_cast<char*>(hll);
   
           mem_pool->mem_tracker()->Consume(sizeof(HyperLogLog));
           auto defer = new Defer([]() {
             mem_pool->mem_tracker()->Release();
          });
          agg_pool->add(defer);
   ```




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

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