title: reduce cannot run after map 100%
body: <p>Today I ran a job on hadoop of two nodes.My program hang after map 100% and reduce cannot run.
  The messages returned are:</p>
  
  <pre><code>14/01/15 20:30:49 INFO input.FileInputFormat: Total input paths to process : 25
  14/01/15 20:30:49 INFO util.NativeCodeLoader: Loaded the native-hadoop library
  14/01/15 20:30:49 WARN snappy.LoadSnappy: Snappy native library not loaded
  14/01/15 20:30:51 INFO mapred.JobClient: Running job: job_201401152029_0001
  14/01/15 20:30:52 INFO mapred.JobClient:  map 0% reduce 0%
  14/01/15 20:30:58 INFO mapred.JobClient:  map 7% reduce 0%
  14/01/15 20:31:01 INFO mapred.JobClient:  map 15% reduce 0%
  14/01/15 20:31:22 INFO mapred.JobClient:  map 100% reduce 0%
  </code></pre>
  
  <p>My source code are:</p>
  
  <p>PollingImage.java:</p>
  
  <pre><code>package imagePolling;
  import java.io.IOException;
  import java.util.*;
  
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.io.*;
  import org.apache.hadoop.conf.*;
  
  import org.apache.hadoop.mapreduce.*;
  import org.apache.hadoop.mapreduce.lib.input.*;
  import org.apache.hadoop.mapreduce.lib.output.*;
  import org.apache.hadoop.util.*;
  
  public class PollingImage extends Configured implements Tool{
  public int run(String[] args) throws Exception{
      Job job = new Job(getConf());
      job.setJarByClass(PollingImage.class);
      job.setJobName("polling_image");
  
      job.setMapperClass(PollingMapper.class);
      job.setReducerClass(PollingReducer.class);
      job.setMapOutputKeyClass(Text.class);
      job.setMapOutputValueClass(Text.class);
      job.setOutputKeyClass(Text.class);
      job.setOutputValueClass(Text.class);
      //job.setNumReduceTasks(0);
      job.setInputFormatClass(TextInputFormat.class);
      job.setOutputFormatClass(TextOutputFormat.class);
  
      FileInputFormat.setInputPaths(job,new Path(args[0]));
      FileOutputFormat.setOutputPath(job, new Path(args[1]));
  
      boolean success = job.waitForCompletion(true);
  
      return success?0:1;
  }
  public static void main(String[] args) {
      try{
          int ret = ToolRunner.run(new PollingImage(), args);
          System.exit(ret);
      }catch(Exception ex){
          System.out.println(ex.getMessage());
      }
  }
  }
  </code></pre>
  
  <p>PollingMapper.java:</p>
  
  <pre><code>package imagePolling;
  import java.io.IOException;
  
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.io.*;
  import org.apache.hadoop.mapreduce.*;
  import org.apache.hadoop.mapreduce.lib.input.*;
  
  public class PollingMapper extends Mapper&lt;LongWritable, Text, Text, Text&gt; {
  private Text nameKey=new Text();
  public void map(LongWritable key,Text value,Context ctx) throws                 IOException,InterruptedException {
      Path filePath=((FileSplit)ctx.getInputSplit()).getPath();
      String name=filePath.getName().replaceAll(".txt", "");
      nameKey = new Text(name);
      ctx.write(nameKey, value);
  }
  }
  </code></pre>
  
  <p>PollingReducer.java:</p>
  
  <pre><code>package imagePolling;
  import java.io.IOException;
  import java.util.StringTokenizer;
  
  import org.apache.hadoop.io.*;
  import org.apache.hadoop.mapreduce.Reducer;
  
  public class PollingReducer extends Reducer&lt;Text, Text, Text, Text&gt; {
  @Override
  public void reduce(Text key,Iterable&lt;Text&gt; values,Context ctx) throws IOException,InterruptedException {
      Text v=new Text("a fool");
      ctx.write(key, v);
  }
  }
  </code></pre>
  
  <p>I have read the logs.It just show that the map has completed and nothing about reduce.</p>