Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 66860 invoked from network); 6 Feb 2009 07:34:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Feb 2009 07:34:27 -0000 Received: (qmail 53928 invoked by uid 500); 6 Feb 2009 07:34:20 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 53889 invoked by uid 500); 6 Feb 2009 07:34:20 -0000 Mailing-List: contact core-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-dev@hadoop.apache.org Received: (qmail 53874 invoked by uid 99); 6 Feb 2009 07:34:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Feb 2009 23:34:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Feb 2009 07:34:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C3907234C4AA for ; Thu, 5 Feb 2009 23:33:59 -0800 (PST) Message-ID: <1767907056.1233905639799.JavaMail.jira@brutus> Date: Thu, 5 Feb 2009 23:33:59 -0800 (PST) From: "Raghu Angadi (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Commented: (HADOOP-4584) Slow generation of blockReport at DataNode causes delay of sending heartbeat to NameNode In-Reply-To: <178281774.1225759904336.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-4584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671031#action_12671031 ] Raghu Angadi commented on HADOOP-4584: -------------------------------------- Synchronization is not correct. E.g. : The condition should be checked inside the lock that you wait on. It is not fatal in this case only because it waits only for 1 sec, but still it is better not to write that way. The block report thread should ideally do "{{wait(time till next report)}}", then the bug shows up more. A correct synchronization should work irrespective of wait time. Similarly commandQueue and receviedBlockList sizes are checked outside the locks. We don't need to synchronize on these two any more (since the patch uses common "dataAvailable" for synchronization). I don't think new class for CommandQueue is required. Also no need for conversion between list and arrays etc. I would synchronize the following way : {code} // Block receiver thread : while (1) { cmd = null; synchronized (dataAvaliable) { cmd = commandQ.dequeue(); if (cmd == null) { break; } processCmd(cmd); // similarly receivedBlockList. RPC should called outside lock. } // ... synchronized (dataAvailable) { if (cmdQ.size() == 0 || receivedBlockList.size() == 0) { dataAvailable.wait (time till next report); } } // heartBeat thread : synchronize (dataAvailable) { cmdQ.addAll(cmds); dataAvailable.notify(); } // writers : synchronized (dataAvailable) { receivedBlockArray.add(block); dataAvailable.notify(); } // etc.. may be locking around delHints can also be removed.. though not related here. {code} > Slow generation of blockReport at DataNode causes delay of sending heartbeat to NameNode > ---------------------------------------------------------------------------------------- > > Key: HADOOP-4584 > URL: https://issues.apache.org/jira/browse/HADOOP-4584 > Project: Hadoop Core > Issue Type: Bug > Components: dfs > Reporter: Hairong Kuang > Assignee: Suresh Srinivas > Fix For: 0.20.0 > > Attachments: 4584.patch, 4584.patch, 4584.patch > > > sometimes due to disk or some other problems, datanode takes minutes or tens of minutes to generate a block report. It causes the datanode not able to send heartbeat to NameNode every 3 seconds. In the worst case, it makes NameNode to detect a lost heartbeat and wrongly decide that the datanode is dead. > It would be nice to have two threads instead. One thread is for scanning data directories and generating block report, and executes the requests sent by NameNode; Another thread is for sending heartbeats, block reports, and picking up the requests from NameNode. By having these two threads, the sending of heartbeats will not get delayed by any slow block report or slow execution of NameNode requests. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.