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

Fix creating rollup bug from multi SegmentGroups generated by streaming load #1287

Merged
merged 2 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 13 additions & 2 deletions be/src/olap/olap_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1867,8 +1867,19 @@ void OLAPTable::_list_files_with_suffix(const string& file_suffix, set<string>*
}
}

bool OLAPTable::has_version(const Version& version) const {
return (_data_sources.find(version) != _data_sources.end());
bool OLAPTable::has_segment_group(const Version& version, const SegmentGroup* new_segment_group) const {
if (_data_sources.find(version) == _data_sources.end()) {
return false;
}
bool exist = false;
auto it = _data_sources.find(version);
for (auto segment_group : it->second) {
if (segment_group->segment_group_id() == new_segment_group->segment_group_id()) {
exist = true;
break;
}
}
return exist;
}

void OLAPTable::list_versions(vector<Version>* versions) const {
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/olap_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {

void list_index_files(std::set<std::string>* filenames) const;

bool has_version(const Version& version) const;
bool has_segment_group(const Version& version, const SegmentGroup* new_segment_group) const;

void list_versions(std::vector<Version>* versions) const;

Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/schema_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
sc_params->ref_olap_table->obtain_header_wrlock();
sc_params->new_olap_table->obtain_header_wrlock();

if (!sc_params->new_olap_table->has_version((*it)->version())) {
if (!sc_params->new_olap_table->has_segment_group((*it)->version(), new_segment_group)) {
// register version
std::vector<SegmentGroup*> segment_group_vec;
segment_group_vec.push_back(new_segment_group);
Expand Down