-
Notifications
You must be signed in to change notification settings - Fork 455
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,9 @@ | |
|
||
typedef mongoc_cursor_t *(*make_cursor_fn) (mongoc_collection_t *); | ||
|
||
static mongoc_cursor_t * | ||
_make_cmd_deprecated_cursor (mongoc_collection_t *coll); | ||
|
||
static mongoc_cursor_t * | ||
_make_array_cursor (mongoc_collection_t *coll); | ||
|
||
|
@@ -150,16 +153,17 @@ _test_common_clone_w_concerns (void *ctx) | |
mongoc_read_concern_destroy (cursor->read_concern); | ||
cursor->read_concern = read_concern; | ||
/* don't call mongoc_cursor_next (), since the test may run against a version | ||
* of MongoDB that doesn't support read/write concerns, and we are only | ||
* interested in testing if the clone process works. */ | ||
* of MongoDB that doesn't support read/write concerns, and we are only | ||
* interested in testing if the clone process works. */ | ||
Comment on lines
+156
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format |
||
cloned = mongoc_cursor_clone (cursor); | ||
/* test cloned read_concern. */ | ||
ASSERT (!mongoc_read_concern_is_default (cloned->read_concern)); | ||
ASSERT_CMPSTR (mongoc_read_concern_get_level (cloned->read_concern), | ||
MONGOC_READ_CONCERN_LEVEL_LOCAL); | ||
/* test cloned write_concern. */ | ||
ASSERT (mongoc_write_concern_get_wmajority (cloned->write_concern)); | ||
ASSERT (mongoc_write_concern_get_wtimeout_int64 (cloned->write_concern) == 1000); | ||
ASSERT (mongoc_write_concern_get_wtimeout_int64 (cloned->write_concern) == | ||
1000); | ||
Comment on lines
+165
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format |
||
ASSERT (mongoc_write_concern_get_w (cloned->write_concern) == | ||
MONGOC_WRITE_CONCERN_W_MAJORITY); | ||
/* check generated bson in cloned cursor. */ | ||
|
@@ -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 */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added "isMaster". The issue was caused by the if guards changed below. |
||
if ((make_cursor_fn) ctx != _make_array_cursor && | ||
(make_cursor_fn) ctx != _make_cmd_deprecated_cursor) { | ||
mongoc_cursor_set_batch_size (cursor, 1); | ||
ASSERT_CMPINT (mongoc_cursor_get_batch_size (cursor), ==, 1); | ||
BSON_ASSERT (mongoc_cursor_set_limit (cursor, 2)); | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
/* options should be unchanged. */ | ||
ASSERT_CMPINT (mongoc_cursor_get_hint (cursor), ==, sd->id); | ||
if ((make_cursor_fn) ctx != _make_array_cursor) { | ||
if ((make_cursor_fn) ctx != _make_array_cursor && | ||
(make_cursor_fn) ctx != _make_cmd_deprecated_cursor) { | ||
ASSERT_CMPINT (mongoc_cursor_get_batch_size (cursor), ==, 1); | ||
ASSERT_CMPINT ((int) mongoc_cursor_get_limit (cursor), ==, 2); | ||
/* limit cannot be set again. */ | ||
|
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.
Forward declared so we can reference it on lines 314 and 328.