Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-5136

TestJobImpl->testJobNoTasks fails with IBM JAVA

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.3-alpha
    • 2.1.0-beta
    • None
    • None
    • Linux + IBM JAVA 6

    • Reviewed

    Description

      I am not sure if this is a testcase or a design issue. During execution of TestJobImpl->testJobNoTasks() there is an assertion made based on the order of key/value pairs stored in adjacency list. However adjacency list was created by Configuration->getValByRegex() as a HashMap (order is not guaranteed):

      Testcase:
      JobSubmittedEventHandler jseHandler = new JobSubmittedEventHandler("testId",
      "testName", "testNodeName", "\"key2\"=\"value2\" \"key1\"=\"value1\" ");
      ....
      ....
      try {
      Assert.assertTrue(jseHandler.getAssertValue()); <===

      Configuration->getValByRegex():
      public Map<String,String> getValByRegex(String regex) {
      Pattern p = Pattern.compile(regex);
      Map<String,String> result = new HashMap<String,String>(); <=======

      as we all know, HashMap makes absolutely no guarantees about the iteration order. It can (and will) even change completely when new elements are added.

      Changing HashMap to LinkedHashMap fixes the ordering inconsistency, however with a small performance side effect.

      Attachments

        1. MAPREDUCE-5136.patch
          1 kB
          Amir F Sanjar

        Activity

          People

            asanjar Amir F Sanjar
            asanjar Amir F Sanjar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: