Skip to content
Closed
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
38 changes: 2 additions & 36 deletions .evergreen/.evg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,6 @@ functions:
LOGIN_CONTEXT_NAME=${LOGIN_CONTEXT_NAME} \
.evergreen/run-gssapi-auth-test.sh

"run mmapv1 storage test":
- command: shell.exec
type: test
params:
silent: true
working_dir: "src"
script: |
${PREPARE_SHELL}
PROJECT_DIRECTORY=${PROJECT_DIRECTORY} JAVA_VERSION=${JAVA_VERSION} TOPOLOGY=${TOPOLOGY} STORAGE_ENGINE=${STORAGE_ENGINE} MONGODB_URI="${MONGODB_URI}" .evergreen/run-mmapv1-storage-test.sh

run socks5 tests:
- command: shell.exec
type: test
Expand Down Expand Up @@ -1576,11 +1566,6 @@ tasks:
TEST_LAMBDA_DIRECTORY: ${PROJECT_DIRECTORY}/driver-lambda/
AWS_REGION: us-east-1

- name: "mmapv1-storage-test"
commands:
- func: "bootstrap mongo-orchestration"
- func: "run mmapv1 storage test"

- name: "test-kms-tls-invalid-cert"
tags: ["kms-tls"]
commands:
Expand Down Expand Up @@ -1761,10 +1746,6 @@ axes:
# Multiple mongos instances can be specified in the connection string
# for this version.
SAFE_FOR_MULTI_MONGOS: true
- id: "4.0"
display_name: "4.0"
variables:
VERSION: "4.0"
- id: os
display_name: OS
values:
Expand Down Expand Up @@ -1885,15 +1866,6 @@ axes:
variables:
SCALA: "2.13.15"

# Choice of MongoDB storage engine
- id: storage-engine
display_name: Storage
values:
- id: mmapv1
display_name: MMAPv1
variables:
STORAGE_ENGINE: "mmapv1"

- id: api-version
display_name: API Version
values:
Expand Down Expand Up @@ -2199,7 +2171,7 @@ buildvariants:
- name: "test-bson-and-crypt"

- matrix_name: "tests-jdk8-unsecure"
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest"],
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", version: ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest"],
topology: "*", os: "linux" }
display_name: "${version} ${topology} ${auth} ${ssl} ${jdk} ${os} "
tags: ["tests-variant"]
Expand All @@ -2211,7 +2183,7 @@ buildvariants:

- matrix_name: "tests-jdk-secure"
matrix_spec: { auth: "auth", ssl: "ssl", jdk: [ "jdk8", "jdk17", "jdk21"],
version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest" ],
version: ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "latest" ],
topology: "*", os: "linux" }
display_name: "${version} ${topology} ${auth} ${ssl} ${jdk} ${os} "
tags: ["tests-variant"]
Expand Down Expand Up @@ -2425,12 +2397,6 @@ buildvariants:
tasks:
- name: "publish-release"

- matrix_name: "tests-storage-engines"
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: "jdk8", os: "linux", version: ["4.0"], topology: ["replicaset", "sharded-cluster"], storage-engine: "mmapv1" }
display_name: "${version} Storage ${storage-engine} ${jdk} ${os} ${topology}"
tasks:
- name: "mmapv1-storage-test"

