-
Notifications
You must be signed in to change notification settings - Fork 468
CDRIVER-6182 break resume loop after two timeouts #2194
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 2 commits
5a6b54a
df213b8
3e33772
dd3c772
776f3c7
c179b2a
f02fb99
5c76467
0a288e4
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -149,7 +149,8 @@ struct _mongoc_cursor_t { | |||||
| uint32_t dblen; | ||||||
|
|
||||||
| bson_error_t error; | ||||||
| bson_t error_doc; /* always initialized, and set with server errors. */ | ||||||
| bson_t error_doc; /* always initialized, and set with server errors. */ | ||||||
|
Contributor
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.
Suggested change
Local comment style consistency. |
||||||
| bool had_stream_timeout; // True if previous command run resulted in a timeout on the mongoc_stream_t. | ||||||
|
|
||||||
| const bson_t *current; | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -712,6 +712,8 @@ _mongoc_cursor_run_command( | |
|
|
||
| ENTRY; | ||
|
|
||
| cursor->had_stream_timeout = false; // Reset before running next command. | ||
|
Contributor
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. Suggest moving further below just before the |
||
|
|
||
| const char *cmd_name = _mongoc_get_command_name(command); | ||
|
|
||
| mongoc_cmd_parts_init(&parts, cursor->client, db, MONGOC_QUERY_NONE, command); | ||
|
|
@@ -835,6 +837,8 @@ _mongoc_cursor_run_command( | |
| memset(&cursor->error, 0, sizeof(bson_error_t)); | ||
| } | ||
|
|
||
| cursor->had_stream_timeout = server_stream->timed_out; | ||
|
|
||
| if (is_retryable && _mongoc_read_error_get_type(ret, &cursor->error, reply) == MONGOC_READ_ERR_RETRY) { | ||
| is_retryable = false; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -721,7 +721,8 @@ match_json(const bson_t *doc, | |
| } | ||
|
|
||
| ctx.is_command = is_command; | ||
| matches = match_bson_with_ctx(doc, pattern, &ctx); | ||
| bson_t empty = BSON_INITIALIZER; | ||
|
Collaborator
Author
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. Drive-by fix to support NULL for |
||
| matches = match_bson_with_ctx(doc ? doc : &empty, pattern, &ctx); | ||
|
|
||
| if (!matches) { | ||
| char *as_string = doc ? bson_as_canonical_extended_json(doc, NULL) : NULL; | ||
|
|
||
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.
Suggest tweaking the layout of blocks as suggested to consistently ensure
resumableis set once theif (err_doc)block is evaluated by moving eachresumable = ...to the end of every possible branch.Uh oh!
There was an error while loading. Please reload this page.
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.
One more suggestion: perhaps the CDRIVER-6182 branch should include a
MONGOC_WARNINGto notify users when this scenario is triggered?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.
This led me to realize the
if(err_doc)check was redundant. This is only entered ifmongoc_cursor_error_documentpreviously returned true. mongoc_cursor_error_document guarantees:Changed
if (err_doc)toBSON_ASSERT (err_doc)and also applied the suggested tweaking to useif/elsesoresumableis only set once.I like that idea. Added a warning.