Return-Path: X-Original-To: apmail-falcon-dev-archive@minotaur.apache.org Delivered-To: apmail-falcon-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB150109FC for ; Tue, 10 Feb 2015 12:46:44 +0000 (UTC) Received: (qmail 72151 invoked by uid 500); 10 Feb 2015 12:46:44 -0000 Delivered-To: apmail-falcon-dev-archive@falcon.apache.org Received: (qmail 72107 invoked by uid 500); 10 Feb 2015 12:46:44 -0000 Mailing-List: contact dev-help@falcon.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@falcon.apache.org Delivered-To: mailing list dev@falcon.apache.org Received: (qmail 72096 invoked by uid 99); 10 Feb 2015 12:46:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Feb 2015 12:46:44 +0000 X-ASF-Spam-Status: No, hits=-1997.8 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 10 Feb 2015 12:46:21 +0000 Received: (qmail 70246 invoked by uid 99); 10 Feb 2015 12:46:18 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Feb 2015 12:46:18 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id E2C261CBF5D; Tue, 10 Feb 2015 12:46:17 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============3635216236987819531==" MIME-Version: 1.0 Subject: Re: Review Request 30116: Parallel update APIs create 2 coords From: "Suhas Vasu" To: "Suhas Vasu" , "Shwetha GS" , "Falcon" Date: Tue, 10 Feb 2015 12:46:17 -0000 Message-ID: <20150210124617.11124.41542@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: "Suhas Vasu" X-ReviewGroup: Falcon X-ReviewRequest-URL: https://reviews.apache.org/r/30116/ X-Sender: "Suhas Vasu" References: <20150203102758.32500.88427@reviews.apache.org> In-Reply-To: <20150203102758.32500.88427@reviews.apache.org> Reply-To: "Suhas Vasu" X-ReviewRequest-Repository: falcon-git X-Virus-Checked: Checked by ClamAV on apache.org --===============3635216236987819531== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Feb. 3, 2015, 10:27 a.m., Shwetha GS wrote: > > common/src/main/java/org/apache/falcon/entity/lock/MemoryLocks.java, line 57 > > > > > > this should be synchronised so that 2 threads will not get the same lock > > Suhas Vasu wrote: > I am just relying on the concurrent hashmap to handle the syncronization of adding to the map. should be ok right ? > > Shwetha GS wrote: > Take an example of 2 threads trying to acquire lock for the same entity at the same time with this sequence of execution(assuming its not already locked): > t1 -> !locks.containsKey(entityName) will return true > t2 -> !locks.containsKey(entityName) will also return true > t1 -> locks.put(entityName, MAP_VALUE_CONSTANT) will get lock > t2 -> locks.put(entityName, MAP_VALUE_CONSTANT) will also get lock > > Since acquireLock() is not synchronised, both t1 and t2 will get the lock in this case. > > Instead of making the method synchronised, you can use ConcurrentHashMap.putIfAbsent() and check the return type if lock is successful. putIfAbsent is atomic oh, I missed this scenario > On Feb. 3, 2015, 10:27 a.m., Shwetha GS wrote: > > prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java, line 334 > > > > > > acquireLock() doesn't throw exception? > > Suhas Vasu wrote: > It might. In acquire lock we add the entry into a concurrent hash map. It might throw up in case of concurrent writes. > > Shwetha GS wrote: > acquireLock() signature doesn't define any exception. When is the exception thrown? Have removed this as the signature of the underlying method has changed. > On Feb. 3, 2015, 10:27 a.m., Shwetha GS wrote: > > prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java, line 354 > > > > > > Update API actually takes longer because of dryRun that you should be able to add IT. Can you check please? > > Suhas Vasu wrote: > I tried, didn't work. will crosscheck once The issue is trying to simulate 2 independent & simultaneous update commands. The code gets too complicated while trying to achieve this. - Suhas ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/30116/#review70728 ----------------------------------------------------------- On Feb. 2, 2015, 12:51 p.m., Suhas Vasu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/30116/ > ----------------------------------------------------------- > > (Updated Feb. 2, 2015, 12:51 p.m.) > > > Review request for Falcon. > > > Repository: falcon-git > > > Description > ------- > > In distributed mode, when parallel update command are issued for same entity, they are not syncronized. > This leads to multiple coordinators being spawned in Oozie. > > We need to ensure that the update method is syncronized. > > > Diffs > ----- > > common/src/main/java/org/apache/falcon/entity/lock/MemoryLocks.java PRE-CREATION > prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java 0d34ef3 > > Diff: https://reviews.apache.org/r/30116/diff/ > > > Testing > ------- > > UT's were added and were successful > > > Thanks, > > Suhas Vasu > > --===============3635216236987819531==--