-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HUDI-4287] Optimize Flink checkpoint meta mechanism to fix mistaken …
…pending instants
- Loading branch information
Showing
11 changed files
with
386 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...in/java/org/apache/hudi/table/action/rollback/FlinkCopyOnWriteRollbackActionExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* 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.table.action.rollback; | ||
|
||
import org.apache.hudi.common.engine.HoodieEngineContext; | ||
import org.apache.hudi.common.model.HoodieRecordPayload; | ||
import org.apache.hudi.common.table.timeline.HoodieActiveTimeline; | ||
import org.apache.hudi.common.table.timeline.HoodieInstant; | ||
import org.apache.hudi.config.HoodieWriteConfig; | ||
import org.apache.hudi.metadata.CkpMetadata; | ||
import org.apache.hudi.table.HoodieTable; | ||
|
||
import org.apache.log4j.LogManager; | ||
import org.apache.log4j.Logger; | ||
|
||
public class FlinkCopyOnWriteRollbackActionExecutor<T extends HoodieRecordPayload, I, K, O> | ||
extends CopyOnWriteRollbackActionExecutor<T, I, K, O> { | ||
|
||
private static final Logger LOG = | ||
LogManager.getLogger(FlinkCopyOnWriteRollbackActionExecutor.class); | ||
|
||
public FlinkCopyOnWriteRollbackActionExecutor( | ||
HoodieEngineContext context, | ||
HoodieWriteConfig config, | ||
HoodieTable<T, I, K, O> table, | ||
String instantTime, | ||
HoodieInstant commitInstant, | ||
boolean deleteInstants, | ||
boolean skipLocking) { | ||
|
||
super(context, config, table, instantTime, commitInstant, deleteInstants, skipLocking); | ||
} | ||
|
||
public FlinkCopyOnWriteRollbackActionExecutor( | ||
HoodieEngineContext context, | ||
HoodieWriteConfig config, | ||
HoodieTable<T, I, K, O> table, | ||
String instantTime, | ||
HoodieInstant commitInstant, | ||
boolean deleteInstants, | ||
boolean skipTimelinePublish, | ||
boolean useMarkerBasedStrategy, | ||
boolean skipLocking) { | ||
super( | ||
context, | ||
config, | ||
table, | ||
instantTime, | ||
commitInstant, | ||
deleteInstants, | ||
skipTimelinePublish, | ||
useMarkerBasedStrategy, | ||
skipLocking); | ||
} | ||
|
||
@Override | ||
protected void deleteInflightAndRequestedInstant( | ||
boolean deleteInstant, | ||
HoodieActiveTimeline activeTimeline, | ||
HoodieInstant instantToBeDeleted) { | ||
super.deleteInflightAndRequestedInstant(deleteInstant, activeTimeline, instantToBeDeleted); | ||
// resolvedInstant uncompleted means that we will delete it during rollback | ||
if (deleteInstant && !instantToBeDeleted.isCompleted()) { | ||
CkpMetadata ckpMetadata = | ||
CkpMetadata.getInstance( | ||
table.getMetaClient().getFs(), table.getMetaClient().getBasePath()); | ||
ckpMetadata.deleteInstant(instantToBeDeleted.getTimestamp()); | ||
LOG.info("delete checkpoint metadata for for rollback instant: " + instantToBeDeleted); | ||
} | ||
} | ||
} |
Oops, something went wrong.