Skip to content

sql,streamingest: introduce ALTER TENANT ... PAUSE/RESUME REPLICATION#92363

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
adityamaru:alter-tenant-resume
Dec 8, 2022
Merged

sql,streamingest: introduce ALTER TENANT ... PAUSE/RESUME REPLICATION#92363
craig[bot] merged 1 commit intocockroachdb:masterfrom
adityamaru:alter-tenant-resume

Conversation

@adityamaru
Copy link
Copy Markdown
Contributor

This change introduces:
ALTER TENANT <name> RESUME REPLICATION
ALTER TENANT <name> PAUSE REPLICATION

These statements can be used to pause and resume the replication job if the tenant is being replicated into.

Fixes: #91246

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@adityamaru adityamaru marked this pull request as ready for review November 23, 2022 15:44
@adityamaru adityamaru requested review from a team, dt, lidorcarmel and stevendanna November 23, 2022 15:44
// ALTER TENANT '<tenant_name>' PAUSE REPLICATION
// ALTER TENANT '<tenant_name>' RESUME REPLICATION
alter_tenant_replication_stmt:
ALTER TENANT sconst_or_placeholder PAUSE REPLICATION
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@knz / @dt or anyone else who better understands the rules we have to accept an expression, is sconst_or_placeholder the correct rule to accept a tenant name. Currently, CREATE TENANT accepts a name but we want to change that as well so that we can support placeholders, Additionally, we want to reduce the possibility of us misquoting these names when storing them in the system table (an error I already made in another PR and has been fixed since).

Copy link
Copy Markdown
Contributor

@lidorcarmel lidorcarmel left a comment

Choose a reason for hiding this comment

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

looks good, a couple of small questions.

{`ALTER TENANT ALL RESET ??`, `ALTER TENANT CLUSTER SETTING`},

{`ALTER TENANT 'foo' RESUME REPLICATION ??`, `ALTER TENANT REPLICATION`},
{`ALTER TENANT 'foo' PAUSE REPLICATION ??`, `ALTER TENANT REPLICATION`},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

{ALTER TENANT ALL ??, ALTER TENANT CLUSTER SETTING},
{ALTER TENANT ALL SET ??, ALTER TENANT CLUSTER SETTING},
{ALTER TENANT ALL RESET ??, ALTER TENANT CLUSTER SETTING},
{ALTER TENANT 'foo' RESUME REPLICATION ??, ALTER TENANT REPLICATION},
{ALTER TENANT 'foo' PAUSE REPLICATION ??, ALTER TENANT REPLICATION},

shouldn't the keys on the right be ALTER TENANT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe the way to read this test is the more tokens you type on the left the more specific help text you get, atleast thats my understanding 😅 . So an ALTER TENANT ALL ?? is currently only supported for altering a tenant cluster setting and so that's the help text we see.

alter_ddl_stmt // help texts in sub-rule
| alter_role_stmt // EXTEND WITH HELP: ALTER ROLE
| alter_tenant_csetting_stmt // EXTEND WITH HELP: ALTER TENANT
| alter_tenant_stmt /* SKIP DOC */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why SKIP? I thought we decided to keep all of these? here and below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought we were starting with SKIP DOC but don't skip the help text?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we don't skip for create/drop/show tenant now..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup i have this PR I need to cleanup - #91995, let me go do that.

Copy link
Copy Markdown
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 getting this going. Looks good overall, but just a few nits.

@adityamaru adityamaru force-pushed the alter-tenant-resume branch 2 times, most recently from 6f520da to 8357cfc Compare December 2, 2022 20:18
@adityamaru
Copy link
Copy Markdown
Contributor Author

friendly ping @stevendanna / @lidorcarmel

Copy link
Copy Markdown
Contributor

@lidorcarmel lidorcarmel left a comment

Choose a reason for hiding this comment

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

lgtm!

@adityamaru
Copy link
Copy Markdown
Contributor Author

The CI race failure is interestingggg, some sort of data race. Looking into it.

@adityamaru
Copy link
Copy Markdown
Contributor Author

stress race on TestTenantStreamingDeleteRange doesn't seem to throw up anything after many minutes. A rerun of CI also seems to have "fixed" the failure. I'm going to merge this but will keep monitoring this test:

TFTR!

bors r=lidorcarmel

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 8, 2022

👎 Rejected by code reviews

Copy link
Copy Markdown
Contributor

@lidorcarmel lidorcarmel left a comment

Choose a reason for hiding this comment

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

double approve!

@adityamaru
Copy link
Copy Markdown
Contributor Author

bors r=lidorcarmel

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 8, 2022

👎 Rejected by code reviews

@adityamaru
Copy link
Copy Markdown
Contributor Author

boo, maybe I need @stevendanna's stamp

@stevendanna stevendanna dismissed their stale review December 8, 2022 18:39

Lidor has reviewed.

This change introduces:
`ALTER TENANT <name> RESUME REPLICATION`
`ALTER TENANT <name> PAUSE REPLICATION`

These statements can be used to pause and resume the
replication job if the tenant is being replicated into.

Fixes: cockroachdb#91246

Release note: None
@adityamaru
Copy link
Copy Markdown
Contributor Author

bors r=lidorcarmel

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 8, 2022

Build succeeded:

@craig craig bot merged commit 223f580 into cockroachdb:master Dec 8, 2022
@adityamaru adityamaru deleted the alter-tenant-resume branch December 9, 2022 16:04
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.

c2c: introduce ALTER TENANT grammar

4 participants