Skip to content

Inconsistent order of tuned-group-by output causes random failure #141

Closed
@visibletrap

Description

@visibletrap

We are having random failure issue with our test suite. This is the result of our investigation.

  • We have a rule which inserts a few facts in the rhs.
  • In our test suite, at flush-updates, in some runs, one fact is processed first which result to a passing test, but in some other runs, the other fact is processed first which result to a failing test.
  • We found that the reason why the facts are processed in a random order betwenn the runs is because output of tuned-group-by doesn't always be in a consistent order.
  • The reason why tuned-group-by output doesn't return a list in consistent order is because Java's HashMap, which is using internally, doesn't keep or guarantee any order.

Now, I have some questions regarding this.

  • Does this make sense to you? Do you see any wrong conclusions here?
  • Is the processing order really important here or is it just incidental? Is it possible to make a modification such that we don't care about the output order of tuned-group-by?
  • If the order is essential, should we drop back to use default Clojure's group-by? Have you had a performance issue because of using it?

Note 1: Clojure's group-by guarantees the result order.
Note 2: I wrote a generative test to show that Clojure's group-by and tuned-group-by don't return result in the same order before I realize that it's apparent since Java's HashMap doesn't provide order guarantee. I'll put it here just in case you want to check it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions