danny0405 commented on code in PR #10845:
URL: https://github.com/apache/hudi/pull/10845#discussion_r1520726694


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieGlobalTimeline.java:
##########
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.common.table.timeline;
+
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.ValidationUtils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nullable;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Function;
+
+/**
+ * A global timeline view with both active and archived timeline involved.
+ */
+public class HoodieGlobalTimeline extends HoodieDefaultTimeline {
+  private static final long serialVersionUID = 1L;
+  private static final Logger LOG = 
LoggerFactory.getLogger(HoodieGlobalTimeline.class);
+  private final HoodieTableMetaClient metaClient;
+  private final HoodieActiveTimeline activeTimeline;
+  private final HoodieArchivedTimeline archivedTimeline;
+
+  protected HoodieGlobalTimeline(HoodieTableMetaClient metaClient, 
Option<String> startInstant) {
+    this.metaClient = metaClient;
+    this.activeTimeline = new HoodieActiveTimeline(metaClient);
+    archivedTimeline = startInstant.isPresent() ? new 
HoodieArchivedTimeline(metaClient, startInstant.get()) : new 
HoodieArchivedTimeline(metaClient);
+    this.details = FederatedDetails.create(this.activeTimeline, 
archivedTimeline);
+    setInstants(mergeInstants(archivedTimeline.getInstants(), 
activeTimeline.getInstants()));
+  }
+
+  protected HoodieGlobalTimeline(HoodieActiveTimeline activeTimeline, 
HoodieArchivedTimeline archivedTimeline) {
+    this.metaClient = activeTimeline.metaClient;
+    this.activeTimeline = activeTimeline;
+    this.archivedTimeline = archivedTimeline;
+    this.details = FederatedDetails.create(this.activeTimeline, 
archivedTimeline);
+    setInstants(mergeInstants(archivedTimeline.getInstants(), 
activeTimeline.getInstants()));
+  }
+
+  /**
+   * For serialization and de-serialization only.
+   */
+  public HoodieGlobalTimeline() {
+    this.activeTimeline = null;
+    this.archivedTimeline = null;
+    this.metaClient = null;
+  }
+
+  @Override
+  public HoodieTimeline filterPendingCompactionTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterPendingCompactionTimeline();
+  }
+
+  @Override
+  public HoodieTimeline filterPendingLogCompactionTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterPendingLogCompactionTimeline();
+  }
+
+  @Override
+  public HoodieTimeline filterPendingMajorOrMinorCompactionTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterPendingMajorOrMinorCompactionTimeline();
+  }
+
+  @Override
+  public HoodieTimeline filterPendingReplaceTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterPendingReplaceTimeline();
+  }
+
+  @Override
+  public HoodieTimeline filterPendingRollbackTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterPendingRollbackTimeline();
+  }
+
+  @Override
+  public HoodieTimeline filterRequestedRollbackTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterRequestedRollbackTimeline();
+  }
+
+  @Override
+  public HoodieTimeline filterPendingIndexTimeline() {
+    // override for efficiency
+    return this.activeTimeline.filterPendingIndexTimeline();
+  }
+
+  @Override
+  public boolean empty() {
+    return this.activeTimeline.empty();
+  }
+
+  /**
+   * Returns whether the active timeline contains the given instant or the 
instant is archived.
+   * Needs to rethink the new semantics and rename this method with global 
timeline introduced.
+   */
+  @Override
+  public boolean containsOrBeforeTimelineStarts(String ts) {

Review Comment:
   We need to fix the semantics of this method.



-- 
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]

Reply via email to