HADOOP-6788. [Herriot] Exception exclusion functionality is not working

correctly. Contributed by Vinay Kumar Thota.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@951259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Konstantin Boudnik 2010-06-04 04:10:17 +00:00
parent 908fd4506f
commit 04a00b74f5
2 changed files with 25 additions and 10 deletions

View File

@ -970,6 +970,9 @@ Release 0.21.0 - Unreleased
BUG FIXES BUG FIXES
HADOOP-6788. [Herriot] Exception exclusion functionality is not working
correctly. (Vinay Thota via cos)
HADOOP-6773. Ivy folder contains redundant files (cos) HADOOP-6773. Ivy folder contains redundant files (cos)
HADOOP-5379. CBZip2InputStream to throw IOException on data crc error. HADOOP-5379. CBZip2InputStream to throw IOException on data crc error.

View File

@ -256,19 +256,31 @@ public aspect DaemonProtocolAspect {
public int DaemonProtocol.getNumberOfMatchesInLogFile(String pattern, public int DaemonProtocol.getNumberOfMatchesInLogFile(String pattern,
String[] list) throws IOException { String[] list) throws IOException {
StringBuffer filePattern = new StringBuffer(getFilePattern()); StringBuffer filePattern = new StringBuffer(getFilePattern());
if(list != null){ String[] cmd = null;
for(int i =0; i < list.length; ++i) if (list != null) {
{ StringBuffer filterExpPattern = new StringBuffer();
filePattern.append(" | grep -v " + list[i] ); int index=0;
for (String excludeExp : list) {
if (index++ < list.length -1) {
filterExpPattern.append("grep -v " + excludeExp + " | ");
} else {
filterExpPattern.append("grep -vc " + excludeExp);
}
} }
} cmd = new String[] {
String[] cmd = "bash",
new String[] { "-c",
"bash", "grep "
"-c", + pattern + " " + filePattern + " | "
"grep -c " + filterExpPattern};
} else {
cmd = new String[] {
"bash",
"-c",
"grep -c "
+ pattern + " " + filePattern + pattern + " " + filePattern
+ " | awk -F: '{s+=$2} END {print s}'" }; + " | awk -F: '{s+=$2} END {print s}'" };
}
ShellCommandExecutor shexec = new ShellCommandExecutor(cmd); ShellCommandExecutor shexec = new ShellCommandExecutor(cmd);
shexec.execute(); shexec.execute();
String output = shexec.getOutput(); String output = shexec.getOutput();