Skip to content

Commit 3ff0644

Browse files
authored
Merge branch 'main' into string-opt
2 parents d9cf649 + 4f8217a commit 3ff0644

28 files changed

+85
-237
lines changed

.evergreen/.evg.yml

+5-60
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ functions:
285285
export AWS_TEMP_SESSION_TOKEN=$CSFLE_AWS_TEMP_SESSION_TOKEN
286286
export CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH}
287287
288-
AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" SAFE_FOR_MULTI_MONGOS="${SAFE_FOR_MULTI_MONGOS}" TOPOLOGY="${TOPOLOGY}" \
288+
AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" TOPOLOGY="${TOPOLOGY}" \
289289
COMPRESSOR="${COMPRESSOR}" JAVA_VERSION="${JAVA_VERSION}" REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
290290
TESTS="${TESTS}" .evergreen/run-tests.sh
291291
@@ -344,7 +344,7 @@ functions:
344344
working_dir: "src"
345345
script: |
346346
${PREPARE_SHELL}
347-
SCALA="${SCALA}" AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" SAFE_FOR_MULTI_MONGOS="${SAFE_FOR_MULTI_MONGOS}" TOPOLOGY="${TOPOLOGY}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-scala-tests.sh
347+
SCALA="${SCALA}" AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" TOPOLOGY="${TOPOLOGY}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-scala-tests.sh
348348
349349
"run kotlin tests":
350350
- command: shell.exec
@@ -353,7 +353,7 @@ functions:
353353
working_dir: "src"
354354
script: |
355355
${PREPARE_SHELL}
356-
AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" SAFE_FOR_MULTI_MONGOS="${SAFE_FOR_MULTI_MONGOS}" TOPOLOGY="${TOPOLOGY}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-kotlin-tests.sh
356+
AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" TOPOLOGY="${TOPOLOGY}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-kotlin-tests.sh
357357
358358
359359
"run socket tests":
@@ -599,16 +599,6 @@ functions:
599599
LOGIN_CONTEXT_NAME=${LOGIN_CONTEXT_NAME} \
600600
.evergreen/run-gssapi-auth-test.sh
601601
602-
"run mmapv1 storage test":
603-
- command: shell.exec
604-
type: test
605-
params:
606-
silent: true
607-
working_dir: "src"
608-
script: |
609-
${PREPARE_SHELL}
610-
PROJECT_DIRECTORY=${PROJECT_DIRECTORY} JAVA_VERSION=${JAVA_VERSION} TOPOLOGY=${TOPOLOGY} STORAGE_ENGINE=${STORAGE_ENGINE} MONGODB_URI="${MONGODB_URI}" .evergreen/run-mmapv1-storage-test.sh
611-
612602
run socks5 tests:
613603
- command: shell.exec
614604
type: test
@@ -1577,11 +1567,6 @@ tasks:
15771567
TEST_LAMBDA_DIRECTORY: ${PROJECT_DIRECTORY}/driver-lambda/
15781568
AWS_REGION: us-east-1
15791569

1580-
- name: "mmapv1-storage-test"
1581-
commands:
1582-
- func: "bootstrap mongo-orchestration"
1583-
- func: "run mmapv1 storage test"
1584-
15851570
- name: "test-kms-tls-invalid-cert"
15861571
tags: ["kms-tls"]
15871572
commands:
@@ -1717,55 +1702,30 @@ axes:
17171702
display_name: "latest"
17181703
variables:
17191704
VERSION: "latest"
1720-
# Multiple mongos instances can be specified in the connection string
1721-
# for this version.
1722-
SAFE_FOR_MULTI_MONGOS: true
17231705
- id: "8.0"
17241706
display_name: "8.0"
17251707
variables:
17261708
VERSION: "8.0"
1727-
# Multiple mongos instances can be specified in the connection string
1728-
# for this version.
1729-
SAFE_FOR_MULTI_MONGOS: true
17301709
- id: "7.0"
17311710
display_name: "7.0"
17321711
variables:
17331712
VERSION: "7.0"
1734-
# Multiple mongos instances can be specified in the connection string
1735-
# for this version.
1736-
SAFE_FOR_MULTI_MONGOS: true
17371713
- id: "6.0"
17381714
display_name: "6.0"
17391715
variables:
17401716
VERSION: "6.0"
1741-
# Multiple mongos instances can be specified in the connection string
1742-
# for this version.
1743-
SAFE_FOR_MULTI_MONGOS: true
17441717
- id: "5.0"
17451718
display_name: "5.0"
17461719
variables:
17471720
VERSION: "5.0"
1748-
# Multiple mongos instances can be specified in the connection string
1749-
# for this version.
1750-
SAFE_FOR_MULTI_MONGOS: true
17511721
- id: "4.4"
17521722
display_name: "4.4"
17531723
variables:
17541724
VERSION: "4.4"
1755-
# Multiple mongos instances can be specified in the connection string
1756-
# for this version.
1757-
SAFE_FOR_MULTI_MONGOS: true
17581725
- id: "4.2"
17591726
display_name: "4.2"
17601727
variables:
17611728
VERSION: "4.2"
1762-
# Multiple mongos instances can be specified in the connection string
1763-
# for this version.
1764-
SAFE_FOR_MULTI_MONGOS: true
1765-
- id: "4.0"
1766-
display_name: "4.0"
1767-
variables:
1768-
VERSION: "4.0"
17691729
- id: os
17701730
display_name: OS
17711731
values:
@@ -1886,15 +1846,6 @@ axes:
18861846
variables:
18871847
SCALA: "2.13"
18881848