- matrix_name: "kms-tls-test"
matrix_spec: { os: "linux", version: [ "5.0" ], topology: ["standalone"] }
display_name: "CSFLE KMS TLS"
Expand Down
24 changes: 0 additions & 24 deletions .evergreen/run-mmapv1-storage-test.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public class ServerDescription {
* The minimum supported driver server version
* @since 3.8
*/
public static final String MIN_DRIVER_SERVER_VERSION = "3.6";
public static final String MIN_DRIVER_SERVER_VERSION = "4.2";
/**
* The minimum supported driver wire version
* @since 3.8
*/
public static final int MIN_DRIVER_WIRE_VERSION = 7;
public static final int MIN_DRIVER_WIRE_VERSION = 8;
/**
* The maximum supported driver wire version
* @since 3.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
import static com.mongodb.internal.connection.ByteBufBsonDocument.createList;
import static com.mongodb.internal.connection.ByteBufBsonDocument.createOne;
import static com.mongodb.internal.connection.ReadConcernHelper.getReadConcernDocument;
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_TWO_WIRE_VERSION;
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_ZERO_WIRE_VERSION;
import static com.mongodb.internal.operation.ServerVersionHelper.EARLIEST_WIRE_VERSION;

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

assertFalse(sessionContext.hasActiveTransaction() && sessionContext.isSnapshot());
if (sessionContext.hasActiveTransaction()) {
checkServerVersionForTransactionSupport();
extraElements.add(new BsonElement("txnNumber", new BsonInt64(sessionContext.getTransactionNumber())));
if (firstMessageInTransaction) {
extraElements.add(new BsonElement("startTransaction", BsonBoolean.TRUE));
Expand Down Expand Up @@ -381,12 +379,6 @@ private void addServerApiElements(final List<BsonElement> extraElements) {
}
}

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


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

private static boolean isServerVersionKnown(final MessageSettings settings) {
return settings.getMaxWireVersion() >= FOUR_DOT_ZERO_WIRE_VERSION;
return settings.getMaxWireVersion() >= EARLIEST_WIRE_VERSION;
}

@FunctionalInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void handleException(final SdamIssue sdamIssue, final boolean beforeHand
}
if (sdamIssue.relatedToStateChange()) {
updateDescription(sdamIssue.serverDescription());
if (sdamIssue.serverIsLessThanVersionFourDotTwo() || sdamIssue.relatedToShutdown()) {
if (sdamIssue.relatedToShutdown()) {
connectionPool.invalidate(sdamIssue.exception().orElse(null));
}
serverMonitor.connect();
Expand All @@ -130,9 +130,6 @@ private void handleException(final SdamIssue sdamIssue, final boolean beforeHand
serverMonitor.cancelCurrentCheck();
} else if (sdamIssue.relatedToWriteConcern() || !sdamIssue.specific()) {
updateDescription(sdamIssue.serverDescription());
if (sdamIssue.serverIsLessThanVersionFourDotTwo()) {
connectionPool.invalidate(sdamIssue.exception().orElse(null));
}
serverMonitor.connect();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import static com.mongodb.assertions.Assertions.assertTrue;
import static com.mongodb.internal.connection.ClusterableServer.SHUTDOWN_CODES;
import static com.mongodb.internal.connection.ServerDescriptionHelper.unknownConnectingServerDescription;
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_TWO_WIRE_VERSION;

/**
* See the
Expand Down Expand Up @@ -117,10 +116,6 @@ ServerDescription serverDescription() {
return unknownConnectingServerDescription(context.serverId(), exception);
}

boolean serverIsLessThanVersionFourDotTwo() {
return context.serverIsLessThanVersionFourDotTwo();
}

boolean stale(final ConnectionPool connectionPool, final ServerDescription currentServerDescription) {
return context.stale(connectionPool) || stale(exception, currentServerDescription);
}
Expand Down Expand Up @@ -192,10 +187,6 @@ static final class Context {
this.serverMaxWireVersion = serverMaxWireVersion;
}

private boolean serverIsLessThanVersionFourDotTwo() {
return serverMaxWireVersion < FOUR_DOT_TWO_WIRE_VERSION;
}

private boolean stale(final ConnectionPool connectionPool) {
return connectionPoolGeneration < connectionPool.getGeneration();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

import static com.mongodb.assertions.Assertions.assertNotNull;
import static com.mongodb.internal.operation.ServerVersionHelper.serverIsLessThanVersionFourDotFour;
import static com.mongodb.internal.operation.ServerVersionHelper.serverIsLessThanVersionFourDotTwo;
import static java.lang.String.format;

/**
Expand All @@ -70,10 +69,6 @@ private static void validateArrayFilters(final WriteConcern writeConcern) {
private static void validateWriteRequestHint(final ConnectionDescription connectionDescription, final WriteConcern writeConcern,
final WriteRequest request) {
if (!writeConcern.isAcknowledged()) {
if (request instanceof UpdateRequest && serverIsLessThanVersionFourDotTwo(connectionDescription)) {
throw new IllegalArgumentException(format("Hint not supported by wire version: %s",
connectionDescription.getMaxWireVersion()));
}
if (request instanceof DeleteRequest && serverIsLessThanVersionFourDotFour(connectionDescription)) {
throw new IllegalArgumentException(format("Hint not supported by wire version: %s",
connectionDescription.getMaxWireVersion()));
Expand All @@ -82,10 +77,6 @@ private static void validateWriteRequestHint(final ConnectionDescription connect
}

static void validateHintForFindAndModify(final ConnectionDescription connectionDescription, final WriteConcern writeConcern) {
if (serverIsLessThanVersionFourDotTwo(connectionDescription)) {
throw new IllegalArgumentException(format("Hint not supported by wire version: %s",
connectionDescription.getMaxWireVersion()));
}
if (!writeConcern.isAcknowledged() && serverIsLessThanVersionFourDotFour(connectionDescription)) {
throw new IllegalArgumentException(format("Hint not supported by wire version: %s",
connectionDescription.getMaxWireVersion()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,19 @@
public final class ServerVersionHelper {

public static final int MIN_WIRE_VERSION = 0;
public static final int FOUR_DOT_ZERO_WIRE_VERSION = 7;
public static final int FOUR_DOT_TWO_WIRE_VERSION = 8;
public static final int FOUR_DOT_FOUR_WIRE_VERSION = 9;
public static final int FIVE_DOT_ZERO_WIRE_VERSION = 12;
public static final int SIX_DOT_ZERO_WIRE_VERSION = 17;
public static final int SEVEN_DOT_ZERO_WIRE_VERSION = 21;
public static final int LATEST_WIRE_VERSION = SEVEN_DOT_ZERO_WIRE_VERSION;
public static final int EIGHT_DOT_ZERO_WIRE_VERSION = 21;
public static final int EARLIEST_WIRE_VERSION = FOUR_DOT_TWO_WIRE_VERSION;
public static final int LATEST_WIRE_VERSION = EIGHT_DOT_ZERO_WIRE_VERSION;

public static boolean serverIsAtLeastVersionFourDotFour(final ConnectionDescription description) {
return description.getMaxWireVersion() >= FOUR_DOT_FOUR_WIRE_VERSION;
}

public static boolean serverIsLessThanVersionFourDotTwo(final ConnectionDescription description) {
return description.getMaxWireVersion() < FOUR_DOT_TWO_WIRE_VERSION;
}

public static boolean serverIsLessThanVersionFourDotFour(final ConnectionDescription description) {
return description.getMaxWireVersion() < FOUR_DOT_FOUR_WIRE_VERSION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.mongodb.internal.connection

import com.mongodb.MongoClientException

import com.mongodb.MongoNamespace
import com.mongodb.ReadConcern
import com.mongodb.ReadPreference
Expand All @@ -43,7 +43,6 @@ import spock.lang.Specification
import java.nio.ByteBuffer

import static com.mongodb.internal.connection.SplittablePayload.Type.INSERT
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_ZERO_WIRE_VERSION
import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION

/**
Expand Down Expand Up @@ -360,30 +359,6 @@ class CommandMessageSpecification extends Specification {
output.close()
}

def 'should throw if wire version and sharded cluster does not support transactions'() {
given:
def messageSettings = MessageSettings.builder().serverType(ServerType.SHARD_ROUTER)
.maxWireVersion(FOUR_DOT_ZERO_WIRE_VERSION).build()
def payload = new SplittablePayload(INSERT, [new BsonDocument('a', new BsonInt32(1))], true, fieldNameValidator)
def message = new CommandMessage(namespace, command, fieldNameValidator, ReadPreference.primary(), messageSettings,
false, payload, ClusterConnectionMode.MULTIPLE, null)
def output = new ByteBufferBsonOutput(new SimpleBufferProvider())
def sessionContext = Stub(SessionContext) {
getReadConcern() >> ReadConcern.DEFAULT
hasActiveTransaction() >> true
}

when:
message.encode(output, new OperationContext(IgnorableRequestContext.INSTANCE, sessionContext,
Stub(TimeoutContext), null))

then:
thrown(MongoClientException)

cleanup:
output.close()
}

private static BsonDocument getCommandDocument(ByteBufNIO byteBuf, ReplyHeader replyHeader) {
new ReplyMessage<BsonDocument>(new ResponseBuffers(replyHeader, byteBuf), new BsonDocumentCodec(), 0).document
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import static com.mongodb.MongoClientSettings.getDefaultCodecRegistry;
import static com.mongodb.client.model.bulk.ClientBulkWriteOptions.clientBulkWriteOptions;
import static com.mongodb.internal.mockito.MongoMockito.mock;
import static com.mongodb.internal.operation.ServerVersionHelper.FOUR_DOT_ZERO_WIRE_VERSION;
import static com.mongodb.internal.operation.ServerVersionHelper.LATEST_WIRE_VERSION;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
Expand All @@ -69,7 +68,7 @@ void encodeShouldThrowTimeoutExceptionWhenTimeoutContextIsCalled() {
//given
CommandMessage commandMessage = new CommandMessage(NAMESPACE, COMMAND, NoOpFieldNameValidator.INSTANCE, ReadPreference.primary(),
MessageSettings.builder()
.maxWireVersion(FOUR_DOT_ZERO_WIRE_VERSION)
.maxWireVersion(LATEST_WIRE_VERSION)
.serverType(ServerType.REPLICA_SET_SECONDARY)
.sessionSupported(true)
.build(),
Expand All @@ -96,7 +95,7 @@ void encodeShouldNotAddExtraElementsFromTimeoutContextWhenConnectedToMongoCrypt(
//given
CommandMessage commandMessage = new CommandMessage(NAMESPACE, COMMAND, NoOpFieldNameValidator.INSTANCE, ReadPreference.primary(),
MessageSettings.builder()
.maxWireVersion(FOUR_DOT_ZERO_WIRE_VERSION)
.maxWireVersion(LATEST_WIRE_VERSION)
.serverType(ServerType.REPLICA_SET_SECONDARY)
.sessionSupported(true)
.cryptd(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.bson.BsonDocument;
import org.bson.BsonNull;
import org.bson.BsonValue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand All @@ -41,16 +42,25 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;

// See https://github.com/mongodb/specifications/tree/master/source/server-discovery-and-monitoring/tests
@RunWith(Parameterized.class)
public class ServerDiscoveryAndMonitoringTest extends AbstractServerDiscoveryAndMonitoringTest {

private final String description;

public ServerDiscoveryAndMonitoringTest(final String description, final BsonDocument definition) {
super(definition);
this.description = description;
init(serverAddress -> NO_OP_SERVER_LISTENER, NO_OP_CLUSTER_LISTENER);
}

@Before
public void setUp() {
assumeFalse(description.startsWith("pre-42"));
}

@Test
public void shouldPassAllOutcomes() {
for (BsonValue phase : getDefinition().getArray("phases")) {
Expand Down
Loading