Skip to content
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

Fix non-determinism in test - AlignByDeviceOrderByLimitOffsetTest#orderByExpressionTest1 #13961

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohitbadve
Copy link

@mohitbadve mohitbadve commented Oct 30, 2024

Description

The test org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest#orderByExpressionTest1 fails under NonDex tool which detects non-deterministic nature of tests with when non-deterministic data structures are used. The failure behavior is defined by incorrect ordering of relatedDataRegions. relatedDataRegions is a hashset and hence doesn't have deterministic order as per the java documentation, but is iterated over in the method constructDeviceViewNodeListWithCrossRegion.

How to Reproduce

mvn -pl iotdb-core/datanode edu.illinois:nondex-maven-plugin:2.1.7:nondex 
-Dtest=org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest#orderByExpressionTest1 
-DnondexRuns=10

Error

[INFO] Running org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.430 s <<< FAILURE! -- in org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest
[ERROR] org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest.orderByExpressionTest1 -- Time elapsed: 1.411 s <<< FAILURE!
java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertTrue(Assert.java:53)
	at org.apache.iotdb.db.queryengine.plan.planner.distribution.AlignByDeviceOrderByLimitOffsetTest.orderByExpressionTest1(AlignByDeviceOrderByLimitOffsetTest.java:820)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ...

Proposed Solution

Use LinkedHashSet instead of HashSet to keep the ordering deterministic
Please let me know if you have any questions or need any additional justification/changes from my side.


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hi, this is your first pull request in IoTDB project. Thanks for your contribution! IoTDB will be better because of you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant