Skip to content

remove batchSize and limit from isMaster #750

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 1 commit into from
Mar 9, 2021

Conversation

bazile-clyde
Copy link
Contributor

@bazile-clyde bazile-clyde commented Mar 9, 2021

This commit fixes the failing cmd_deprecated tasks on Evergreen (here for example).

@codecov-io
Copy link

codecov-io commented Mar 9, 2021

Codecov Report

Merging #750 (18d10e2) into master (26898e5) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #750      +/-   ##
==========================================
- Coverage   60.91%   60.86%   -0.05%     
==========================================
  Files         278      278              
  Lines       73398    73400       +2     
==========================================
- Hits        44709    44674      -35     
- Misses      28689    28726      +37     
Impacted Files Coverage Δ
src/libmongoc/tests/test-mongoc-cursor.c 60.53% <100.00%> (-0.03%) ⬇️
src/libmongoc/tests/test-mongoc-async.c 3.81% <0.00%> (-25.20%) ⬇️
src/libmongoc/tests/json-test-monitoring.c 66.35% <0.00%> (-0.47%) ⬇️
src/libbson/src/bson/bson-iter.c 89.98% <0.00%> (-0.41%) ⬇️
src/libmongoc/src/mongoc/mongoc-socket.c 75.89% <0.00%> (-0.33%) ⬇️
src/libmongoc/src/mongoc/mongoc-server-monitor.c 62.04% <0.00%> (+0.20%) ⬆️
src/libmongoc/tests/test-mongoc-socket.c 98.71% <0.00%> (+0.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26898e5...18d10e2. Read the comment docs.

Comment on lines +47 to +49
static mongoc_cursor_t *
_make_cmd_deprecated_cursor (mongoc_collection_t *coll);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forward declared so we can reference it on lines 314 and 328.

Comment on lines +156 to +157
* of MongoDB that doesn't support read/write concerns, and we are only
* interested in testing if the clone process works. */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format

Comment on lines +165 to +166
ASSERT (mongoc_write_concern_get_wtimeout_int64 (cloned->write_concern) ==
1000);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format

@@ -316,10 +321,11 @@ _test_common_opts (void *ctx)
mongoc_cursor_set_max_await_time_ms (cursor, 3);
ASSERT_CMPINT (mongoc_cursor_get_max_await_time_ms (cursor), ==, 3);
/* prime the cursor. */
BSON_ASSERT (mongoc_cursor_next (cursor, &doc));
ASSERT_OR_PRINT (mongoc_cursor_next (cursor, &doc), cursor->error);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helped debug the issue. If this fails again, we'd definitely want the cursor's error message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -305,8 +309,9 @@ _test_common_opts (void *ctx)
BSON_ASSERT (mongoc_cursor_set_hint (cursor, sd->id));
ASSERT_CMPINT (mongoc_cursor_get_hint (cursor), ==, sd->id);

/* listDatabases prohibits limit and batchSize */
if ((make_cursor_fn) ctx != _make_array_cursor) {
/* listDatabases and isMaster prohibits limit and batchSize */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added "isMaster".

The issue was caused by the if guards changed below. _make_cmd_deprecated_cursor creates a cursor with an "isMaster" command. Since "isMaster" commands - like the "listDatabases" referenced here - do not accept a "batchSize" or "limit", the server errored with the message (paraphrased) "batchSize (or limit) option not found".

@samantharitter
Copy link
Contributor

LGTM!

@@ -316,10 +321,11 @@ _test_common_opts (void *ctx)
mongoc_cursor_set_max_await_time_ms (cursor, 3);
ASSERT_CMPINT (mongoc_cursor_get_max_await_time_ms (cursor), ==, 3);
/* prime the cursor. */
BSON_ASSERT (mongoc_cursor_next (cursor, &doc));
ASSERT_OR_PRINT (mongoc_cursor_next (cursor, &doc), cursor->error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@bazile-clyde bazile-clyde merged commit 270c54f into mongodb:master Mar 9, 2021
@bazile-clyde bazile-clyde deleted the fix branch March 9, 2021 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants