-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: generate random index name for change streams #32689
Conversation
Generates index names for change stream partition metadata table using a random UUID. This prevents issues if the job is being redeployed in an existing database.
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
retest this please |
...n/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dao/PartitionMetadataTableNames.java
Show resolved
Hide resolved
Finds and drops all indexes on the metadata table before attempting to drop it.
...src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/dao/PartitionMetadataDao.java
Outdated
Show resolved
Hide resolved
If a table is given, we still need to generate the index names in case the given table does not exist and needs to be created.
Assigning reviewers. If you would like to opt out of this review, comment R: @damondouglas for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Is this a fix for issue #32509? If so, can you add a "fixes: " in the description please? |
LGTM |
@ahmedabu98 for next reviewer in chain |
gentle ping @ahmedabu98 =) |
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.
Given there were issues with the index, should we add a pipeline option controlling whether the index is used or not? Or perhaps there would be too much code complication by having two paths, what do you think?
@@ -129,7 +123,7 @@ public void createPartitionMetadataTable() { | |||
// Literals need be added around literals to preserve casing. | |||
ddl.add( | |||
"CREATE TABLE \"" | |||
+ tableName | |||
+ names.getTableName() |
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 this method fail if the tables/indexes already exist?
IIUC the issue correctly this is failing currently because the index has the same name across pipelines and the creation is failing. Do we also have to worry about a single pipeline failing if it created the tables but Dataflow retries the work? It seems we might want ot use create if it doesn't exist.
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. Since the names have a random component, I assumed the job would fail and we would re-generate them.
Updated with IF NOT EXISTS to circumvent this problem.
Generates index names for change stream partition metadata table using a random UUID. This prevents issues if the job is being redeployed in an existing database.