Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12436

GlobPattern regex library has performance issues with wildcard characters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.0, 2.7.1
    • 3.0.0-alpha1
    • fs
    • None
    • Incompatible change
    • GlobFilter and RegexFilter.compile() now returns com.google.re2j.pattern.Pattern instead of java.util.regex.Pattern

    Description

      java.util.regex classes have performance problems with certain wildcard patterns. Namely, consecutive * characters in a file name (not properly escaped as literals) will cause commands such as "hadoop fs -ls file******name" to consume 100% CPU and probably never return in a reasonable time (time scales with number of *'s).

      Here is an example:

      hadoop fs -touchz /user/mattp/job_1429571161900_4222-1430338332599-tda%2D%2D\\\+\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\*\\\+\\\+\\\+...%270%27%28Stage-1430338580443-39-2000-SUCCEEDED-production%2Dhigh-1430338340360.jhist
      hadoop fs -ls /user/mattp/job_1429571161900_4222-1430338332599-tda%2D%2D+******************************+++...%270%27%28Stage-1430338580443-39-2000-SUCCEEDED-production%2Dhigh-1430338340360.jhist
      

      causes:

      PID    COMMAND      %CPU   TIME  
      14526  java         100.0  01:18.85 
      

      Not every string of *'s causes this, but the above filename reproduces this reliably.

      Attachments

        1. HADOOP-12436.01.patch
          6 kB
          Matthew Paduano
        2. HADOOP-12436.02.patch
          7 kB
          Matthew Paduano
        3. HADOOP-12436.03.patch
          9 kB
          Matthew Paduano
        4. HADOOP-12436.04.patch
          9 kB
          Matthew Paduano
        5. HADOOP-12436.05.patch
          10 kB
          Matthew Paduano

        Issue Links

          Activity

            People

              mattpaduano Matthew Paduano
              mattpaduano Matthew Paduano
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: