Zakelly commented on code in PR #27185:
URL: https://github.com/apache/flink/pull/27185#discussion_r2485895133


##########
flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/fs/ForStFileSystemGenericWrapper.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.flink.state.forst.fs;
+
+import org.apache.flink.core.fs.Path;
+
+import javax.annotation.Nullable;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+/** A wrapper of {@link ForStFlinkFileSystem} to adapt ForSt to various 
FileSystems. */
+public class ForStFileSystemGenericWrapper extends ForStFlinkFileSystem {
+    /**
+     * Whether the underlying FileSystem uses a dummy mkdir implementation, 
meaning it does not
+     * actually create the directory when mkdir() completes. We determine this 
condition during the
+     * first call to mkdir() that returns true. When this occurs, we record 
the path of the
+     * should-be-created directory in dummyCreatedDirPaths and subsequently 
return true for
+     * existence checks.
+     */
+    private @Nullable Boolean dummyMkdirEnabled = null;
+
+    private final Set<Path> dummyCreatedDirPaths = new HashSet<>();
+
+    public ForStFileSystemGenericWrapper(ForStFlinkFileSystem fileSystem) {
+        super(fileSystem);
+    }
+
+    @Override
+    public synchronized boolean mkdirs(Path path) throws IOException {
+        boolean mkdirSucceed = super.mkdirs(path);
+        if (!mkdirSucceed) {
+            return false;
+        }
+
+        if (dummyMkdirEnabled == null) {

Review Comment:
   I thought we should apply an util to detect the wrapped filesystem's 
behavior, and decide to apply a decorator or not.



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