chaoyli commented on a change in pull request #1976: And multi-path in
RowsetGraph
URL: https://github.com/apache/incubator-doris/pull/1976#discussion_r334765461
##########
File path: be/src/olap/tablet.cpp
##########
@@ -287,31 +168,63 @@ OLAPStatus Tablet::add_rowset(RowsetSharedPtr rowset,
bool need_persist) {
return OLAP_SUCCESS;
}
-OLAPStatus Tablet::modify_rowsets(const vector<RowsetSharedPtr>& to_add,
- const vector<RowsetSharedPtr>& to_delete) {
+OLAPStatus Tablet::add_rowsets(const vector<RowsetSharedPtr>& to_add) {
+ WriteLock wrlock(&_meta_lock);
+
+ // Add rowsets to tablet_meta for compaction/clone/alter table/rollup.
+ // Before taking these rowsets into effect, should
+ // check shortest-path existence after adding rowsets
+
vector<RowsetMetaSharedPtr> rs_metas_to_add;
for (auto& rs : to_add) {
rs_metas_to_add.push_back(rs->rowset_meta());
}
+ TabletMetaSharedPtr new_tablet_meta(new TabletMeta());
+ RETURN_NOT_OK(generate_tablet_meta_copy(new_tablet_meta));
+
+ RowsetGraph new_rs_graph = _rs_graph;
+
+ Version maximum_version = new_tablet_meta->max_version();
+ std::vector<Version> version_path;
+
+ OLAPStatus res = new_rs_graph.capture_consistent_versions(maximum_version,
&version_path);
+ if (res != OLAP_SUCCESS) {
+ LOG(WARNING) << "add rowsets failed because of shortest-path
inexistence";
+ return res;
+ }
+
+ _tablet_meta = new_tablet_meta;
+ for (auto& rs : to_add) {
+ _rs_version_map[rs->version()] = rs;
+ }
+
+ _rs_graph = new_rs_graph;
+
+ // only used in local mode
+ res = save_meta();
Review comment:
I will obey the rule that save local meta first and then modify in-memory
data structure.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]