Skip to content

kv: properly handle intent pushes to synthetic timestamps#63800

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/pushSynthetic
Apr 22, 2021
Merged

kv: properly handle intent pushes to synthetic timestamps#63800
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/pushSynthetic

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Apr 16, 2021

This commit reworks the timestamp that pushers use when pushing intents
to synthetic timestamps. Usually, as of #59086, a pusher limits the
timestamp that it pushes conflicting intents to using the local HLC
clock. This is based on the assumption that it will be able to ignore
any intent above the local HLC clock's reading using observed timestamps
and a local uncertainty limit.

However, this argument only holds if we expect to be able to use a local
uncertainty limit when we return to read the pushed intent. Notably,
local uncertainty limits can not be used to ignore intents with
synthetic timestamps that would otherwise be in a reader's uncertainty
interval. This is because observed timestamps do not apply to
intents/values with synthetic timestamps. So if we know that we will be
pushing an intent to a synthetic timestamp, we don't limit the value to
a clock reading from the local clock.

This came out of some exploration of kvnemesis. I don't think this was
actually causing an issue, but it seemed like a potential source of an
infinite push + conflict loop.

Release note (bug fix): Read-write contention on GLOBAL tables no longer
has a potential to thrash without making progress.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@nvb nvb requested a review from andreimatei April 17, 2021 04:11
Copy link
Copy Markdown
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

:lgtm:

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


pkg/kv/kvserver/concurrency/lock_table_waiter.go, line 567 at r1 (raw file):

}

func (w *lockTableWaiterImpl) pushHeader(req Request) roachpb.Header {

mind adding a comment to this function


pkg/kv/kvserver/concurrency/lock_table_waiter.go, line 618 at r1 (raw file):

			// not come from an HLC clock, but it does not currently get marked as
			// so. See the TODO in roachpb.MakeTransaction.
			uncertaintyLimit = uncertaintyLimit.WithSynthetic(true)

should this WithSynthetic be moved up? And then Backwards above will make it non-synthetic on the other branch I think.

This commit reworks the timestamp that pushers use when pushing intents
to synthetic timestamps. Usually, as of cockroachdb#59086, a pusher limits the
timestamp that it pushes conflicting intents to using the local HLC
clock. This is based on the assumption that it will be able to ignore
any intent above the local HLC clock's reading using observed timestamps
and a local uncertainty limit.

However, this argument only holds if we expect to be able to use a local
uncertainty limit when we return to read the pushed intent. Notably,
local uncertainty limits can not be used to ignore intents with
synthetic timestamps that would otherwise be in a reader's uncertainty
interval. This is because observed timestamps do not apply to
intents/values with synthetic timestamps. So if we know that we will be
pushing an intent to a synthetic timestamp, we don't limit the value to
a clock reading from the local clock.

This came out of some exploration of kvnemesis. I don't think this was
actually causing an issue, but it seemed like a potential source of an
infinite push + conflict loop.

Release note (bug fix): Read-write contention on GLOBAL tables no longer
has a potential to thrash without making progress.
@nvb nvb force-pushed the nvanbenschoten/pushSynthetic branch from e0138db to 1dac4bb Compare April 22, 2021 16:07
Copy link
Copy Markdown
Contributor Author

@nvb nvb left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @andreimatei)


pkg/kv/kvserver/concurrency/lock_table_waiter.go, line 567 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

mind adding a comment to this function

Done.


pkg/kv/kvserver/concurrency/lock_table_waiter.go, line 618 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

should this WithSynthetic be moved up? And then Backwards above will make it non-synthetic on the other branch I think.

Yeah, good idea. Done.

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Apr 22, 2021

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 22, 2021

Build succeeded:

@craig craig bot merged commit 97955d4 into cockroachdb:master Apr 22, 2021
@nvb nvb deleted the nvanbenschoten/pushSynthetic branch April 27, 2021 02:39
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.

3 participants