-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[FLINK-36610] MySQL CDC supports parsing gh-ost / pt-osc generated schema changes #3668
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9c21a98
[FLINK-36610] MySQL CDC supports parsing gh-ost generated schema changes
yuxiqian 6e3146e
supports parsing pt-osc generated schema changes
MOBIN-F 7f6f884
rename XXXGhOstSchemaChanges -> XXXOnLineSchemaChanges
MOBIN-F 03d14fd
fix comment
MOBIN-F a47de50
add: mysql table source test
yuxiqian e23e07b
nit: add option prefix
yuxiqian 23b8613
minor: rename config name
yuxiqian 0c38f98
tests: lock percona toolkit docker image tag
yuxiqian 0435c41
nit: wait for binlog stage before starting to trigger any schema change
yuxiqian ac644aa
nit: remove unnecessary `toLowerCase`
yuxiqian 4565e8d
docs: add option specification for `scan.parse.online.schema.changes.…
yuxiqian bfdd35b
optimize error message
yuxiqian 46fbcac
prefer using built-in constants
yuxiqian 80c5336
fix: lock percona toolkit version
yuxiqian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
flink-cdc-common/src/main/java/org/apache/flink/cdc/common/utils/TestCaseUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.flink.cdc.common.utils; | ||
|
|
||
| import org.apache.flink.util.function.SupplierWithException; | ||
|
|
||
| import java.time.Duration; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.function.Predicate; | ||
| import java.util.function.Supplier; | ||
|
|
||
| /** Some utility methods for creating repeated-checking test cases. */ | ||
| public class TestCaseUtils { | ||
|
|
||
| public static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); | ||
| public static final Duration DEFAULT_INTERVAL = Duration.ofSeconds(1); | ||
|
|
||
| /** Fetch with a ({@code timeout}, {@code interval}) duration. */ | ||
| public static void repeatedCheck(Supplier<Boolean> fetcher) { | ||
| repeatedCheck(fetcher, DEFAULT_TIMEOUT); | ||
| } | ||
|
|
||
| /** Fetch with a ({@code timeout}, {@code interval}) duration. */ | ||
| public static void repeatedCheck(Supplier<Boolean> fetcher, Duration timeout) { | ||
| repeatedCheck(fetcher, timeout, DEFAULT_INTERVAL); | ||
| } | ||
|
|
||
| /** Fetch with a ({@code timeout}, {@code interval}) duration. */ | ||
| public static void repeatedCheck( | ||
| Supplier<Boolean> fetcher, Duration timeout, Duration interval) { | ||
| repeatedCheck(fetcher::get, timeout, interval, Collections.emptyList()); | ||
| } | ||
|
|
||
| /** Fetch and wait with a ({@code timeout}, {@code interval}) duration. */ | ||
| public static <T> void repeatedCheck( | ||
| Supplier<T> fetcher, Predicate<T> validator, Duration timeout, Duration interval) { | ||
| repeatedCheckAndValidate( | ||
| fetcher::get, validator, timeout, interval, Collections.emptyList()); | ||
| } | ||
|
|
||
| /** Waiting for fetching values with a ({@code timeout}, {@code interval}) duration. */ | ||
| public static void repeatedCheck( | ||
| SupplierWithException<Boolean, Throwable> fetcher, | ||
| Duration timeout, | ||
| Duration interval, | ||
| List<Class<? extends Throwable>> allowedThrowsList) { | ||
| repeatedCheckAndValidate(fetcher, b -> b, timeout, interval, allowedThrowsList); | ||
| } | ||
|
|
||
| /** Fetch and validate, with a ({@code timeout}, {@code interval}) duration. */ | ||
| public static <T> void repeatedCheckAndValidate( | ||
| SupplierWithException<T, Throwable> fetcher, | ||
| Predicate<T> validator, | ||
| Duration timeout, | ||
| Duration interval, | ||
| List<Class<? extends Throwable>> allowedThrowsList) { | ||
|
|
||
| long start = System.currentTimeMillis(); | ||
| while (System.currentTimeMillis() - start < timeout.toMillis()) { | ||
| try { | ||
| if (validator.test(fetcher.get())) { | ||
| return; | ||
| } | ||
| } catch (Throwable t) { | ||
| if (allowedThrowsList.stream() | ||
| .noneMatch(clazz -> clazz.isAssignableFrom(t.getClass()))) { | ||
| throw new RuntimeException("Fetcher has thrown an unexpected exception: ", t); | ||
| } | ||
| } | ||
| try { | ||
| Thread.sleep(interval.toMillis()); | ||
| } catch (InterruptedException ignored) { | ||
| // ignored | ||
| } | ||
| } | ||
| throw new RuntimeException("Timeout when waiting for state to be ready."); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.