wuchong commented on code in PR #3617:
URL: https://github.com/apache/fluss/pull/3617#discussion_r3542089566


##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/utils/FlinkConnectorOptionsUtils.java:
##########
@@ -201,13 +202,38 @@ public static long parseTimestamp(String timestampStr, 
String optionKey, ZoneId
 
     public static String getClientScannerIoTmpDir(
             Configuration flussConf, 
org.apache.flink.configuration.Configuration flinkConfig) {
-        if (!flussConf.contains(CLIENT_SCANNER_IO_TMP_DIR)) {
-            if (flinkConfig.contains(TMP_DIRS)) {
-                // pass flink io tmp dir to fluss client.
-                return new File(flinkConfig.get(CoreOptions.TMP_DIRS), 
"/fluss").getAbsolutePath();
+        return getClientScannerIoTmpDir(flussConf, flinkConfig, 0);
+    }
+
+    public static String getClientScannerIoTmpDir(
+            Configuration flussConf,
+            org.apache.flink.configuration.Configuration flinkConfig,
+            int taskIndex) {
+        return flussConf
+                .getOptional(CLIENT_SCANNER_IO_TMP_DIR)
+                .orElseGet(
+                        () -> {
+                            String[] flinkTmpDirs = 
getFlinkIoTmpDirs(flinkConfig);
+                            int idx = taskIndex % flinkTmpDirs.length;
+                            return new File(flinkTmpDirs[idx], 
"/fluss").getAbsolutePath();
+                        });

Review Comment:
   +1



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to