1889-
# Choice of MongoDB storage engine
1890-
- id: storage-engine
1891-
display_name: Storage
1892-
values:
1893-
- id: mmapv1
1894-
display_name: MMAPv1
1895-
variables:
1896-
STORAGE_ENGINE: "mmapv1"
1897-
18981849
- id: api-version
18991850
display_name: API Version
19001851
values:
@@ -2201,7 +2152,7 @@ buildvariants:
22012152
- name: "test-bson-and-crypt"
22022153

22032154
- matrix_name: "tests-jdk8-unsecure"
2204-
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest"],
2155+
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", version: ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest"],
22052156
topology: "*", os: "linux" }
22062157
display_name: "${version} ${topology} ${auth} ${ssl} ${jdk} ${os} "
22072158
tags: ["tests-variant"]
@@ -2213,7 +2164,7 @@ buildvariants:
22132164

22142165
- matrix_name: "tests-jdk-secure"
22152166
matrix_spec: { auth: "auth", ssl: "ssl", jdk: [ "jdk8", "jdk17", "jdk21"],
2216-
version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest" ],
2167+
version: ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest" ],
22172168
topology: "*", os: "linux" }
22182169
display_name: "${version} ${topology} ${auth} ${ssl} ${jdk} ${os} "
22192170
tags: ["tests-variant"]
@@ -2427,12 +2378,6 @@ buildvariants:
24272378
tasks:
24282379
- name: "publish-release"
24292380

2430-
- matrix_name: "tests-storage-engines"
2431-
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", os: "linux", version: ["4.0"], topology: ["replicaset", "sharded-cluster"], storage-engine: "mmapv1" }
2432-
display_name: "${version} Storage ${storage-engine} ${jdk} ${os} ${topology}"
2433-
tasks:
2434-
- name: "mmapv1-storage-test"
2435-
24362381
- matrix_name: "kms-tls-test"
24372382
matrix_spec: { os: "linux", version: [ "5.0" ], topology: ["standalone"] }
24382383
display_name: "CSFLE KMS TLS"

.evergreen/run-kotlin-tests.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ AUTH=${AUTH:-noauth}
88
SSL=${SSL:-nossl}
99
MONGODB_URI=${MONGODB_URI:-}
1010
TOPOLOGY=${TOPOLOGY:-standalone}
11-
SAFE_FOR_MULTI_MONGOS=${SAFE_FOR_MULTI_MONGOS:-}
1211

1312
############################################
1413
# Main Program #
@@ -27,9 +26,7 @@ if [ "$AUTH" != "noauth" ]; then
2726
exit 1
2827
fi
2928

30-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
31-
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MONGODB_URI}"
32-
fi
29+
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MONGODB_URI}"
3330

3431
./gradlew -version
3532

.evergreen/run-mmapv1-storage-test.sh

-24
This file was deleted.

.evergreen/run-scala-tests.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ AUTH=${AUTH:-noauth}
88
SSL=${SSL:-nossl}
99
MONGODB_URI=${MONGODB_URI:-}
1010
TOPOLOGY=${TOPOLOGY:-standalone}
11-
SAFE_FOR_MULTI_MONGOS=${SAFE_FOR_MULTI_MONGOS:-}
1211

1312
############################################
1413
# Main Program #
@@ -27,9 +26,7 @@ if [ "$AUTH" != "noauth" ]; then
2726
exit 1
2827
fi
2928

30-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
31-
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MONGODB_URI}"
32-
fi
29+
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MONGODB_URI}"
3330

3431
echo "Running scala tests with Scala $SCALA"
3532

.evergreen/run-tests.sh

