Skip to content

Commit b207b41

Browse files
committed
CDRIVER-2670 change streams fixes
1 parent 7345439 commit b207b41

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/libmongoc/src/mongoc/mongoc-change-stream.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ _is_resumable_error (const bson_t *reply)
6666
/* Change Streams Spec resumable criteria: "any server error response from a
6767
* getMore command excluding those containing the following error codes" */
6868
switch (error.code) {
69-
case 11601: /* Interrupted */
70-
case 136: /* CappedPositionLost */
71-
case 237: /* CursorKilled */
72-
case 0: /* error code omitted */
69+
case 11601: /* Interrupted */
70+
case 136: /* CappedPositionLost */
71+
case 237: /* CursorKilled */
72+
case MONGOC_ERROR_QUERY_FAILURE: /* error code omitted */
7373
return false;
7474
default:
7575
return true;

src/libmongoc/tests/test-mongoc-change-stream.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,23 @@ test_change_stream_client_watch (void *test_ctx)
13011301
mongoc_client_destroy (client);
13021302
}
13031303

1304+
1305+
/* Wire version 7 doesn't imply change stream updates are available on the
1306+
* server. We must also check the version number. */
1307+
static int
1308+
_skip_if_no_change_stream_updates (void)
1309+
{
1310+
if (!TestSuite_CheckLive ()) {
1311+
return 0;
1312+
}
1313+
if (test_framework_get_server_version () >=
1314+
test_framework_str_to_version ("4.0.0")) {
1315+
return 1;
1316+
}
1317+
return 0;
1318+
}
1319+
1320+
13041321
void
13051322
test_change_stream_install (TestSuite *suite)
13061323
{
@@ -1381,17 +1398,21 @@ test_change_stream_install (TestSuite *suite)
13811398
NULL,
13821399
NULL,
13831400
test_framework_skip_if_not_rs_version_7,
1384-
test_framework_skip_if_no_sessions);
1401+
test_framework_skip_if_no_sessions,
1402+
test_framework_skip_if_no_crypto,
1403+
_skip_if_no_change_stream_updates);
13851404
TestSuite_AddFull (suite,
13861405
"/change_stream/database",
13871406
test_change_stream_database_watch,
13881407
NULL,
13891408
NULL,
1390-
test_framework_skip_if_not_rs_version_7);
1409+
test_framework_skip_if_not_rs_version_7,
1410+
_skip_if_no_change_stream_updates);
13911411
TestSuite_AddFull (suite,
13921412
"/change_stream/client",
13931413
test_change_stream_database_watch,
13941414
NULL,
13951415
NULL,
1396-
test_framework_skip_if_not_rs_version_7);
1416+
test_framework_skip_if_not_rs_version_7,
1417+
_skip_if_no_change_stream_updates);
13971418
}

0 commit comments

Comments
 (0)