diff --git a/client-mr/core/src/main/java/org/apache/hadoop/mapred/SortWriteBufferManager.java b/client-mr/core/src/main/java/org/apache/hadoop/mapred/SortWriteBufferManager.java index ea450619bd..0da7cd9304 100644 --- a/client-mr/core/src/main/java/org/apache/hadoop/mapred/SortWriteBufferManager.java +++ b/client-mr/core/src/main/java/org/apache/hadoop/mapred/SortWriteBufferManager.java @@ -239,7 +239,9 @@ private void prepareBufferForSend(List shuffleBlocks, SortWrit if (combinerRunner != null) { try { buffer = combineBuffer(buffer); - LOG.debug("Successfully finished combining."); + if (LOG.isDebugEnabled()) { + LOG.debug("Successfully finished combining."); + } } catch (Exception e) { LOG.error("Error occurred while combining in Map:", e); } diff --git a/client-mr/core/src/test/java/org/apache/hadoop/mapred/SortWriteBufferManagerTest.java b/client-mr/core/src/test/java/org/apache/hadoop/mapred/SortWriteBufferManagerTest.java index 929ecf3d18..fbb2803913 100644 --- a/client-mr/core/src/test/java/org/apache/hadoop/mapred/SortWriteBufferManagerTest.java +++ b/client-mr/core/src/test/java/org/apache/hadoop/mapred/SortWriteBufferManagerTest.java @@ -366,6 +366,22 @@ public void testCombineBuffer() throws Exception { Task.CombinerRunner.create( jobConf, new TaskAttemptID(), combineInputCounter, reporter, null); + SortWriteBuffer buffer = + new SortWriteBuffer( + 1, comparator, 10000, keySerializer, valueSerializer); + + List wordTable = + Lists.newArrayList( + "apple", "banana", "fruit", "cherry", "Chinese", "America", "Japan", "tomato"); + Random random = new Random(); + for (int i = 0; i < 8; i++) { + buffer.addRecord(new Text(wordTable.get(i)), new IntWritable(1)); + } + for (int i = 0; i < 100; i++) { + int index = random.nextInt(wordTable.size()); + buffer.addRecord(new Text(wordTable.get(index)), new IntWritable(1)); + } + SortWriteBufferManager manager = new SortWriteBufferManager( 10240, @@ -394,22 +410,6 @@ public void testCombineBuffer() throws Exception { new RssConf(), combinerRunner); - SortWriteBuffer buffer = - new SortWriteBuffer( - 1, comparator, 10000, keySerializer, valueSerializer); - - List wordTable = - Lists.newArrayList( - "apple", "banana", "fruit", "cherry", "Chinese", "America", "Japan", "tomato"); - Random random = new Random(); - for (int i = 0; i < 8; i++) { - buffer.addRecord(new Text(wordTable.get(i)), new IntWritable(1)); - } - for (int i = 0; i < 100; i++) { - int index = random.nextInt(wordTable.size()); - buffer.addRecord(new Text(wordTable.get(index)), new IntWritable(1)); - } - buffer.sort(); SortWriteBuffer newBuffer = manager.combineBuffer(buffer);