Skip to content

Conversation

@openinx
Copy link
Member

@openinx openinx commented Feb 22, 2022

This PR is trying to fix the flaky testHashDistributeMode unit test fundamentally. The following are the explannation about the current fix.

  1. Flink: fix flink unit test testHashDistributeMode #4117 (comment)
  2. Flink: fix flink unit test testHashDistributeMode #4117 (comment)
  3. Flakey flink unit tests TestFlinkTableSink#testHashDistributeMode #2575 (comment)

@openinx openinx added this to the Iceberg 0.14.0 Release milestone Feb 22, 2022
@github-actions github-actions bot added the flink label Feb 22, 2022
@openinx
Copy link
Member Author

openinx commented Feb 22, 2022

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
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
Member Author

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
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?

Copy link
Contributor

@yittg yittg left a comment

Choose a reason for hiding this comment

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

LGTM

@stevenzwu
Copy link
Contributor

stevenzwu commented Feb 23, 2022

@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.

Copy link
Contributor

@stevenzwu stevenzwu left a comment

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
Member Author

openinx commented Feb 23, 2022

@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.

@openinx openinx changed the title Flink 1.14: Fix the flaky testHashDistributeMode by controlling rows in one checkpoint precisely Flink 1.14: Fix the flaky testHashDistributeMode by ingesting all rows in one checkpoint cycle. Feb 23, 2022
@stevenzwu
Copy link
Contributor

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

@rdblue rdblue merged commit e6c08a8 into apache:master Feb 23, 2022
@rdblue
Copy link
Contributor

rdblue commented Feb 23, 2022

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 free to 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