This is an automated email from the ASF dual-hosted git repository.
weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new efc88fba85 HDDS-9255. LeaseRecovery CLI Should work for O3fs path.
(#5259)
efc88fba85 is described below
commit efc88fba85c0abc0a8d5c9f096349de652ea9b7d
Author: Pratyush Bhatt <[email protected]>
AuthorDate: Tue Sep 12 09:40:10 2023 +0530
HDDS-9255. LeaseRecovery CLI Should work for O3fs path. (#5259)
---
.../debug/ozone-debug-lease-recovery.robot | 47 ++++++++++++++++++++++
.../src/main/smoketest/debug/ozone-debug.robot | 5 +++
.../apache/hadoop/ozone/debug/LeaseRecoverer.java | 9 +++--
3 files changed, 58 insertions(+), 3 deletions(-)
diff --git
a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-lease-recovery.robot
b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-lease-recovery.robot
new file mode 100644
index 0000000000..a721f2acbb
--- /dev/null
+++
b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-lease-recovery.robot
@@ -0,0 +1,47 @@
+# 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.
+
+*** Settings ***
+Documentation Test lease recovery of ozone filesystem
+Library OperatingSystem
+Resource ../lib/os.robot
+Resource ozone-debug.robot
+Test Timeout 5 minute
+Suite Setup Create volume bucket and put key
+
+*** Variables ***
+${VOLUME} lease-recovery-volume
+${BUCKET} lease-recovery-bucket
+${TESTFILE} testfile22
+
+*** Keywords ***
+Create volume bucket and put key
+ Execute ozone sh volume create /${VOLUME}
+ Execute ozone sh bucket create /${VOLUME}/${BUCKET}
+ Create File ${TESTFILE}
+ Execute ozone sh key put /${VOLUME}/${BUCKET}/${TESTFILE}
${TESTFILE}
+
+*** Test Cases ***
+Test ozone debug recover for o3fs
+ ${result} = Execute Lease recovery cli
o3fs://${BUCKET}.${VOLUME}.om/${TESTFILE}
+ Should Contain ${result} Lease recovery SUCCEEDED
+ ${result} = Execute Lease recovery cli
o3fs://${BUCKET}.${VOLUME}.om/randomfile
+ Should Contain ${result} not found
+
+Test ozone debug recover for ofs
+ ${result} = Execute Lease recovery cli
ofs://om/${VOLUME}/${BUCKET}/${TESTFILE}
+ Should Contain ${result} Lease recovery SUCCEEDED
+ ${result} = Execute Lease recovery cli
ofs://om/${VOLUME}/${BUCKET}/randomfile
+ Should Contain ${result} not found
diff --git a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot
b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot
index ce9b749750..9f2364aaae 100644
--- a/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot
@@ -26,6 +26,11 @@ Execute read-replicas CLI tool
File Should Exist ${directory}/${TESTFILE}_manifest
[Return] ${directory}
+Execute Lease recovery cli
+ [Arguments] ${KEY_PATH}
+ ${result} = Execute And Ignore Error ozone debug
recover --path=${KEY_PATH}
+ [Return] ${result}
+
Read Replicas Manifest
${manifest} = Get File ${DIR}/${TESTFILE}_manifest
${json} = Evaluate json.loads('''${manifest}''')
json
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/LeaseRecoverer.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/LeaseRecoverer.java
index 81b5f84d4e..a8891404e0 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/LeaseRecoverer.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/LeaseRecoverer.java
@@ -23,7 +23,7 @@ import java.util.concurrent.Callable;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.ozone.RootedOzoneFileSystem;
+import org.apache.hadoop.fs.LeaseRecoverable;
import org.apache.hadoop.hdds.cli.SubcommandWithParent;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
@@ -72,13 +72,16 @@ public class LeaseRecoverer implements Callable<Void>,
SubcommandWithParent {
OzoneConfiguration configuration = new OzoneConfiguration();
URI uri = URI.create(this.path);
FileSystem fs = FileSystem.get(uri, configuration);
- if (fs instanceof RootedOzoneFileSystem) {
- ((RootedOzoneFileSystem) fs).recoverLease(new Path(uri));
+
+ if (fs instanceof LeaseRecoverable) {
+ ((LeaseRecoverable) fs).recoverLease(new Path(uri));
} else {
throw new IllegalArgumentException("Unsupported file system: "
+ fs.getScheme());
}
+ System.out.println("Lease recovery SUCCEEDED on " + uri);
+
return null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]