+12-22
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,10 @@ provision_multi_mongos_uri_for_ssl () {
6868
# Arguments for auth + SSL
6969
if [ "$AUTH" != "noauth" ] || [ "$TOPOLOGY" == "replica_set" ]; then
7070
export MONGODB_URI="${MONGODB_URI}&ssl=true&sslInvalidHostNameAllowed=true"
71-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
72-
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}&ssl=true&sslInvalidHostNameAllowed=true"
73-
fi
71+
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}&ssl=true&sslInvalidHostNameAllowed=true"
7472
else
7573
export MONGODB_URI="${MONGODB_URI}/?ssl=true&sslInvalidHostNameAllowed=true"
76-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
77-
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}/?ssl=true&sslInvalidHostNameAllowed=true"
78-
fi
74+
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}/?ssl=true&sslInvalidHostNameAllowed=true"
7975
fi
8076
}
8177

@@ -85,13 +81,11 @@ provision_multi_mongos_uri_for_ssl () {
8581

8682
# Provision the correct connection string and set up SSL if needed
8783
if [ "$TOPOLOGY" == "sharded_cluster" ]; then
88-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
89-
if [ "$AUTH" = "auth" ]; then
90-
export MULTI_MONGOS_URI="mongodb://bob:pwd123@localhost:27017,localhost:27018/?authSource=admin"
91-
else
92-
export MULTI_MONGOS_URI="${MONGODB_URI}"
93-
fi
94-
fi
84+
if [ "$AUTH" = "auth" ]; then
85+
export MULTI_MONGOS_URI="mongodb://bob:pwd123@localhost:27017,localhost:27018/?authSource=admin"
86+
else
87+
export MULTI_MONGOS_URI="${MONGODB_URI}"
88+
fi
9589

9690
if [ "$AUTH" = "auth" ]; then
9791
export MONGODB_URI="mongodb://bob:pwd123@localhost:27017/?authSource=admin"
@@ -107,12 +101,10 @@ if [ "$COMPRESSOR" != "" ]; then
107101
export MONGODB_URI="${MONGODB_URI}/?compressors=${COMPRESSOR}"
108102
fi
109103

110-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
111-
if [[ "$MULTI_MONGOS_URI" == *"?"* ]]; then
112-
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}&compressors=${COMPRESSOR}"
113-
else
114-
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}/?compressors=${COMPRESSOR}"
115-
fi
104+
if [[ "$MULTI_MONGOS_URI" == *"?"* ]]; then
105+
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}&compressors=${COMPRESSOR}"
106+
else
107+
export MULTI_MONGOS_URI="${MULTI_MONGOS_URI}/?compressors=${COMPRESSOR}"
116108
fi
117109
fi
118110

@@ -123,9 +115,7 @@ if [ "$SSL" != "nossl" ]; then
123115
provision_multi_mongos_uri_for_ssl
124116
fi
125117

126-
if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
127-
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MULTI_MONGOS_URI}"
128-
fi
118+
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MULTI_MONGOS_URI}"
129119

130120
# For now it's sufficient to hard-code the API version to "1", since it's the only API version
131121
if [ ! -z "$REQUIRE_API_VERSION" ]; then

driver-core/src/main/com/mongodb/connection/ConnectionDescription.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import static com.mongodb.assertions.Assertions.notNull;
3131
import static com.mongodb.connection.ServerDescription.getDefaultMaxDocumentSize;
32+
import static com.mongodb.internal.operation.ServerVersionHelper.UNKNOWN_WIRE_VERSION;
3233

