TanYuxin-tyx commented on code in PR #22851:
URL: https://github.com/apache/flink/pull/22851#discussion_r1250828739


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/tier/TierFactory.java:
##########
@@ -32,7 +32,9 @@
 public interface TierFactory {
 
     /** Creates the master-side agent of a Tier. */
-    TierMasterAgent createMasterAgent(TieredStorageResourceRegistry 
tieredStorageResourceRegistry);
+    TierMasterAgent createMasterAgent(
+            String remoteStorageBaseHomePath,

Review Comment:
   1. Moved `remoteStorageBasePath` to the constructor.
   2. `dataFileBasePath` is the result partition path, which should be an 
argument.
   3. `partitionFileWriter` and `partitionFileReader` has been removed from the 
arguments. They are initialized by calling the static methods of the partition 
file.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/tier/remote/RemoteTierMasterAgent.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.runtime.io.network.partition.hybrid.tiered.tier.remote;
+
+import org.apache.flink.core.fs.Path;
+import 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStoragePartitionId;
+import 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.storage.TieredStorageResourceRegistry;
+import 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierMasterAgent;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageUtils.deletePathQuietly;
+import static 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageUtils.getPartitionPath;
+import static 
org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageUtils.removePartitionFiles;
+
+/** The implementation of {@link TierMasterAgent} for the remote tier. */
+public class RemoteTierMasterAgent implements TierMasterAgent {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(RemoteTierMasterAgent.class);
+
+    private final TieredStorageResourceRegistry resourceRegistry;
+
+    private final String remoteStorageBaseHomePath;
+
+    RemoteTierMasterAgent(
+            String remoteStorageBaseHomePath, TieredStorageResourceRegistry 
resourceRegistry) {
+        this.remoteStorageBaseHomePath = remoteStorageBaseHomePath;
+        this.resourceRegistry = resourceRegistry;
+    }
+
+    @Override
+    public void addPartition(TieredStoragePartitionId partitionID) {
+        resourceRegistry.registerResource(
+                partitionID,
+                () -> deletePathQuietly(getPartitionPath(partitionID, 
remoteStorageBaseHomePath)));
+    }
+
+    @Override
+    public void releasePartition(TieredStoragePartitionId partitionID) {
+        try {
+            removePartitionFiles(new Path(remoteStorageBaseHomePath), 
partitionID);
+        } catch (IOException e) {
+            LOG.error("Failed to release the partition file for {}", 
partitionID);
+        }
+
+        resourceRegistry.clearResourceFor(partitionID);
+    }
+
+    @Override
+    public void release(String toRelease) {
+        deletePathQuietly(toRelease);
+    }

Review Comment:
   Removed.



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