[HUDI-2861] Re-use same rollback instant time for failed rollbacks (#4123)
This commit is contained in:
committed by
GitHub
parent
a88691fed3
commit
f8e0176eb0
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.apache.hudi.avro.model.HoodieRollbackPlan;
|
||||
import org.apache.hudi.common.table.timeline.HoodieInstant;
|
||||
|
||||
/**
|
||||
* Holds rollback instant and rollback plan for a pending rollback.
|
||||
*/
|
||||
public class HoodiePendingRollbackInfo {
|
||||
|
||||
private final HoodieInstant rollbackInstant;
|
||||
private final HoodieRollbackPlan rollbackPlan;
|
||||
|
||||
public HoodiePendingRollbackInfo(HoodieInstant rollbackInstant, HoodieRollbackPlan rollbackPlan) {
|
||||
this.rollbackInstant = rollbackInstant;
|
||||
this.rollbackPlan = rollbackPlan;
|
||||
}
|
||||
|
||||
public HoodieInstant getRollbackInstant() {
|
||||
return rollbackInstant;
|
||||
}
|
||||
|
||||
public HoodieRollbackPlan getRollbackPlan() {
|
||||
return rollbackPlan;
|
||||
}
|
||||
}
|
||||
@@ -124,6 +124,12 @@ public class HoodieDefaultTimeline implements HoodieTimeline {
|
||||
s -> s.getAction().equals(HoodieTimeline.REPLACE_COMMIT_ACTION) && !s.isCompleted()), details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HoodieTimeline filterPendingRollbackTimeline() {
|
||||
return new HoodieDefaultTimeline(instants.stream().filter(
|
||||
s -> s.getAction().equals(HoodieTimeline.ROLLBACK_ACTION) && !s.isCompleted()), details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HoodieTimeline filterPendingCompactionTimeline() {
|
||||
return new HoodieDefaultTimeline(
|
||||
|
||||
@@ -157,6 +157,11 @@ public interface HoodieTimeline extends Serializable {
|
||||
*/
|
||||
HoodieTimeline filterPendingReplaceTimeline();
|
||||
|
||||
/**
|
||||
* Filter this timeline to include pending rollbacks.
|
||||
*/
|
||||
HoodieTimeline filterPendingRollbackTimeline();
|
||||
|
||||
/**
|
||||
* Create a new Timeline with all the instants after startTs.
|
||||
*/
|
||||
|
||||
@@ -340,6 +340,10 @@ public class FileCreateUtils {
|
||||
removeMetaFile(basePath, instantTime, HoodieTimeline.REPLACE_COMMIT_EXTENSION);
|
||||
}
|
||||
|
||||
public static void deleteRollbackCommit(String basePath, String instantTime) throws IOException {
|
||||
removeMetaFile(basePath, instantTime, HoodieTimeline.ROLLBACK_EXTENSION);
|
||||
}
|
||||
|
||||
public static long getTotalMarkerFileCount(String basePath, String partitionPath, String instantTime, IOType ioType) throws IOException {
|
||||
Path parentPath = Paths.get(basePath, HoodieTableMetaClient.TEMPFOLDER_NAME, instantTime, partitionPath);
|
||||
if (Files.notExists(parentPath)) {
|
||||
|
||||
Reference in New Issue
Block a user