Return-Path: Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: (qmail 73855 invoked from network); 26 Mar 2011 00:33:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Mar 2011 00:33:45 -0000 Received: (qmail 48774 invoked by uid 500); 26 Mar 2011 00:33:45 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 48720 invoked by uid 500); 26 Mar 2011 00:33:45 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 48711 invoked by uid 99); 26 Mar 2011 00:33:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Mar 2011 00:33:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Mar 2011 00:33:43 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B17EC4E728 for ; Sat, 26 Mar 2011 00:33:05 +0000 (UTC) Date: Sat, 26 Mar 2011 00:33:05 +0000 (UTC) From: "Matt Foley (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <2040465131.13027.1301099585723.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (HDFS-1790) review use of synchronized methods in FSNamesystem MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org review use of synchronized methods in FSNamesystem -------------------------------------------------- Key: HDFS-1790 URL: https://issues.apache.org/jira/browse/HDFS-1790 Project: Hadoop HDFS Issue Type: Bug Components: name-node Affects Versions: 0.23.0 Reporter: Matt Foley Fix For: 0.23.0 While analyzing SafeMode semantics for HDFS-1726, I noticed the following usage of synchronized methods in FSNamesystem that raised questions: 1. incVolumeFailure() is synchronized on the FSNamesystem instance (monitor lock), for unclear reasons. Is this a left-over from the conversion to read/write lock in FSNamesystem? 2. isInSafeMode() and isPopulatingReplQueues() are also synchronized on the FSNamesystem instance (monitor lock), but the SafeModeInfo methods they call (safeMode.isInSafeMode() and safeMode.isPopulatingReplQueues() are synchronized on the SafeModeInfo instance. Is synchronizing on the FSNamesystem instance necessary? What does it add? If it is necessary, should it be using the read/write lock? 3. In SafeModeInfo, these methods are synchronized on the SafeModeInfo instance: isOn isPopulatingReplQueues leave initialize canInitializeReplQueues canLeave setBlock incrementSafeBlockCount decrementSafeBlockCount setManual but these are not: enter needEnter checkMode isManual isConsistent - isOn() asserts isConsistent(), but is otherwise an atomic read operation. - isPopulatingReplQueues() is an atomic read. Does it need synchronization? - leave() is complex, but shouldn't it be synchronized with enter(), which is also a write operation? Yet enter() is unsynchronized. - initializeReplQueues() calls blockManager.processMisReplicatedBlocks(), which can take minutes to run. By synchronizing on the SafeModeInfo instance, it prevents essentially all of the other safeMode methods from running for the duration! Is this desirable or needed? - canInitializeReplQueues() is a read-only operation, although it does compare two read values. needEnter() compares four read values, and is unsynchronized. Does either need synchronization? - canLeave() is a compound operation, it's good that it is synchronized. - checkMode() is a big compound read/write operation. Doesn't it need synchronization if the other methods do? and so on. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira