svn merge -c 1344763 FIXES: 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/branches/branch-2@1344764 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Joseph Evans 2012-05-31 15:17:39 +00:00
parent 71d16b28d5
commit f376251475
3 changed files with 10 additions and 3 deletions

View File

@ -431,6 +431,9 @@ Release 0.23.3 - UNRELEASED
MAPREDUCE-4152. map task left hanging after AM dies trying to connect to RM MAPREDUCE-4152. map task left hanging after AM dies trying to connect to RM
(Tom Graves via bobby) (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 Release 0.23.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -522,7 +522,8 @@ hadoop jar <gridmix-jar> org.apache.hadoop.mapred.gridmix.Gridmix \
</source> </source>
<p>For backward compatibility reasons, each line of users-list file can <p>For backward compatibility reasons, each line of users-list file can
contain username followed by groupnames in the form username[,group]*. 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.
</p> </p>
</section> </section>

View File

@ -68,15 +68,18 @@ public class RoundRobinUserResolver implements UserResolver {
try { try {
in = new LineReader(fs.open(userloc)); in = new LineReader(fs.open(userloc));
while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]* 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 // e is end position of user name in this line
int e = rawUgi.find(","); int e = rawUgi.find(",");
if (rawUgi.getLength() == 0 || e == 0) { if (e == 0) {
throw new IOException("Missing username: " + rawUgi); throw new IOException("Missing username: " + rawUgi);
} }
if (e == -1) { if (e == -1) {
e = rawUgi.getLength(); 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; UserGroupInformation ugi = null;
try { try {
ugi = UserGroupInformation.createProxyUser(username, ugi = UserGroupInformation.createProxyUser(username,