Skip to content

Commit

Permalink
Revert "HDDS-5544. Update GRPC OmTransport implementation for HA (apa…
Browse files Browse the repository at this point in the history
…che#2901)"

This reverts commit 413d4aa.
  • Loading branch information
adoroszlai committed Apr 11, 2022
1 parent d87a746 commit d57616e
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 516 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,26 +227,6 @@ public static OptionalInt getHostPort(String value) {
}
}

/**
* Retrieve a number, trying the supplied config keys in order.
* Each config value may be absent
*
* @param conf Conf
* @param keys a list of configuration key names.
*
* @return first number found from the given keys, or absent.
*/
public static OptionalInt getNumberFromConfigKeys(
ConfigurationSource conf, String... keys) {
for (final String key : keys) {
final String value = conf.getTrimmed(key);
if (value != null) {
return OptionalInt.of(Integer.parseInt(value));
}
}
return OptionalInt.empty();
}

/**
* Retrieve the port number, trying the supplied config keys in order.
* Each config value may be absent, or if present in the format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_ADDRESS_KEY;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DATANODE_PORT_KEY;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT;

import static org.hamcrest.core.Is.is;
import org.junit.Assert;
import static org.junit.Assert.assertThat;
Expand Down Expand Up @@ -218,39 +216,4 @@ public void testGetSCMAddressesWithHAConfig() {

}

@Test
public void testGetNumberFromConfigKeys() {
final String testnum1 = "8";
final String testnum2 = "7";
final String serviceId = "id1";
final String nodeId = "scm1";

OzoneConfiguration conf = new OzoneConfiguration();
conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT,
testnum1);
Assert.assertTrue(Integer.parseInt(testnum1) ==
HddsUtils.getNumberFromConfigKeys(
conf,
OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT).orElse(0));

/* Test to return first unempty key number from list */
/* first key is absent */
Assert.assertTrue(Integer.parseInt(testnum1) ==
HddsUtils.getNumberFromConfigKeys(
conf,
ConfUtils.addKeySuffixes(OZONE_SCM_DATANODE_PORT_KEY,
serviceId, nodeId),
OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT).orElse(0));

/* now set the empty key and ensure returned value from this key */
conf.set(ConfUtils.addKeySuffixes(OZONE_SCM_DATANODE_PORT_KEY,
serviceId, nodeId),
testnum2);
Assert.assertTrue(Integer.parseInt(testnum2) ==
HddsUtils.getNumberFromConfigKeys(
conf,
ConfUtils.addKeySuffixes(OZONE_SCM_DATANODE_PORT_KEY,
serviceId, nodeId),
OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT).orElse(0));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ private OMConfigKeys() {
public static final String OZONE_OM_BIND_HOST_DEFAULT =
"0.0.0.0";
public static final int OZONE_OM_PORT_DEFAULT = 9862;
public static final String OZONE_OM_GRPC_PORT_KEY =
"ozone.om.grpc.port";

public static final String OZONE_OM_HTTP_ENABLED_KEY =
"ozone.om.http.enabled";
public static final String OZONE_OM_HTTP_BIND_HOST_KEY =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ protected void loadOMClientConfigs(ConfigurationSource config, String omSvcId)
rpcAddrStr);

if (omProxyInfo.getAddress() != null) {


// For a non-HA OM setup, nodeId might be null. If so, we assign it
// the default value
if (nodeId == null) {
Expand Down Expand Up @@ -549,18 +551,14 @@ public static OMNotLeaderException getNotLeaderException(
return null;
}

protected void setProxies(
Map<String, ProxyInfo<T>> setOMProxies,
Map<String, OMProxyInfo> setOMProxyInfos,
List<String> setOMNodeIDList) {
this.omProxies = setOMProxies;
this.omProxyInfos = setOMProxyInfos;
this.omNodeIDList = setOMNodeIDList;
}

protected List<String> getOmNodeIDList() {
return omNodeIDList;
@VisibleForTesting
protected void setProxiesForTesting(
Map<String, ProxyInfo<T>> testOMProxies,
Map<String, OMProxyInfo> testOMProxyInfos,
List<String> testOMNodeIDList) {
this.omProxies = testOMProxies;
this.omProxyInfos = testOMProxyInfos;
this.omNodeIDList = testOMNodeIDList;
}

}

Loading

0 comments on commit d57616e

Please sign in to comment.