3334
/**
3435
* A description of a connection to a MongoDB server.
@@ -57,7 +58,7 @@ public class ConnectionDescription {
5758
* @param serverId the server address
5859
*/
5960
public ConnectionDescription(final ServerId serverId) {
60-
this(new ConnectionId(serverId), 0, ServerType.UNKNOWN, DEFAULT_MAX_WRITE_BATCH_SIZE,
61+
this(new ConnectionId(serverId), UNKNOWN_WIRE_VERSION, ServerType.UNKNOWN, DEFAULT_MAX_WRITE_BATCH_SIZE,
6162
getDefaultMaxDocumentSize(), DEFAULT_MAX_MESSAGE_SIZE, Collections.emptyList());
6263
}
6364

driver-core/src/main/com/mongodb/connection/ServerDescription.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public class ServerDescription {
5555
* The minimum supported driver server version
5656
* @since 3.8
5757
*/
58-
public static final String MIN_DRIVER_SERVER_VERSION = "3.6";
58+
public static final String MIN_DRIVER_SERVER_VERSION = "4.2";
5959
/**
6060
* The minimum supported driver wire version
6161
* @since 3.8
6262
*/
63-
public static final int MIN_DRIVER_WIRE_VERSION = 7;
63+
public static final int MIN_DRIVER_WIRE_VERSION = 8;
6464
/**
6565
* The maximum supported driver wire version
6666
* @since 3.8

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

+2-10
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@
6060
import static com.mongodb.internal.connection.ByteBufBsonDocument.createList;
6161
import static com.mongodb.internal.connection.ByteBufBsonDocument.createOne;
6262
import static com.mongodb.internal.connection.ReadConcernHelper.getReadConcernDocument;
63-
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_TWO_WIRE_VERSION;
64-
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_ZERO_WIRE_VERSION;
63+
import static com.mongodb.internal.operation.ServerVersionHelper.UNKNOWN_WIRE_VERSION;
6564

6665
/**
6766
* A command message that uses OP_MSG or OP_QUERY to send the command.
@@ -346,7 +345,6 @@ private List<BsonElement> getExtraElements(final OperationContext operationConte
346345

347346
assertFalse(sessionContext.hasActiveTransaction() && sessionContext.isSnapshot());
348347
if (sessionContext.hasActiveTransaction()) {
349-
checkServerVersionForTransactionSupport();
350348
extraElements.add(new BsonElement("txnNumber", new BsonInt64(sessionContext.getTransactionNumber())));
351349
if (firstMessageInTransaction) {
352350
extraElements.add(new BsonElement("startTransaction", BsonBoolean.TRUE));
@@ -381,12 +379,6 @@ private void addServerApiElements(final List<BsonElement> extraElements) {
381379
}
382380
}
383381

384-
private void checkServerVersionForTransactionSupport() {
385-
if (getSettings().getMaxWireVersion() < FOUR_DOT_TWO_WIRE_VERSION && getSettings().getServerType() == SHARD_ROUTER) {
386-
throw new MongoClientException("Transactions are not supported by the MongoDB cluster to which this client is connected.");
387-
}
388-
}
389-
390382

391383
private void addReadConcernDocument(final List<BsonElement> extraElements, final SessionContext sessionContext) {
392384
BsonDocument readConcernDocument = getReadConcernDocument(sessionContext, getSettings().getMaxWireVersion());
@@ -416,7 +408,7 @@ private static OpCode getOpCode(final MessageSettings settings, final ClusterCon
416408
}
417409

418410
private static boolean isServerVersionKnown(final MessageSettings settings) {
419-
return settings.getMaxWireVersion() >= FOUR_DOT_ZERO_WIRE_VERSION;
411+
return settings.getMaxWireVersion() != UNKNOWN_WIRE_VERSION;
420412
}
421413

422414
@FunctionalInterface

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private void handleException(final SdamIssue sdamIssue, final boolean beforeHand
119119
}
120120
if (sdamIssue.relatedToStateChange()) {
121121
updateDescription(sdamIssue.serverDescription());
122-
if (sdamIssue.serverIsLessThanVersionFourDotTwo() || sdamIssue.relatedToShutdown()) {
122+
if (sdamIssue.relatedToShutdown()) {
123123
connectionPool.invalidate(sdamIssue.exception().orElse(null));
124124
}
125125
serverMonitor.connect();
@@ -130,9 +130,6 @@ private void handleException(final SdamIssue sdamIssue, final boolean beforeHand
130130
serverMonitor.cancelCurrentCheck();
131131
} else if (sdamIssue.relatedToWriteConcern() || !sdamIssue.specific()) {
132132
updateDescription(sdamIssue.serverDescription());
133-
if (sdamIssue.serverIsLessThanVersionFourDotTwo()) {
134-
connectionPool.invalidate(sdamIssue.exception().orElse(null));
135-
}
136133
serverMonitor.connect();
137134
}
138135
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import com.mongodb.annotations.NotThreadSafe;
2121
import com.mongodb.connection.ServerType;
2222

23+
import static com.mongodb.internal.operation.ServerVersionHelper.UNKNOWN_WIRE_VERSION;
24+
2325
/**
2426
* The message settings
2527
*
@@ -75,7 +77,7 @@ public static final class Builder {
7577
private int maxDocumentSize = DEFAULT_MAX_DOCUMENT_SIZE;
7678
private int maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE;
7779
private int maxBatchCount = DEFAULT_MAX_BATCH_COUNT;
78-
private int maxWireVersion;
80+
private int maxWireVersion = UNKNOWN_WIRE_VERSION;
7981
private ServerType serverType;
8082
private boolean sessionSupported;
8183
private boolean cryptd;

0 commit comments

Comments
 (0)