-
Notifications
You must be signed in to change notification settings - Fork 13.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
[FLINK-32495][connectors/common] Fix the bug that the shared thread factory causes the source alignment unit test to fail #22911
[FLINK-32495][connectors/common] Fix the bug that the shared thread factory causes the source alignment unit test to fail #22911
Conversation
…actory causes the source alignment unit test to fail
3c4c809
to
e62427b
Compare
e62427b
to
85b96a1
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.
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.
Hello, @1996fanrui , Thanks for your driving the fix.
That looks good to me.
@Before | ||
public void setup() { | ||
@BeforeEach | ||
void setup() { | ||
provider = | ||
new SourceCoordinatorProvider<>( | ||
"SourceCoordinatorProviderTest", |
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 about
"SourceCoordinatorProviderTest", | |
this.getClass().getSimpleName(), |
?
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.
it's not related to this fix, and this fix is urgent, so i will merge it first.
@Test | ||
void testCoordinatorExecutorThreadFactoryNewMultipleThread() { | ||
SourceCoordinatorProvider.CoordinatorExecutorThreadFactory | ||
coordinatorExecutorThreadFactory = | ||
new SourceCoordinatorProvider.CoordinatorExecutorThreadFactory( | ||
"test_coordinator_thread", | ||
new MockOperatorCoordinatorContext( | ||
new OperatorID(1234L, 5678L), 3)); | ||
|
||
coordinatorExecutorThreadFactory.newThread(() -> {}); | ||
// coordinatorExecutorThreadFactory cannot create multiple threads. | ||
assertThatThrownBy(() -> coordinatorExecutorThreadFactory.newThread(() -> {})) | ||
.isInstanceOf(IllegalStateException.class); | ||
} |
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.
👍
checkState( | ||
t == null, | ||
"Please using the new CoordinatorExecutorThreadFactory," | ||
+ " this factory cannot new multiple threads."); |
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.
nice~.
This design is in line with the principle that It should fail first once encounter error operation.
Hi @snuyanzin @RocMarshal , thanks for the quick review, merging. |
What is the purpose of the change
SourceCoordinatorAlignmentTest.testWatermarkAlignmentWithTwoGroups fails.
I analyzed this CI : https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=50668&view=logs&j=a57e0635-3fad-5b08-57c7-a4142d7d6fa9&t=2ef0effc-1da1-50e5-c2bd-aab434b1c5b7&l=9089
Root cause:
coordinatorThreadFactory.isCurrentThreadCoordinatorThread()
, such as: SourceCoordinatorContext.attemptReady.Brief change log
Don't share the CoordinatorExecutorThreadFactory.
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: ( no)Documentation