This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new df909238eb [improvement](compaction) enable compaction if state is
TABLET_NOTREADY (#16482)
df909238eb is described below
commit df909238ebf13dcf990fac48c7a7970c209f889a
Author: yixiutt <[email protected]>
AuthorDate: Tue Feb 7 21:46:21 2023 +0800
[improvement](compaction) enable compaction if state is TABLET_NOTREADY
(#16482)
cherry-pick 16470
---
be/src/olap/cumulative_compaction_policy.cpp | 8 ++++++++
be/src/olap/tablet.cpp | 7 +++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/be/src/olap/cumulative_compaction_policy.cpp
b/be/src/olap/cumulative_compaction_policy.cpp
index 5b30e3aa07..821c4a43b3 100644
--- a/be/src/olap/cumulative_compaction_policy.cpp
+++ b/be/src/olap/cumulative_compaction_policy.cpp
@@ -242,6 +242,7 @@ int SizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
std::vector<RowsetSharedPtr>* input_rowsets, Version*
last_delete_version,
size_t* compaction_score) {
size_t promotion_size = tablet->cumulative_promotion_size();
+ auto max_version = tablet->max_version().first;
int transient_size = 0;
*compaction_score = 0;
int64_t total_size = 0;
@@ -262,6 +263,13 @@ int
SizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
continue;
}
}
+ if (tablet->tablet_state() == TABLET_NOTREADY) {
+ // If tablet under alter, keep latest 10 version so that base
tablet max version
+ // not merged in new tablet, and then we can copy data from base
tablet
+ if (rowset->version().second < max_version - 10) {
+ continue;
+ }
+ }
if (*compaction_score >= max_compaction_score) {
// got enough segments
break;
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index f039bf96f7..d1b3eca443 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -794,10 +794,9 @@ bool Tablet::can_do_compaction(size_t path_hash,
CompactionType compaction_type)
}
if (tablet_state() == TABLET_NOTREADY) {
- // Before doing schema change, tablet's rowsets that versions smaller
than max converting version will be
- // removed. So, we only need to do the compaction when it is being
converted.
- // After being converted, tablet's state will be changed to
TABLET_RUNNING.
- return SchemaChangeHandler::tablet_in_converting(tablet_id());
+ // In TABLET_NOTREADY, we keep last 10 versions in new tablet so base
tablet max_version
+ // not merged in new tablet and then we can do compaction
+ return true;
}
return true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]