Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-2936 Running Accumulo on different JVMs
  3. ACCUMULO-2942

org.apache.accumulo.core.util.format.ShardedTableDistributionFormatterTest.testAggregate failure

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.6.1, 1.7.0
    • tserver
    • IBM JVM

    Description

      org.apache.accumulo.core.util.format.ShardedTableDistributionFormatterTest.testAggregate . This fails on IBM JRE, since the test is asserting order of elements in a HashMap. This consistently passes on Sun , and consistently fails on Oracle.

      The ShardedTableDistributionFormatter inherits from AggregatingFormatter which has 2 overriding methods - aggregateStats and getStats. In the ShardedTableDistributionFormatter implementation, the aggregateStats prepares a list based on the HashMap, and the getStats creates a string by serializing values in the HashMap.

      Due to the unpredictability of Hash ordering in different Java versions (even same vendor, different versions), the getStats() output is inconsistent. This is not a problem in itself. However since we are asserting on the content of getStats, we we either make the getStatus consistent or we do some refactoring and do 2 tests - one test on the structure that getStats is serializing, and another test to assert the output of getStats based on a predictable structure.

      Some people expressed concern for changing the underlying structure from a HashMap to TreeMap due to performance considerations. Question is, is this code ever executed in such an environment to be concerned about this?

      Alternatively, we could just change the getStats method, which is after the 'heavy-lifting' of iterating over all entries. The stats that are calculated are aggregates per day. Therefore this will not be such a large structure, and could then be sorted before being output.

      Attachments

        Issue Links

          Activity

            People

              haydenmarchant Hayden Marchant
              haydenmarchant Hayden Marchant
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Time Spent - 20m Remaining Estimate - 23h 40m
                  23h 40m
                  Logged:
                  Time Spent - 20m Remaining Estimate - 23h 40m
                  20m