Author: cutting
Date: Mon Aug  1 21:33:43 2005
New Revision: 226947

URL: http://svn.apache.org/viewcvs?rev=226947&view=rev
Log:
Use a slightly different interval for block reporting on each node so that they 
don't all report at once, clogging up the namenode.

Modified:
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java

Modified: 
lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java
URL: 
http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java?rev=226947&r1=226946&r2=226947&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java 
(original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/DataNode.java 
Mon Aug  1 21:33:43 2005
@@ -111,6 +111,8 @@
         long lastHeartbeat = 0, lastBlockReport = 0;
         long sendStart = System.currentTimeMillis();
         int heartbeatsSent = 0;
+        long blockReportInterval =
+          BLOCKREPORT_INTERVAL - new 
Random().nextInt((int)(BLOCKREPORT_INTERVAL/10));
 
         //
         // Now loop for a long time....
@@ -135,7 +137,7 @@
                     LOG.info("Just sent heartbeat, with name " + localName);
                     lastHeartbeat = now;
                }
-               if (now - lastBlockReport > BLOCKREPORT_INTERVAL) {
+               if (now - lastBlockReport > blockReportInterval) {
                     //
                     // Send latest blockinfo report if timer has expired
                     //


Reply via email to