Skip to content

Commit 24ed3a0

Browse files
authored
CDRIVER-5956 raise min wire version from 7 to 8 (server 4.2) (#1998)
* bump WIRE_VERSION_MIN to 4.2 * update NEWS * remove test tasks for 4.0 * regenerate Evergreen config * remove `WIRE_VERSION_4_0` Remove behavior and tests that only run on server <= 4.0. * remove transactions wireversion=7 check * remove test check for wireversion=5 * remove change stream prose test 9 Test is only expected to run on server >=4.0 and <4.0.7. * expect `killCursors` in resume test The "not primary" error does not cause the connection to be closed in > 4.0. Expect a `killCursors` command is sent on resume. * remove prose test 12 Test requires server < 4.0.7 * remove unnecessary test wire version checks Tests are expected to run on all supported server versions. * remove test checks for wireversion=7 * comment describing server version for wire version * remove test checks for wireversion<8 * remove test check for wireversion=6 * remove test checks for server 3.8 * skip pre-4.2 SDAM tests * skip auth tests using 4.0 server * update exhaust cursor tests to expect OP_MSG Expect `killCursors` command on non-network error to avoid delay in `mongoc_cursor_destroy`.
1 parent 9705893 commit 24ed3a0

25 files changed

+180
-534
lines changed

.evergreen/config_generator/components/sasl/darwinssl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
]
2323

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

2727
('macos-11-arm64', 'clang', None, 'cyrus', ['auth'], ['server'], ['6.0', '7.0', ]),
2828
('macos-14-arm64', 'clang', None, 'cyrus', ['auth'], ['server'], ['6.0', '7.0', '8.0', 'latest']),

.evergreen/config_generator/components/sasl/winssl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
]
2222

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

2626
('windows-vsCurrent', 'mingw', None, 'sspi', ['auth'], ['server'], ['8.0', 'latest']),
2727
('windows-vsCurrent', 'vs2017x86', None, 'sspi', ['auth'], ['server'], ['8.0', 'latest']),

.evergreen/generated_configs/tasks.yml

-42
Original file line numberDiff line numberDiff line change
@@ -3275,27 +3275,6 @@ tasks:
32753275
CC: clang
32763276
CXX: clang++
32773277
- func: upload-build
3278-
- name: sasl-cyrus-darwinssl-macos-14-clang-test-4.0-server-auth
3279-
run_on: macos-14
3280-
tags: [sasl-matrix-darwinssl, test, macos-14, clang, sasl-cyrus, auth, server, "4.0", darwinssl]
3281-
depends_on: [{ name: sasl-cyrus-darwinssl-macos-14-clang-compile }]
3282-
commands:
3283-
- func: fetch-build
3284-
vars:
3285-
BUILD_NAME: sasl-cyrus-darwinssl-macos-14-clang-compile
3286-
- command: expansions.update
3287-
params:
3288-
updates:
3289-
- { key: CC, value: clang }
3290-
- { key: CXX, value: clang++ }
3291-
- { key: AUTH, value: auth }
3292-
- { key: MONGODB_VERSION, value: "4.0" }
3293-
- { key: TOPOLOGY, value: server }
3294-
- { key: SSL, value: darwinssl }
3295-
- func: fetch-det
3296-
- func: bootstrap-mongo-orchestration
3297-
- func: run-simple-http-server
3298-
- func: run-tests
32993278
- name: sasl-cyrus-darwinssl-macos-14-clang-test-4.2-server-auth
33003279
run_on: macos-14
33013280
tags: [sasl-matrix-darwinssl, test, macos-14, clang, sasl-cyrus, auth, server, "4.2", darwinssl]
@@ -4676,27 +4655,6 @@ tasks:
46764655
CMAKE_GENERATOR: Visual Studio 15 2017
46774656
CMAKE_GENERATOR_PLATFORM: x64
46784657
- func: upload-build
4679-
- name: sasl-sspi-winssl-windows-2019-vs2017-x64-test-4.0-server-auth
4680-
run_on: windows-vsCurrent-small
4681-
tags: [sasl-matrix-winssl, test, windows-vsCurrent, vs2017x64, sasl-sspi, auth, server, "4.0", winssl]
4682-
depends_on: [{ name: sasl-sspi-winssl-windows-2019-vs2017-x64-compile }]
4683-
commands:
4684-
- func: fetch-build
4685-
vars:
4686-
BUILD_NAME: sasl-sspi-winssl-windows-2019-vs2017-x64-compile
4687-
- command: expansions.update
4688-
params:
4689-
updates:
4690-
- { key: CMAKE_GENERATOR, value: Visual Studio 15 2017 }
4691-
- { key: CMAKE_GENERATOR_PLATFORM, value: x64 }
4692-
- { key: AUTH, value: auth }
4693-
- { key: MONGODB_VERSION, value: "4.0" }
4694-
- { key: TOPOLOGY, value: server }
4695-
- { key: SSL, value: winssl }
4696-
- func: fetch-det
4697-
- func: bootstrap-mongo-orchestration
4698-
- func: run-simple-http-server
4699-
- func: run-tests
47004658
- name: sasl-sspi-winssl-windows-2019-vs2017-x64-test-4.2-server-auth
47014659
run_on: windows-vsCurrent-small
47024660
tags: [sasl-matrix-winssl, test, windows-vsCurrent, vs2017x64, sasl-sspi, auth, server, "4.2", winssl]

