Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D3E21029C for ; Thu, 22 Oct 2015 15:20:17 +0000 (UTC) Received: (qmail 68279 invoked by uid 500); 22 Oct 2015 15:20:04 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 68220 invoked by uid 500); 22 Oct 2015 15:20:04 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 68211 invoked by uid 99); 22 Oct 2015 15:20:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Oct 2015 15:20:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8C4A8E391F; Thu, 22 Oct 2015 15:20:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aw@apache.org To: common-commits@hadoop.apache.org Message-Id: <5a106afefa4c4c8eb480f8bd3423a7f9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: HADOOP-12436. GlobPattern regex library has performance issues with wildcard characters (Matthew Paduano via aw) Date: Thu, 22 Oct 2015 15:20:03 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/trunk 2798723a5 -> 4c0bae240 HADOOP-12436. GlobPattern regex library has performance issues with wildcard characters (Matthew Paduano via aw) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4c0bae24 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4c0bae24 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4c0bae24 Branch: refs/heads/trunk Commit: 4c0bae240bea9a475e8ee9a0b081bfce6d1cd1e5 Parents: 2798723 Author: Allen Wittenauer Authored: Thu Oct 22 08:19:56 2015 -0700 Committer: Allen Wittenauer Committed: Thu Oct 22 08:19:56 2015 -0700 ---------------------------------------------------------------------- LICENSE.txt | 35 ++++++++++++++++++++ hadoop-common-project/hadoop-common/CHANGES.txt | 3 ++ hadoop-common-project/hadoop-common/pom.xml | 6 ++++ .../java/org/apache/hadoop/fs/GlobFilter.java | 2 +- .../java/org/apache/hadoop/fs/GlobPattern.java | 7 ++-- .../metrics2/filter/AbstractPatternFilter.java | 4 +-- .../hadoop/metrics2/filter/GlobFilter.java | 2 +- .../hadoop/metrics2/filter/RegexFilter.java | 2 +- .../apache/hadoop/security/SaslRpcClient.java | 2 +- .../org/apache/hadoop/fs/TestGlobPattern.java | 9 +++-- hadoop-project/pom.xml | 3 ++ 11 files changed, 64 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/LICENSE.txt ---------------------------------------------------------------------- diff --git a/LICENSE.txt b/LICENSE.txt index f339a70..46da0f8 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -320,6 +320,41 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +For com.google.re2j.* classes: +--------------------------------------------------------------------- +This is a work derived from Russ Cox's RE2 in Go, whose license +http://golang.org/LICENSE is as follows: + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + For hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/util/tree.h --------------------------------------------------------------------- Copyright 2002 Niels Provos http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index aebd4f3..ce2a2a7 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -243,6 +243,9 @@ Trunk (Unreleased) HADOOP-12249. pull argument parsing into a function (aw) + HADOOP-12436. GlobPattern regex library has performance issues with + wildcard characters (Matthew Paduano via aw) + BUG FIXES HADOOP-11473. test-patch says "-1 overall" even when all checks are +1 http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/pom.xml b/hadoop-common-project/hadoop-common/pom.xml index 21af670..4e47a3f 100644 --- a/hadoop-common-project/hadoop-common/pom.xml +++ b/hadoop-common-project/hadoop-common/pom.xml @@ -192,6 +192,12 @@ test + com.google.re2j + re2j + ${re2j.version} + compile + + com.google.protobuf protobuf-java compile http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java index 24bff5f..e649bd2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java @@ -18,7 +18,7 @@ package org.apache.hadoop.fs; -import java.util.regex.PatternSyntaxException; +import com.google.re2j.PatternSyntaxException; import java.io.IOException; import org.apache.hadoop.classification.InterfaceAudience; http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java index 4be5b1c..16505a6 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java @@ -18,8 +18,8 @@ package org.apache.hadoop.fs; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; +import com.google.re2j.Pattern; +import com.google.re2j.PatternSyntaxException; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; @@ -164,6 +164,7 @@ public class GlobPattern { } private static void error(String message, String pattern, int pos) { - throw new PatternSyntaxException(message, pattern, pos); + String fullMessage = String.format("%s at pos %d", message, pos); + throw new PatternSyntaxException(fullMessage, pattern); } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/AbstractPatternFilter.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/AbstractPatternFilter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/AbstractPatternFilter.java index 07b50ab..bf35c41 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/AbstractPatternFilter.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/AbstractPatternFilter.java @@ -19,8 +19,6 @@ package org.apache.hadoop.metrics2.filter; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import com.google.common.collect.Maps; import org.apache.commons.configuration.SubsetConfiguration; @@ -30,6 +28,8 @@ import org.apache.hadoop.metrics2.MetricsException; import org.apache.hadoop.metrics2.MetricsFilter; import org.apache.hadoop.metrics2.MetricsTag; +import com.google.re2j.Matcher; +import com.google.re2j.Pattern; /** * Base class for pattern based filters */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/GlobFilter.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/GlobFilter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/GlobFilter.java index ad4a514..7311428 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/GlobFilter.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/GlobFilter.java @@ -18,12 +18,12 @@ package org.apache.hadoop.metrics2.filter; -import java.util.regex.Pattern; import org.apache.hadoop.fs.GlobPattern; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import com.google.re2j.Pattern; /** * A glob pattern filter for metrics. * http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/RegexFilter.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/RegexFilter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/RegexFilter.java index 45cb996..31c1266 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/RegexFilter.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/filter/RegexFilter.java @@ -18,11 +18,11 @@ package org.apache.hadoop.metrics2.filter; -import java.util.regex.Pattern; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import com.google.re2j.Pattern; /** * A regex pattern filter for metrics */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java index 7d3afa8..83adc4a 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java @@ -33,7 +33,6 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; @@ -75,6 +74,7 @@ import org.apache.hadoop.util.ProtoUtil; import com.google.common.annotations.VisibleForTesting; import com.google.protobuf.ByteString; +import com.google.re2j.Pattern; /** * A utility class that encapsulates SASL logic for RPC client */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestGlobPattern.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestGlobPattern.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestGlobPattern.java index 0fffc47..356c442 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestGlobPattern.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestGlobPattern.java @@ -18,10 +18,10 @@ package org.apache.hadoop.fs; -import java.util.regex.PatternSyntaxException; import org.junit.Test; import static org.junit.Assert.*; +import com.google.re2j.PatternSyntaxException; /** * Tests for glob patterns */ @@ -69,6 +69,11 @@ public class TestGlobPattern { } @Test public void testInvalidPatterns() { - shouldThrow("[", "[[]]", "[][]", "{", "\\"); + shouldThrow("[", "[[]]", "{", "\\"); + } + + @Test(timeout=1000) public void testPathologicalPatterns() { + String badFilename = "job_1429571161900_4222-1430338332599-tda%2D%2D+******************************+++...%270%27%28Stage-1430338580443-39-2000-SUCCEEDED-production%2Dhigh-1430338340360.jhist"; + assertMatch(true, badFilename, badFilename); } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c0bae24/hadoop-project/pom.xml ---------------------------------------------------------------------- diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 9724b18..d59c44a 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -68,6 +68,9 @@ 1.9.13 2.2.3 + + 1.0 + 2.5.0