-
Notifications
You must be signed in to change notification settings - Fork 591
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
refactor: move server.id for MySQL CDC from meta to fe #19169
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ use either::Either; | |
use itertools::Itertools; | ||
use maplit::{convert_args, hashmap}; | ||
use pgwire::pg_response::{PgResponse, StatementType}; | ||
use rand::Rng; | ||
use risingwave_common::array::arrow::{arrow_schema_iceberg, IcebergArrowConvert}; | ||
use risingwave_common::bail_not_implemented; | ||
use risingwave_common::catalog::{ | ||
|
@@ -1465,6 +1466,14 @@ pub fn bind_connector_props( | |
.to_string(), | ||
); | ||
} | ||
if with_properties.is_mysql_cdc_connector() { | ||
// Generate a random server id for mysql cdc source if needed | ||
// `server.id` (in the range from 1 to 2^32 - 1). This value MUST be unique across whole replication | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we ensure uniqueness by generating a random number locally? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't guarantee uniqueness, this is just a side note. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't quite get this. So will this be a problem? |
||
// group (that is, different from any other server id being used by any master or slave) | ||
with_properties | ||
.entry("server.id".to_string()) | ||
.or_insert(rand::thread_rng().gen_range(1..u32::MAX).to_string()); | ||
} | ||
Ok(with_properties) | ||
} | ||
|
||
|
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.
Manually tested that before this PR, this test will fail if
server.id
not specified