Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-12029. Move ozone debug recover to ozone admin om lease recover #7670

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions hadoop-ozone/dist/src/main/compose/ozone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ execute_robot_test scm freon
execute_robot_test scm cli
execute_robot_test scm admincli

execute_robot_test scm debug/ozone-debug-lease-recovery.robot

execute_robot_test scm -v USERNAME:httpfs httpfs
execute_debug_tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Documentation Test lease recovery of ozone filesystem
Library OperatingSystem
Resource ../lib/os.robot
Resource ../lib/fs.robot
Resource ozone-debug.robot
Test Timeout 5 minute
Suite Setup Create volume bucket and put key

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

Execute Lease recovery cli
[Arguments] ${KEY_PATH}
${result} = Execute And Ignore Error ozone admin om lease recover --path=${KEY_PATH}
[Return] ${result}

*** Test Cases ***
Test ozone debug recover for o3fs
Test ozone admin om lease recover for o3fs
${o3fs_path} = Format FS URL o3fs ${VOLUME} ${BUCKET} ${TESTFILE}
${result} = Execute Lease recovery cli ${o3fs_path}
Should Contain ${result} Lease recovery SUCCEEDED
${o3fs_path} = Format FS URL o3fs ${VOLUME} ${BUCKET} randomfile
${result} = Execute Lease recovery cli ${o3fs_path}
Should Contain ${result} not found

Test ozone debug recover for ofs
Test ozone admin om lease recover for ofs
${ofs_path} = Format FS URL ofs ${VOLUME} ${BUCKET} ${TESTFILE}
${result} = Execute Lease recovery cli ${ofs_path}
Should Contain ${result} Lease recovery SUCCEEDED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ HSync Lease Recover Can Be Used
Pass Execution If '${DATA_VERSION}' < '${FSO_VERSION}' Skipped write test case
Pass Execution If '${CLIENT_VERSION}' < '${HSYNC_VERSION}' Client does not support HSYNC
Pass Execution If '${CLUSTER_VERSION}' < '${HSYNC_VERSION}' Cluster does not support HSYNC
Execute ozone debug recover --path=ofs://om/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/file
Execute ozone admin om lease recover --path=ofs://om/vol1/fso-bucket-${DATA_VERSION}/dir/subdir/file
5 changes: 0 additions & 5 deletions hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.hadoop.ozone.debug;
package org.apache.hadoop.ozone.admin.om.lease;

import java.io.IOException;
import java.io.PrintWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.hadoop.ipc.ProtobufRpcEngine;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ozone.OmUtils;
import org.apache.hadoop.ozone.admin.om.lease.LeaseSubCommand;
import org.apache.hadoop.ozone.client.OzoneClientException;
import org.apache.hadoop.ozone.client.OzoneClientFactory;
import org.apache.hadoop.ozone.client.protocol.ClientProtocol;
Expand Down Expand Up @@ -58,7 +59,8 @@
DecommissionOMSubcommand.class,
UpdateRangerSubcommand.class,
TransferOmLeaderSubCommand.class,
FetchKeySubCommand.class
FetchKeySubCommand.class,
LeaseSubCommand.class
})
@MetaInfServices(AdminSubcommand.class)
public class OMAdmin implements AdminSubcommand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,29 @@
* limitations under the License.
*/

package org.apache.hadoop.ozone.debug;
package org.apache.hadoop.ozone.admin.om.lease;

import java.net.URI;
import java.util.concurrent.Callable;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.LeaseRecoverable;
import org.apache.hadoop.hdds.cli.DebugSubcommand;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;

import org.kohsuke.MetaInfServices;
import picocli.CommandLine;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Spec;

/**
* Tool that recover the lease of a specified file.
* CLI to recover the lease of a specified file.
*/
@CommandLine.Command(
name = "recover",
customSynopsis = "ozone debug recover --path=<path>",
description = "recover the lease of a specified file. Make sure to specify "
customSynopsis = "ozone admin om lease recover --path=<path>",
description = "Recover the lease of a specified file. Make sure to specify "
+ "file system scheme if ofs:// is not the default.")
@MetaInfServices(DebugSubcommand.class)
public class LeaseRecoverer implements Callable<Void>, DebugSubcommand {
public class LeaseRecoverer implements Callable<Void> {

@Spec
private CommandSpec spec;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.hadoop.ozone.admin.om.lease;

import picocli.CommandLine;

/**
* Handler of ozone admin om lease command.
*/
@CommandLine.Command(
name = "lease",
description = "Command for all lease related queries.",
subcommands = {
LeaseRecoverer.class
}
)
public class LeaseSubCommand {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.
*/

/**
* Lease related OM Admin tools.
*/
package org.apache.hadoop.ozone.admin.om.lease;
Loading