morningman commented on a change in pull request #6932:
URL: https://github.com/apache/incubator-doris/pull/6932#discussion_r736123481
##########
File path: be/src/olap/schema_change.cpp
##########
@@ -1184,6 +1196,16 @@ OLAPStatus
SchemaChangeWithSorting::process(RowsetReaderSharedPtr rowset_reader,
true)) {
LOG(WARNING) << "failed to allocate RowBlock.";
return OLAP_ERR_INPUT_PARAMETER_ERROR;
+ }else {
+ // do memory check for sorting, in case schema change task fail at
row block sorting because of
+ // not doing internal sorting first
+ if
(!_row_block_allocator->is_memory_enough_for_sorting(ref_row_block->row_block_info().row_num,
+
row_block_sorter.num_rows())) {
+ if (new_row_block != nullptr) {
+ _row_block_allocator->release(new_row_block);
+ new_row_block = nullptr;
+ }
Review comment:
Why not just return here?
##########
File path: be/src/olap/schema_change.cpp
##########
@@ -1184,6 +1196,16 @@ OLAPStatus
SchemaChangeWithSorting::process(RowsetReaderSharedPtr rowset_reader,
true)) {
LOG(WARNING) << "failed to allocate RowBlock.";
return OLAP_ERR_INPUT_PARAMETER_ERROR;
+ }else {
Review comment:
```suggestion
} else {
```
##########
File path: be/src/olap/schema_change.cpp
##########
@@ -800,6 +803,15 @@ void RowBlockAllocator::release(RowBlock* row_block) {
delete row_block;
}
+bool RowBlockAllocator::is_memory_enough_for_sorting(size_t num_rows, size_t
allocated_rows){
+ if (num_rows <= allocated_rows) {
+ return true;
+ }
+ size_t row_block_size = _row_len * (num_rows - allocated_rows);
+ return _memory_allocated + row_block_size < _memory_limitation;
Review comment:
`_memory_allocated` seems not initialized? And nowhere to set it.
Looks like it can be removed, and use `_mem_tracker->consumption()` instead.
--
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]