Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]fix the crash of checksum task #3735 #3738

Merged
merged 4 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions be/src/olap/row.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ void agg_finalize_row(const std::vector<uint32_t>& ids, RowType* row, MemPool* m

template<typename RowType>
uint32_t hash_row(const RowType& row, uint32_t seed) {
FieldType type;
for (uint32_t cid : row.schema()->column_ids()) {
type = row.schema()->column(cid)->type();
if (type == OLAP_FIELD_TYPE_FLOAT || type == OLAP_FIELD_TYPE_DOUBLE) {
continue;
}
seed = row.schema()->column(cid)->hash_code(row.cell(cid), seed);
}
return seed;
Expand Down
13 changes: 5 additions & 8 deletions be/src/olap/task/engine_checksum_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ OLAPStatus EngineChecksumTask::_compute_checksum() {
}
}

// ignore float and double type considering to precision lose
for (size_t i = 0; i < tablet->tablet_schema().num_columns(); ++i) {
FieldType type = tablet->tablet_schema().column(i).type();
if (type == OLAP_FIELD_TYPE_FLOAT || type == OLAP_FIELD_TYPE_DOUBLE) {
continue;
}

reader_params.return_columns.push_back(i);
}

Expand All @@ -109,6 +103,7 @@ OLAPStatus EngineChecksumTask::_compute_checksum() {

bool eof = false;
uint32_t row_checksum = 0;
uint32_t one_checksum;
while (true) {
OLAPStatus res = reader.next_row_with_aggregation(&row, mem_pool.get(), agg_object_pool.get(), &eof);
if (res == OLAP_SUCCESS && eof) {
Expand All @@ -118,8 +113,10 @@ OLAPStatus EngineChecksumTask::_compute_checksum() {
OLAP_LOG_WARNING("fail to read in reader. [res=%d]", res);
return res;
}

row_checksum = hash_row(row, row_checksum);
one_checksum = 0;
one_checksum = hash_row(row, one_checksum);
// The value of checksum is independent of the sorting of data rows.
row_checksum = row_checksum ^ one_checksum;
// the memory allocate by mem pool has been copied,
// so we should release memory immediately
mem_pool->clear();
Expand Down