dataroaring commented on code in PR #54395:
URL: https://github.com/apache/doris/pull/54395#discussion_r2256441896
##########
be/src/cloud/cloud_meta_mgr.cpp:
##########
@@ -1695,5 +1703,122 @@ Status CloudMetaMgr::get_schema_dict(int64_t index_id,
return Status::OK();
}
+Status CloudMetaMgr::fill_version_holes(CloudTablet* tablet, int64_t
max_version,
+ std::unique_lock<std::shared_mutex>&
wlock) {
+ if (max_version <= 0) {
+ return Status::OK();
+ }
+
+ std::vector<RowsetSharedPtr> hole_rowsets;
+
+ Versions existing_versions;
+ for (const auto& rs : tablet->tablet_meta()->all_rs_metas()) {
+ existing_versions.emplace_back(rs->version());
+ }
+
+ // sort the existing versions in ascending order
+ std::sort(existing_versions.begin(), existing_versions.end(),
+ [](const Version& a, const Version& b) {
+ // simple because 2 versions are certainly not overlapping
+ return a.first < b.first;
+ });
+
+ // From the first version(=0), find the missing version until spec_version
+ int64_t last_version = -1;
+ Versions missed_versions;
+ for (const Version& version : existing_versions) {
+ // missing versions are those that are not in the existing_versions
+ if (version.first > last_version + 1) {
+ // there is a hole between versions
+ auto prev_rowset = tablet->get_rowset_by_version(version);
+ for (int64_t ver = last_version + 1; ver < version.first; ++ver) {
+ RowsetSharedPtr hole_rowset;
+ RETURN_IF_ERROR(create_empty_rowset_for_hole(
+ tablet, ver, prev_rowset->rowset_meta(),
&hole_rowset));
Review Comment:
We should use rowset meta from previous rowset. e.g. dropped column may
happens.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]