-
Notifications
You must be signed in to change notification settings - Fork 455
CDRIVER-4629 Remove code requiring maxWireVersion less than WIRE_VERSION_OP_MSG #1248
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
Conversation
…LE_WRITE_ERROR_LABEL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much code deleted ❤️.
Looks great to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic, LGTM
install_json_test_suite_with_check (suite, | ||
JSON_DIR, | ||
"retryable_writes/legacy", | ||
test_retryable_writes_cb, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_retryable_writes_cb, | |
test_retryable_writes_cb, | |
TestSuite_CheckLive, |
To skip test when environment variable MONGOC_TEST_SKIP_LIVE=ON
is set.
Description
Resolves CDRIVER-4629. Verified by this patch.
Removes code that is conditioned on the reported
maxWireVersion
being less thanWIRE_VERSION_OP_MSG (6)
, which is also the current value ofWIRE_VERSION_MIN (6)
, meaning we do not support conducting operations on such servers anymore since CDRIVER-4098 (#926, released in 1.21.0). In short, this PR removes obsolete code that is no longer being executed.Obsolete WIRE_VERSION_* Macros
This PR's primary set of changes involve removal of code referencing
WIRE_VERSION_*
macros with values less than or equal toWIRE_VERSION_MIN
.For (almost) all such code,
wire_version > WIRE_VERSION_OBSOLETE
is assumed to be always true. Similarly,wire_version <= WIRE_VERSION_OBSOLETE
is assumed to be always false. Using these assumptions, code transformations are applied to remove subsequently redundant or obsolete code. Changes include:if
/else
branches.wire_version
parameters no longer needed by helper functions.mongoc-write-command-legacy
component.The only notable exception to the patterns above is in
mongoc_cluster_run_command_private
:server_stream->sd->max_wire_version >= WIRE_VERSION_OP_MSG
cannot be assumed to be always true, asmongoc_cluster_run_command_private
is sometimes used to run the initial connection handshake with a stream whosemaxWireVersion
has not yet been set (defaults to 0). The comparison was updated to useWIRE_VERSION_MIN
instead to account for this behavior. All other comparisons withserver_stream->sd->max_wire_version
used a post-initial-connection-handshake stream that has an updatedmaxWireVersion
(verified by this patch which temporarily inserts assertions in place of all the modified "always true/false" code paths).Test Suite
Some tests had to be updated to account for the changes described above.
/max_staleness
CDRIVER-4152 and CDRIVER-4204 synced new and modified test files into src/libmongoc/tests/json/max_staleness, but did not remove deleted test files. Some of these files were triggering test failures after updates due to assumptions that no longer apply.
/retryable_writes/failover
The mock server "not primary" reply was missing the
RetryableWriteError
error label required by retryWrites since server 4.4./inheritance/aggregate
A workaround concerning readPreference with secondaries to account for CDRIVER-4224 is no longer applicable on server 5.0+ thanks to CDRIVER-3893. Bumped the mock server version to
WIRE_VERSION_MAX
for consistency and removed the workaround.test_framework_skip_if_.*_6
References to
WIRE_VERSION_CHECKS (6)
functions were removed from the test suite as the corresponding conditions are now always true (3.6+) or always false. Use oftest_framework_skip_if_not_rs_version_6
were replaced withtest_framework_skip_if_not_replset
to preserve the replica set condition.