File tree Expand file tree Collapse file tree 2 files changed +103
-0
lines changed
tests/SpecTests/change-streams Expand file tree Collapse file tree 2 files changed +103
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ class ChangeStream implements Iterator
4242 */
4343 const CURSOR_NOT_FOUND = 43 ;
4444
45+ /** @var int */
46+ private static $ cursorNotFound = 43 ;
47+
4548 /** @var int[] */
4649 private static $ resumableErrorCodes = [
4750 6 , // HostUnreachable
@@ -197,6 +200,10 @@ private function isResumableError(RuntimeException $exception)
197200 return false ;
198201 }
199202
203+ if ($ exception ->getCode () === self ::$ cursorNotFound ) {
204+ return true ;
205+ }
206+
200207 if (server_supports_feature ($ this ->iterator ->getServer (), self ::$ wireVersionForResumableChangeStreamError )) {
201208 return $ exception ->hasErrorLabel ('ResumableChangeStreamError ' );
202209 }
Original file line number Diff line number Diff line change 16481648 }
16491649 ]
16501650 }
1651+ },
1652+ {
1653+ "description" : " change stream resumes after CursorNotFound" ,
1654+ "minServerVersion" : " 4.2" ,
1655+ "failPoint" : {
1656+ "configureFailPoint" : " failCommand" ,
1657+ "mode" : {
1658+ "times" : 1
1659+ },
1660+ "data" : {
1661+ "failCommands" : [
1662+ " getMore"
1663+ ],
1664+ "errorCode" : 43 ,
1665+ "closeConnection" : false
1666+ }
1667+ },
1668+ "target" : " collection" ,
1669+ "topology" : [
1670+ " replicaset" ,
1671+ " sharded"
1672+ ],
1673+ "changeStreamPipeline" : [],
1674+ "changeStreamOptions" : {},
1675+ "operations" : [
1676+ {
1677+ "database" : " change-stream-tests" ,
1678+ "collection" : " test" ,
1679+ "name" : " insertOne" ,
1680+ "arguments" : {
1681+ "document" : {
1682+ "x" : 1
1683+ }
1684+ }
1685+ }
1686+ ],
1687+ "expectations" : [
1688+ {
1689+ "command_started_event" : {
1690+ "command" : {
1691+ "aggregate" : " test" ,
1692+ "cursor" : {},
1693+ "pipeline" : [
1694+ {
1695+ "$changeStream" : {}
1696+ }
1697+ ]
1698+ },
1699+ "command_name" : " aggregate" ,
1700+ "database_name" : " change-stream-tests"
1701+ }
1702+ },
1703+ {
1704+ "command_started_event" : {
1705+ "command" : {
1706+ "getMore" : 42 ,
1707+ "collection" : " test"
1708+ },
1709+ "command_name" : " getMore" ,
1710+ "database_name" : " change-stream-tests"
1711+ }
1712+ },
1713+ {
1714+ "command_started_event" : {
1715+ "command" : {
1716+ "aggregate" : " test" ,
1717+ "cursor" : {},
1718+ "pipeline" : [
1719+ {
1720+ "$changeStream" : {}
1721+ }
1722+ ]
1723+ },
1724+ "command_name" : " aggregate" ,
1725+ "database_name" : " change-stream-tests"
1726+ }
1727+ }
1728+ ],
1729+ "result" : {
1730+ "success" : [
1731+ {
1732+ "_id" : " 42" ,
1733+ "documentKey" : " 42" ,
1734+ "operationType" : " insert" ,
1735+ "ns" : {
1736+ "db" : " change-stream-tests" ,
1737+ "coll" : " test"
1738+ },
1739+ "fullDocument" : {
1740+ "x" : {
1741+ "$numberInt" : " 1"
1742+ }
1743+ }
1744+ }
1745+ ]
1746+ }
16511747 }
16521748 ]
16531749}
You can’t perform that action at this time.
0 commit comments