Skip to content

CDRIVER-5956 raise min wire version from 7 to 8 (server 4.2) #1998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Apr 30, 2025
Merged
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
2 changes: 1 addition & 1 deletion .evergreen/config_generator/components/sasl/darwinssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]

TEST_MATRIX = [
('macos-14', 'clang', None, 'cyrus', ['auth'], ['server'], ['4.0', '4.2', '4.4', '5.0']),
('macos-14', 'clang', None, 'cyrus', ['auth'], ['server'], ['4.2', '4.4', '5.0']),

('macos-11-arm64', 'clang', None, 'cyrus', ['auth'], ['server'], ['6.0', '7.0', ]),
('macos-14-arm64', 'clang', None, 'cyrus', ['auth'], ['server'], ['6.0', '7.0', '8.0', 'latest']),
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/config_generator/components/sasl/winssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]

TEST_MATRIX = [
('windows-vsCurrent', 'vs2017x64', None, 'sspi', ['auth'], ['server'], ['4.0', '4.2', '4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),
('windows-vsCurrent', 'vs2017x64', None, 'sspi', ['auth'], ['server'], ['4.2', '4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),

('windows-vsCurrent', 'mingw', None, 'sspi', ['auth'], ['server'], ['8.0', 'latest']),
('windows-vsCurrent', 'vs2017x86', None, 'sspi', ['auth'], ['server'], ['8.0', 'latest']),
Expand Down
42 changes: 0 additions & 42 deletions .evergreen/generated_configs/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3275,27 +3275,6 @@ tasks:
CC: clang
CXX: clang++
- func: upload-build
- name: sasl-cyrus-darwinssl-macos-14-clang-test-4.0-server-auth
run_on: macos-14
tags: [sasl-matrix-darwinssl, test, macos-14, clang, sasl-cyrus, auth, server, "4.0", darwinssl]
depends_on: [{ name: sasl-cyrus-darwinssl-macos-14-clang-compile }]
commands:
- func: fetch-build
vars:
BUILD_NAME: sasl-cyrus-darwinssl-macos-14-clang-compile
- command: expansions.update
params:
updates:
- { key: CC, value: clang }
- { key: CXX, value: clang++ }
- { key: AUTH, value: auth }
- { key: MONGODB_VERSION, value: "4.0" }
- { key: TOPOLOGY, value: server }
- { key: SSL, value: darwinssl }
- func: fetch-det
- func: bootstrap-mongo-orchestration
- func: run-simple-http-server
- func: run-tests
- name: sasl-cyrus-darwinssl-macos-14-clang-test-4.2-server-auth
run_on: macos-14
tags: [sasl-matrix-darwinssl, test, macos-14, clang, sasl-cyrus, auth, server, "4.2", darwinssl]
Expand Down Expand Up @@ -4676,27 +4655,6 @@ tasks:
CMAKE_GENERATOR: Visual Studio 15 2017
CMAKE_GENERATOR_PLATFORM: x64
- func: upload-build
- name: sasl-sspi-winssl-windows-2019-vs2017-x64-test-4.0-server-auth
run_on: windows-vsCurrent-small
tags: [sasl-matrix-winssl, test, windows-vsCurrent, vs2017x64, sasl-sspi, auth, server, "4.0", winssl]
depends_on: [{ name: sasl-sspi-winssl-windows-2019-vs2017-x64-compile }]
commands:
- func: fetch-build
vars:
BUILD_NAME: sasl-sspi-winssl-windows-2019-vs2017-x64-compile
- command: expansions.update
params:
updates:
- { key: CMAKE_GENERATOR, value: Visual Studio 15 2017 }
- { key: CMAKE_GENERATOR_PLATFORM, value: x64 }
- { key: AUTH, value: auth }
- { key: MONGODB_VERSION, value: "4.0" }
- { key: TOPOLOGY, value: server }
- { key: SSL, value: winssl }
- func: fetch-det
- func: bootstrap-mongo-orchestration
- func: run-simple-http-server
- func: run-tests
- name: sasl-sspi-winssl-windows-2019-vs2017-x64-test-4.2-server-auth
run_on: windows-vsCurrent-small
tags: [sasl-matrix-winssl, test, windows-vsCurrent, vs2017x64, sasl-sspi, auth, server, "4.2", winssl]
Expand Down
26 changes: 16 additions & 10 deletions .evergreen/scripts/run-auth-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ elif command -v otool >/dev/null; then
LD_LIBRARY_PATH="${openssl_lib_prefix}" otool -L "${test_gssapi}" | grep "libssl" || true
fi

# TODO: Remove `skip_for_zseries` when resolving CDRIVER-5990.
skip_for_zseries() {
maybe_skip() {
if true; then
# TODO: Remove if-block when resolving CDRIVER-5995.
echo "Skipping test until DEVPROD-9029 is resolved."
return
fi

if $IS_ZSERIES; then
# TODO: Remove if-block when resolving CDRIVER-5990.
echo "Skipping test until DEVPROD-16954 is resolved."
return
fi
Expand All @@ -113,7 +119,7 @@ if [[ "${ssl}" != "OFF" ]]; then
# FIXME: CDRIVER-2008 for the cygwin check
if [[ "${OSTYPE}" != "cygwin" ]]; then
echo "Authenticating using X.509"
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://CN=client,OU=kerneluser,O=10Gen,L=New York City,ST=New York,C=US@${auth_host}/?ssl=true&authMechanism=MONGODB-X509&sslClientCertificateKeyFile=src/libmongoc/tests/x509gen/ldaptest-client-key-and-cert.pem&sslCertificateAuthorityFile=src/libmongoc/tests/x509gen/ldaptest-ca-cert.crt&sslAllowInvalidHostnames=true&${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://CN=client,OU=kerneluser,O=10Gen,L=New York City,ST=New York,C=US@${auth_host}/?ssl=true&authMechanism=MONGODB-X509&sslClientCertificateKeyFile=src/libmongoc/tests/x509gen/ldaptest-client-key-and-cert.pem&sslCertificateAuthorityFile=src/libmongoc/tests/x509gen/ldaptest-ca-cert.crt&sslAllowInvalidHostnames=true&${c_timeout}"
fi
echo "Connecting to Atlas Free Tier"
LD_LIBRARY_PATH="${openssl_lib_prefix}" "${ping}" "${atlas_free:?}&${c_timeout}"
Expand Down Expand Up @@ -155,32 +161,32 @@ if [[ "${ssl}" != "OFF" ]]; then
fi

echo "Authenticating using PLAIN"
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_plain:?}@${auth_host}/?authMechanism=PLAIN&${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_plain:?}@${auth_host}/?authMechanism=PLAIN&${c_timeout}"

echo "Authenticating using default auth mechanism"
# Though the auth source is named "mongodb-cr", authentication uses the default mechanism (currently SCRAM-SHA-1).
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_mongodbcr:?}@${auth_host}/mongodb-cr?${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_mongodbcr:?}@${auth_host}/mongodb-cr?${c_timeout}"

if [[ "${sasl}" != "OFF" ]]; then
echo "Authenticating using GSSAPI"
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_gssapi:?}@${auth_host}/?authMechanism=GSSAPI&${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_gssapi:?}@${auth_host}/?authMechanism=GSSAPI&${c_timeout}"

echo "Authenticating with CANONICALIZE_HOST_NAME"
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_gssapi:?}@${ip_addr}/?authMechanism=GSSAPI&authMechanismProperties=CANONICALIZE_HOST_NAME:true&${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_gssapi:?}@${ip_addr}/?authMechanism=GSSAPI&authMechanismProperties=CANONICALIZE_HOST_NAME:true&${c_timeout}"

declare ld_preload="${LD_PRELOAD:-}"
if [[ "${ASAN:-}" == "on" ]]; then
ld_preload="$(bypass_dlclose):${ld_preload}"
fi

echo "Test threaded GSSAPI auth"
LD_LIBRARY_PATH="${openssl_lib_prefix}" MONGOC_TEST_GSSAPI_HOST="${auth_host}" MONGOC_TEST_GSSAPI_USER="${auth_gssapi}" LD_PRELOAD="${ld_preload:-}" skip_for_zseries "${test_gssapi}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" MONGOC_TEST_GSSAPI_HOST="${auth_host}" MONGOC_TEST_GSSAPI_USER="${auth_gssapi}" LD_PRELOAD="${ld_preload:-}" maybe_skip "${test_gssapi}"
echo "Threaded GSSAPI auth OK"

if [[ "${OSTYPE}" == "cygwin" ]]; then
echo "Authenticating using GSSAPI (service realm: LDAPTEST.10GEN.CC)"
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_crossrealm:?}@${auth_host}/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_REALM:LDAPTEST.10GEN.CC&${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_crossrealm:?}@${auth_host}/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_REALM:LDAPTEST.10GEN.CC&${c_timeout}"
echo "Authenticating using GSSAPI (UTF-8 credentials)"
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_gssapi_utf8:?}@${auth_host}/?authMechanism=GSSAPI&${c_timeout}"
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_gssapi_utf8:?}@${auth_host}/?authMechanism=GSSAPI&${c_timeout}"
fi
fi
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
libmongoc 2.1.0 (Unreleased)
============================

