From b8c5e6bead701cb228935256016a88842a8741e9 Mon Sep 17 00:00:00 2001 From: csun5285 Date: Fri, 2 Aug 2024 17:32:51 +0800 Subject: [PATCH 1/2] add log and fix time series fix fix build and comment --- be/src/olap/compaction.cpp | 12 ++++++++++-- be/src/olap/cumulative_compaction.cpp | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp index 849db757ac070e..2256d1c304efb3 100644 --- a/be/src/olap/compaction.cpp +++ b/be/src/olap/compaction.cpp @@ -333,7 +333,11 @@ Status Compaction::do_compaction_impl(int64_t permits) { int64_t now = UnixMillis(); if (compaction_type() == ReaderType::READER_CUMULATIVE_COMPACTION) { - _tablet->set_last_cumu_compaction_success_time(now); + // TIME_SERIES_POLICY, generating an empty rowset doesn't need to update the timestamp. + if (!(_tablet->tablet_meta()->compaction_policy() == CUMULATIVE_TIME_SERIES_POLICY && + _output_rowset->num_segments() == 0)) { + _tablet->set_last_cumu_compaction_success_time(now); + } } else if (compaction_type() == ReaderType::READER_BASE_COMPACTION) { _tablet->set_last_base_compaction_success_time(now); } else if (compaction_type() == ReaderType::READER_FULL_COMPACTION) { @@ -748,7 +752,11 @@ Status Compaction::do_compaction_impl(int64_t permits) { int64_t now = UnixMillis(); // TODO(yingchun): do the judge in Tablet class if (compaction_type() == ReaderType::READER_CUMULATIVE_COMPACTION) { - _tablet->set_last_cumu_compaction_success_time(now); + // TIME_SERIES_POLICY, generating an empty rowset doesn't need to update the timestamp. + if (!(_tablet->tablet_meta()->compaction_policy() == CUMULATIVE_TIME_SERIES_POLICY && + _output_rowset->num_segments() == 0)) { + _tablet->set_last_cumu_compaction_success_time(now); + } } else if (compaction_type() == ReaderType::READER_BASE_COMPACTION) { _tablet->set_last_base_compaction_success_time(now); } else if (compaction_type() == ReaderType::READER_FULL_COMPACTION) { diff --git a/be/src/olap/cumulative_compaction.cpp b/be/src/olap/cumulative_compaction.cpp index 04504432f195fa..bd7574f29c5f79 100644 --- a/be/src/olap/cumulative_compaction.cpp +++ b/be/src/olap/cumulative_compaction.cpp @@ -27,6 +27,7 @@ #include "common/config.h" #include "common/logging.h" #include "olap/cumulative_compaction_policy.h" +#include "olap/cumulative_compaction_time_series_policy.h" #include "olap/olap_define.h" #include "olap/rowset/rowset_meta.h" #include "runtime/thread_context.h" From 4f44fca50b4454b6485cd35ba2fd010cbe41c50c Mon Sep 17 00:00:00 2001 From: csun5285 Date: Wed, 7 Aug 2024 19:11:26 +0800 Subject: [PATCH 2/2] fix rebase --- be/src/olap/cumulative_compaction.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/be/src/olap/cumulative_compaction.cpp b/be/src/olap/cumulative_compaction.cpp index bd7574f29c5f79..04504432f195fa 100644 --- a/be/src/olap/cumulative_compaction.cpp +++ b/be/src/olap/cumulative_compaction.cpp @@ -27,7 +27,6 @@ #include "common/config.h" #include "common/logging.h" #include "olap/cumulative_compaction_policy.h" -#include "olap/cumulative_compaction_time_series_policy.h" #include "olap/olap_define.h" #include "olap/rowset/rowset_meta.h" #include "runtime/thread_context.h"