Skip to content

Commit 2f6e229

Browse files
authored
HDDS-12029. Move ozone debug recover to ozone admin om lease recover (#7670)
1 parent 0723902 commit 2f6e229

File tree

9 files changed

+74
-21
lines changed

9 files changed

+74
-21
lines changed

hadoop-ozone/dist/src/main/compose/ozone/test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ execute_robot_test scm freon
4848
execute_robot_test scm cli
4949
execute_robot_test scm admincli
5050

51-
execute_robot_test scm debug/ozone-debug-lease-recovery.robot
52-
5351
execute_robot_test scm -v USERNAME:httpfs httpfs
5452
execute_debug_tests
5553

hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-lease-recovery.robot renamed to hadoop-ozone/dist/src/main/smoketest/admincli/lease-recovery.robot

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Documentation Test lease recovery of ozone filesystem
1818
Library OperatingSystem
1919
Resource ../lib/os.robot
2020
Resource ../lib/fs.robot
21-
Resource ozone-debug.robot
2221
Test Timeout 5 minute
2322
Suite Setup Create volume bucket and put key
2423

@@ -35,16 +34,21 @@ Create volume bucket and put key
3534
Create File ${TEMP_DIR}/${TESTFILE}
3635
Execute ozone sh key put /${VOLUME}/${BUCKET}/${TESTFILE} ${TEMP_DIR}/${TESTFILE}
3736

37+
Execute Lease recovery cli
38+
[Arguments] ${KEY_PATH}
39+
${result} = Execute And Ignore Error ozone admin om lease recover --path=${KEY_PATH}
40+
[Return] ${result}
41+
3842
*** Test Cases ***
39-
Test ozone debug recover for o3fs
43+
Test ozone admin om lease recover for o3fs
4044
${o3fs_path} = Format FS URL o3fs ${VOLUME} ${BUCKET} ${TESTFILE}
4145
${result} = Execute Lease recovery cli ${o3fs_path}
4246
Should Contain ${result} Lease recovery SUCCEEDED
4347
${o3fs_path} = Format FS URL o3fs ${VOLUME} ${BUCKET} randomfile
4448
${result} = Execute Lease recovery cli ${o3fs_path}
4549
Should Contain ${result} not found
4650

47-
Test ozone debug recover for ofs
51+
Test ozone admin om lease recover for ofs
4852
${ofs_path} = Format FS URL ofs ${VOLUME} ${BUCKET} ${TESTFILE}
4953
${result} = Execute Lease recovery cli ${ofs_path}
5054
Should Contain ${result} Lease recovery SUCCEEDED

hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ HSync Lease Recover Can Be Used
154154
Pass Execution If '${DATA_VERSION}' < '${FSO_VERSION}' Skipped write test case
155155
Pass Execution If '${CLIENT_VERSION}' < '${HSYNC_VERSION}' Client does not support HSYNC
156156
Pass Execution If '${CLUSTER_VERSION}' < '${HSYNC_VERSION}' Cluster does not support HSYNC
157-
Execute ozone debug recover --path=ofs://om/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/file
157+
Execute ozone admin om lease recover --path=ofs://om/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/file

hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ Execute read-replicas CLI tool
2626
File Should Exist ${directory}/${TESTFILE}_manifest
2727
[Return] ${directory}
2828

29-
Execute Lease recovery cli
30-
[Arguments] ${KEY_PATH}
31-
${result} = Execute And Ignore Error ozone debug recover --path=${KEY_PATH}
32-
[Return] ${result}
33-
3429
Read Replicas Manifest
3530
${manifest} = Get File ${DIR}/${TESTFILE}_manifest
3631
${json} = Evaluate json.loads('''${manifest}''') json

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/debug/TestLeaseRecoverer.java renamed to hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/admin/om/lease/TestLeaseRecoverer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations under
1515
* the License.
1616
*/
17-
package org.apache.hadoop.ozone.debug;
17+
package org.apache.hadoop.ozone.admin.om.lease;
1818

1919
import java.io.IOException;
2020
import java.io.PrintWriter;

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/OMAdmin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.hadoop.ipc.ProtobufRpcEngine;
2525
import org.apache.hadoop.ipc.RPC;
2626
import org.apache.hadoop.ozone.OmUtils;
27+
import org.apache.hadoop.ozone.admin.om.lease.LeaseSubCommand;
2728
import org.apache.hadoop.ozone.client.OzoneClientException;
2829
import org.apache.hadoop.ozone.client.OzoneClientFactory;
2930
import org.apache.hadoop.ozone.client.protocol.ClientProtocol;
@@ -58,7 +59,8 @@
5859
DecommissionOMSubcommand.class,
5960
UpdateRangerSubcommand.class,
6061
TransferOmLeaderSubCommand.class,
61-
FetchKeySubCommand.class
62+
FetchKeySubCommand.class,
63+
LeaseSubCommand.class
6264
})
6365
@MetaInfServices(AdminSubcommand.class)
6466
public class OMAdmin implements AdminSubcommand {

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/LeaseRecoverer.java renamed to hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/lease/LeaseRecoverer.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,29 @@
1616
* limitations under the License.
1717
*/
1818

19-
package org.apache.hadoop.ozone.debug;
19+
package org.apache.hadoop.ozone.admin.om.lease;
2020

2121
import java.net.URI;
2222
import java.util.concurrent.Callable;
2323

2424
import org.apache.hadoop.fs.FileSystem;
2525
import org.apache.hadoop.fs.Path;
2626
import org.apache.hadoop.fs.LeaseRecoverable;
27-
import org.apache.hadoop.hdds.cli.DebugSubcommand;
2827
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
2928

30-
import org.kohsuke.MetaInfServices;
3129
import picocli.CommandLine;
3230
import picocli.CommandLine.Model.CommandSpec;
3331
import picocli.CommandLine.Spec;
3432

3533
/**
36-
* Tool that recover the lease of a specified file.
34+
* CLI to recover the lease of a specified file.
3735
*/
3836
@CommandLine.Command(
3937
name = "recover",
40-
customSynopsis = "ozone debug recover --path=<path>",
41-
description = "recover the lease of a specified file. Make sure to specify "
38+
customSynopsis = "ozone admin om lease recover --path=<path>",
39+
description = "Recover the lease of a specified file. Make sure to specify "
4240
+ "file system scheme if ofs:// is not the default.")
43-
@MetaInfServices(DebugSubcommand.class)
44-
public class LeaseRecoverer implements Callable<Void>, DebugSubcommand {
41+
public class LeaseRecoverer implements Callable<Void> {
4542

4643
@Spec
4744
private CommandSpec spec;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.hadoop.ozone.admin.om.lease;
20+
21+
import picocli.CommandLine;
22+
23+
/**
24+
* Handler of ozone admin om lease command.
25+
*/
26+
@CommandLine.Command(
27+
name = "lease",
28+
description = "Command for all lease related queries.",
29+
subcommands = {
30+
LeaseRecoverer.class
31+
}
32+
)
33+
public class LeaseSubCommand {
34+
35+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/**
20+
* Lease related OM Admin tools.
21+
*/
22+
package org.apache.hadoop.ozone.admin.om.lease;

0 commit comments

Comments
 (0)