You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jj...@apache.org on 2020/04/20 13:36:05 UTC
[geode] 01/01: Revert "GEODE-7565: Allow gateway receivers with
same host and port (#4824)"
This is an automated email from the ASF dual-hosted git repository.
jjramos pushed a commit to branch revert-4824-feature/GEODE-7565_2
in repository https://gitbox.apache.org/repos/asf/geode.git
commit c81d55ec14b3fac282db00f51c51054c0f278652
Author: Juan José Ramos <ju...@users.noreply.github.com>
AuthorDate: Mon Apr 20 14:35:40 2020 +0100
Revert "GEODE-7565: Allow gateway receivers with same host and port (#4824)"
This reverts commit dd23ee8200cba67cea82e57e2e4ccedcdf9e8266.
---
.../LocatorLoadSnapshotIntegrationTest.java | 7 +-
.../codeAnalysis/sanctionedDataSerializables.txt | 4 -
.../client/internal/CacheServerLoadMessage.java | 4 +-
.../cache/client/internal/LiveServerPinger.java | 2 +-
.../apache/geode/cache/client/internal/PingOp.java | 21 +--
.../geode/cache/client/internal/ServerProxy.java | 10 ++
.../distributed/internal/LocatorLoadSnapshot.java | 177 +++++----------------
.../internal/ServerLocationAndMemberId.java | 72 ---------
.../geode/distributed/internal/ServerLocator.java | 14 +-
.../org/apache/geode/internal/DSFIDFactory.java | 2 -
.../internal/cache/DistributedPingMessage.java | 79 ---------
.../apache/geode/internal/cache/GridAdvisor.java | 10 +-
.../internal/cache/tier/sockets/command/Ping.java | 48 +-----
.../internal/LocatorLoadSnapshotJUnitTest.java | 72 ++++-----
.../sockets/ClientServerMiscDUnitTestBase.java | 19 ---
.../serialization/DataSerializableFixedID.java | 2 -
16 files changed, 102 insertions(+), 441 deletions(-)
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
index f33327e..61bdcec 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
@@ -46,7 +46,6 @@ public class LocatorLoadSnapshotIntegrationTest {
final int NUM_REQUESTS = 10000;
int ALLOWED_THRESHOLD = 50; // We should never be off by more than
// the number of concurrent threads.
- final int LOAD_POLL_INTERVAL = 30000;
final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
final ServerLocation l1 = new ServerLocation("localhost", 1);
@@ -57,9 +56,9 @@ public class LocatorLoadSnapshotIntegrationTest {
int initialLoad2 = (int) (Math.random() * (NUM_REQUESTS / 2));
int initialLoad3 = (int) (Math.random() * (NUM_REQUESTS / 2));
- sn.addServer(l1, "", new String[0], new ServerLoad(initialLoad1, 1, 0, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[0], new ServerLoad(initialLoad2, 1, 0, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l3, "", new String[0], new ServerLoad(initialLoad3, 1, 0, 1), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[0], new ServerLoad(initialLoad1, 1, 0, 1));
+ sn.addServer(l2, new String[0], new ServerLoad(initialLoad2, 1, 0, 1));
+ sn.addServer(l3, new String[0], new ServerLoad(initialLoad3, 1, 0, 1));
final Map loadCounts = new HashMap();
loadCounts.put(l1, new AtomicInteger(initialLoad1));
diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index 024c5d7..f305269 100644
--- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -939,10 +939,6 @@ org/apache/geode/internal/cache/DistributedClearOperation$ClearRegionWithContext
fromData,15
toData,15
-org/apache/geode/internal/cache/DistributedPingMessage,2
-fromData,26
-toData,23
-
org/apache/geode/internal/cache/DistributedPutAllOperation$EntryVersionsList,2
fromData,272
toData,292
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/CacheServerLoadMessage.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/CacheServerLoadMessage.java
index 3646486..ad8412d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/CacheServerLoadMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/CacheServerLoadMessage.java
@@ -67,11 +67,13 @@ public class CacheServerLoadMessage extends SerialDistributionMessage {
InternalLocator l = (InternalLocator) locators.get(i);
ServerLocator serverLocator = l.getServerLocatorAdvisee();
if (serverLocator != null) {
- serverLocator.updateLoad(location, this.getSender().getUniqueId(), load, this.clientIds);
+ serverLocator.updateLoad(location, load, this.clientIds);
}
}
}
+
+
@Override
public int getDSFID() {
return CACHE_SERVER_LOAD_MESSAGE;
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
index 623d976..0b13f1b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/LiveServerPinger.java
@@ -87,7 +87,7 @@ public class LiveServerPinger extends EndpointListenerAdapter {
public void run2() {
if (endpoint.timeToPing(pingIntervalNanos)) {
try {
- PingOp.execute(pool, endpoint.getLocation(), endpoint.getMemberId());
+ PingOp.execute(pool, endpoint.getLocation());
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Error occurred while pinging server: {} - {}", endpoint.getLocation(),
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PingOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PingOp.java
index d290b06..6429098 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PingOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PingOp.java
@@ -14,7 +14,6 @@
*/
package org.apache.geode.cache.client.internal;
-import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.internal.cache.tier.sockets.Message;
@@ -30,12 +29,11 @@ public class PingOp {
* Ping the specified server to see if it is still alive
*
* @param pool the pool to use to communicate with the server.
- * @param serverLocation the server to do the execution on
+ * @param server the server to do the execution on
*/
- public static void execute(ExecutablePool pool, ServerLocation serverLocation,
- DistributedMember serverID) {
- AbstractOp op = new PingOpImpl(serverLocation, serverID);
- pool.executeOn(serverLocation, op, false, false);
+ public static void execute(ExecutablePool pool, ServerLocation server) {
+ AbstractOp op = new PingOpImpl();
+ pool.executeOn(server, op, false, false);
}
private PingOp() {
@@ -45,16 +43,12 @@ public class PingOp {
static class PingOpImpl extends AbstractOp {
private long startTime;
- private ServerLocation location;
- private final DistributedMember serverID;
/**
* @throws org.apache.geode.SerializationException if serialization fails
*/
- PingOpImpl(ServerLocation location, DistributedMember serverID) {
+ PingOpImpl() {
super(MessageType.PING, 0);
- this.location = location;
- this.serverID = serverID;
}
@Override
@@ -71,9 +65,8 @@ public class PingOp {
@Override
protected void sendMessage(Connection cnx) throws Exception {
getMessage().clearMessageHasSecurePartFlag();
- getMessage().setNumberOfParts(1);
- getMessage().addObjPart(serverID);
- getMessage().send(true);
+ this.startTime = System.currentTimeMillis();
+ getMessage().send(false);
Message.MESSAGE_TYPE.set(MessageType.PING);
}
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ServerProxy.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ServerProxy.java
index 5f9c7b9..675a55e5 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ServerProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ServerProxy.java
@@ -16,6 +16,7 @@ package org.apache.geode.cache.client.internal;
import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.distributed.internal.ServerLocation;
/**
* Used to send operations from a client to a server.
@@ -49,6 +50,15 @@ public class ServerProxy {
}
/**
+ * Ping the specified server to see if it is still alive
+ *
+ * @param server the server to do the execution on
+ */
+ public void ping(ServerLocation server) {
+ PingOp.execute(this.pool, server);
+ }
+
+ /**
* Does a query on a server
*
* @param queryPredicate A query language boolean query predicate
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorLoadSnapshot.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorLoadSnapshot.java
index d153927..f0ba83b 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorLoadSnapshot.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorLoadSnapshot.java
@@ -50,8 +50,7 @@ public class LocatorLoadSnapshot {
private final Map<ServerLocation, String[]> serverGroupMap = new HashMap<>();
- private final Map<String, Map<ServerLocationAndMemberId, LoadHolder>> connectionLoadMap =
- new HashMap<>();
+ private final Map<String, Map<ServerLocation, LoadHolder>> connectionLoadMap = new HashMap<>();
private final Map<String, Map<ServerLocation, LoadHolder>> queueLoadMap = new HashMap<>();
@@ -85,27 +84,29 @@ public class LocatorLoadSnapshot {
}
}
+ public void addServer(ServerLocation location, String[] groups, ServerLoad initialLoad) {
+ addServer(location, groups, initialLoad, 30000);
+ }
+
/**
* Add a new server to the load snapshot.
*/
- public synchronized void addServer(ServerLocation location, String memberId, String[] groups,
+ public synchronized void addServer(ServerLocation location, String[] groups,
ServerLoad initialLoad, long loadPollInterval) {
serverGroupMap.put(location, groups);
- LoadHolder connectionLoad =
- new LoadHolder(location, initialLoad.getConnectionLoad(),
- initialLoad.getLoadPerConnection(), loadPollInterval);
- addGroups(connectionLoadMap, groups, connectionLoad, memberId);
- LoadHolder queueLoad = new LoadHolder(location,
- initialLoad.getSubscriptionConnectionLoad(),
+ LoadHolder connectionLoad = new LoadHolder(location, initialLoad.getConnectionLoad(),
+ initialLoad.getLoadPerConnection(), loadPollInterval);
+ addGroups(connectionLoadMap, groups, connectionLoad);
+ LoadHolder queueLoad = new LoadHolder(location, initialLoad.getSubscriptionConnectionLoad(),
initialLoad.getLoadPerSubscriptionConnection(), loadPollInterval);
addGroups(queueLoadMap, groups, queueLoad);
- updateLoad(location, memberId, initialLoad);
+ updateLoad(location, initialLoad);
}
/**
* Remove a server from the load snapshot.
*/
- public synchronized void removeServer(ServerLocation location, String memberId) {
+ public synchronized void removeServer(ServerLocation location) {
String[] groups = serverGroupMap.remove(location);
/*
* Adding null check for #41522 - we were getting a remove from a BridgeServer that was shutting
@@ -113,21 +114,20 @@ public class LocatorLoadSnapshot {
* be a race from profile add / remove from different channels.
*/
if (groups != null) {
- removeFromMap(connectionLoadMap, groups, location, memberId);
+ removeFromMap(connectionLoadMap, groups, location);
removeFromMap(queueLoadMap, groups, location);
}
}
- public void updateLoad(ServerLocation location, String memberId, ServerLoad newLoad) {
- updateLoad(location, memberId, newLoad, null);
+ public void updateLoad(ServerLocation location, ServerLoad newLoad) {
+ updateLoad(location, newLoad, null);
}
/**
* Update the load information for a server that was previously added.
*/
- synchronized void updateLoad(ServerLocation location, String memberId, ServerLoad newLoad,
+ synchronized void updateLoad(ServerLocation location, ServerLoad newLoad,
List<ClientProxyMembershipID> clientIds) {
-
String[] groups = serverGroupMap.get(location);
// the server was asynchronously removed, so don't do anything.
if (groups == null) {
@@ -140,7 +140,7 @@ public class LocatorLoadSnapshot {
}
}
- updateMap(connectionLoadMap, location, memberId, newLoad.getConnectionLoad(),
+ updateMap(connectionLoadMap, location, newLoad.getConnectionLoad(),
newLoad.getLoadPerConnection());
updateMap(queueLoadMap, location, newLoad.getSubscriptionConnectionLoad(),
newLoad.getLoadPerSubscriptionConnection());
@@ -151,15 +151,15 @@ public class LocatorLoadSnapshot {
group = null;
}
- Map<ServerLocationAndMemberId, LoadHolder> groupServers = connectionLoadMap.get(group);
+ Map<ServerLocation, LoadHolder> groupServers = connectionLoadMap.get(group);
return isBalanced(groupServers);
}
- private synchronized boolean isBalanced(Map<ServerLocationAndMemberId, LoadHolder> groupServers) {
+ private synchronized boolean isBalanced(Map<ServerLocation, LoadHolder> groupServers) {
return isBalanced(groupServers, false);
}
- private synchronized boolean isBalanced(Map<ServerLocationAndMemberId, LoadHolder> groupServers,
+ private synchronized boolean isBalanced(Map<ServerLocation, LoadHolder> groupServers,
boolean withThresholdCheck) {
if (groupServers == null || groupServers.isEmpty()) {
return true;
@@ -169,7 +169,7 @@ public class LocatorLoadSnapshot {
float largestLoadPerConnection = Float.MIN_VALUE;
float worstLoad = Float.MIN_VALUE;
- for (Entry<ServerLocationAndMemberId, LoadHolder> loadHolderEntry : groupServers.entrySet()) {
+ for (Entry<ServerLocation, LoadHolder> loadHolderEntry : groupServers.entrySet()) {
LoadHolder nextLoadReference = loadHolderEntry.getValue();
float nextLoad = nextLoadReference.getLoad();
float nextLoadPerConnection = nextLoadReference.getLoadPerConnection();
@@ -246,13 +246,13 @@ public class LocatorLoadSnapshot {
group = null;
}
- Map<ServerLocationAndMemberId, LoadHolder> groupServers = connectionLoadMap.get(group);
+ Map<ServerLocation, LoadHolder> groupServers = connectionLoadMap.get(group);
if (groupServers == null || groupServers.isEmpty()) {
return null;
}
{
- List bestLHs = findBestServersUsingMemberId(groupServers, excludedServers, 1);
+ List bestLHs = findBestServers(groupServers, excludedServers, 1);
if (bestLHs.isEmpty()) {
return null;
}
@@ -266,15 +266,12 @@ public class LocatorLoadSnapshot {
if ("".equals(group)) {
group = null;
}
- Map<ServerLocationAndMemberId, LoadHolder> groupServers = connectionLoadMap.get(group);
+ Map<ServerLocation, LoadHolder> groupServers = connectionLoadMap.get(group);
if (groupServers == null || groupServers.isEmpty()) {
return null;
}
- ArrayList result = new ArrayList<>();
- for (ServerLocationAndMemberId locationAndMemberId : groupServers.keySet()) {
- result.add(locationAndMemberId.getServerLocation());
- }
- return result;
+
+ return new ArrayList<>(groupServers.keySet());
}
public void shutDown() {
@@ -282,7 +279,7 @@ public class LocatorLoadSnapshot {
}
/**
- * Pick the least loaded server in the given group if currentServer is the most loaded server.
+ * Pick the least loaded server in the given group if currentServer is the most loaded server. n
*
* @param group the group, or null or "" if the client has no server group.
* @param excludedServers a list of servers to exclude as choices
@@ -295,7 +292,7 @@ public class LocatorLoadSnapshot {
group = null;
}
- Map<ServerLocationAndMemberId, LoadHolder> groupServers = connectionLoadMap.get(group);
+ Map<ServerLocation, LoadHolder> groupServers = connectionLoadMap.get(group);
if (groupServers == null || groupServers.isEmpty()) {
return null;
}
@@ -311,7 +308,7 @@ public class LocatorLoadSnapshot {
return currentServer;
}
{
- List<LoadHolder> bestLHs = findBestServersUsingMemberId(groupServers, excludedServers, 1);
+ List<LoadHolder> bestLHs = findBestServers(groupServers, excludedServers, 1);
if (bestLHs.isEmpty()) {
return null;
}
@@ -394,13 +391,13 @@ public class LocatorLoadSnapshot {
* each server.
*/
public synchronized Map<ServerLocation, ServerLoad> getLoadMap() {
- Map<ServerLocationAndMemberId, LoadHolder> connectionMap = connectionLoadMap.get(null);
+ Map<ServerLocation, LoadHolder> connectionMap = connectionLoadMap.get(null);
Map<ServerLocation, LoadHolder> queueMap = queueLoadMap.get(null);
Map<ServerLocation, ServerLoad> result = new HashMap<>();
- for (Entry<ServerLocationAndMemberId, LoadHolder> entry : connectionMap
+ for (Entry<ServerLocation, LoadHolder> entry : connectionMap
.entrySet()) {
- ServerLocation location = entry.getKey().getServerLocation();
+ ServerLocation location = entry.getKey();
LoadHolder connectionLoad = entry.getValue();
LoadHolder queueLoad = queueMap.get(location);
// was asynchronously removed
@@ -428,22 +425,6 @@ public class LocatorLoadSnapshot {
}
}
- private void addGroups(Map<String, Map<ServerLocationAndMemberId, LoadHolder>> map,
- String[] groups,
- LoadHolder holder, String memberId) {
- for (String group : groups) {
- Map<ServerLocationAndMemberId, LoadHolder> groupMap =
- map.computeIfAbsent(group, k -> new HashMap<>());
- groupMap.put(new ServerLocationAndMemberId(holder.getLocation(), memberId), holder);
- }
- // Special case for GatewayReceiver where we don't put those serverlocation against holder
- if (!(groups.length > 0 && groups[0].equals(GatewayReceiver.RECEIVER_GROUP))) {
- Map<ServerLocationAndMemberId, LoadHolder> groupMap =
- map.computeIfAbsent(null, k -> new HashMap<>());
- groupMap.put(new ServerLocationAndMemberId(holder.getLocation(), memberId), holder);
- }
- }
-
private void removeFromMap(Map<String, Map<ServerLocation, LoadHolder>> map, String[] groups,
ServerLocation location) {
for (String group : groups) {
@@ -459,24 +440,6 @@ public class LocatorLoadSnapshot {
groupMap.remove(location);
}
- private void removeFromMap(Map<String, Map<ServerLocationAndMemberId, LoadHolder>> map,
- String[] groups,
- ServerLocation location, String memberId) {
- ServerLocationAndMemberId locationAndMemberId =
- new ServerLocationAndMemberId(location, memberId);
- for (String group : groups) {
- Map<ServerLocationAndMemberId, LoadHolder> groupMap = map.get(group);
- if (groupMap != null) {
- groupMap.remove(locationAndMemberId);
- if (groupMap.size() == 0) {
- map.remove(group);
- }
- }
- }
- Map groupMap = map.get(null);
- groupMap.remove(locationAndMemberId);
- }
-
private void updateMap(Map map, ServerLocation location, float load, float loadPerConnection) {
Map groupMap = (Map) map.get(null);
LoadHolder holder = (LoadHolder) groupMap.get(location);
@@ -485,65 +448,6 @@ public class LocatorLoadSnapshot {
}
}
- private void updateMap(Map map, ServerLocation location, String memberId, float load,
- float loadPerConnection) {
- Map groupMap = (Map) map.get(null);
- ServerLocationAndMemberId locationAndMemberId =
- new ServerLocationAndMemberId(location, memberId);
- LoadHolder holder =
- (LoadHolder) groupMap.get(locationAndMemberId);
-
- if (holder != null) {
- holder.setLoad(load, loadPerConnection);
- }
- }
-
- /**
- *
- * @param groupServers the servers to consider
- * @param excludedServers servers to exclude
- * @param count how many you want. a negative number means all of them in order of best to worst
- * @return a list of best...worst server LoadHolders
- */
- private List<LoadHolder> findBestServersUsingMemberId(
- Map<ServerLocationAndMemberId, LoadHolder> groupServers,
- Set<ServerLocation> excludedServers, int count) {
-
- TreeSet<LoadHolder> bestEntries = new TreeSet<>((l1, l2) -> {
- int difference = Float.compare(l1.getLoad(), l2.getLoad());
- if (difference != 0) {
- return difference;
- }
- ServerLocation sl1 = l1.getLocation();
- ServerLocation sl2 = l2.getLocation();
- return sl1.compareTo(sl2);
- });
-
- boolean retainAll = (count < 0);
- float lastBestLoad = Float.MAX_VALUE;
-
- for (Map.Entry<ServerLocationAndMemberId, LoadHolder> loadEntry : groupServers.entrySet()) {
- ServerLocation location = loadEntry.getKey().getServerLocation();
- if (excludedServers.contains(location)) {
- continue;
- }
-
- LoadHolder nextLoadReference = loadEntry.getValue();
- float nextLoad = nextLoadReference.getLoad();
-
- if ((bestEntries.size() < count) || retainAll || (nextLoad < lastBestLoad)) {
- bestEntries.add(nextLoadReference);
- if (!retainAll && (bestEntries.size() > count)) {
- bestEntries.remove(bestEntries.last());
- }
- LoadHolder lastBestHolder = bestEntries.last();
- lastBestLoad = lastBestHolder.getLoad();
- }
- }
-
- return new ArrayList<>(bestEntries);
- }
-
/**
*
* @param groupServers the servers to consider
@@ -589,26 +493,17 @@ public class LocatorLoadSnapshot {
return new ArrayList<>(bestEntries);
}
-
/**
* If it is most loaded then return its LoadHolder; otherwise return null;
*/
private LoadHolder isCurrentServerMostLoaded(ServerLocation currentServer,
- Map<ServerLocationAndMemberId, LoadHolder> groupServers) {
-
- // Check if there are keys in the map that contains currentServer.
- LoadHolder currentLH = null;
- for (ServerLocationAndMemberId locationAndMemberId : groupServers.keySet()) {
- if (currentServer.equals(locationAndMemberId.getServerLocation())) {
- currentLH = groupServers.get(locationAndMemberId);
- break;
- }
- }
+ Map<ServerLocation, LoadHolder> groupServers) {
+ final LoadHolder currentLH = groupServers.get(currentServer);
if (currentLH == null)
return null;
final float currentLoad = currentLH.getLoad();
- for (Map.Entry<ServerLocationAndMemberId, LoadHolder> loadEntry : groupServers.entrySet()) {
- ServerLocation location = loadEntry.getKey().getServerLocation();
+ for (Map.Entry<ServerLocation, LoadHolder> loadEntry : groupServers.entrySet()) {
+ ServerLocation location = loadEntry.getKey();
if (location.equals(currentServer)) {
continue;
}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocationAndMemberId.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocationAndMemberId.java
deleted file mode 100644
index 878fa34..0000000
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocationAndMemberId.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.geode.distributed.internal;
-
-public class ServerLocationAndMemberId {
-
- private ServerLocation serverLocation;
- private String memberId;
-
- public ServerLocationAndMemberId() {}
-
- public ServerLocationAndMemberId(ServerLocation serverLocation) {
- this.serverLocation = serverLocation;
- memberId = "";
- }
-
- public ServerLocationAndMemberId(ServerLocation serverLocation, String memberId) {
- this(serverLocation);
- this.memberId = memberId;
- }
-
- public ServerLocation getServerLocation() {
- return this.serverLocation;
- }
-
- public String getMemberId() {
- return this.memberId;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof ServerLocationAndMemberId))
- return false;
- final ServerLocationAndMemberId other = (ServerLocationAndMemberId) obj;
-
- if (!this.serverLocation.equals(other.getServerLocation())) {
- return false;
- }
-
- return this.memberId.equals(other.getMemberId());
- }
-
- @Override
- public String toString() {
- return serverLocation.toString() + "@" + memberId;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result =
- prime * result + serverLocation.hashCode() + ((memberId != null) ? memberId.hashCode() : 0);
- return result;
- }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
index 4442073..075489f 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
@@ -405,9 +405,7 @@ public class ServerLocator implements TcpHandler, RestartHandler, DistributionAd
CacheServerProfile bp = (CacheServerProfile) profile;
ServerLocation location = buildServerLocation(bp);
String[] groups = bp.getGroups();
- loadSnapshot.addServer(
- location, bp.getDistributedMember().getUniqueId(), groups,
- bp.getInitialLoad(), bp.getLoadPollInterval());
+ loadSnapshot.addServer(location, groups, bp.getInitialLoad(), bp.getLoadPollInterval());
if (logger.isDebugEnabled()) {
logger.debug("ServerLocator: Received load from a new server {}, {}", location,
bp.getInitialLoad());
@@ -425,7 +423,7 @@ public class ServerLocator implements TcpHandler, RestartHandler, DistributionAd
CacheServerProfile bp = (CacheServerProfile) profile;
// InternalDistributedMember id = bp.getDistributedMember();
ServerLocation location = buildServerLocation(bp);
- loadSnapshot.removeServer(location, bp.getDistributedMember().getUniqueId());
+ loadSnapshot.removeServer(location);
if (logger.isDebugEnabled()) {
logger.debug("ServerLocator: server departed {}", location);
}
@@ -443,14 +441,12 @@ public class ServerLocator implements TcpHandler, RestartHandler, DistributionAd
.warning("ServerLocator - unexpected profile update.");
}
- public void updateLoad(ServerLocation location, String memberId, ServerLoad load,
- List clientIds) {
+ public void updateLoad(ServerLocation location, ServerLoad load, List clientIds) {
if (getLogWriter().fineEnabled()) {
getLogWriter()
- .fine("ServerLocator: Received a load update from " + location + " at " + memberId + " , "
- + load);
+ .fine("ServerLocator: Received a load update from " + location + ", " + load);
}
- loadSnapshot.updateLoad(location, memberId, load, clientIds);
+ loadSnapshot.updateLoad(location, load, clientIds);
this.stats.incServerLoadUpdates();
logServers();
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
index 59e9bc2..993ad3e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
@@ -203,7 +203,6 @@ import org.apache.geode.internal.cache.DistTXPrecommitMessage.DistTxPrecommitRes
import org.apache.geode.internal.cache.DistTXRollbackMessage;
import org.apache.geode.internal.cache.DistributedClearOperation.ClearRegionMessage;
import org.apache.geode.internal.cache.DistributedClearOperation.ClearRegionWithContextMessage;
-import org.apache.geode.internal.cache.DistributedPingMessage;
import org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList;
import org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllMessage;
import org.apache.geode.internal.cache.DistributedRegionFunctionStreamingMessage;
@@ -975,7 +974,6 @@ public class DSFIDFactory implements DataSerializableFixedID {
GatewaySenderQueueEntrySynchronizationOperation.GatewaySenderQueueEntrySynchronizationEntry.class);
serializer.registerDSFID(ABORT_BACKUP_REQUEST, AbortBackupRequest.class);
serializer.registerDSFID(HOST_AND_PORT, HostAndPort.class);
- serializer.registerDSFID(DISTRIBUTED_PING_MESSAGE, DistributedPingMessage.class);
}
/**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPingMessage.java
deleted file mode 100644
index 8eda0fa..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPingMessage.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.geode.internal.cache;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.ClusterDistributionManager;
-import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor;
-import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
-import org.apache.geode.internal.serialization.DeserializationContext;
-import org.apache.geode.internal.serialization.SerializationContext;
-import org.apache.geode.internal.serialization.Version;
-
-public class DistributedPingMessage extends HighPriorityDistributionMessage {
- private ClientProxyMembershipID proxyID;
-
- public DistributedPingMessage() {
- // no-arg constructor for serialization
- }
-
- public DistributedPingMessage(DistributedMember targetServer, ClientProxyMembershipID proxyID) {
- super();
- this.proxyID = proxyID;
- setRecipient((InternalDistributedMember) targetServer);
- }
-
- @Override
- protected void process(ClusterDistributionManager dm) {
- ClientHealthMonitor chm = ClientHealthMonitor.getInstance();
- if (chm != null) {
- chm.receivedPing(proxyID);
- }
- }
-
- @Override
- public void toData(DataOutput out, SerializationContext context) throws IOException {
- super.toData(out, context);
- context.getSerializer().writeObject(proxyID, out);
- }
-
- @Override
- public void fromData(DataInput in, DeserializationContext context)
- throws IOException, ClassNotFoundException {
- super.fromData(in, context);
- proxyID = context.getDeserializer().readObject(in);
- }
-
- @Override
- public int getDSFID() {
- return DISTRIBUTED_PING_MESSAGE;
- }
-
- @Override
- public Version[] getSerializationVersions() {
- return null;
- }
-
- @Override
- public String toString() {
- return super.toString() + "; proxyId=" + proxyID;
- }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
index 8097118..98faad2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
@@ -418,24 +418,18 @@ public abstract class GridAdvisor extends DistributionAdvisor {
public int hashCode() {
final String thisHost = this.gp.getHost();
final int thisPort = this.gp.getPort();
- final String thisMemberId = this.getMemberId().getUniqueId();
- final int thisMemberIdHashCode = (thisMemberId != null) ? thisMemberId.hashCode() : 0;
- return thisHost != null ? (thisHost.hashCode() ^ thisPort) + thisMemberIdHashCode
- : thisPort + thisMemberIdHashCode;
+ return thisHost != null ? (thisHost.hashCode() ^ thisPort) : thisPort;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof GridProfileId) {
final GridProfileId other = (GridProfileId) obj;
-
if (this.gp.getPort() == other.gp.getPort()) {
final String thisHost = this.gp.getHost();
final String otherHost = other.gp.getHost();
if (thisHost != null) {
- if (thisHost.equals(otherHost)) {
- return this.getMemberId().equals(other.getMemberId());
- }
+ return thisHost.equals(otherHost);
} else {
return (otherHost == null);
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
index b290025..ea90f14 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
@@ -17,9 +17,8 @@ package org.apache.geode.internal.cache.tier.sockets.command;
import java.io.IOException;
import org.apache.geode.annotations.Immutable;
-import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.DistributionStats;
-import org.apache.geode.internal.cache.DistributedPingMessage;
+import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.Command;
import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
@@ -48,27 +47,10 @@ public class Ping extends BaseCommand {
clientMessage.getTransactionId(), serverConnection.getSocketString(),
(DistributionStats.getStatTime() - start));
}
- if (clientMessage.getNumberOfParts() > 0) {
- try {
- DistributedMember targetServer = (DistributedMember) clientMessage.getPart(0).getObject();
- DistributedMember myID = serverConnection.getCache().getMyId();
- if (!myID.equals(targetServer)) {
- pingCorrectServer(clientMessage, targetServer, serverConnection);
- writeReply(clientMessage, serverConnection);
- serverConnection.setAsTrue(RESPONDED);
- return;
- }
- } catch (ClassNotFoundException e) {
- logger.warn("Unable to deserialize message from " + serverConnection.getProxyID());
- writeErrorResponse(clientMessage, MessageType.PING, serverConnection);
- serverConnection.setAsTrue(RESPONDED);
- return;
- }
- }
ClientHealthMonitor chm = ClientHealthMonitor.getInstance();
- if (chm != null) {
+ if (chm != null)
chm.receivedPing(serverConnection.getProxyID());
- }
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
writeReply(clientMessage, serverConnection);
serverConnection.setAsTrue(RESPONDED);
@@ -78,30 +60,6 @@ public class Ping extends BaseCommand {
}
}
- /**
- * Process a ping request that was sent to the wrong server
- */
- protected void pingCorrectServer(Message clientMessage, DistributedMember targetServer,
- ServerConnection serverConnection)
- throws IOException {
- if (logger.isDebugEnabled()) {
- logger.debug("Received a Ping request from {} intended for {}. Forwarding the ping...",
- serverConnection.getProxyID(), targetServer);
- }
- if (!serverConnection.getCache().getDistributionManager().isCurrentMember(targetServer)) {
- logger.warn("Unable to ping non-member {} for client {}", targetServer,
- serverConnection.getProxyID());
- writeErrorResponse(clientMessage, MessageType.PING, serverConnection);
- serverConnection.setAsTrue(RESPONDED);
- } else {
- // send a ping message to the server. This is a one-way message that doesn't send a reply
- final DistributedPingMessage distributedPingMessage =
- new DistributedPingMessage(targetServer, serverConnection.getProxyID());
- serverConnection.getCache().getDistributionManager().putOutgoing(distributedPingMessage);
- writeReply(clientMessage, serverConnection);
- }
- }
-
@Override
protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
Message replyMsg = serverConnection.getReplyMessage();
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotJUnitTest.java
index e7d20c9..5a38b28 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -39,8 +39,6 @@ import org.apache.geode.test.junit.categories.MembershipTest;
@Category({MembershipTest.class})
public class LocatorLoadSnapshotJUnitTest {
- final int LOAD_POLL_INTERVAL = 30000;
-
/**
* Test to make sure than an empty snapshot returns the correct values.
*/
@@ -64,8 +62,8 @@ public class LocatorLoadSnapshotJUnitTest {
ServerLocation l2 = new ServerLocation("localhost", 2);
ServerLoad ld1 = new ServerLoad(3, 1, 1.01f, 1);
ServerLoad ld2 = new ServerLoad(5, .2f, 1f, .2f);
- sn.addServer(l1, "", new String[0], ld1, LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[0], ld2, LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[0], ld1);
+ sn.addServer(l2, new String[0], ld2);
HashMap expectedLoad = new HashMap();
expectedLoad.put(l1, ld1);
@@ -105,12 +103,12 @@ public class LocatorLoadSnapshotJUnitTest {
LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
ServerLocation l1 = new ServerLocation("localhost", 1);
ServerLocation l2 = new ServerLocation("localhost", 2);
- sn.addServer(l1, "", new String[0], new ServerLoad(1, 1, 1, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[0], new ServerLoad(100, .2f, 1, .2f), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[0], new ServerLoad(1, 1, 1, 1));
+ sn.addServer(l2, new String[0], new ServerLoad(100, .2f, 1, .2f));
assertEquals(l1, sn.getServerForConnection(null, Collections.EMPTY_SET));
assertEquals(l1, sn.getServerForConnection(null, Collections.EMPTY_SET));
- sn.updateLoad(l1, "", new ServerLoad(200, 1, 1, 1));
+ sn.updateLoad(l1, new ServerLoad(200, 1, 1, 1));
assertEquals(l2, sn.getServerForConnection(null, Collections.EMPTY_SET));
assertEquals(l2, sn.getServerForConnection(null, Collections.EMPTY_SET));
}
@@ -124,13 +122,13 @@ public class LocatorLoadSnapshotJUnitTest {
LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
ServerLocation l1 = new ServerLocation("localhost", 1);
ServerLocation l2 = new ServerLocation("localhost", 2);
- sn.addServer(l1, "", new String[0], new ServerLoad(1, 1, 1, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[0], new ServerLoad(100, .2f, 10, .2f), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[0], new ServerLoad(1, 1, 1, 1));
+ sn.addServer(l2, new String[0], new ServerLoad(100, .2f, 10, .2f));
assertEquals(l1, sn.getServerForConnection(null, Collections.EMPTY_SET));
assertEquals(Arrays.asList(new ServerLocation[] {l1, l2}),
sn.getServersForQueue(null, Collections.EMPTY_SET, -1));
- sn.removeServer(l1, "");
+ sn.removeServer(l1);
assertEquals(l2, sn.getServerForConnection(null, Collections.EMPTY_SET));
assertEquals(Collections.singletonList(l2),
sn.getServersForQueue(null, Collections.EMPTY_SET, -1));
@@ -144,14 +142,14 @@ public class LocatorLoadSnapshotJUnitTest {
LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
ServerLocation l1 = new ServerLocation("localhost", 1);
ServerLocation l2 = new ServerLocation("localhost", 2);
- sn.addServer(l1, "", new String[] {"a", "b"}, new ServerLoad(1, 1, 1, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[] {"b", "c"}, new ServerLoad(1, 1, 1, 1), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[] {"a", "b"}, new ServerLoad(1, 1, 1, 1));
+ sn.addServer(l2, new String[] {"b", "c"}, new ServerLoad(1, 1, 1, 1));
assertNotNull(sn.getServerForConnection(null, Collections.EMPTY_SET));
assertEquals(l1, sn.getServerForConnection("a", Collections.EMPTY_SET));
assertEquals(l2, sn.getServerForConnection("c", Collections.EMPTY_SET));
- sn.updateLoad(l1, "", new ServerLoad(10, 1, 1, 1));
+ sn.updateLoad(l1, new ServerLoad(10, 1, 1, 1));
assertEquals(l2, sn.getServerForConnection("b", Collections.EMPTY_SET));
- sn.updateLoad(l2, "", new ServerLoad(100, 1, 1, 1));
+ sn.updateLoad(l2, new ServerLoad(100, 1, 1, 1));
assertEquals(l1, sn.getServerForConnection("b", Collections.EMPTY_SET));
assertEquals(Arrays.asList(new ServerLocation[] {l1}),
sn.getServersForQueue("a", Collections.EMPTY_SET, -1));
@@ -164,7 +162,7 @@ public class LocatorLoadSnapshotJUnitTest {
assertEquals(Arrays.asList(new ServerLocation[] {l1, l2}),
sn.getServersForQueue("b", Collections.EMPTY_SET, 5));
- sn.removeServer(l1, "");
+ sn.removeServer(l1);
assertEquals(l2, sn.getServerForConnection("b", Collections.EMPTY_SET));
assertEquals(l2, sn.getServerForConnection("b", Collections.EMPTY_SET));
assertNull(sn.getServerForConnection("a", Collections.EMPTY_SET));
@@ -184,9 +182,9 @@ public class LocatorLoadSnapshotJUnitTest {
ServerLocation l1 = new ServerLocation("localhost", 1);
ServerLocation l2 = new ServerLocation("localhost", 2);
ServerLocation l3 = new ServerLocation("localhost", 3);
- sn.addServer(l1, "", new String[] {"a",}, new ServerLoad(0, 1, 0, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[] {"a", "b"}, new ServerLoad(0, 1, 0, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l3, "", new String[] {"b"}, new ServerLoad(0, 1, 0, 1), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[] {"a",}, new ServerLoad(0, 1, 0, 1));
+ sn.addServer(l2, new String[] {"a", "b"}, new ServerLoad(0, 1, 0, 1));
+ sn.addServer(l3, new String[] {"b"}, new ServerLoad(0, 1, 0, 1));
// Test with interleaving requests for either group
for (int i = 0; i < 60; i++) {
@@ -203,9 +201,9 @@ public class LocatorLoadSnapshotJUnitTest {
expected.put(l3, expectedLoad);
assertEquals(expected, sn.getLoadMap());
- sn.updateLoad(l1, "", new ServerLoad(0, 1, 0, 1));
- sn.updateLoad(l2, "", new ServerLoad(0, 1, 0, 1));
- sn.updateLoad(l3, "", new ServerLoad(0, 1, 0, 1));
+ sn.updateLoad(l1, new ServerLoad(0, 1, 0, 1));
+ sn.updateLoad(l2, new ServerLoad(0, 1, 0, 1));
+ sn.updateLoad(l3, new ServerLoad(0, 1, 0, 1));
// Now do the same test, but make all the requests for one group first,
@@ -247,8 +245,8 @@ public class LocatorLoadSnapshotJUnitTest {
LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
ServerLocation l1 = new ServerLocation("localhost", 1);
ServerLocation l2 = new ServerLocation("localhost", 2);
- sn.addServer(l1, "", new String[0], new ServerLoad(1, 1, 1, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[0], new ServerLoad(100, 1, 100, 1), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[0], new ServerLoad(1, 1, 1, 1));
+ sn.addServer(l2, new String[0], new ServerLoad(100, 1, 100, 1));
HashSet excludeAll = new HashSet();
excludeAll.add(l1);
@@ -274,20 +272,20 @@ public class LocatorLoadSnapshotJUnitTest {
final ServerLocation l2 = new ServerLocation("localhost", 2);
final ServerLocation l3 = new ServerLocation("localhost", 3);
- sn.addServer(l1, "", new String[] {"a"}, new ServerLoad(0, 1, 0, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l2, "", new String[] {"a", "b"}, new ServerLoad(0, 1, 0, 1), LOAD_POLL_INTERVAL);
- sn.addServer(l3, "", new String[] {"b"}, new ServerLoad(0, 1, 0, 1), LOAD_POLL_INTERVAL);
+ sn.addServer(l1, new String[] {"a"}, new ServerLoad(0, 1, 0, 1));
+ sn.addServer(l2, new String[] {"a", "b"}, new ServerLoad(0, 1, 0, 1));
+ sn.addServer(l3, new String[] {"b"}, new ServerLoad(0, 1, 0, 1));
assertTrue(sn.hasBalancedConnections(null));
assertTrue(sn.hasBalancedConnections("a"));
assertTrue(sn.hasBalancedConnections("b"));
- sn.updateLoad(l1, "", new ServerLoad(1, 1, 0, 1));
+ sn.updateLoad(l1, new ServerLoad(1, 1, 0, 1));
assertTrue(sn.hasBalancedConnections(null));
assertTrue(sn.hasBalancedConnections("a"));
assertTrue(sn.hasBalancedConnections("b"));
- sn.updateLoad(l2, "", new ServerLoad(2, 1, 0, 1));
+ sn.updateLoad(l2, new ServerLoad(2, 1, 0, 1));
assertFalse(sn.hasBalancedConnections(null));
assertTrue(sn.hasBalancedConnections("a"));
assertFalse(sn.hasBalancedConnections("b"));
@@ -306,12 +304,9 @@ public class LocatorLoadSnapshotJUnitTest {
float l1ConnectionLoad = 50 + defaultLoadImbalanceThreshold;
float l2ConnectionLoad = 50;
float l3ConnectionLoad = 50 - defaultLoadImbalanceThreshold;
- loadSnapshot.addServer(l1, "", new String[] {"a"}, new ServerLoad(l1ConnectionLoad, 1, 0, 1),
- LOAD_POLL_INTERVAL);
- loadSnapshot.addServer(l2, "", new String[] {"a", "b"},
- new ServerLoad(l2ConnectionLoad, 1, 0, 1), LOAD_POLL_INTERVAL);
- loadSnapshot.addServer(l3, "", new String[] {"b"}, new ServerLoad(l3ConnectionLoad, 1, 0, 1),
- LOAD_POLL_INTERVAL);
+ loadSnapshot.addServer(l1, new String[] {"a"}, new ServerLoad(l1ConnectionLoad, 1, 0, 1));
+ loadSnapshot.addServer(l2, new String[] {"a", "b"}, new ServerLoad(l2ConnectionLoad, 1, 0, 1));
+ loadSnapshot.addServer(l3, new String[] {"b"}, new ServerLoad(l3ConnectionLoad, 1, 0, 1));
// a new server should be selected until the load-imbalance-threshold is reached
ServerLocation newServer = null;
@@ -351,12 +346,9 @@ public class LocatorLoadSnapshotJUnitTest {
float l1ConnectionLoad = 50 + defaultLoadImbalanceThreshold - 1;
float l2ConnectionLoad = 50;
float l3ConnectionLoad = 50 + (defaultLoadImbalanceThreshold / 2);
- loadSnapshot.addServer(l1, "", new String[] {"a"}, new ServerLoad(l1ConnectionLoad, 1, 0, 1),
- LOAD_POLL_INTERVAL);
- loadSnapshot.addServer(l2, "", new String[] {"a", "b"},
- new ServerLoad(l2ConnectionLoad, 1, 0, 1), LOAD_POLL_INTERVAL);
- loadSnapshot.addServer(l3, "", new String[] {"b"}, new ServerLoad(l3ConnectionLoad, 1, 0, 1),
- LOAD_POLL_INTERVAL);
+ loadSnapshot.addServer(l1, new String[] {"a"}, new ServerLoad(l1ConnectionLoad, 1, 0, 1));
+ loadSnapshot.addServer(l2, new String[] {"a", "b"}, new ServerLoad(l2ConnectionLoad, 1, 0, 1));
+ loadSnapshot.addServer(l3, new String[] {"b"}, new ServerLoad(l3ConnectionLoad, 1, 0, 1));
ServerLocation newServer =
loadSnapshot.getReplacementServerForConnection(l1, "", Collections.EMPTY_SET);
diff --git a/geode-dunit/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTestBase.java b/geode-dunit/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTestBase.java
index 41599a8..af73fc7 100755
--- a/geode-dunit/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTestBase.java
+++ b/geode-dunit/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTestBase.java
@@ -63,7 +63,6 @@ import org.apache.geode.cache.client.PoolFactory;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.client.internal.Connection;
import org.apache.geode.cache.client.internal.Op;
-import org.apache.geode.cache.client.internal.PingOp;
import org.apache.geode.cache.client.internal.PoolImpl;
import org.apache.geode.cache.client.internal.QueueConnectionImpl;
import org.apache.geode.cache.client.internal.RegisterInterestTracker;
@@ -73,7 +72,6 @@ import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
-import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.AvailablePort;
import org.apache.geode.internal.cache.CachePerfStats;
@@ -520,23 +518,6 @@ public class ClientServerMiscDUnitTestBase extends JUnit4CacheTestCase {
}
- @Test
- public void testPingWrongServer() throws Exception {
- PORT1 = initServerCache(true);
- initServerCache2();
- InternalDistributedMember server2ID = server2.invoke("get ID", () -> cache.getMyId());
- pool = (PoolImpl) createClientCache(NetworkUtils.getServerHostName(), PORT1);
- // send the ping to server1 but use server2's identifier so the ping will be forwarded
- PingOp.execute(pool, new ServerLocation(NetworkUtils.getServerHostName(), PORT1), server2ID);
- ClientProxyMembershipID proxyID = server1.invoke(
- () -> CacheClientNotifier.getInstance().getClientProxies().iterator().next().getProxyID());
- // if the ping made it to server2 it will have the client's ID in its health monitor
- server2.invoke(() -> {
- assertThat(ClientHealthMonitor.getInstance().getClientHeartbeats().keySet().contains(proxyID))
- .isTrue();
- });
- }
-
/**
* Test two regions: notify by subscription is true. Both the regions have registered interest in
* all the keys. Destroy region1 on the client. It should reach the server , kill the region on
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/DataSerializableFixedID.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/DataSerializableFixedID.java
index a11aaf1..e00dd64 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/DataSerializableFixedID.java
+++ b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/DataSerializableFixedID.java
@@ -57,8 +57,6 @@ public interface DataSerializableFixedID extends SerializationVersions, BasicSer
// NOTE, codes < -65536 will take 4 bytes to serialize
// NOTE, codes < -128 will take 2 bytes to serialize
- short DISTRIBUTED_PING_MESSAGE = -160;
-
short CREATE_REGION_MESSAGE_LUCENE = -159;
short FINAL_CHECK_PASSED_MESSAGE = -158;
short NETWORK_PARTITION_MESSAGE = -157;