hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r486810 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/InputFormatBase.java src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java
Date Wed, 13 Dec 2006 19:31:48 GMT
Author: cutting
Date: Wed Dec 13 11:31:47 2006
New Revision: 486810

URL: http://svn.apache.org/viewvc?view=rev&rev=486810
Log:
HADOOP-794.  Fix a divide-by-zero exception when a job specifies zero map tasks.  Contributed
by Owen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/InputFormatBase.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=486810&r1=486809&r2=486810
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Dec 13 11:31:47 2006
@@ -86,6 +86,9 @@
 24. HADOOP-720.  Add an HDFS white paper to website.
     (Dhruba Borthakur via cutting) 
 
+25. HADOOP-794.  Fix a divide-by-zero exception when a job specifies
+    zero map tasks.  (omalley via cutting)
+
 
 Release 0.9.1 - 2006-12-06
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/InputFormatBase.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/InputFormatBase.java?view=diff&rev=486810&r1=486809&r2=486810
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/InputFormatBase.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/InputFormatBase.java Wed Dec 13
11:31:47 2006
@@ -130,8 +130,7 @@
       totalSize += fs.getLength(files[i]);
     }
 
-    long goalSize = totalSize / numSplits;   // start w/ desired num splits
-
+    long goalSize = totalSize / (numSplits == 0 ? 1 : numSplits);
     long minSize = Math.max(job.getLong("mapred.min.split.size", 1),
                             minSplitSize);
 
@@ -159,7 +158,7 @@
         }
       }
     }
-    //LOG.info( "Total # of splits: " + splits.size() );
+    LOG.debug( "Total # of splits: " + splits.size() );
     return (FileSplit[])splits.toArray(new FileSplit[splits.size()]);
   }
 

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java?view=diff&rev=486810&r1=486809&r2=486810
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java Wed Dec 13
11:31:47 2006
@@ -174,7 +174,11 @@
           assertEquals("The\t1\nbrown\t1\nfox\t2\nhas\t1\nmany\t1\n" +
                        "quick\t1\nred\t1\nsilly\t1\nsox\t1\n", result);
           checkTaskDirectories(mr, new String[]{"job_0002"}, new String[]{"task_0002_m_000001_0"});
-          
+          // test with maps=0
+          jobConf = new JobConf();
+          result = launchWordCount(namenode, jobTrackerName, jobConf, 
+                                   "owen is oom", 0, 1);
+          assertEquals("is\t1\noom\t1\nowen\t1\n", result);
       } finally {
           if (fileSys != null) { fileSys.close(); }
           if (dfs != null) { dfs.shutdown(); }



Mime
View raw message