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