-
Notifications
You must be signed in to change notification settings - Fork 465
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
persist-txn: support "eager" physical upper advancement on data shards #23552
Conversation
0d7c72b
to
33edace
Compare
There's a couple WIPs left to polish out, but this is ready for a look! I'll likely pull out the bits to turn it on in CI before merging |
MitigationsCompleting required mitigations increases Resilience Coverage.
Bug Hotspots:
|
// TODO: Ideally the upper advancements would be done concurrently with | ||
// this apply_le. | ||
let tidy = self.apply_le(ts).await; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anything bad happen if we crash here, after the apply_le
but before the advancing the physical uppers? One potentially bad scenario:
- Upper of some shard
s
is at5
. - Apply txns at
10
. - Crash.
- Reboot.
- Try and read
s
at10
.
If at some point during startup we call apply_eager_le(ts')
s.t. ts' >= 10
, then I think we're fine. Otherwise we might need to wait until the next commit to read the shard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, seems like we just need call apply_eager_le
in init_ts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like it would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it though, we definitely do at least one table write during bootstrap so it's probably fine as is. Might be better to be explicit about it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I realized the same thing and ditto for create_collection, which would also advance them. Added it anyway :), but had to do it in register instead of init_txns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming that the WIPs and TODOs will be resolved in a later PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still have the WIP overrides in here to get CI to exercise this and still have the other PR commit (it hasn't quite merged yet), but I think I've finished polishing up the rest!
// TODO: Ideally the upper advancements would be done concurrently with | ||
// this apply_le. | ||
let tidy = self.apply_le(ts).await; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I realized the same thing and ditto for create_collection, which would also advance them. Added it anyway :), but had to do it in register instead of init_txns.
src/storage-controller/src/lib.rs
Outdated
tx.clone(), | ||
txns, | ||
lazy_persist_txn_tables, | ||
); | ||
let txns_read = TxnsRead::start::<TxnsCodecRow>(txns_client.clone(), txns_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized last night that having this txns_read around is wasteful for eager uppers (plus having it running increases our exposure to bugs slightly), so reworked a touch here to avoid that.
8d1111f
to
6a1ef27
Compare
When a txn commits, the "logical upper" of each data shard is advanced but the "physical upper" is only advanced for the data shards involved in the txn. This creates a "lazy upper" situation that is addressed on the read side. This commit introduces the ability to instead advance the upper of all registered data shards, which means we can use all totally normal unchanged read paths. The eager uppers of course don't get the efficiency and cost benefits of lazy uppers, but they'll allow us to derisk the rollout to prod by breaking it into two pieces.
6a1ef27
to
afbdcee
Compare
TFTR! |
persist-txn: support "eager" physical upper advancement on data shards
When a txn commits, the "logical upper" of each data shard is advanced
but the "physical upper" is only advanced for the data shards involved
in the txn. This creates a "lazy upper" situation that is addressed on
the read side.
This commit introduces the ability to instead advance the upper of all
registered data shards, which means we can use all totally normal
unchanged read paths. The eager uppers of course don't get the
efficiency and cost benefits of lazy uppers, but they'll allow us to
de-risk the rollout to prod by breaking it into two pieces.
Touches https://github.com/MaterializeInc/database-issues/issues/6685
Touches https://github.com/MaterializeInc/database-issues/issues/6888
Motivation
Tips for reviewer
Ignore the first commit, it's #23588.
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way), then it is tagged with aT-proto
label.