Modified: hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/TestFiPipelines.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/TestFiPipelines.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/TestFiPipelines.java (original) +++ hadoop/hdfs/trunk/src/test/aop/org/apache/hadoop/hdfs/TestFiPipelines.java Sat Aug 28 23:06:00 2010 @@ -78,7 +78,9 @@ public class TestFiPipelines { @Test public void pipeline_04() throws IOException { final String METHOD_NAME = GenericTestUtils.getMethodName(); - LOG.debug("Running " + METHOD_NAME); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + METHOD_NAME); + } final PipelinesTestUtil.PipelinesTest pipst = (PipelinesTestUtil.PipelinesTest) PipelinesTestUtil.initTest(); @@ -99,7 +101,9 @@ public class TestFiPipelines { @Test public void pipeline_05() throws IOException { final String METHOD_NAME = GenericTestUtils.getMethodName(); - LOG.debug("Running " + METHOD_NAME); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + METHOD_NAME); + } final PipelinesTestUtil.PipelinesTest pipst = (PipelinesTestUtil.PipelinesTest) PipelinesTestUtil.initTest(); @@ -126,7 +130,9 @@ public class TestFiPipelines { final String METHOD_NAME = GenericTestUtils.getMethodName(); final int MAX_PACKETS = 80; - LOG.debug("Running " + METHOD_NAME); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + METHOD_NAME); + } final PipelinesTestUtil.PipelinesTest pipst = (PipelinesTestUtil.PipelinesTest) PipelinesTestUtil.initTest(); @@ -148,13 +154,18 @@ public class TestFiPipelines { // The actual logic is expressed in DFSClient#computePacketChunkSize int bytesToSend = 700; while (cnt < 100 && pipst.getSuspend()) { - LOG.debug("_06(): " + cnt++ + " sending another " + bytesToSend + " bytes"); + if(LOG.isDebugEnabled()) { + LOG.debug("_06(): " + cnt++ + " sending another " + + bytesToSend + " bytes"); + } TestPipelines.writeData(fsOut, bytesToSend); } } catch (Exception e) { LOG.warn("Getting unexpected exception: ", e); } - LOG.debug("Last queued packet number " + pipst.getLastQueued()); + if(LOG.isDebugEnabled()) { + LOG.debug("Last queued packet number " + pipst.getLastQueued()); + } assertTrue("Shouldn't be able to send more than 81 packet", pipst.getLastQueued() <= 81); } @@ -171,23 +182,32 @@ public class TestFiPipelines { @Override public void run() { while (!done) { - LOG.debug("_06: checking for the limit " + test.getLastQueued() + - " and " + MAX); + if(LOG.isDebugEnabled()) { + LOG.debug("_06: checking for the limit " + test.getLastQueued() + + " and " + MAX); + } if (test.getLastQueued() >= MAX) { - LOG.debug("FI: Resume packets acking"); + if(LOG.isDebugEnabled()) { + LOG.debug("FI: Resume packets acking"); + } test.setSuspend(false); //Do not suspend ack sending any more done = true; } if (!done) try { - LOG.debug("_06: MAX isn't reached yet. Current=" + test.getLastQueued()); + if(LOG.isDebugEnabled()) { + LOG.debug("_06: MAX isn't reached yet. Current=" + + test.getLastQueued()); + } sleep(100); } catch (InterruptedException e) { } } assertTrue("Shouldn't be able to send more than 81 packet", test.getLastQueued() <= 81); try { - LOG.debug("_06: shutting down the cluster"); + if(LOG.isDebugEnabled()) { + LOG.debug("_06: shutting down the cluster"); + } // It has to be done like that, because local version of shutDownCluster() // won't work, because it tries to close an instance of FileSystem too. // Which is where the waiting is happening. @@ -196,7 +216,9 @@ public class TestFiPipelines { } catch (Exception e) { e.printStackTrace(); } - LOG.debug("End QueueChecker thread"); + if(LOG.isDebugEnabled()) { + LOG.debug("End QueueChecker thread"); + } } }
Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestPipelines.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestPipelines.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestPipelines.java (original) +++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestPipelines.java Sat Aug 28 23:06:00 2010 @@ -87,11 +87,15 @@ public class TestPipelines { @Test public void pipeline_01() throws IOException { final String METHOD_NAME = GenericTestUtils.getMethodName(); - LOG.debug("Running " + METHOD_NAME); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + METHOD_NAME); + } Path filePath = new Path("/" + METHOD_NAME + ".dat"); DFSTestUtil.createFile(fs, filePath, FILE_SIZE, REPL_FACTOR, rand.nextLong()); - LOG.debug("Invoking append but doing nothing otherwise..."); + if(LOG.isDebugEnabled()) { + LOG.debug("Invoking append but doing nothing otherwise..."); + } FSDataOutputStream ofs = fs.append(filePath); ofs.writeBytes("Some more stuff to write"); ((DFSOutputStream) ofs.getWrappedStream()).hflush(); @@ -130,7 +134,9 @@ public class TestPipelines { System.arraycopy(toWrite, 0, ret, (ret.length - bytesToWrite), bytesToWriteNext); written += bytesToWriteNext; - LOG.debug("Written: " + bytesToWriteNext + "; Total: " + written); + if(LOG.isDebugEnabled()) { + LOG.debug("Written: " + bytesToWriteNext + "; Total: " + written); + } bytesToWrite -= bytesToWriteNext; } return ret; Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReport.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReport.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReport.java (original) +++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestBlockReport.java Sat Aug 28 23:06:00 2010 @@ -108,19 +108,27 @@ public class TestBlockReport { ArrayList<Block> blocks = prepareForRide(filePath, METHOD_NAME, FILE_SIZE); - LOG.debug("Number of blocks allocated " + blocks.size()); + if(LOG.isDebugEnabled()) { + LOG.debug("Number of blocks allocated " + blocks.size()); + } long[] oldLengths = new long[blocks.size()]; int tempLen; for (int i = 0; i < blocks.size(); i++) { Block b = blocks.get(i); - LOG.debug("Block " + b.getBlockName() + " before\t" + "Size " + - b.getNumBytes()); + if(LOG.isDebugEnabled()) { + LOG.debug("Block " + b.getBlockName() + " before\t" + "Size " + + b.getNumBytes()); + } oldLengths[i] = b.getNumBytes(); - LOG.debug("Setting new length"); + if(LOG.isDebugEnabled()) { + LOG.debug("Setting new length"); + } tempLen = rand.nextInt(BLOCK_SIZE); b.set(b.getBlockId(), tempLen, b.getGenerationStamp()); - LOG.debug("Block " + b.getBlockName() + " after\t " + "Size " + - b.getNumBytes()); + if(LOG.isDebugEnabled()) { + LOG.debug("Block " + b.getBlockName() + " after\t " + "Size " + + b.getNumBytes()); + } } cluster.getNameNode().blockReport( cluster.getDataNodes().get(DN_N0).dnRegistration, @@ -129,8 +137,10 @@ public class TestBlockReport { List<LocatedBlock> blocksAfterReport = DFSTestUtil.getAllBlocks(fs.open(filePath)); - LOG.debug("After mods: Number of blocks allocated " + - blocksAfterReport.size()); + if(LOG.isDebugEnabled()) { + LOG.debug("After mods: Number of blocks allocated " + + blocksAfterReport.size()); + } for (int i = 0; i < blocksAfterReport.size(); i++) { Block b = blocksAfterReport.get(i).getBlock(); @@ -178,10 +188,14 @@ public class TestBlockReport { } ArrayList<Block> blocks = locatedToBlocks(lBlocks, removedIndex); - LOG.debug("Number of blocks allocated " + lBlocks.size()); + if(LOG.isDebugEnabled()) { + LOG.debug("Number of blocks allocated " + lBlocks.size()); + } for (Block b : blocks2Remove) { - LOG.debug("Removing the block " + b.getBlockName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Removing the block " + b.getBlockName()); + } for (File f : findAllFiles(dataDir, new MyFileFilter(b.getBlockName(), true))) { cluster.getDataNodes().get(DN_N0).getFSDataset().unfinalizeBlock(b); @@ -231,7 +245,9 @@ public class TestBlockReport { cluster.getNameNode().blockReport( cluster.getDataNodes().get(DN_N0).dnRegistration, new BlockListAsLongs(blocks, null).getBlockListAsLongs()); - LOG.debug("Got the command: " + dnCmd); + if(LOG.isDebugEnabled()) { + LOG.debug("Got the command: " + dnCmd); + } printStats(); assertEquals("Wrong number of CorruptedReplica+PendingDeletion " + @@ -313,12 +329,15 @@ public class TestBlockReport { Block corruptedBlock = blocks.get(randIndex); String secondNode = cluster.getDataNodes().get(DN_N1). getDatanodeRegistration().getStorageID(); - LOG.debug("Working with " + secondNode); - LOG.debug("BlockGS before " + blocks.get(randIndex).getGenerationStamp()); + if(LOG.isDebugEnabled()) { + LOG.debug("Working with " + secondNode); + LOG.debug("BlockGS before " + blocks.get(randIndex).getGenerationStamp()); + } corruptBlockGS(corruptedBlock); - LOG.debug("BlockGS after " + blocks.get(randIndex).getGenerationStamp()); - - LOG.debug("Done corrupting GS of " + corruptedBlock.getBlockName()); + if(LOG.isDebugEnabled()) { + LOG.debug("BlockGS after " + blocks.get(randIndex).getGenerationStamp()); + LOG.debug("Done corrupting GS of " + corruptedBlock.getBlockName()); + } cluster.getNameNode().blockReport( cluster.getDataNodes().get(DN_N1).dnRegistration, new BlockListAsLongs(blocks, null).getBlockListAsLongs()); @@ -338,7 +357,9 @@ public class TestBlockReport { randIndex--; corruptedBlock = blocks.get(randIndex); corruptBlockLen(corruptedBlock); - LOG.debug("Done corrupting length of " + corruptedBlock.getBlockName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Done corrupting length of " + corruptedBlock.getBlockName()); + } cluster.getNameNode().blockReport( cluster.getDataNodes().get(DN_N1).dnRegistration, new BlockListAsLongs(blocks, null).getBlockListAsLongs()); @@ -448,11 +469,15 @@ public class TestBlockReport { final boolean tooLongWait = false; final int TIMEOUT = 40000; - LOG.debug("Wait for datanode " + DN_N1 + " to appear"); + if(LOG.isDebugEnabled()) { + LOG.debug("Wait for datanode " + DN_N1 + " to appear"); + } while (cluster.getDataNodes().size() <= DN_N1) { waitTil(20); } - LOG.debug("Total number of DNs " + cluster.getDataNodes().size()); + if(LOG.isDebugEnabled()) { + LOG.debug("Total number of DNs " + cluster.getDataNodes().size()); + } // Look about specified DN for the replica of the block from 1st DN Replica r; r = ((FSDataset) cluster.getDataNodes().get(DN_N1).getFSDataset()). @@ -465,25 +490,33 @@ public class TestBlockReport { fetchReplicaInfo(bl.getBlockId()); long waiting_period = System.currentTimeMillis() - start; if (count++ % 10 == 0) - LOG.debug("Has been waiting for " + waiting_period + " ms."); + if(LOG.isDebugEnabled()) { + LOG.debug("Has been waiting for " + waiting_period + " ms."); + } if (waiting_period > TIMEOUT) assertTrue("Was waiting too long to get ReplicaInfo from a datanode", tooLongWait); } HdfsConstants.ReplicaState state = r.getState(); - LOG.debug("Replica state before the loop " + state.getValue()); + if(LOG.isDebugEnabled()) { + LOG.debug("Replica state before the loop " + state.getValue()); + } start = System.currentTimeMillis(); while (state != HdfsConstants.ReplicaState.TEMPORARY) { waitTil(100); state = r.getState(); - LOG.debug("Keep waiting for " + bl.getBlockName() + - " is in state " + state.getValue()); + if(LOG.isDebugEnabled()) { + LOG.debug("Keep waiting for " + bl.getBlockName() + + " is in state " + state.getValue()); + } if (System.currentTimeMillis() - start > TIMEOUT) assertTrue("Was waiting too long for a replica to become TEMPORARY", tooLongWait); } - LOG.debug("Replica state after the loop " + state.getValue()); + if(LOG.isDebugEnabled()) { + LOG.debug("Replica state after the loop " + state.getValue()); + } } // Helper methods from here below... @@ -497,21 +530,27 @@ public class TestBlockReport { REPL_FACTOR = 2; blocks = prepareForRide(filePath, METHOD_NAME, fileSize); } catch (IOException e) { - LOG.debug("Caught exception ", e); + if(LOG.isDebugEnabled()) { + LOG.debug("Caught exception ", e); + } } return blocks; } private void startDNandWait(Path filePath, boolean waitReplicas) throws IOException { - LOG.debug("Before next DN start: " + cluster.getDataNodes().size()); + if(LOG.isDebugEnabled()) { + LOG.debug("Before next DN start: " + cluster.getDataNodes().size()); + } cluster.startDataNodes(conf, 1, true, null, null); ArrayList<DataNode> datanodes = cluster.getDataNodes(); assertEquals(datanodes.size(), 2); - LOG.debug("New datanode " - + cluster.getDataNodes().get(datanodes.size() - 1) - .getDatanodeRegistration() + " has been started"); + if(LOG.isDebugEnabled()) { + LOG.debug("New datanode " + + cluster.getDataNodes().get(datanodes.size() - 1) + .getDatanodeRegistration() + " has been started"); + } if (waitReplicas) DFSTestUtil.waitReplication(fs, filePath, REPL_FACTOR); } @@ -530,16 +569,18 @@ public class TestBlockReport { private void printStats() { NameNodeAdapter.refreshBlockCounts(cluster.getNameNode()); - LOG.debug("Missing " + cluster.getNamesystem().getMissingBlocksCount()); - LOG.debug("Corrupted " + cluster.getNamesystem().getCorruptReplicaBlocks()); - LOG.debug("Under-replicated " + cluster.getNamesystem(). - getUnderReplicatedBlocks()); - LOG.debug("Pending delete " + cluster.getNamesystem(). - getPendingDeletionBlocks()); - LOG.debug("Pending replications " + cluster.getNamesystem(). - getPendingReplicationBlocks()); - LOG.debug("Excess " + cluster.getNamesystem().getExcessBlocks()); - LOG.debug("Total " + cluster.getNamesystem().getBlocksTotal()); + if(LOG.isDebugEnabled()) { + LOG.debug("Missing " + cluster.getNamesystem().getMissingBlocksCount()); + LOG.debug("Corrupted " + cluster.getNamesystem().getCorruptReplicaBlocks()); + LOG.debug("Under-replicated " + cluster.getNamesystem(). + getUnderReplicatedBlocks()); + LOG.debug("Pending delete " + cluster.getNamesystem(). + getPendingDeletionBlocks()); + LOG.debug("Pending replications " + cluster.getNamesystem(). + getPendingReplicationBlocks()); + LOG.debug("Excess " + cluster.getNamesystem().getExcessBlocks()); + LOG.debug("Total " + cluster.getNamesystem().getBlocksTotal()); + } } private ArrayList<Block> locatedToBlocks(final List<LocatedBlock> locatedBlks, @@ -547,7 +588,9 @@ public class TestBlockReport { ArrayList<Block> newList = new ArrayList<Block>(); for (int i = 0; i < locatedBlks.size(); i++) { if (positionsToRemove != null && positionsToRemove.contains(i)) { - LOG.debug(i + " block to be omitted"); + if(LOG.isDebugEnabled()) { + LOG.debug(i + " block to be omitted"); + } continue; } newList.add(new Block(locatedBlks.get(i).getBlock())); @@ -611,8 +654,10 @@ public class TestBlockReport { assertTrue("Old and new length shouldn't be the same", block.getNumBytes() != newLen); block.setNumBytes(newLen); - LOG.debug("Length of " + block.getBlockName() + - " is changed to " + newLen + " from " + oldLen); + if(LOG.isDebugEnabled()) { + LOG.debug("Length of " + block.getBlockName() + + " is changed to " + newLen + " from " + oldLen); + } } private void corruptBlockGS(final Block block) @@ -625,8 +670,10 @@ public class TestBlockReport { assertTrue("Old and new GS shouldn't be the same", block.getGenerationStamp() != newGS); block.setGenerationStamp(newGS); - LOG.debug("Generation stamp of " + block.getBlockName() + - " is changed to " + block.getGenerationStamp() + " from " + oldGS); + if(LOG.isDebugEnabled()) { + LOG.debug("Generation stamp of " + block.getBlockName() + + " is changed to " + block.getGenerationStamp() + " from " + oldGS); + } } private Block findBlock(Path path, long size) throws IOException { Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java (original) +++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java Sat Aug 28 23:06:00 2010 @@ -770,14 +770,18 @@ public class NNThroughputBenchmark { dnRegistration, DF_CAPACITY, DF_USED, DF_CAPACITY - DF_USED, 0, 0); if(cmds != null) { for (DatanodeCommand cmd : cmds ) { - LOG.debug("sendHeartbeat Name-node reply: " + cmd.getAction()); + if(LOG.isDebugEnabled()) { + LOG.debug("sendHeartbeat Name-node reply: " + cmd.getAction()); + } } } } boolean addBlock(Block blk) { if(nrBlocks == blocks.size()) { - LOG.debug("Cannot add block: datanode capacity = " + blocks.size()); + if(LOG.isDebugEnabled()) { + LOG.debug("Cannot add block: datanode capacity = " + blocks.size()); + } return false; } blocks.set(nrBlocks, blk); Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestLargeDirectoryDelete.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestLargeDirectoryDelete.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestLargeDirectoryDelete.java (original) +++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestLargeDirectoryDelete.java Sat Aug 28 23:06:00 2010 @@ -198,7 +198,9 @@ public class TestLargeDirectoryDelete { try { wait(); } catch (InterruptedException e) { - LOG.debug("Ignoring " + e, e); + if(LOG.isDebugEnabled()) { + LOG.debug("Ignoring " + e, e); + } } } } Modified: hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java (original) +++ hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestBlockRecovery.java Sat Aug 28 23:06:00 2010 @@ -151,7 +151,9 @@ public class TestBlockRecovery { */ @Test public void testFinalizedReplicas () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } ReplicaRecoveryInfo replica1 = new ReplicaRecoveryInfo(BLOCK_ID, REPLICA_LEN1, GEN_STAMP-1, ReplicaState.FINALIZED); ReplicaRecoveryInfo replica2 = new ReplicaRecoveryInfo(BLOCK_ID, @@ -186,7 +188,9 @@ public class TestBlockRecovery { */ @Test public void testFinalizedRbwReplicas() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } // rbw and finalized replicas have the same length ReplicaRecoveryInfo replica1 = new ReplicaRecoveryInfo(BLOCK_ID, @@ -223,7 +227,9 @@ public class TestBlockRecovery { */ @Test public void testFinalizedRwrReplicas() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } // rbw and finalized replicas have the same length ReplicaRecoveryInfo replica1 = new ReplicaRecoveryInfo(BLOCK_ID, @@ -261,7 +267,9 @@ public class TestBlockRecovery { */ @Test public void testRBWReplicas() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } ReplicaRecoveryInfo replica1 = new ReplicaRecoveryInfo(BLOCK_ID, REPLICA_LEN1, GEN_STAMP-1, ReplicaState.RBW); ReplicaRecoveryInfo replica2 = new ReplicaRecoveryInfo(BLOCK_ID, @@ -283,7 +291,9 @@ public class TestBlockRecovery { */ @Test public void testRBW_RWRReplicas() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } ReplicaRecoveryInfo replica1 = new ReplicaRecoveryInfo(BLOCK_ID, REPLICA_LEN1, GEN_STAMP-1, ReplicaState.RBW); ReplicaRecoveryInfo replica2 = new ReplicaRecoveryInfo(BLOCK_ID, @@ -305,7 +315,9 @@ public class TestBlockRecovery { */ @Test public void testRWRReplicas() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } ReplicaRecoveryInfo replica1 = new ReplicaRecoveryInfo(BLOCK_ID, REPLICA_LEN1, GEN_STAMP-1, ReplicaState.RWR); ReplicaRecoveryInfo replica2 = new ReplicaRecoveryInfo(BLOCK_ID, @@ -339,7 +351,9 @@ public class TestBlockRecovery { @Test public void testRecoveryInProgressException() throws IOException, InterruptedException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } DataNode spyDN = spy(dn); doThrow(new RecoveryInProgressException("Replica recovery is in progress")). when(spyDN).initReplicaRecovery(any(RecoveringBlock.class)); @@ -357,7 +371,9 @@ public class TestBlockRecovery { */ @Test public void testErrorReplicas() throws IOException, InterruptedException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } DataNode spyDN = spy(dn); doThrow(new IOException()). when(spyDN).initReplicaRecovery(any(RecoveringBlock.class)); @@ -374,7 +390,9 @@ public class TestBlockRecovery { */ @Test public void testZeroLenReplicas() throws IOException, InterruptedException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } DataNode spyDN = spy(dn); doReturn(new ReplicaRecoveryInfo(block.getBlockId(), 0, block.getGenerationStamp(), ReplicaState.FINALIZED)).when(spyDN). @@ -405,7 +423,9 @@ public class TestBlockRecovery { */ @Test public void testFailedReplicaUpdate() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } DataNode spyDN = spy(dn); doThrow(new IOException()).when(spyDN).updateReplicaUnderRecovery( block, RECOVERY_ID, block.getNumBytes()); @@ -424,7 +444,9 @@ public class TestBlockRecovery { */ @Test public void testNoReplicaUnderRecovery() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } dn.data.createRbw(block); try { dn.syncBlock(rBlock, initBlockRecords(dn)); @@ -444,7 +466,9 @@ public class TestBlockRecovery { */ @Test public void testNotMatchedReplicaID() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } ReplicaInPipelineInterface replicaInfo = dn.data.createRbw(block); BlockWriteStreams streams = null; try { Modified: hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java?rev=990466&r1=990465&r2=990466&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java (original) +++ hadoop/hdfs/trunk/src/test/unit/org/apache/hadoop/hdfs/server/namenode/TestNNLeaseRecovery.java Sat Aug 28 23:06:00 2010 @@ -105,7 +105,9 @@ public class TestNNLeaseRecovery { */ @Test public void testInternalReleaseLease_allCOMPLETE () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } LeaseManager.Lease lm = mock(LeaseManager.Lease.class); Path file = spy(new Path("/test.dat")); DatanodeDescriptor dnd = mock(DatanodeDescriptor.class); @@ -127,7 +129,9 @@ public class TestNNLeaseRecovery { */ @Test(expected=IOException.class) public void testInternalReleaseLease_UNKNOWN_COMM () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } LeaseManager.Lease lm = mock(LeaseManager.Lease.class); Path file = spy(new Path("/" + GenericTestUtils.getMethodName() + "_test.dat")); @@ -151,7 +155,9 @@ public class TestNNLeaseRecovery { */ @Test(expected=AlreadyBeingCreatedException.class) public void testInternalReleaseLease_COMM_COMM () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } LeaseManager.Lease lm = mock(LeaseManager.Lease.class); Path file = spy(new Path("/" + GenericTestUtils.getMethodName() + "_test.dat")); @@ -174,7 +180,9 @@ public class TestNNLeaseRecovery { */ @Test public void testInternalReleaseLease_0blocks () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } LeaseManager.Lease lm = mock(LeaseManager.Lease.class); Path file = spy(new Path("/" + GenericTestUtils.getMethodName() + "_test.dat")); @@ -196,7 +204,9 @@ public class TestNNLeaseRecovery { */ @Test(expected=AlreadyBeingCreatedException.class) public void testInternalReleaseLease_1blocks () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } LeaseManager.Lease lm = mock(LeaseManager.Lease.class); Path file = spy(new Path("/" + GenericTestUtils.getMethodName() + "_test.dat")); @@ -219,7 +229,9 @@ public class TestNNLeaseRecovery { */ @Test public void testInternalReleaseLease_COMM_CONSTRUCTION () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } LeaseManager.Lease lm = mock(LeaseManager.Lease.class); Path file = spy(new Path("/" + GenericTestUtils.getMethodName() + "_test.dat")); @@ -237,7 +249,9 @@ public class TestNNLeaseRecovery { @Test public void testCommitBlockSynchronization_BlockNotFound () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } long recoveryId = 2002; long newSize = 273487234; Path file = @@ -261,7 +275,9 @@ public class TestNNLeaseRecovery { @Test public void testCommitBlockSynchronization_notUR () throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } long recoveryId = 2002; long newSize = 273487234; Path file = @@ -287,7 +303,9 @@ public class TestNNLeaseRecovery { @Test public void testCommitBlockSynchronization_WrongGreaterRecoveryID() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } long recoveryId = 2002; long newSize = 273487234; Path file = @@ -313,7 +331,9 @@ public class TestNNLeaseRecovery { @Test public void testCommitBlockSynchronization_WrongLesserRecoveryID() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } long recoveryId = 2002; long newSize = 273487234; Path file = @@ -339,7 +359,9 @@ public class TestNNLeaseRecovery { @Test public void testCommitBlockSynchronization_EqualRecoveryID() throws IOException { - LOG.debug("Running " + GenericTestUtils.getMethodName()); + if(LOG.isDebugEnabled()) { + LOG.debug("Running " + GenericTestUtils.getMethodName()); + } long recoveryId = 2002; long newSize = 273487234; Path file =
