Skip to content

Commit 083eff5

Browse files
committed
Merge cherry-pick #18772
1 parent 8f3228d commit 083eff5

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/Storages/MergeTree/MergeTreeDataPartWriterOnDisk.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -207,33 +207,33 @@ void MergeTreeDataPartWriterOnDisk::calculateAndSerializePrimaryIndex(const Bloc
207207
}
208208

209209
{
210-
/** While filling index (index_columns), disable memory tracker.
211-
* Because memory is allocated here (maybe in context of INSERT query),
212-
* but then freed in completely different place (while merging parts), where query memory_tracker is not available.
213-
* And otherwise it will look like excessively growing memory consumption in context of query.
214-
* (observed in long INSERT SELECTs)
215-
*/
216-
MemoryTracker::BlockerInThread temporarily_disable_memory_tracker;
210+
/** While filling index (index_columns), disable memory tracker.
211+
* Because memory is allocated here (maybe in context of INSERT query),
212+
* but then freed in completely different place (while merging parts), where query memory_tracker is not available.
213+
* And otherwise it will look like excessively growing memory consumption in context of query.
214+
* (observed in long INSERT SELECTs)
215+
*/
216+
MemoryTracker::BlockerInThread temporarily_disable_memory_tracker;
217217

218-
/// Write index. The index contains Primary Key value for each `index_granularity` row.
218+
/// Write index. The index contains Primary Key value for each `index_granularity` row.
219219

220-
size_t current_row = getIndexOffset();
221-
size_t total_marks = index_granularity.getMarksCount();
220+
size_t current_row = getIndexOffset();
221+
size_t total_marks = index_granularity.getMarksCount();
222222

223-
while (index_mark < total_marks && current_row < rows)
224-
{
225-
if (metadata_snapshot->hasPrimaryKey())
223+
while (index_mark < total_marks && current_row < rows)
226224
{
227-
for (size_t j = 0; j < primary_columns_num; ++j)
225+
if (metadata_snapshot->hasPrimaryKey())
228226
{
229-
const auto & primary_column = primary_index_block.getByPosition(j);
230-
index_columns[j]->insertFrom(*primary_column.column, current_row);
231-
primary_column.type->serializeBinary(*primary_column.column, current_row, *index_stream);
227+
for (size_t j = 0; j < primary_columns_num; ++j)
228+
{
229+
const auto & primary_column = primary_index_block.getByPosition(j);
230+
index_columns[j]->insertFrom(*primary_column.column, current_row);
231+
primary_column.type->serializeBinary(*primary_column.column, current_row, *index_stream);
232+
}
232233
}
233-
}
234234

235-
current_row += index_granularity.getMarkRows(index_mark++);
236-
}
235+
current_row += index_granularity.getMarkRows(index_mark++);
236+
}
237237
}
238238

239239
/// store last index row to write final mark at the end of column

0 commit comments

Comments
 (0)