-
Notifications
You must be signed in to change notification settings - Fork 472
storage: allow kafka/loadgen sources on multi-replica clusters, gated by dyncfg #31227
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
storage: allow kafka/loadgen sources on multi-replica clusters, gated by dyncfg #31227
Conversation
f8c49f7
to
3e761d9
Compare
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.
Woohoo!
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.
Test changes lgtm, I triggered a nightly run: https://buildkite.com/materialize/nightly/builds/11070
I'm a bit confused by the data ingest error: https://buildkite.com/materialize/nightly/builds/11070#0194dc61-63a3-4e71-b78a-7dad5aa1bac1
I thought that shouldn't happen anymore since we enable multi-cluster replication now? |
@def- This only enables multi-replica sources for Kafka sources, the other sources are still an open TODO after this. And yeah, sorry because the issue title is confusing. Fwiw, here's the overall EPIC: https://github.com/MaterializeInc/database-issues/issues/5051 |
3e761d9
to
c1cf70e
Compare
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.
Another nightly run: https://buildkite.com/materialize/nightly/builds/11102 Edit: I'm fixing up data ingest Edit2: New run just with data ingest: https://buildkite.com/materialize/nightly/builds/11104
I also want to write some more tests, but can do it after this is merged too.
8265d81
to
eae3e49
Compare
Something interesting seems to have happened in the data ingest test: https://buildkite.com/materialize/nightly/builds/11104#_
|
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.
Looks mostly good, but I'm suspicious that the active_copies
tracking might not always be correct. At least I don't understand why we can unconditionally initialize the number of active copies to 1 when a collection is created, and I think we can leak CollectionState
when a replica is dropped at the wrong moment.
} else { | ||
soft_panic_or_log!( | ||
"DroppedId for ID {id} but we have neither ingestion nor export \ | ||
under that 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.
I think that soft panic should stay? Since we're doing the active_copies
tracking there isn't a reason we should ever get here, right?
for id in instance.active_ingestions() { | ||
self.collections | ||
.get_mut(id) | ||
.expect("instance contains unknown ingestion") |
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.
Can we make this a soft panic instead? I'm wary of panics that could bring down envd, if it's not immediately obvious that we can't hit them. And I don't think that's obvious here.
@@ -948,6 +963,7 @@ where | |||
data_source, | |||
collection_metadata: metadata, | |||
extra_state, | |||
active_copies: 1, |
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.
How do we know that there is one active copy when a collection is created? Don't we need to look at the number of replicas for that?
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.
If this ends up being an ingestion, then run_ingestions
sets the active_copies to the number of instance replicas. Otherwise it is set to one for tables.
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.
I see. Would be great to have that context in a comment too!
self.collections | ||
.get_mut(id) | ||
.expect("instance contains unknown ingestion") | ||
.active_copies -= 1; |
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.
We might have to remove collection state if this value drops to zero. For example, consider the case where a source is dropped but before we receive the DroppedId
response from the replica we drop the replica. With the current code I think we would just leak the CollectionState
for the dropped collection.
This is tricky because we can't always drop a collection when this counter goes to zero. All replicas in a cluster can be dropped without the sources on the same cluster being dropped as well.
@petrosagg Could you please look at the questions about |
@teskje and @petrosagg For some of the trickier questions around collection state, |
@def- the nightly is failing with:
Which happens when |
eae3e49
to
7f1aabf
Compare
Rebased and fixed, @def- we still need to get to the bottom of ☝️ , are the tests flipping the dyncfg on and off? |
No, they are not. The dyncfg should always be on in the Data Ingest test. |
What might happen is that during bootstrapping we parse the SQL without respecting the dyncfg setting? |
7f1aabf
to
0882f9c
Compare
Good catch! I pushed a commit that should fix this. |
We want the mint operation to be a no-op if either new_from_upper or binding_ts are not beyond the current source_upper and upper respectively. Before, we only checked the former which meant that if the requested binding_ts was in the past we would attempt to write to the remap shard updates that are not beyond the upper. Co-authored-by: Petros Angelatos <[email protected]> Signed-off-by: Petros Angelatos <[email protected]>
Signed-off-by: Petros Angelatos <[email protected]>
This will lead to panics when bootstrapping from a catalog that has these allowed. Largely, it seems, because we don't yet have the proper dyncfg value that would allow this. We still have checks that disallow sources on multi-replica clusters at the sequencer level, so should be fine.
0882f9c
to
7ed362c
Compare
@def- what about that remaining cloudtest failure here: https://buildkite.com/materialize/nightly/builds/11180? |
2e0132c
to
a2fe527
Compare
a2fe527
to
08db2f5
Compare
@def- I think you pushed a commit that changes the expected error message, on top of mine which changes size to |
Oops, didn't see your comment and just pushed something similar, sorry! |
08db2f5
to
a2fe527
Compare
No worries at all! |
Version of #30003 with a dyncfg for enabling/disabling multi-replica sources
Motivation
Tips for reviewer
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way), then it is tagged with aT-proto
label.