You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2011/02/25 01:52:23 UTC

svn commit: r1074366 - in /incubator/hama/trunk: CHANGES.txt conf/hama-default.xml src/java/org/apache/hama/bsp/BSPPeer.java

Author: edwardyoon
Date: Fri Feb 25 00:52:23 2011
New Revision: 1074366

URL: http://svn.apache.org/viewvc?rev=1074366&view=rev
Log:
Intermittent conflicts of enterBarrier() and leaveBarrier()

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/conf/hama-default.xml
    incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1074366&r1=1074365&r2=1074366&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Fri Feb 25 00:52:23 2011
@@ -198,6 +198,7 @@ Trunk (unreleased changes)
 
   BUG FIXES
   
+    HAMA-355: Intermittent conflicts of enterBarrier() and leaveBarrier() (edwardyoon)
     HAMA-352: Can't send one more messages on to same server in bsp() method (edwardyoon)
     HAMA-350: Add task log appender and Fix log4j rootLogger (edwardyoon)
     HAMA-345: Add execution time calculator to Pi job (edwardyoon)

Modified: incubator/hama/trunk/conf/hama-default.xml
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/conf/hama-default.xml?rev=1074366&r1=1074365&r2=1074366&view=diff
==============================================================================
--- incubator/hama/trunk/conf/hama-default.xml (original)
+++ incubator/hama/trunk/conf/hama-default.xml Fri Feb 25 00:52:23 2011
@@ -71,7 +71,7 @@
   </property>
   <property>
     <name>bsp.child.java.opts</name>
-    <value>-Xmx200m</value>
+    <value>-Xmx500m</value>
     <description>Java opts for the groom server child processes.  
     The following symbol, if present, will be interpolated: @taskid@ is replaced 
     by current TaskID. Any other occurrences of '@' will go unchanged.

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java?rev=1074366&r1=1074365&r2=1074366&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPPeer.java Fri Feb 25 00:52:23 2011
@@ -179,6 +179,9 @@ public class BSPPeer implements Watcher,
       }
     }
 
+    waitForSync();
+    Thread.sleep(100);
+    
     // Clear outgoing queues.
     clearOutgoingQueues();
 
@@ -210,9 +213,32 @@ public class BSPPeer implements Watcher,
     }
   }
 
+  protected boolean waitForSync() throws KeeperException, InterruptedException {
+    try {
+      zk.create(bspRoot + "/" + getPeerName() + "-data", new byte[0],
+          Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
+    } catch (KeeperException e) {
+      e.printStackTrace();
+    } catch (InterruptedException e) {
+      e.printStackTrace();
+    }
+
+    while (true) {
+      synchronized (mutex) {
+        List<String> list = zk.getChildren(bspRoot, true);
+        if (list.size() < (jobConf.getNumBspTask() * 2)) {
+          mutex.wait();
+        } else {
+          return true;
+        }
+      }
+    }
+  }
+
   protected boolean leaveBarrier() throws KeeperException, InterruptedException {
     zk.delete(bspRoot + "/" + getPeerName(), 0);
-
+    zk.delete(bspRoot + "/" + getPeerName() + "-data", 0);
+    
     while (true) {
       synchronized (mutex) {
         List<String> list = zk.getChildren(bspRoot, true);