[HUDI-1917] Remove the metadata sync logic in HoodieFlinkWriteClient#preWrite because it is not thread safe (#2971)
This commit is contained in:
@@ -20,7 +20,6 @@ package org.apache.hudi.client;
|
||||
|
||||
import org.apache.hudi.client.common.HoodieFlinkEngineContext;
|
||||
import org.apache.hudi.client.embedded.EmbeddedTimelineService;
|
||||
import org.apache.hudi.client.utils.TransactionUtils;
|
||||
import org.apache.hudi.common.engine.HoodieEngineContext;
|
||||
import org.apache.hudi.common.fs.FSUtils;
|
||||
import org.apache.hudi.common.model.FileSlice;
|
||||
@@ -243,15 +242,9 @@ public class HoodieFlinkWriteClient<T extends HoodieRecordPayload> extends
|
||||
@Override
|
||||
protected void preWrite(String instantTime, WriteOperationType writeOperationType, HoodieTableMetaClient metaClient) {
|
||||
setOperationType(writeOperationType);
|
||||
this.lastCompletedTxnAndMetadata = TransactionUtils.getLastCompletedTxnInstantAndMetadata(metaClient);
|
||||
this.txnManager.beginTransaction(Option.of(new HoodieInstant(HoodieInstant.State.INFLIGHT, metaClient.getCommitActionType(), instantTime)), lastCompletedTxnAndMetadata
|
||||
.isPresent()
|
||||
? Option.of(lastCompletedTxnAndMetadata.get().getLeft()) : Option.empty());
|
||||
try {
|
||||
syncTableMetadata();
|
||||
} finally {
|
||||
this.txnManager.endTransaction();
|
||||
}
|
||||
// Note: the code to read the commit metadata is not thread safe for JSON deserialization,
|
||||
// remove the table metadata sync
|
||||
|
||||
// remove the async cleaning
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user