Skip to content

Commit 41f304b

Browse files
committed
Remove serviceId hack for load balancer testing (#868)
JAVA-4463
1 parent 120c6dd commit 41f304b

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

.evergreen/.evg.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ functions:
223223
params:
224224
script: |
225225
${PREPARE_SHELL}
226-
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} AUTH=${AUTH} SSL=${SSL} STORAGE_ENGINE=${STORAGE_ENGINE} ORCHESTRATION_FILE=${ORCHESTRATION_FILE} sh ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
226+
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} LOAD_BALANCER=${LOAD_BALANCER} MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} AUTH=${AUTH} SSL=${SSL} STORAGE_ENGINE=${STORAGE_ENGINE} ORCHESTRATION_FILE=${ORCHESTRATION_FILE} sh ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
227227
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
228228
- command: expansions.update
229229
params:
@@ -828,6 +828,8 @@ tasks:
828828
- name: load-balancer-test
829829
commands:
830830
- func: "bootstrap mongo-orchestration"
831+
vars:
832+
LOAD_BALANCER: 'true'
831833
- func: "run load-balancer"
832834
- func: "run load-balancer tests"
833835

driver-core/src/main/com/mongodb/internal/connection/DescriptionHelper.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import java.util.Map;
4343
import java.util.Set;
4444

45-
import static com.mongodb.assertions.Assertions.assertNotNull;
4645
import static com.mongodb.connection.ConnectionDescription.getDefaultMaxMessageSize;
4746
import static com.mongodb.connection.ConnectionDescription.getDefaultMaxWriteBatchSize;
4847
import static com.mongodb.connection.ServerConnectionState.CONNECTED;
@@ -60,13 +59,6 @@
6059
import static java.util.concurrent.TimeUnit.NANOSECONDS;
6160

6261
public final class DescriptionHelper {
63-
64-
private static volatile boolean manufactureServiceId = false;
65-
66-
public static void enableServiceIdManufacturing() {
67-
manufactureServiceId = true;
68-
}
69-
7062
static ConnectionDescription createConnectionDescription(final ClusterConnectionMode clusterConnectionMode,
7163
final ConnectionId connectionId, final BsonDocument helloResult) {
7264
ConnectionDescription connectionDescription = new ConnectionDescription(connectionId,
@@ -82,10 +74,6 @@ static ConnectionDescription createConnectionDescription(final ClusterConnection
8274
ObjectId serviceId = getServiceId(helloResult);
8375
if (serviceId != null) {
8476
connectionDescription = connectionDescription.withServiceId(serviceId);
85-
} else if (manufactureServiceId) {
86-
TopologyVersion topologyVersion = getTopologyVersion(helloResult);
87-
assertNotNull(topologyVersion);
88-
connectionDescription = connectionDescription.withServiceId(topologyVersion.getProcessId());
8977
} else {
9078
throw new MongoClientException("Driver attempted to initialize in load balancing mode, but the server does not support "
9179
+ "this mode");

driver-core/src/test/functional/com/mongodb/ClusterFixture.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
import static com.mongodb.connection.ClusterType.STANDALONE;
8888
import static com.mongodb.internal.connection.ClusterDescriptionHelper.getPrimaries;
8989
import static com.mongodb.internal.connection.ClusterDescriptionHelper.getSecondaries;
90-
import static com.mongodb.internal.connection.DescriptionHelper.enableServiceIdManufacturing;
9190
import static java.lang.String.format;
9291
import static java.lang.Thread.sleep;
9392
import static java.util.Arrays.asList;
@@ -128,14 +127,6 @@ public final class ClusterFixture {
128127

129128
static {
130129
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
131-
132-
ConnectionString defaultConnectionString = getConnectionStringFromSystemProperty(MONGODB_URI_SYSTEM_PROPERTY_NAME);
133-
if (defaultConnectionString != null) {
134-
Boolean loadBalanced = defaultConnectionString.isLoadBalanced();
135-
if (loadBalanced != null && loadBalanced) {
136-
enableServiceIdManufacturing();
137-
}
138-
}
139130
}
140131

141132
private ClusterFixture() {

0 commit comments

Comments
 (0)