Skip to content

kvserver: default kv.rangefeed.closed_timestamp_refresh_interval to 3s#108667

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:rangefeed-closedts-interval
Aug 22, 2023
Merged

kvserver: default kv.rangefeed.closed_timestamp_refresh_interval to 3s#108667
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:rangefeed-closedts-interval

Conversation

@erikgrinaker
Copy link
Copy Markdown
Contributor

@erikgrinaker erikgrinaker commented Aug 12, 2023

This patch sets kv.rangefeed.closed_timestamp_refresh_interval to 3s by default. Previously, it defaulted to 0, which fell back to kv.closed_timestamp.side_transport_interval at 200ms by default.

The setting is also made public, since users may often have to tune this. It is also made TenantReadOnly, since tenants need to access the host's setting, and the only current option is to set an explicit setting for the tenant since they can't directly access host settings.

Frequent rangefeed closed timestamp processing can have a significant cost with many ranges, and the 200ms interval was far lower than the default target lag (3s) and changefeed checkpoint interval (30s), so this work was for little benefit.

kv.closed_timestamp.side_transport_interval has not been modified, since this would affect the latency of follower reads and global tables.

Resolves #108656.

Release note (ops change): The rangefeed closed timestamp interval controlled by kv.rangefeed.closed_timestamp_refresh_interval now defaults to 3 second. This affects how often rangefeeds emit resolved timestamps, and thus how often changefeeds can emit checkpoints. Previously, its default value of 0 would fall back to kv.closed_timestamp.side_transport_interval, which defaults to 200 milliseconds. Users who rely on the setting
kv.closed_timestamp.side_transport_interval to control the rangefeed closed timestamp interval should make sure they either set kv.rangefeed.closed_timestamp_refresh_interval to 0 to retain the old behavior (preferably before upgrading), or to an appropriate value.

@erikgrinaker erikgrinaker self-assigned this Aug 12, 2023
@erikgrinaker erikgrinaker requested a review from a team as a code owner August 12, 2023 16:38
@erikgrinaker erikgrinaker requested a review from a team August 12, 2023 16:38
@erikgrinaker erikgrinaker requested review from a team as code owners August 12, 2023 16:38
@erikgrinaker erikgrinaker requested review from lidorcarmel and removed request for a team August 12, 2023 16:38
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@erikgrinaker
Copy link
Copy Markdown
Contributor Author

erikgrinaker commented Aug 12, 2023

I could also be convinced to set this to 2-3s. Wdyt @miretskiy?

@erikgrinaker erikgrinaker removed request for a team and lidorcarmel August 12, 2023 16:38
@erikgrinaker
Copy link
Copy Markdown
Contributor Author

erikgrinaker commented Aug 13, 2023

Getting a bunch of test failures here because kv.rangefeed.closed_timestamp_refresh_interval can't be set from tenants. This makes sense, but the same call sites successfully set kv.closed_timestamp.side_transport_interval from tenants, which doesn't make sense and is misleading. I'm going to clean this up separately, #108678.

@erikgrinaker erikgrinaker force-pushed the rangefeed-closedts-interval branch from 43764bd to 689a596 Compare August 13, 2023 11:41
@erikgrinaker erikgrinaker changed the title kvserver: default kv.rangefeed.closed_timestamp_refresh_interval to 1s kvserver: default kv.rangefeed.closed_timestamp_refresh_interval to 3s Aug 13, 2023
@erikgrinaker
Copy link
Copy Markdown
Contributor Author

Decided to bump this to 3 seconds instead of 1 second, considering the changefeed checkpoint default is 30 seconds.

@erikgrinaker erikgrinaker marked this pull request as draft August 21, 2023 12:02
@erikgrinaker erikgrinaker force-pushed the rangefeed-closedts-interval branch 3 times, most recently from 8e50065 to 82605fb Compare August 21, 2023 18:06
This patch sets `kv.rangefeed.closed_timestamp_refresh_interval` to 3s
by default. Previously, it defaulted to 0, which fell back to
`kv.closed_timestamp.side_transport_interval` at 200ms by default.

The setting is also made public, since users may often have to tune
this. It is also made TenantReadOnly, since tenants need to access the
host's setting, and the only current option is to set an explicit
setting for the tenant since they can't directly access host settings.

Frequent rangefeed closed timestamp processing can have a significant
cost with many ranges, and the 200ms interval was far lower than the
default target lag (3s) and changefeed checkpoint interval (30s), so
this work was for little benefit.

`kv.closed_timestamp.side_transport_interval` has not been modified,
since this would affect the latency of follower reads and global tables.

Release note (ops change): The rangefeed closed timestamp interval
controlled by `kv.rangefeed.closed_timestamp_refresh_interval` now
defaults to 3 second. This affects how often rangefeeds emit resolved
timestamps, and thus how often changefeeds can emit checkpoints.
Previously, its default value of 0 would fall back to
`kv.closed_timestamp.side_transport_interval`, which defaults to 200
milliseconds. Users who rely on the setting
`kv.closed_timestamp.side_transport_interval` to control the rangefeed
closed timestamp interval should make sure they either set
`kv.rangefeed.closed_timestamp_refresh_interval` to 0 to retain the old
behavior (preferably before upgrading), or to an appropriate value.
@erikgrinaker erikgrinaker force-pushed the rangefeed-closedts-interval branch from 82605fb to e1fc2dc Compare August 22, 2023 06:42
@erikgrinaker erikgrinaker marked this pull request as ready for review August 22, 2023 07:00
@erikgrinaker erikgrinaker requested review from a team and ericharmeling and removed request for a team and ericharmeling August 22, 2023 07:01
@erikgrinaker
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 22, 2023

Build succeeded:

@craig craig bot merged commit a54a41e into cockroachdb:master Aug 22, 2023
arulajmani added a commit to arulajmani/cockroach that referenced this pull request Sep 5, 2023
Previously, we weren't waiting for the PTS record to make its way to KV
in this test. This meant expecting it to provide protection (which the
test asserted) was racy with spanconfig reconciliation. Span config
reconciliation is built over rangefeeds, so when we bumped the default
value of `kv.rangefeed.closed_timestamp_refresh_interval` in cockroachdb#108667,
it meant span config reconciliation would take longer. This caused the
GC queue to run before the replica was aware of the PTS record, which
violated a test assertion.

This patch fixes the issue by only enqueueing the range in the GC queue
once the PTS record is known to have made it to KV.

Closes cockroachdb#109244

Release note: None
craig bot pushed a commit that referenced this pull request Sep 5, 2023
110072: kvserver: deflake TestProtectedTimestamps r=irfansharif a=arulajmani

Previously, we weren't waiting for the PTS record to make its way to KV in this test. This meant expecting it to provide protection (which the test asserted) was racy with spanconfig reconciliation. Span config reconciliation is built over rangefeeds, so when we bumped the default value of `kv.rangefeed.closed_timestamp_refresh_interval` in #108667, it meant span config reconciliation would take longer. This caused the GC queue to run before the replica was aware of the PTS record, which violated a test assertion.

This patch fixes the issue by only enqueueing the range in the GC queue once the PTS record is known to have made it to KV.

Closes #109244

Release note: None

Co-authored-by: Arul Ajmani <arulajmani@gmail.com>
@erikgrinaker erikgrinaker deleted the rangefeed-closedts-interval branch November 14, 2023 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kvserver: consider increasing closed timestamp interval defaults

4 participants