-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Flink: Fix hash code comparison for requesting global statistics in DataStatisticsCoordinator #13827
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: Fix hash code comparison for requesting global statistics in DataStatisticsCoordinator #13827
Changes from 1 commit
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 |
---|---|---|
|
@@ -279,6 +279,57 @@ public void testRequestGlobalStatisticsEventHandling() throws Exception { | |
} | ||
} | ||
|
||
@Test | ||
public void testMultipleRequestGlobalStatisticsEvents() throws Exception { | ||
try (DataStatisticsCoordinator dataStatisticsCoordinator = | ||
createCoordinator(StatisticsType.Map)) { | ||
dataStatisticsCoordinator.start(); | ||
tasksReady(dataStatisticsCoordinator); | ||
|
||
StatisticsEvent checkpoint1Subtask0DataStatisticEvent = | ||
Fixtures.createStatisticsEvent( | ||
StatisticsType.Map, Fixtures.TASK_STATISTICS_SERIALIZER, 1L, CHAR_KEYS.get("a")); | ||
StatisticsEvent checkpoint1Subtask1DataStatisticEvent = | ||
Fixtures.createStatisticsEvent( | ||
StatisticsType.Map, Fixtures.TASK_STATISTICS_SERIALIZER, 1L, CHAR_KEYS.get("b")); | ||
|
||
dataStatisticsCoordinator.handleEventFromOperator( | ||
0, 0, checkpoint1Subtask0DataStatisticEvent); | ||
dataStatisticsCoordinator.handleEventFromOperator( | ||
1, 0, checkpoint1Subtask1DataStatisticEvent); | ||
|
||
waitForCoordinatorToProcessActions(dataStatisticsCoordinator); | ||
|
||
// signature is null | ||
dataStatisticsCoordinator.handleEventFromOperator(0, 0, new RequestGlobalStatisticsEvent()); | ||
|
||
// Checkpoint StatisticEvent + RequestGlobalStatisticsEvent | ||
Awaitility.await("wait for first statistics event") | ||
.pollInterval(Duration.ofMillis(10)) | ||
.atMost(Duration.ofSeconds(10)) | ||
.until(() -> receivingTasks.getSentEventsForSubtask(0).size() == 2); | ||
|
||
// signature is right | ||
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. nit: maybe the comment can be changed to following?
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. OK |
||
int correctSignature = dataStatisticsCoordinator.globalStatistics().hashCode(); | ||
dataStatisticsCoordinator.handleEventFromOperator( | ||
0, 0, new RequestGlobalStatisticsEvent(correctSignature)); | ||
|
||
Thread.sleep(200); | ||
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 know we are waiting for 200 ms to confirm no response is sent in this case. We can probably replace the sleep with 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. Thanks for point is out, I have change it . |
||
// Checkpoint StatisticEvent + RequestGlobalStatisticsEvent | ||
assertThat(receivingTasks.getSentEventsForSubtask(0).size()).isEqualTo(2); | ||
|
||
// signature is different | ||
dataStatisticsCoordinator.handleEventFromOperator( | ||
0, 0, new RequestGlobalStatisticsEvent(correctSignature + 1)); | ||
|
||
// Checkpoint StatisticEvent + RequestGlobalStatisticsEvent + RequestGlobalStatisticsEvent | ||
Awaitility.await("wait for second statistics event") | ||
.pollInterval(Duration.ofMillis(10)) | ||
.atMost(Duration.ofSeconds(10)) | ||
.until(() -> receivingTasks.getSentEventsForSubtask(0).size() == 3); | ||
} | ||
} | ||
|
||
static void setAllTasksReady( | ||
int subtasks, | ||
DataStatisticsCoordinator dataStatisticsCoordinator, | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
thx for catching the bug. I think your fix is correct.
Should we also fix the log message as following?
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.
Yes, I have change it now.