Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
*/
@CommandLine.Command(
name = "cancelprepare",
description = "Cancel prepare state in the OMs.",
description = "Deprecated. This command is no longer required, but is kept for backward compatibility with older" +
" Ozone Managers.",
hidden = true,
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@

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

import static org.apache.hadoop.ozone.OmUtils.getOmHostsFromConfig;
import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse.PrepareStatus.PREPARE_COMPLETED;

import java.io.IOException;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.OmUtils;
import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse.PrepareStatus;
Expand All @@ -40,11 +41,9 @@
*/
@CommandLine.Command(
name = "prepare",
description = "Prepares Ozone Manager for upgrade/downgrade, by applying " +
"all pending transactions, taking a Ratis snapshot at the last " +
"transaction and purging all logs on each OM instance. The returned " +
"transaction #ID corresponds to the last transaction in the quorum in" +
" which the snapshot is taken.",
description = "Deprecated. This command is no longer required, but is kept for backward compatibility with older" +
" Ozone Managers.",
hidden = true,
mixinStandardHelpOptions = true,
versionProvider = HddsVersionProvider.class
)
Expand Down Expand Up @@ -106,9 +105,11 @@ private void execute(OzoneManagerProtocol client) throws Exception {
"with Transaction Id : [" + prepareTxnId + "].");

Map<String, Boolean> omPreparedStatusMap = new HashMap<>();
Set<String> omHosts = getOmHostsFromConfig(
parent.getParent().getOzoneConf(), omServiceOption.getServiceID());
omHosts.forEach(h -> omPreparedStatusMap.put(h, false));
OzoneConfiguration conf = parent.getParent().getOzoneConf();
OmUtils.getAllOMHAAddresses(conf, omServiceOption.getServiceID(), false)
.stream()
.map(OMNodeDetails::getRpcAddressString)
.forEach(addr -> omPreparedStatusMap.put(addr, false));
Duration pTimeout = Duration.of(prepareTimeOut, ChronoUnit.SECONDS);
Duration pInterval = Duration.of(prepareCheckInterval, ChronoUnit.SECONDS);

Expand All @@ -123,10 +124,9 @@ private void execute(OzoneManagerProtocol client) throws Exception {
for (Map.Entry<String, Boolean> e : omPreparedStatusMap.entrySet()) {
if (!e.getValue()) {
String omHost = e.getKey();
try (OzoneManagerProtocol singleOmClient =
parent.createOmClient(omServiceOption.getServiceID(), omHost, false)) {
PrepareStatusResponse response =
singleOmClient.getOzoneManagerPrepareStatus(prepareTxnId);
try (OzoneManagerProtocol singleOmClient = parent.createOmClient(omServiceOption.getServiceID(), omHost,
false)) {
PrepareStatusResponse response = singleOmClient.getOzoneManagerPrepareStatus(prepareTxnId);
PrepareStatus status = response.getStatus();
System.out.println("OM : [" + omHost + "], Prepare " +
"Status : [" + status.name() + "], Current Transaction Id : [" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public static boolean isReadOnly(OMRequest omRequest) {
return true;
case GetQuotaRepairStatus:
case StartQuotaRepair:
// Prepare and CancelPrepare are now no-ops, but still produce responses for compatability.
case Prepare:
case CancelPrepare:
case QueryUpgradeStatus:
return true;
case CreateVolume:
Expand Down Expand Up @@ -299,8 +302,6 @@ public static boolean isReadOnly(OMRequest omRequest) {
// as deprecated
case FinalizeUpgrade:
case StartFinalizeUpgrade:
case Prepare:
case CancelPrepare:
case DeleteOpenKeys:
case SetS3Secret:
case RevokeS3Secret:
Expand Down
25 changes: 0 additions & 25 deletions hadoop-ozone/dist/src/main/compose/ozone-om-prepare/.env

This file was deleted.

This file was deleted.

37 changes: 0 additions & 37 deletions hadoop-ozone/dist/src/main/compose/ozone-om-prepare/docker-config

This file was deleted.

62 changes: 0 additions & 62 deletions hadoop-ozone/dist/src/main/compose/ozone-om-prepare/test.sh

This file was deleted.

44 changes: 0 additions & 44 deletions hadoop-ozone/dist/src/main/smoketest/omha/om-cancel-prepare.robot

This file was deleted.

Loading