// 记录 delta_index 更新前的状态 auto [my_placed_rows, my_placed_deletes] = my_delta_index->getPlacedStatus();
// Let's do a fast check, determine whether we need to do place or not. if (!delta_reader->shouldPlace(dm_context, my_delta_index, rowkey_range, relevant_range, max_version)) return {my_delta_index, false}; //... }
for (size_t file_index = start_file_index; file_index < snapshot->getColumnFileCount(); ++file_index) { auto & column_file = column_files[file_index];
// Always do place index if ColumnFileBig exists. // ColumnBigFile 中的数据肯定是没有更新到 DelteTree 中,更新完应该是要对这个 BigFile 做个操作 if (column_file->isBigFile()) returntrue; if (unlikely(column_file->isDeleteRange())) //??? throwException("column file is delete range", ErrorCodes::LOGICAL_ERROR);
auto & column_file_reader = column_file_readers[file_index]; if (column_file->isInMemoryFile()) { auto & dpb_reader = typeid_cast<ColumnFileInMemoryReader &>(*column_file_reader); auto pk_column = dpb_reader.getPKColumn(); auto version_column = dpb_reader.getVersionColumn();
auto rkcc = RowKeyColumnContainer(pk_column, context.is_common_handle); constauto & version_col_data = toColumnVectorData<UInt64>(version_column);
for (auto i = rows_start_in_file; i < rows_end_in_file; ++i) { // 这是什么逻辑 if (version_col_data[i] <= max_version && relevant_range.check(rkcc.getRowKeyValue(i))) returntrue; } } elseif (column_file->isTinyFile()) { auto & dpb_reader = typeid_cast<ColumnFileTinyReader &>(*column_file_reader); auto pk_column = dpb_reader.getPKColumn(); auto version_column = dpb_reader.getVersionColumn();
auto rkcc = RowKeyColumnContainer(pk_column, context.is_common_handle); constauto & version_col_data = toColumnVectorData<UInt64>(version_column);
for (auto i = rows_start_in_file; i < rows_end_in_file; ++i) { if (version_col_data[i] <= max_version && relevant_range.check(rkcc.getRowKeyValue(i))) returntrue; } } else { throwException("Unknown column file: " + column_file->toString(), ErrorCodes::LOGICAL_ERROR); } }