This is an automated email from the ASF dual-hosted git repository.
danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 5b31ef20c1e [HUDI-8108] Optimize
HoodieTimeline#filterPendingExcludingMajorAndMinorCompaction function naming
(#11808)
5b31ef20c1e is described below
commit 5b31ef20c1ee78efc6f4f799fa5f06c4e463e3be
Author: usberkeley <[email protected]>
AuthorDate: Thu Aug 22 09:31:10 2024 +0800
[HUDI-8108] Optimize
HoodieTimeline#filterPendingExcludingMajorAndMinorCompaction function naming
(#11808)
---
.../java/org/apache/hudi/client/BaseHoodieTableServiceClient.java | 2 +-
.../org/apache/hudi/table/upgrade/OneToZeroDowngradeHandler.java | 2 +-
.../org/apache/hudi/table/upgrade/TwoToOneDowngradeHandler.java | 2 +-
.../java/org/apache/hudi/table/upgrade/ZeroToOneUpgradeHandler.java | 2 +-
.../apache/hudi/common/table/timeline/HoodieDefaultTimeline.java | 3 +--
.../java/org/apache/hudi/common/table/timeline/HoodieTimeline.java | 6 +++---
.../apache/hudi/common/table/timeline/TestHoodieActiveTimeline.java | 4 ++--
7 files changed, 10 insertions(+), 11 deletions(-)
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java
index 397fa6ea2ea..4599de49411 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java
@@ -1097,7 +1097,7 @@ public abstract class BaseHoodieTableServiceClient<I, T,
O> extends BaseHoodieCl
public void rollbackFailedBootstrap() {
LOG.info("Rolling back pending bootstrap if present");
HoodieTable table = createTable(config, storageConf);
- HoodieTimeline inflightTimeline =
table.getMetaClient().getCommitsTimeline().filterPendingExcludingMajorAndMinorCompaction();
+ HoodieTimeline inflightTimeline =
table.getMetaClient().getCommitsTimeline().filterPendingExcludingCompactionAndLogCompaction();
Option<String> instant = Option.fromJavaOptional(
inflightTimeline.getReverseOrderedInstants().map(HoodieInstant::getTimestamp).findFirst());
if (instant.isPresent() && HoodieTimeline.compareTimestamps(instant.get(),
HoodieTimeline.LESSER_THAN_OR_EQUALS,
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/OneToZeroDowngradeHandler.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/OneToZeroDowngradeHandler.java
index d4b2bafc9ab..f8bda1e21a4 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/OneToZeroDowngradeHandler.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/OneToZeroDowngradeHandler.java
@@ -43,7 +43,7 @@ public class OneToZeroDowngradeHandler implements
DowngradeHandler {
SupportsUpgradeDowngrade upgradeDowngradeHelper) {
HoodieTable table = upgradeDowngradeHelper.getTable(config, context);
// fetch pending commit info
- HoodieTimeline inflightTimeline =
table.getMetaClient().getCommitsTimeline().filterPendingExcludingMajorAndMinorCompaction();
+ HoodieTimeline inflightTimeline =
table.getMetaClient().getCommitsTimeline().filterPendingExcludingCompactionAndLogCompaction();
List<HoodieInstant> commits =
inflightTimeline.getReverseOrderedInstants().collect(Collectors.toList());
for (HoodieInstant inflightInstant : commits) {
// delete existing markers
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/TwoToOneDowngradeHandler.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/TwoToOneDowngradeHandler.java
index 47ed00d5f6e..10cb8dba841 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/TwoToOneDowngradeHandler.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/TwoToOneDowngradeHandler.java
@@ -59,7 +59,7 @@ public class TwoToOneDowngradeHandler implements
DowngradeHandler {
HoodieTableMetaClient metaClient = table.getMetaClient();
// re-create marker files if any partial timeline server based markers are
found
- HoodieTimeline inflightTimeline =
metaClient.getCommitsTimeline().filterPendingExcludingMajorAndMinorCompaction();
+ HoodieTimeline inflightTimeline =
metaClient.getCommitsTimeline().filterPendingExcludingCompactionAndLogCompaction();
List<HoodieInstant> commits =
inflightTimeline.getReverseOrderedInstants().collect(Collectors.toList());
for (HoodieInstant inflightInstant : commits) {
// Converts the markers in new format to old format of direct markers
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/ZeroToOneUpgradeHandler.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/ZeroToOneUpgradeHandler.java
index 9fdc707a909..37b3660d57a 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/ZeroToOneUpgradeHandler.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/ZeroToOneUpgradeHandler.java
@@ -55,7 +55,7 @@ public class ZeroToOneUpgradeHandler implements
UpgradeHandler {
SupportsUpgradeDowngrade upgradeDowngradeHelper) {
// fetch pending commit info
HoodieTable table = upgradeDowngradeHelper.getTable(config, context);
- HoodieTimeline inflightTimeline =
table.getMetaClient().getCommitsTimeline().filterPendingExcludingMajorAndMinorCompaction();
+ HoodieTimeline inflightTimeline =
table.getMetaClient().getCommitsTimeline().filterPendingExcludingCompactionAndLogCompaction();
List<String> commits =
inflightTimeline.getReverseOrderedInstants().map(HoodieInstant::getTimestamp)
.collect(Collectors.toList());
if (!commits.isEmpty() && instantTime != null) {
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java
index 8261aaf6538..cb9871e3fd8 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java
@@ -127,9 +127,8 @@ public class HoodieDefaultTimeline implements
HoodieTimeline {
&&
(!instant.getAction().equals(HoodieTimeline.LOG_COMPACTION_ACTION))), details);
}
- //TODO: Use a better naming convention for this.
@Override
- public HoodieTimeline filterPendingExcludingMajorAndMinorCompaction() {
+ public HoodieTimeline filterPendingExcludingCompactionAndLogCompaction() {
return new HoodieDefaultTimeline(getInstantsAsStream().filter(instant ->
(!instant.isCompleted())
&& (!instant.getAction().equals(HoodieTimeline.COMPACTION_ACTION)
||
!instant.getAction().equals(HoodieTimeline.LOG_COMPACTION_ACTION))), details);
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieTimeline.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieTimeline.java
index 00abaf3421d..a0ccdd43467 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieTimeline.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieTimeline.java
@@ -143,11 +143,11 @@ public interface HoodieTimeline extends Serializable {
HoodieTimeline filterPendingExcludingLogCompaction();
/**
- * Filter this timeline to just include the in-flights excluding major and
minor compaction instants.
+ * Filter this timeline to just include the in-flights excluding compaction
and log compaction instants.
*
- * @return New instance of HoodieTimeline with just in-flights excluding
major and minor compaction instants
+ * @return New instance of HoodieTimeline with just in-flights excluding
compaction and log compaction instants
*/
- HoodieTimeline filterPendingExcludingMajorAndMinorCompaction();
+ HoodieTimeline filterPendingExcludingCompactionAndLogCompaction();
/**
* Filter this timeline to just include the completed instants.
diff --git
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/timeline/TestHoodieActiveTimeline.java
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/timeline/TestHoodieActiveTimeline.java
index 46c33d526b9..3f7f1c05b84 100755
---
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/timeline/TestHoodieActiveTimeline.java
+++
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/timeline/TestHoodieActiveTimeline.java
@@ -134,7 +134,7 @@ public class TestHoodieActiveTimeline extends
HoodieCommonTestHarness {
timeline.getCommitAndReplaceTimeline().filterCompletedInstants().getInstantsAsStream(),
"Check the instants stream");
assertStreamEquals(Stream.of(instant5),
-
timeline.getCommitAndReplaceTimeline().filterPendingExcludingMajorAndMinorCompaction().getInstantsAsStream(),
+
timeline.getCommitAndReplaceTimeline().filterPendingExcludingCompactionAndLogCompaction().getInstantsAsStream(),
"Check the instants stream");
// Backwards compatibility testing for reading compaction plans
@@ -199,7 +199,7 @@ public class TestHoodieActiveTimeline extends
HoodieCommonTestHarness {
.getInstantsAsStream().map(HoodieInstant::getTimestamp),
"findInstantsBefore 07 should return 3 instants");
assertFalse(timeline.empty());
-
assertFalse(timeline.getCommitAndReplaceTimeline().filterPendingExcludingMajorAndMinorCompaction().empty());
+
assertFalse(timeline.getCommitAndReplaceTimeline().filterPendingExcludingCompactionAndLogCompaction().empty());
assertEquals(12, timeline.countInstants());
assertEquals("01", timeline.firstInstant(
HoodieTimeline.COMMIT_ACTION, State.COMPLETED).get().getTimestamp());