Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Data Processors
    • Labels:
      None

      Description

      The current pattern used for extracting tags from the tags field:

      Pattern tagPattern = Pattern.compile("."tagName"=\"(.?)\".*");

      Doesn't work very well. If you pass tagName "bar", will also match (and return) the content of foobar="dssad" tag.

      The proposed path is more correct, and also faster than using .*

      1. fixpat.patch
        0.6 kB
        Ari Rabkin
      2. improve_tags_pattern-v2.diff
        0.9 kB
        Guille -bisho-
      3. improve_tags_pattern.diff
        0.8 kB
        Guille -bisho-

        Activity

        Hide
        hudson Hudson added a comment -
        Show
        hudson Hudson added a comment - Integrated in Chukwa-trunk #330 (See http://hudson.zones.apache.org/hudson/job/Chukwa-trunk/330/ )
        Hide
        asrabkin Ari Rabkin added a comment -

        I just committed this.

        Show
        asrabkin Ari Rabkin added a comment - I just committed this.
        Hide
        bisho Guille -bisho- added a comment -

        Look fine!

        Show
        bisho Guille -bisho- added a comment - Look fine!
        Hide
        asrabkin Ari Rabkin added a comment -

        With patch, all unit tests pass on my end. Look OK?

        Show
        asrabkin Ari Rabkin added a comment - With patch, all unit tests pass on my end. Look OK?
        Hide
        asrabkin Ari Rabkin added a comment -

        This causes TestFilter to fail.

        Show
        asrabkin Ari Rabkin added a comment - This causes TestFilter to fail.
        Hide
        asrabkin Ari Rabkin added a comment -

        Just committed revised patch. Moral of the story: Unit tests are your friends.

        Show
        asrabkin Ari Rabkin added a comment - Just committed revised patch. Moral of the story: Unit tests are your friends.
        Hide
        bisho Guille -bisho- added a comment -

        The test was failing because of CHUKWA-462 I have applied in my local branch. Tests pass fine with patch v2.

        Show
        bisho Guille -bisho- added a comment - The test was failing because of CHUKWA-462 I have applied in my local branch. Tests pass fine with patch v2.
        Hide
        bisho Guille -bisho- added a comment -

        There is still one test failing:

        Testcase: testFSMBuilder_JobHistory020(org.apache.hadoop.chukwa.analysis.salsa.fsm.TestFSMBuilder): FAILED
        Error running FSMBuilder: java.io.IOException: Job failed!
        junit.framework.AssertionFailedError: Error running FSMBuilder: java.io.IOException: Job failed!
        at org.apache.hadoop.chukwa.analysis.salsa.fsm.TestFSMBuilder.testFSMBuilder_JobHistory020(TestFSMBuilder.java:354)

        I don't know why, because the cluster is extracted correctly. I will continue with this on tuesday, I'm on a travel. If anyone know what could be happening here, please tell me.

        Show
        bisho Guille -bisho- added a comment - There is still one test failing: Testcase: testFSMBuilder_JobHistory020(org.apache.hadoop.chukwa.analysis.salsa.fsm.TestFSMBuilder): FAILED Error running FSMBuilder: java.io.IOException: Job failed! junit.framework.AssertionFailedError: Error running FSMBuilder: java.io.IOException: Job failed! at org.apache.hadoop.chukwa.analysis.salsa.fsm.TestFSMBuilder.testFSMBuilder_JobHistory020(TestFSMBuilder.java:354) I don't know why, because the cluster is extracted correctly. I will continue with this on tuesday, I'm on a travel. If anyone know what could be happening here, please tell me.
        Hide
        bisho Guille -bisho- added a comment -

        Fixed patch

        Show
        bisho Guille -bisho- added a comment - Fixed patch
        Hide
        bisho Guille -bisho- added a comment -

        Wrong patch

        Show
        bisho Guille -bisho- added a comment - Wrong patch
        Hide
        bisho Guille -bisho- added a comment -

        Damm! I'm sorry. This may break things.

        I'm not expert in java regexp, and I didn't notice that matches only matches if the full string starts with tagName="...

        For a regular expresion that can match in the middle of a string, we need to do a matcher.find() instead.

        I re-atach a diff.

        Show
        bisho Guille -bisho- added a comment - Damm! I'm sorry. This may break things. I'm not expert in java regexp, and I didn't notice that matches only matches if the full string starts with tagName="... For a regular expresion that can match in the middle of a string, we need to do a matcher.find() instead. I re-atach a diff.
        Hide
        asrabkin Ari Rabkin added a comment -

        I just committed this. Thanks!

        Show
        asrabkin Ari Rabkin added a comment - I just committed this. Thanks!
        Hide
        asrabkin Ari Rabkin added a comment -

        Good catch. +1 ; will commit later today.

        Show
        asrabkin Ari Rabkin added a comment - Good catch. +1 ; will commit later today.
        Hide
        bisho Guille -bisho- added a comment -

        Proposed patch

        Show
        bisho Guille -bisho- added a comment - Proposed patch

          People

          • Assignee:
            asrabkin Ari Rabkin
            Reporter:
            bisho Guille -bisho-
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development