Skip to content

Flink 1.14: Fix the flaky testHashDistributeMode by ingesting all rows in one checkpoint cycle. - #4189

Merged
rdblue merged 2 commits into
apache:masterfrom
openinx:flakey-test-hash-distribute-mode
Feb 23, 2022
Merged

Flink 1.14: Fix the flaky testHashDistributeMode by ingesting all rows in one checkpoint cycle.#4189
rdblue merged 2 commits into
apache:masterfrom
openinx:flakey-test-hash-distribute-mode

Conversation

@openinx

Copy link
Copy Markdown
Member

@openinx

Copy link
Copy Markdown
MemberAuthor

Run this 20 times in my host, everything seems OK:

for i in `seq 1 20`; do
./gradlew :iceberg-flink:iceberg-flink-1.14_2.12:test --tests "org.apache.iceberg.flink.TestFlinkTableSink"
if [ ! $? -eq 0 ] ; then
exit 1
fi
done

Comment on lines +263 to +267
List<Row> dataSet = ImmutableList.of(
Row.of(1, "aaa"), Row.of(1, "bbb"), Row.of(1, "ccc"),
Row.of(2, "aaa"), Row.of(2, "bbb"), Row.of(2, "ccc"),
Row.of(3, "aaa"), Row.of(3, "bbb"), Row.of(3, "ccc"));
String dataId = BoundedTableFactory.registerDataSet(ImmutableList.of(dataSet));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we produce more than one checkpoint? and add enough records in each part instead of enumerating them?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a single checkpoint is good enough to validate the PartitionKeySelector. More checkpoints will make the unit test more complex but validate the same thing in my mind.

Mocking more records as the testing data set looks good to me.

sql("INSERT INTO %s SELECT * FROM %s", tableName, SOURCE_TABLE);

Table table = validationCatalog.loadTable(TableIdentifier.of(icebergNamespace, tableName));
SimpleDataUtil.assertTableRecords(table, ImmutableList.of(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check records based on dataSet?

@yittgyittg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stevenzwu

stevenzwu commented Feb 23, 2022

Copy link
Copy Markdown
Contributor

@openinx I have run the test hundreds of times locally in a test loop like you did before and was never able to reproduce it.

Think again about the root cause that we discussed in the issue where we may miss the notifyCheckpointComplete callback. As a result, two checkpoint cycles got squashed into one Iceberg commit and hence have 2 files for a partition in one Iceberg commit.

I misunderstood the PR earlier. Looks like the change is to make sure we have one checkpoint cycle for all rows to bypass the potential problem from multiple checkpoint cycles.

@stevenzwustevenzwu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

nit: can we change the description to "by ingesting all rows in one checkpoint cycle"? Earlier, I misunderstood the PR. I mistakenly thought we are still doing multiple checkpoint cycles and we are just precisely control rows in each checkpoint cycle.

@openinx

Copy link
Copy Markdown
MemberAuthor

@stevenzwu The root cause is : Previous design could not guarantee that a single checkpoint could commit all rows to a given transaction. Here is another example. That's why we are now trying to guarantee this in this PR.

The new description looks good to me if you think it's more clear.

@openinxopeninx changed the title Flink 1.14: Fix the flaky testHashDistributeMode by controlling rows in one checkpoint preciselyFlink 1.14: Fix the flaky testHashDistributeMode by ingesting all rows in one checkpoint cycle.Feb 23, 2022
@stevenzwu

Copy link
Copy Markdown
Contributor

@openinx looks good. can you merge this? should be safe.

@rdblue
rdblue merged commit e6c08a8 into apache:masterFeb 23, 2022
@rdblue

Copy link
Copy Markdown
Contributor

Thanks for fixing the flaky test, @openinx!

openinx added a commit to openinx/iceberg that referenced this pull request Feb 24, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 16, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 17, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 17, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 17, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 17, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 18, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 18, 2022
nastra pushed a commit to nastra/iceberg that referenced this pull request May 18, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@openinx@stevenzwu@rdblue@yittg