Skip to content

Commit 5066a6e

Browse files
biniona-mongodbschmalliso
authored andcommitted
(DOCSP-19885) Offset Tips 1.3-1.7 (#232)
1 parent 3882e4c commit 5066a6e

File tree

3 files changed

+54
-29
lines changed

3 files changed

+54
-29
lines changed

snooty.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ connector_version="1.7"
1515
connector_patch_version="0"
1616
connector_driver_version="4.5"
1717
connector_version_github_tag="master"
18+
connector_kafka_version_major="2"
19+
connector_kafka_version_minor="6"
20+
connector_kafka_version_docs="https://kafka.apache.org/{+connector_kafka_version_major+}{+connector_kafka_version_minor+}"
1821
sink-connector="MongoDB Kafka sink connector"
1922
source-connector="MongoDB Kafka source connector"
2023
connector_driver_url_base="https://docs.mongodb.com/drivers/java/sync/v{+connector_driver_version+}/"

source/source-connector/configuration-properties/error-handling.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,15 @@ Settings
102102
to instruct the connector to start a new change stream when an
103103
existing offset contains an invalid resume token. If you leave
104104
this setting blank, the connector uses the default partition name
105-
based on the connection details.
105+
based on the connection details. To view a strategy for naming
106+
offset partitions, see the :ref:`<troubleshoot-reset-stored-offsets>`
107+
guide.
106108

107-
| **Default:** ""
108-
| **Accepted Values**: A valid partition name
109+
| **Default:** ``""``
110+
| **Accepted Values**: A string. To learn more about naming a partition,
111+
see
112+
`SourceRecord <{+connector_kafka_version_docs+}/javadoc/org/apache/kafka/connect/source/SourceRecord.html>`__
113+
in the {+ak+} API documentation.
109114

110115
* - | **heartbeat.interval.ms**
111116
- | **Type:** long

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

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ Solutions
9494
You can recover from an invalid resume token using one of the following
9595
strategies:
9696

97-
- :ref:`Temporarily Tolerate Errors <temporarily-tolerate-errors>`
98-
- :ref:`Delete Stored Offsets <troubleshoot-delete-stored-offsets>`
97+
- :ref:`<temporarily-tolerate-errors>`
98+
- :ref:`<troubleshoot-reset-stored-offsets>`
9999

100100
.. _temporarily-tolerate-errors:
101101

@@ -132,43 +132,60 @@ To configure your source connector to temporarily tolerate errors:
132132
For more information on the ``errors.tolerance`` option, see the
133133
:ref:`<source-configuration-error-handling>` page.
134134

135+
.. _troubleshoot-reset-stored-offsets:
135136
.. _troubleshoot-delete-stored-offsets:
136137

137-
Delete Stored Offsets
138+
Reset Stored Offsets
138139
~~~~~~~~~~~~~~~~~~~~~
139140

140-
You can delete your Kafka Connect offset data, which contains your resume token,
141-
to allow your connector to resume processing your change stream. This strategy is
142-
more complex than the preceding strategy, but does not risk tolerating errors
143-
unrelated to the invalid resume token.
141+
You can reset your Kafka Connect offset data, which contains your resume token,
142+
to allow your connector to resume processing your change stream.
144143

145-
.. As far as I can tell, there is not a straightforward way to tell at runtime
146-
which mode you are in. The Data Engineer Persona likely knows how they
147-
configured their pipeline, but if they do not know they may
148-
have to attempt both choices.
144+
To reset your offset data, change the value of the
145+
``offset.partition.name`` configuration property to a partition name that does
146+
not exist on your Kafka deployment. You can set your ``offset.partition.name``
147+
property like this:
149148

150-
The steps to perform this strategy depend on whether you are running Kafka Connect
151-
in distributed mode or standalone mode. Click on the tab corresponding to the
152-
mode of your deployment:
149+
.. code-block:: properties
153150

154-
.. tabs::
151+
offset.partition.name=<a string>
152+
153+
.. tip:: Naming your Offset Partitions
154+
155+
Consider using the following pattern to name your offset partitions:
156+
157+
.. code-block:: properties
158+
159+
offset.partition.name=<source connector name>.<monotonically increasing number>
160+
161+
This pattern provides the following benefits:
162+
163+
- Records the number of times you reset your connector
164+
- Documents to which connector an offset partition belongs
165+
166+
.. example::
167+
168+
Assume you named your source connector ``"source-values"`` and you are
169+
setting the ``offset.partition.name`` property for the first time.
170+
You would configure your connector as follows:
171+
172+
.. code-block:: properties
155173

156-
.. tab:: Distributed
157-
:tabid: distributed
174+
offset.partition.name=source-values.1
158175

159-
#. Delete the topic specified in the ``offset.storage.topic`` property of your
160-
Kafka Connect deployment. For more information on deleting topics in Apache Kafka, see the
161-
`official Apache Kafka documentation <https://kafka.apache.org/081/documentation.html#basic_ops_add_topic>`__.
176+
The next time you reset your connector's offset data, configure
177+
your connector as follows:
162178

163-
#. Restart your source connector and continue to process change stream events.
179+
.. code-block:: properties
164180

165-
.. tab:: Standalone
166-
:tabid: standalone
181+
offset.partition.name=source-values.2
167182

168-
#. Delete the file referenced by the ``offset.storage.file.filename`` property of
169-
your Kafka Connect deployment.
183+
To learn more about the ``offset.partition.name`` configuration property, see
184+
the :ref:`<source-configuration-error-handling>` page.
170185

171-
#. Restart your source connector and continue to process change stream events.
186+
To learn about naming your connector, see the official
187+
`{+ak+} <https://kafka.apache.org/documentation/#connect_configuring>`__
188+
documentation.
172189

173190
.. _invalid-resume-token-prevention:
174191

0 commit comments

Comments
 (0)