## Notes

* The minimum supported MongoDB Server version is raised from 4.0 to 4.2. This is in accordance with [MongoDB Software Lifecycle Schedules](https://www.mongodb.com/legal/support-policy/lifecycles).

libmongoc 1.30.3
================

Expand Down
5 changes: 2 additions & 3 deletions src/libmongoc/src/mongoc/mongoc-change-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ _make_command (mongoc_change_stream_t *stream, bson_t *command)
/* The driver MUST set resumeAfter to the cached resumeToken */
BSON_APPEND_DOCUMENT (&change_stream_doc, "resumeAfter", &stream->resume_token);
}
} else if (!_mongoc_timestamp_empty (&stream->operation_time) && stream->max_wire_version >= WIRE_VERSION_4_0) {
} else if (!_mongoc_timestamp_empty (&stream->operation_time)) {
/* Else if there is no cached resumeToken and the ChangeStream
has a saved operation time and the max wire version is >= 7,
the driver MUST set startAtOperationTime */
Expand Down Expand Up @@ -330,8 +330,7 @@ _make_cursor (mongoc_change_stream_t *stream)

/* Change stream spec: startAtOperationTime */
if (bson_empty (&stream->opts.resumeAfter) && bson_empty (&stream->opts.startAfter) &&
_mongoc_timestamp_empty (&stream->operation_time) && stream->max_wire_version >= WIRE_VERSION_4_0 &&
bson_empty (&stream->resume_token) &&
_mongoc_timestamp_empty (&stream->operation_time) && bson_empty (&stream->resume_token) &&
bson_iter_init_find (&iter, _mongoc_cursor_change_stream_get_reply (stream->cursor), "operationTime") &&
BSON_ITER_HOLDS_TIMESTAMP (&iter)) {
_mongoc_timestamp_set_from_bson (&stream->operation_time, &iter);
Expand Down
4 changes: 1 addition & 3 deletions src/libmongoc/src/mongoc/mongoc-client-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

BSON_BEGIN_DECLS

/* version corresponding to server 4.0 release */
#define WIRE_VERSION_4_0 7
/* first version to support hint for "update" command */
#define WIRE_VERSION_UPDATE_HINT 8
/* version corresponding to server 4.2 release */
Expand Down Expand Up @@ -83,7 +81,7 @@ BSON_BEGIN_DECLS
/* Range of wire protocol versions this driver supports. Bumping
* WIRE_VERSION_MAX must be accompanied by an update to
* `_mongoc_wire_version_to_server_version`. */
#define WIRE_VERSION_MIN WIRE_VERSION_4_0 /* a.k.a. minWireVersion */
#define WIRE_VERSION_MIN WIRE_VERSION_4_2 /* a.k.a. minWireVersion */
#define WIRE_VERSION_MAX WIRE_VERSION_8_0 /* a.k.a. maxWireVersion */

struct _mongoc_collection_t;
Expand Down
11 changes: 0 additions & 11 deletions src/libmongoc/src/mongoc/mongoc-client-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,17 +1053,6 @@ mongoc_client_session_start_transaction (mongoc_client_session_t *session,
GOTO (done);
}

if (server_stream->sd->max_wire_version < 7 ||
(server_stream->sd->max_wire_version < 8 && server_stream->sd->type == MONGOC_SERVER_MONGOS)) {
_mongoc_set_error (error,
MONGOC_ERROR_TRANSACTION,
MONGOC_ERROR_TRANSACTION_INVALID_STATE,
"Multi-document transactions are not supported by this "
"server version");
ret = false;
GOTO (done);
}

/* use "switch" so that static checkers ensure we handle all states */
switch (session->txn.state) {
case MONGOC_INTERNAL_TRANSACTION_STARTING:
Expand Down
2 changes: 1 addition & 1 deletion src/libmongoc/src/mongoc/mongoc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ _handle_sdam_app_error_command (mongoc_topology_t *topology,
return false;
}

should_clear_pool = (max_wire_version <= WIRE_VERSION_4_0 || _mongoc_error_is_shutdown (&cmd_error));
should_clear_pool = _mongoc_error_is_shutdown (&cmd_error);

tdmod = mc_tpld_modify_begin (topology);

Expand Down
2 changes: 1 addition & 1 deletion src/libmongoc/src/mongoc/mongoc-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ _mongoc_wire_version_to_server_version (int32_t version)
return "3.4";
case 6:
return "3.6";
case WIRE_VERSION_4_0:
case 7:
return "4.0";
case WIRE_VERSION_4_2:
return "4.2";
Expand Down
9 changes: 6 additions & 3 deletions src/libmongoc/tests/test-libmongoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,12 +1984,14 @@ int
test_framework_skip_if_no_txns (void)
{
if (test_framework_skip_if_no_crypto () && test_framework_skip_if_no_sessions () &&
test_framework_skip_if_not_replset () && test_framework_skip_if_max_wire_version_less_than_7 ()) {
test_framework_skip_if_not_replset ()) {
// Have crypto, sessions, and replica set. Proceed.
return 1;
}

if (test_framework_skip_if_no_crypto () && test_framework_skip_if_no_sessions () &&
test_framework_skip_if_not_mongos () && test_framework_skip_if_max_wire_version_less_than_8 ()) {
test_framework_skip_if_not_mongos ()) {
// Have crypto, sessions, and sharded cluster. Proceed.
return 1;
}

Expand Down Expand Up @@ -2252,8 +2254,9 @@ test_framework_skip_if_not_replset (void)
return (test_framework_max_wire_version_at_least (wv) && test_framework_is_replset ()) ? 0 : 1; \
}

WIRE_VERSION_CHECKS (7)
/* wire version 8 begins with the 4.2 release. */
WIRE_VERSION_CHECKS (8)
/* wire version 9 begins with the 4.4 release. */
WIRE_VERSION_CHECKS (9)
/* wire versions 10, 11, 12 were internal to the 5.0 release cycle */
WIRE_VERSION_CHECKS (13)
Expand Down
3 changes: 2 additions & 1 deletion src/libmongoc/tests/test-libmongoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ test_framework_skip_if_slow_or_live (void);
int test_framework_skip_if_rs_version_##wv (void); \
int test_framework_skip_if_not_rs_version_##wv (void);

WIRE_VERSION_CHECK_DECLS (7)
/* wire version 8 begins with the 4.2 release. */
WIRE_VERSION_CHECK_DECLS (8)
/* wire version 9 begins with the 4.4 release. */
WIRE_VERSION_CHECK_DECLS (9)
/* wire versions 10, 11, 12 were internal to the 5.0 release cycle */
WIRE_VERSION_CHECK_DECLS (13)
Expand Down
4 changes: 1 addition & 3 deletions src/libmongoc/tests/test-mongoc-bulk.c
Original file line number Diff line number Diff line change
Expand Up @@ -4976,9 +4976,7 @@ test_bulk_install (TestSuite *suite)
test_bulk_write_multiple_errors,
NULL,
NULL,
test_framework_skip_if_no_failpoint,
/* Require server 4.2 for failCommand appName */
test_framework_skip_if_max_wire_version_less_than_8);
test_framework_skip_if_no_failpoint);
TestSuite_AddLive (suite, "/BulkOperation/set_client_after_operation", test_bulk_write_set_client_after_operation);
TestSuite_AddMockServerTest (suite,
"/BulkOperation/set_client_updates_operation_id_when_client_changes",
Expand Down
Loading