.evergreen/scripts/run-auth-tests.sh

+16-10
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,15 @@ elif command -v otool >/dev/null; then
9999
LD_LIBRARY_PATH="${openssl_lib_prefix}" otool -L "${test_gssapi}" | grep "libssl" || true
100100
fi
101101

102-
# TODO: Remove `skip_for_zseries` when resolving CDRIVER-5990.
103-
skip_for_zseries() {
102+
maybe_skip() {
103+
if true; then
104+
# TODO: Remove if-block when resolving CDRIVER-5995.
105+
echo "Skipping test until DEVPROD-9029 is resolved."
106+
return
107+
fi
108+
104109
if $IS_ZSERIES; then
110+
# TODO: Remove if-block when resolving CDRIVER-5990.
105111
echo "Skipping test until DEVPROD-16954 is resolved."
106112
return
107113
fi
@@ -113,7 +119,7 @@ if [[ "${ssl}" != "OFF" ]]; then
113119
# FIXME: CDRIVER-2008 for the cygwin check
114120
if [[ "${OSTYPE}" != "cygwin" ]]; then
115121
echo "Authenticating using X.509"
116-
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}"
122+
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}"
117123
fi
118124
echo "Connecting to Atlas Free Tier"
119125
LD_LIBRARY_PATH="${openssl_lib_prefix}" "${ping}" "${atlas_free:?}&${c_timeout}"
@@ -155,32 +161,32 @@ if [[ "${ssl}" != "OFF" ]]; then
155161
fi
156162

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

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

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

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

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

176182
echo "Test threaded GSSAPI auth"
177-
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}"
183+
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}"
178184
echo "Threaded GSSAPI auth OK"
179185

180186
if [[ "${OSTYPE}" == "cygwin" ]]; then
181187
echo "Authenticating using GSSAPI (service realm: LDAPTEST.10GEN.CC)"
182-
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}"
188+
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_crossrealm:?}@${auth_host}/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_REALM:LDAPTEST.10GEN.CC&${c_timeout}"
183189
echo "Authenticating using GSSAPI (UTF-8 credentials)"
184-
LD_LIBRARY_PATH="${openssl_lib_prefix}" skip_for_zseries "${ping}" "mongodb://${auth_gssapi_utf8:?}@${auth_host}/?authMechanism=GSSAPI&${c_timeout}"
190+
LD_LIBRARY_PATH="${openssl_lib_prefix}" maybe_skip "${ping}" "mongodb://${auth_gssapi_utf8:?}@${auth_host}/?authMechanism=GSSAPI&${c_timeout}"
185191
fi
186192
fi

