docs icon indicating copy to clipboard operation
docs copied to clipboard

PR #101694 - schemafeed: Add an optimization where we can pause polling

Open cockroach-teamcity opened this issue 2 years ago • 0 comments

Exalate commented:

Related PR: https://github.com/cockroachdb/cockroach/pull/101694 Commit: https://github.com/cockroachdb/cockroach/commit/8396f3304258cbf9c904e808a5e777742947cc40 Epic: CRDB-2258


Release note (performance improvement): We improved our changefeed to decrease the commit-to-emit latency (i.e. The difference between an event's MVCC timestamp and the time it is ready to emit to a downstream sink). Previously, it is determined by a non-documented cluster setting (changefeed.experimental_poll_interval) which defaults to 1s.

To enable this performance improvement, users should "lock" the watched table with ALTER TABLE <tbl> SET (schema_locked =t);, which would disallow schema changes on . If a schema change stmt is attempted on a locked table, CRDB will reject it and return an error. The user could lock the table either before creating a changefeed or when a changefeed is running, CRDB will be able to detect that and enable this performance improvement automatically.

If the user is running a changefeed on a locked table but wish to perform schema changes to the table, they need to explicitly unlock the table first with ALTER TABLE <tbl> RESET schema_locked. After the schema change completes, we recommend the user to lock the table again to re-gain this performance improvement. The changefeed job itself does not need to be modified in any way by the user (e.g. the user does not need to pause the job when locking/unlocking a table).

Note: This change is a "pure" optimization in that if the table is not locked, everything should still work in the way it used to. In other words, we implemented the logic in such a way that we'd transparently fall back to the old behavior if the table is not locked.

Jira Issue: DOC-7618

cockroach-teamcity avatar May 10 '23 05:05 cockroach-teamcity