Skip to content

sql: use background QoS for atomic COPY#115674

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:copy-qos
Dec 13, 2023
Merged

sql: use background QoS for atomic COPY#115674
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:copy-qos

Conversation

@yuzefovich
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich commented Dec 6, 2023

We recently merged a change to make COPY use "background" QoS by default. However, that change was incomplete - it only made it so that we use the "background" QoS only whenever a new txn is started by the copy state machine, and we forgot to make the corresponding update for the initial txn created outside of the state machine, if we're in an implicit txn. This is now fixed.

Note that this initial txn is only used for "atomic" COPY because for non-atomic we always create a fresh txn before each batch.

This commit also adjusts an existing test to verify that the expected QoS is used for all implicit txns.

Epic: None

Release note: None

@yuzefovich yuzefovich added the backport-23.2.x PAST MAINTENANCE SUPPORT: 23.2 patch releases via ER request only label Dec 6, 2023
@yuzefovich yuzefovich requested review from a team, michae2 and rafiss December 6, 2023 01:35
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Dec 6, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

nice find - have you thought of how we could test this?

We recently merged a change to make COPY use "background" QoS by
default. However, that change was incomplete - it only made it so that
we use the "background" QoS only whenever a new txn is started by the
copy state machine, and we forgot to make the corresponding update for
the initial txn created outside of the state machine, if we're in an
implicit txn. This is now fixed.

Note that this initial txn is only used for "atomic" COPY because for
non-atomic we always create a fresh txn before each batch.

This commit also adjusts an existing test to verify that the expected
QoS is used for all implicit txns.

Release note: None
@yuzefovich yuzefovich changed the title sql: use background QoS for COPY for the initial batch sql: use background QoS for atomic COPY Dec 7, 2023
Copy link
Copy Markdown
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Good point - adjusted an existing test to do that. Working on this also made me realize that this PR fixes only the case of atomic COPY - for non-atomic COPY even the initial batch is handled by the txn with background QoS because we call preparePlannerForCopy before each batch, which commits the original txn with default QoS and creates a new one with background QoS. Thanks for the nudge!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @michae2)

@yuzefovich
Copy link
Copy Markdown
Member Author

Friendly ping @rafiss

Copy link
Copy Markdown
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

the new test is great, thanks

Reviewed 2 of 3 files at r1, 6 of 6 files at r2, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @michae2)

@yuzefovich
Copy link
Copy Markdown
Member Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 13, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-23.2.x PAST MAINTENANCE SUPPORT: 23.2 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants