yanghua commented on a change in pull request #2434:
URL: https://github.com/apache/hudi/pull/2434#discussion_r557465318
##########
File path:
hudi-flink/src/main/java/org/apache/hudi/operator/InstantGenerateOperator.java
##########
@@ -102,65 +106,76 @@ public void open() throws Exception {
// Hadoop FileSystem
fs = FSUtils.getFs(cfg.targetBasePath, serializableHadoopConf.get());
- TaskContextSupplier taskContextSupplier = new
FlinkTaskContextSupplier(null);
+ if (isMain) {
+ TaskContextSupplier taskContextSupplier = new
FlinkTaskContextSupplier(null);
- // writeClient
- writeClient = new HoodieFlinkWriteClient(new
HoodieFlinkEngineContext(taskContextSupplier),
StreamerUtil.getHoodieClientConfig(cfg), true);
+ // writeClient
+ writeClient = new HoodieFlinkWriteClient(new
HoodieFlinkEngineContext(taskContextSupplier),
StreamerUtil.getHoodieClientConfig(cfg), true);
- // init table, create it if not exists.
- initTable();
+ // init table, create it if not exists.
+ initTable();
+
+ // create instant marker directory
+ createInstantMarkerDir();
+ }
}
@Override
public void prepareSnapshotPreBarrier(long checkpointId) throws Exception {
super.prepareSnapshotPreBarrier(checkpointId);
- // check whether the last instant is completed, if not, wait 10s and then
throws an exception
- if (!StringUtils.isNullOrEmpty(latestInstant)) {
- doCheck();
- // last instant completed, set it empty
- latestInstant = "";
- }
+ int indexOfThisSubtask = getRuntimeContext().getIndexOfThisSubtask();
+ String instantMarkerFileName = String.format("%d_%d_%d",
indexOfThisSubtask, checkpointId, batchSize.get());
+ Path path = new Path(new Path(HoodieTableMetaClient.AUXILIARYFOLDER_NAME,
INSTANT_MARKER_FOLDER_NAME), instantMarkerFileName);
Review comment:
Using `Paths.get(string, string, ...)` looks better?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]