Skip to content

Commit c69deee

Browse files
biniona-mongodbschmalliso
authored andcommitted
(DOCSP-19179) Heartbeat Note (#185)
1 parent 7f461ec commit c69deee

File tree

1 file changed

+64
-19
lines changed

1 file changed

+64
-19
lines changed

source/troubleshooting/recover-from-invalid-resume-token.txt

Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,58 @@ The following stack trace indicates that the source connector has an invalid res
3535
possible, as the resume point may no longer be in the oplog
3636
...
3737

38+
39+
.. _invalid-resume-token-cause:
40+
3841
Cause
3942
-----
4043

4144
When the ID of your source connector's resume token does not correspond to any
4245
entry in your MongoDB deployment's :ref:`oplog <replica-set-oplog>`,
4346
your connector has no way to determine where to begin to process your
44-
MongoDB change stream. This issue most commonly occurs when you pause the source
45-
connector and fill the oplog, as outlined in the following scenario:
46-
47-
#. You start a Kafka deployment with a MongoDB Kafka Connector source connector.
48-
#. You produce change stream events in MongoDB, and your connector stores a
49-
resume token corresponding to the most recent oplog entry in MongoDB.
50-
#. You pause your source connector.
51-
#. While your connector sits idle, you fill your MongoDB oplog such that MongoDB
52-
deletes the oplog entry corresponding to your resume token.
53-
#. You restart your source connector, and it is unable to resume
54-
processing as its resume token does not exist in your MongoDB oplog.
47+
MongoDB change stream. Click the following tabs to see scenarios
48+
in which you can experience this issue:
49+
50+
.. tabs::
51+
52+
.. tab:: Paused Connector
53+
:tabid: paused-connector
54+
55+
In this scenario, you pause your source connector and you fill your MongoDB
56+
deployment's oplog:
57+
58+
#. You start a Kafka deployment with a {+source-connector+}.
59+
#. You produce a change event in your source MongoDB namespace, and your
60+
connector stores a resume token corresponding to this event.
61+
#. You pause your source connector.
62+
#. While your connector pauses, you fill your MongoDB oplog such that MongoDB
63+
deletes the oplog entry corresponding to your resume token.
64+
#. You restart your source connector and it is unable to resume
65+
processing as its resume token does not exist in your MongoDB oplog.
66+
67+
68+
.. tab:: Infrequently Updated Namespace
69+
:tabid: infrequently-updated-namespace
70+
71+
In this scenario, your source connector listens for changes on an infrequently
72+
updated MongoDB namespace and the
73+
:ref:`heartbeat feature <invalid-resume-token-prevention>` is not enabled:
74+
75+
#. You start a Kafka deployment with a {+source-connector+}.
76+
#. You produce a change event in your source MongoDB namespace, and your
77+
connector stores a resume token corresponding to this event.
78+
#. Your source MongoDB namespace is not updated in the time it takes for your MongoDB
79+
deployment to rotate the change event corresponding to your resume token out of its
80+
oplog.
81+
#. You produce a change event in your source MongoDB namespace and your
82+
source connector is unable to resume processing as its resume token does
83+
not exist in your MongoDB oplog.
5584

5685
For more information on the oplog, see the
5786
:ref:`MongoDB Manual <replica-set-oplog>`.
5887

59-
.. TODO: update doc link to ref once page is written
60-
6188
For more information on change streams, see the
62-
:doc:`guide on change streams </source-connector/fundamentals/change-streams>`.
89+
:ref:`<kafka-source-change-streams>` guide.
6390

6491
Solutions
6592
---------
@@ -102,11 +129,8 @@ To configure your source connector to temporarily tolerate errors:
102129

103130
errors.tolerance="none"
104131

105-
.. TODO: <Confirm linked page discusses errors.tolerance once it's written>
106-
.. TODO: update doc link to ref once page is written
107-
108-
For more information on the ``errors.tolerance`` option, see the guide on
109-
:ref:`source connector configuration properties <source-configuration-index>`.
132+
For more information on the ``errors.tolerance`` option, see the
133+
:ref:`<source-configuration-error-handling>` page.
110134

111135
.. _troubleshoot-delete-stored-offsets:
112136

@@ -145,3 +169,24 @@ mode of your deployment:
145169
your Kafka Connect deployment.
146170

147171
#. Restart your source connector and continue to process change stream events.
172+
173+
.. _invalid-resume-token-prevention:
174+
175+
Prevention
176+
----------
177+
178+
To prevent invalid resume token errors caused by an
179+
:ref:`infrequently updated namespace <invalid-resume-token-cause>`, enable
180+
**heartbeats**. Heartbeats is a feature of your source connector that causes
181+
your connector to update its resume token at regular intervals as well as when
182+
the contents of your source MongoDB namespace changes.
183+
184+
Specify the following option in your source connector configuration to enable
185+
heartbeats:
186+
187+
.. code-block:: properties
188+
189+
heartbeat.interval.ms=<a positive integer>
190+
191+
To learn more about heartbeats, see the
192+
:ref:`<source-configuration-error-handling>` guide.

0 commit comments

Comments
 (0)