Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamingccl: add EXPIRATION WINDOW option to ALTER VIRTUAL CLUSTER #117776

Merged

Conversation

msbutler
Copy link
Collaborator

@msbutler msbutler commented Jan 14, 2024

Previously, the private stream_replication.job_liveness_timeout cluster
setting determined how long the producer job would stay alive without a
hearbeat from the consumer job. This patch removes this setting, and adds new
sql syntax so the user can set this timeout on for all producer jobs on the
given tenant.

Epic: CRDB-34233

Release note (sql change): This patch adds the new EXPIRATION WINDOW option set
through ALTER TENANT appTenant SET REPLICATION EXPIRATION WINDOW ='100ms',
which allows the user to override the default producer job expiration window of
24 hours. The producer job expiration window determines how long the producer
job stays alive without a heartbeat from the consumer job.

@msbutler msbutler self-assigned this Jan 14, 2024
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@msbutler msbutler force-pushed the butler-rebased-alter-tenant-producer branch 4 times, most recently from e5c7a5b to c411be4 Compare January 14, 2024 18:17
@msbutler msbutler changed the title Butler rebased alter tenant producer streamingccl: add EXPIRATION WINDOW option to ALTER VIRTUAL CLUSTER Jan 14, 2024
@msbutler msbutler marked this pull request as ready for review January 14, 2024 18:18
@msbutler msbutler requested review from a team as code owners January 14, 2024 18:18
@msbutler msbutler requested review from dt and stevendanna and removed request for a team January 14, 2024 18:18
Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Left some very minor naming nitpicks and cleanups. Take them or leave them.

pkg/ccl/streamingccl/streamingest/alter_replication_job.go Outdated Show resolved Hide resolved
Comment on lines +507 to +514
md.Progress.GetStreamReplication().Expiration = newExpiration
ju.UpdateProgress(md.Progress)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be more than we want to chew in this PR, but I'm mildly of the opinion that the builtin really should be saving the LastCheckinTime rather than the expiration.

// We don't allow the user to specify the producer job expirationWindow during
// replication creation from the destination cluster, as this job setting
// should only be set from the producer cluster.
return nil, nil, nil, false, errors.New("cannot specify expirationWindow option while starting a physical replication stream")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe: s/expirationWindow option/the EXPIRATION WINDOW option/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily for this PR, but I wonder if we should allow them to set the expiration window here and then the expiration set here would be used on the producer job we created post cutover, failing back to the retention window if it is is unset. But, I suppose then there would be confusion about why that doesn't also set the expiration window on the producer job on the source.

pkg/ccl/streamingccl/streamproducer/producer_job.go Outdated Show resolved Hide resolved
pkg/jobs/jobspb/jobs.proto Show resolved Hide resolved
pkg/ccl/streamingccl/streamingest/ingest_span_configs.go Outdated Show resolved Hide resolved
Comment on lines 243 to 247
if !alterTenantStmt.Options.IsDefault() {
return alterTenantSetReplication(ctx, p.InternalSQLTxn(), jobRegistry, options, tenInfo)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really your problem but this and the last couple of changes have moved this function from one in which all of the possible commands were handled in the if/else block below into one where some are handled above with early returns and some are handled below with early returns.

If we find ourselves modifying this again it might be nice to clean up.

pkg/ccl/streamingccl/streamingest/alter_replication_job.go Outdated Show resolved Hide resolved
Previously, the private `stream_replication.job_liveness_timeout` cluster
setting determined how long the producer job would stay alive without a
hearbeat from the consumer job. This patch removes this setting, and adds new
sql syntax so the user can set this timeout on for all producer jobs on the
given tenant.

Epic: CRDB-34233

Release note (sql change): This patch adds the new EXPIRATION WINDOW option set
through `ALTER TENANT appTenant SET REPLICATION EXPIRATION WINDOW ='100ms'`,
which allows the user to override the default producer job expiration window of
24 hours. The producer job expiration window determines how long the producer
job stays alive without a heartbeat from the consumer job.
@msbutler msbutler force-pushed the butler-rebased-alter-tenant-producer branch from c411be4 to de0265a Compare January 16, 2024 14:26
@msbutler
Copy link
Collaborator Author

TFTR!

bors r=stevendanna

@craig
Copy link
Contributor

craig bot commented Jan 16, 2024

Build succeeded:

@craig craig bot merged commit 515663b into cockroachdb:master Jan 16, 2024
9 checks passed
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.

None yet

3 participants