Skip to content

CDRIVER-4192 Support retryable handshake network errors #1141

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 33 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bc0cee0
Remove README.rst
eramongodb Oct 7, 2022
1a51281
Move legacy retryable reads test files into legacy subdirectory
eramongodb Oct 7, 2022
03352d1
Move legacy retryable writes test files into legacy subdirectory
eramongodb Oct 11, 2022
d470f48
Sync unified retryable reads test files with 08230607
eramongodb Oct 7, 2022
039c9ce
Sync unified retryable writes test files with 08230607
eramongodb Oct 11, 2022
30898bf
Sync unified transactions test files with 08230607
eramongodb Oct 11, 2022
092c741
Bump default task timeout from 40 minutes to to 1 hour
eramongodb Nov 3, 2022
1b3e3cb
Address TSAN warnings in test_add_and_scan_failure
eramongodb Nov 3, 2022
b0bc187
Address -Wunused-const-variable for gHexCharPairs
eramongodb Nov 3, 2022
7f72936
Improve error message when expected OP_MSG request is not received
eramongodb Nov 1, 2022
fab25ab
Improve assertion message for monotonic clock time comparison
eramongodb Nov 3, 2022
6592c6f
Address null pointer warnings by scan-build
eramongodb Nov 3, 2022
9ee659d
CDRIVER-4517 Update retryable writes handshake error spec tests
eramongodb Oct 31, 2022
8916427
CDRIVER-4517 Update retryable reads handshake error spec tests
eramongodb Oct 31, 2022
f3b0c69
Declare _mongoc_cluster_stream_for_server as static
eramongodb Oct 28, 2022
9b50167
Refactor _mongoc_bson_init_with_transient_txn_error -> _mongoc_add_tr…
eramongodb Oct 27, 2022
625b139
Separate aggregates with writes from mongoc_cluster_stream_for_reads
eramongodb Oct 27, 2022
489beff
Add _mongoc_error_is_auth
eramongodb Oct 28, 2022
32346e0
Declare _mongoc_write_error_append_retryable_label in mongoc-error-pr…
eramongodb Oct 28, 2022
040399d
Remove always-true handshake_complete parameter from _handle_network_…
eramongodb Oct 27, 2022
9186c66
Assert preconditions for mongoc_cluster_stream_for_server
eramongodb Oct 31, 2022
51a7c82
Permit empty arguments field for operation_list_collections
eramongodb Nov 1, 2022
f3e44d5
Retry when encountering a network error establishing an initial conne…
eramongodb Oct 31, 2022
5c9a0a0
Update tests to account for retryable handshake network failures
eramongodb Nov 1, 2022
403e4dc
Revert changes to test_cluster_command_error
eramongodb Nov 7, 2022
36d4c9a
Fix documentation for _mongoc_add_transient_txn_error
eramongodb Nov 7, 2022
37b4568
Ensure clean errorLabels field when appending new label
eramongodb Nov 7, 2022
52d8fc6
Add unified test runner support for listDatabaseNames
eramongodb Nov 8, 2022
a67d380
CDRIVER-4517 Update handshakeError.json unified spec tests
eramongodb Nov 8, 2022
8c4b265
CDRIVER-4517 Update handshakeError.json unified spec tests
eramongodb Nov 9, 2022
687ad06
Format runner.c
eramongodb Nov 9, 2022
70808ae
Skip retryable reads tests that require unsupported optional helpers
eramongodb Nov 9, 2022
6336637
Replace bson_steal with bson_copy_to
eramongodb Nov 11, 2022
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
98 changes: 1 addition & 97 deletions .evergreen/config.yml

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions build/evergreen_config_lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,8 @@ def __init__(self, *args, **kwargs):
elif self.coverage:
self.add_tags('test-coverage')
self.add_tags(self.version)
self.options['exec_timeout_secs'] = 3600
elif self.sanitizer == "asan":
self.add_tags('test-asan', self.version)
self.options['exec_timeout_secs'] = 3600
elif self.sanitizer == "tsan":
self.add_tags('tsan')
self.add_tags(self.version)
Expand Down Expand Up @@ -855,15 +853,13 @@ def __init__(self, *args, **kwargs):
NamedTask(
'test-coverage-latest-server-dns',
tags=['test-coverage'],
exec_timeout_secs=3600,
commands=[func('debug-compile-coverage-notest-nosasl-openssl'),
bootstrap(TOPOLOGY='replica_set', AUTH='auth', SSL='ssl'),
run_tests(AUTH='auth', SSL='ssl', DNS='on'),
func('update codecov.io')]),
NamedTask(
'authentication-tests-memcheck',
tags=['authentication-tests', 'valgrind'],
exec_timeout_seconds=3600,
commands=[
shell_mongoc("""
VALGRIND=ON DEBUG=ON CC='${CC}' MARCH='${MARCH}' SASL=AUTO \
Expand Down Expand Up @@ -1120,7 +1116,6 @@ def __init__(self, *args, **kwargs):
"unimplemented configuration for LoadBalancedTask")

self.add_tags(self.version)
self.options['exec_timeout_secs'] = 3600

# Return the task name.
# Example: test-loadbalanced-asan-auth-openssl-latest
Expand Down
4 changes: 2 additions & 2 deletions build/generate-evergreen-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
config = OD([
('stepback', True),
('command_type', 'system'),
# 40 minute max except valgrind tasks, which get 2 hours.
('exec_timeout_secs', 2400),
# 60 minute max except valgrind tasks, which get 2 hours.
('exec_timeout_secs', 3600),
('functions', all_functions),
('pre', [
OD([('func', 'fetch source')]),
Expand Down
2 changes: 1 addition & 1 deletion src/libbson/src/bson/bson-oid.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* to hex formatted ASCII. Performing two characters at a time roughly
* reduces the number of operations by one-half.
*/
static const uint16_t gHexCharPairs[] = {
BSON_MAYBE_UNUSED static const uint16_t gHexCharPairs[] = {
#if BSON_BYTE_ORDER == BSON_BIG_ENDIAN
12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12385,
12386, 12387, 12388, 12389, 12390, 12592, 12593, 12594, 12595, 12596, 12597,
Expand Down
9 changes: 2 additions & 7 deletions src/libmongoc/src/mongoc/mongoc-change-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,8 @@ _make_cursor (mongoc_change_stream_t *stream)
goto cleanup;
}

server_stream =
mongoc_cluster_stream_for_reads (&stream->client->cluster,
stream->read_prefs,
cs,
&reply,
/* Not aggregate-with-write */ false,
&stream->err);
server_stream = mongoc_cluster_stream_for_reads (
&stream->client->cluster, stream->read_prefs, cs, &reply, &stream->err);
if (!server_stream) {
bson_destroy (&stream->err_doc);
bson_copy_to (&reply, &stream->err_doc);
Expand Down
15 changes: 2 additions & 13 deletions src/libmongoc/src/mongoc/mongoc-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,6 @@ _mongoc_client_retryable_read_command_with_stream (
parts->read_prefs,
parts->assembled.session,
NULL,
/* Not aggregate-with-write */ false,
&ignored_error);

if (retry_server_stream && retry_server_stream->sd->max_wire_version >=
Expand Down Expand Up @@ -1892,12 +1891,7 @@ mongoc_client_command_simple (mongoc_client_t *client,
* preference argument."
*/
server_stream =
mongoc_cluster_stream_for_reads (cluster,
read_prefs,
NULL,
reply,
/* Not aggregate-with-write */ false,
error);
mongoc_cluster_stream_for_reads (cluster, read_prefs, NULL, reply, error);

if (server_stream) {
ret = _mongoc_client_command_with_stream (
Expand Down Expand Up @@ -2057,12 +2051,7 @@ _mongoc_client_command_with_opts (mongoc_client_t *client,
mongoc_cluster_stream_for_writes (cluster, cs, reply_ptr, error);
} else {
server_stream =
mongoc_cluster_stream_for_reads (cluster,
prefs,
cs,
reply_ptr,
/* Not aggregate-with-write */ false,
error);
mongoc_cluster_stream_for_reads (cluster, prefs, cs, reply_ptr, error);
}

if (!server_stream) {
Expand Down
21 changes: 20 additions & 1 deletion src/libmongoc/src/mongoc/mongoc-cluster-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ mongoc_cluster_stream_for_reads (mongoc_cluster_t *cluster,
const mongoc_read_prefs_t *read_prefs,
mongoc_client_session_t *cs,
bson_t *reply,
bool is_aggr_with_write,
bson_error_t *error);

/**
Expand All @@ -143,6 +142,26 @@ mongoc_cluster_stream_for_writes (mongoc_cluster_t *cluster,
bson_t *reply,
bson_error_t *error);

/**
* @brief Obtain a server stream appropriate for aggregate operations with
* writes on the cluster.
*
* Returns a new stream (that must be freed) or NULL and sets an error via
* `error`.
*
* @note The returned stream must be released via
* `mongoc_server_stream_cleanup`.
*
* @note May add nodes and/or update the cluster's topology.
*/
mongoc_server_stream_t *
mongoc_cluster_stream_for_aggr_with_write (
mongoc_cluster_t *cluster,
const mongoc_read_prefs_t *read_prefs,
mongoc_client_session_t *cs,
bson_t *reply,
bson_error_t *error);

/**
* @brief Obtain a server stream associated with the cluster node associated
* with the given server ID.
Expand Down
Loading