[
https://issues.apache.org/jira/browse/FLINK-39423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rui Fan resolved FLINK-39423.
-----------------------------
Resolution: Fixed
Merged to master(2.3.0) via: a267e58e69babbdc6b2991ca480acc36b9556dcb and
ec02b44cb56aefd17c0afc71b29d2213918881c6
> Fix PseudoRandomValueSelector.randomize() producing identical values for all
> boolean config options
> ---------------------------------------------------------------------------------------------------
>
> Key: FLINK-39423
> URL: https://issues.apache.org/jira/browse/FLINK-39423
> Project: Flink
> Issue Type: Bug
> Components: Test Infrastructure
> Reporter: Rui Fan
> Assignee: Rui Fan
> Priority: Major
> Labels: pull-request-available
>
> h2. Problem
> All boolean config options always get the *same* value within a single test —
> either all {{true}} or all {{{}false{}}}:
> {code:java}
> Randomly selected true for
> execution.checkpointing.unaligned.recover-output-on-downstream.enabled
> Randomly selected true for
> execution.checkpointing.unaligned.during-recovery.enabled
> Randomly selected true for execution.checkpointing.cleaner.parallel-mode
> Randomly selected true for
> execution.checkpointing.unaligned.interruptible-timers.enabled
> Randomly selected true for execution.checkpointing.snapshot-compression
> Randomly selected true for execution.checkpointing.file-merging.enabled
> Randomly selected true for
> state.backend.rocksdb.use-ingest-db-restore-mode{code}
>
> This reduces test coverage since many configuration combinations are never
> tested.
> h2. Root Cause
> [{{randomize()}}|https://github.com/apache/flink/blob/master/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/PseudoRandomValueSelector.java#L128-L133]
> [1] creates a new {{java.util.Random}} with the same seed (commit hash +
> test name) for every call. Since {{new Random(seed).nextInt(2)}} is
> deterministic, all boolean options get identical results.
> h2. Fix
> Include the config option key in the seed so each option gets a different
> seed:
> {code:java}
> PseudoRandomValueSelector.create(
> (testName != null ? testName : "unknown") + option.key());{code}
>
> {{[1] }}
> [https://github.com/apache/flink/blob/master/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/PseudoRandomValueSelector.java#L128-L133]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)