NEWS

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
libmongoc 2.1.0 (Unreleased)
2+
============================
3+
4+
## Notes
5+
6+
* 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).
7+
18
libmongoc 1.30.3
29
================
310

src/libmongoc/src/mongoc/mongoc-change-stream.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ _make_command (mongoc_change_stream_t *stream, bson_t *command)
140140
/* The driver MUST set resumeAfter to the cached resumeToken */
141141
BSON_APPEND_DOCUMENT (&change_stream_doc, "resumeAfter", &stream->resume_token);
142142
}
143-
} else if (!_mongoc_timestamp_empty (&stream->operation_time) && stream->max_wire_version >= WIRE_VERSION_4_0) {
143+
} else if (!_mongoc_timestamp_empty (&stream->operation_time)) {
144144
/* Else if there is no cached resumeToken and the ChangeStream
145145
has a saved operation time and the max wire version is >= 7,
146146
the driver MUST set startAtOperationTime */
@@ -330,8 +330,7 @@ _make_cursor (mongoc_change_stream_t *stream)
330330

331331
/* Change stream spec: startAtOperationTime */
332332
if (bson_empty (&stream->opts.resumeAfter) && bson_empty (&stream->opts.startAfter) &&
333-
_mongoc_timestamp_empty (&stream->operation_time) && stream->max_wire_version >= WIRE_VERSION_4_0 &&
334-
bson_empty (&stream->resume_token) &&
333+
_mongoc_timestamp_empty (&stream->operation_time) && bson_empty (&stream->resume_token) &&
335334
bson_iter_init_find (&iter, _mongoc_cursor_change_stream_get_reply (stream->cursor), "operationTime") &&
336335
BSON_ITER_HOLDS_TIMESTAMP (&iter)) {
337336
_mongoc_timestamp_set_from_bson (&stream->operation_time, &iter);

src/libmongoc/src/mongoc/mongoc-client-private.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141

4242
BSON_BEGIN_DECLS
4343

44-
/* version corresponding to server 4.0 release */
45-
#define WIRE_VERSION_4_0 7
4644
/* first version to support hint for "update" command */
4745
#define WIRE_VERSION_UPDATE_HINT 8
4846
/* version corresponding to server 4.2 release */
@@ -83,7 +81,7 @@ BSON_BEGIN_DECLS
8381
/* Range of wire protocol versions this driver supports. Bumping
8482
* WIRE_VERSION_MAX must be accompanied by an update to
8583
* `_mongoc_wire_version_to_server_version`. */
86-
#define WIRE_VERSION_MIN WIRE_VERSION_4_0 /* a.k.a. minWireVersion */
84+
#define WIRE_VERSION_MIN WIRE_VERSION_4_2 /* a.k.a. minWireVersion */
8785
#define WIRE_VERSION_MAX WIRE_VERSION_8_0 /* a.k.a. maxWireVersion */
8886

8987
struct _mongoc_collection_t;

src/libmongoc/src/mongoc/mongoc-client-session.c

-11
Original file line numberDiff line numberDiff line change
@@ -1053,17 +1053,6 @@ mongoc_client_session_start_transaction (mongoc_client_session_t *session,
10531053
GOTO (done);
10541054
}
10551055

1056-
if (server_stream->sd->max_wire_version < 7 ||
1057-
(server_stream->sd->max_wire_version < 8 && server_stream->sd->type == MONGOC_SERVER_MONGOS)) {
1058-
_mongoc_set_error (error,
1059-
MONGOC_ERROR_TRANSACTION,
1060-
MONGOC_ERROR_TRANSACTION_INVALID_STATE,
1061-
"Multi-document transactions are not supported by this "
1062-
"server version");
1063-
ret = false;
1064-
GOTO (done);
1065-
}
1066-
10671056
/* use "switch" so that static checkers ensure we handle all states */
10681057
switch (session->txn.state) {
10691058
case MONGOC_INTERNAL_TRANSACTION_STARTING:

src/libmongoc/src/mongoc/mongoc-topology.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ _handle_sdam_app_error_command (mongoc_topology_t *topology,
17791779
return false;
17801780
}
17811781

1782-
should_clear_pool = (max_wire_version <= WIRE_VERSION_4_0 || _mongoc_error_is_shutdown (&cmd_error));
1782+
should_clear_pool = _mongoc_error_is_shutdown (&cmd_error);
17831783

17841784
tdmod = mc_tpld_modify_begin (topology);
17851785

src/libmongoc/src/mongoc/mongoc-util.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ _mongoc_wire_version_to_server_version (int32_t version)
285285
return "3.4";
286286
case 6:
287287
return "3.6";
288-
case WIRE_VERSION_4_0:
288+
case 7:
289289
return "4.0";
290290
case WIRE_VERSION_4_2:
291291
return "4.2";

src/libmongoc/tests/test-libmongoc.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -1984,12 +1984,14 @@ int
19841984
test_framework_skip_if_no_txns (void)
19851985
{
19861986
if (test_framework_skip_if_no_crypto () && test_framework_skip_if_no_sessions () &&
1987-
test_framework_skip_if_not_replset () && test_framework_skip_if_max_wire_version_less_than_7 ()) {
1987+
test_framework_skip_if_not_replset ()) {
1988+
// Have crypto, sessions, and replica set. Proceed.
19881989
return 1;
19891990
}
19901991

19911992
if (test_framework_skip_if_no_crypto () && test_framework_skip_if_no_sessions () &&
1992-
test_framework_skip_if_not_mongos () && test_framework_skip_if_max_wire_version_less_than_8 ()) {
1993+
test_framework_skip_if_not_mongos ()) {
1994+
// Have crypto, sessions, and sharded cluster. Proceed.
19931995
return 1;
19941996
}
19951997

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

2255-
WIRE_VERSION_CHECKS (7)
2257+
/* wire version 8 begins with the 4.2 release. */
22562258
WIRE_VERSION_CHECKS (8)
2259+
/* wire version 9 begins with the 4.4 release. */
22572260
WIRE_VERSION_CHECKS (9)
22582261
/* wire versions 10, 11, 12 were internal to the 5.0 release cycle */
22592262
WIRE_VERSION_CHECKS (13)

src/libmongoc/tests/test-libmongoc.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ test_framework_skip_if_slow_or_live (void);
195195
int test_framework_skip_if_rs_version_##wv (void); \
196196
int test_framework_skip_if_not_rs_version_##wv (void);
197197

198-
WIRE_VERSION_CHECK_DECLS (7)
198+
/* wire version 8 begins with the 4.2 release. */
199199
WIRE_VERSION_CHECK_DECLS (8)
200+
/* wire version 9 begins with the 4.4 release. */
200201
WIRE_VERSION_CHECK_DECLS (9)
201202
/* wire versions 10, 11, 12 were internal to the 5.0 release cycle */
202203
WIRE_VERSION_CHECK_DECLS (13)

src/libmongoc/tests/test-mongoc-bulk.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -4976,9 +4976,7 @@ test_bulk_install (TestSuite *suite)
49764976
test_bulk_write_multiple_errors,
49774977
NULL,
49784978
NULL,
4979-
test_framework_skip_if_no_failpoint,
4980-
/* Require server 4.2 for failCommand appName */
4981-
test_framework_skip_if_max_wire_version_less_than_8);
4979+
test_framework_skip_if_no_failpoint);
49824980
TestSuite_AddLive (suite, "/BulkOperation/set_client_after_operation", test_bulk_write_set_client_after_operation);
49834981
TestSuite_AddMockServerTest (suite,
49844982
"/BulkOperation/set_client_updates_operation_id_when_client_changes",

0 commit comments

Comments
 (0)