From 8bbacfaa31b5ab3a739e420979692220ec1ceccf Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Thu, 31 May 2012 15:16:48 +0000 Subject: [PATCH] MAPREDUCE-4297. Usersmap file in gridmix should not fail on empty lines (Ravi Prakash via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1344763 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../src/docs/src/documentation/content/xdocs/gridmix.xml | 3 ++- .../hadoop/mapred/gridmix/RoundRobinUserResolver.java | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index fcc57dd41f..f7486d304f 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -547,6 +547,9 @@ Release 0.23.3 - UNRELEASED MAPREDUCE-4152. map task left hanging after AM dies trying to connect to RM (Tom Graves via bobby) + MAPREDUCE-4297. Usersmap file in gridmix should not fail on empty lines + (Ravi Prakash via bobby) + Release 0.23.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/src/docs/src/documentation/content/xdocs/gridmix.xml b/hadoop-mapreduce-project/src/docs/src/documentation/content/xdocs/gridmix.xml index 410ca407fc..5e5d0f4174 100644 --- a/hadoop-mapreduce-project/src/docs/src/documentation/content/xdocs/gridmix.xml +++ b/hadoop-mapreduce-project/src/docs/src/documentation/content/xdocs/gridmix.xml @@ -538,7 +538,8 @@ hadoop jar <gridmix-jar> org.apache.hadoop.mapred.gridmix.Gridmix \

For backward compatibility reasons, each line of users-list file can contain username followed by groupnames in the form username[,group]*. - The groupnames will be ignored by Gridmix. + The groupnames will be ignored by Gridmix. Empty lines will also be + ignored.

diff --git a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java index db643de664..c06b0a24a2 100644 --- a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java +++ b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java @@ -68,15 +68,18 @@ public class RoundRobinUserResolver implements UserResolver { try { in = new LineReader(fs.open(userloc)); while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]* + if(rawUgi.toString().trim().equals("")) { + continue; //Continue on empty line + } // e is end position of user name in this line int e = rawUgi.find(","); - if (rawUgi.getLength() == 0 || e == 0) { + if (e == 0) { throw new IOException("Missing username: " + rawUgi); } if (e == -1) { e = rawUgi.getLength(); } - final String username = Text.decode(rawUgi.getBytes(), 0, e); + final String username = Text.decode(rawUgi.getBytes(), 0, e).trim(); UserGroupInformation ugi = null; try { ugi = UserGroupInformation.createProxyUser(username,