svn commit: r1482401 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: ./ src/main/java/org/apache/hadoop/ha/ src/test/java/org/apache/hadoop/ha/

2013-05-14 Thread todd
Author: todd
Date: Tue May 14 15:37:12 2013
New Revision: 1482401

URL: http://svn.apache.org/r1482401
Log:
HADOOP-9220. Unnecessary transition to standby in ActiveStandbyElector. 
Contributed by Tom White and Todd Lipcon.

Modified:
hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt

hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java

hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java

hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1482401r1=1482400r2=1482401view=diff
==
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt 
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Tue May 
14 15:37:12 2013
@@ -720,6 +720,9 @@ Release 2.0.5-beta - UNRELEASED
 HADOOP-9307. BufferedFSInputStream.read returns wrong results
 after certain seeks. (todd)
 
+HADOOP-9220. Unnecessary transition to standby in ActiveStandbyElector.
+(tom and todd via todd)
+
 Release 2.0.4-alpha - 2013-04-25 
 
   INCOMPATIBLE CHANGES

Modified: 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java?rev=1482401r1=1482400r2=1482401view=diff
==
--- 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java
 (original)
+++ 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java
 Tue May 14 15:37:12 2013
@@ -159,6 +159,7 @@ public class ActiveStandbyElector implem
   private int createRetryCount = 0;
   private int statRetryCount = 0;
   private ZooKeeper zkClient;
+  private WatcherWithClientRef watcher;
   private ConnectionState zkConnectionState = ConnectionState.TERMINATED;
 
   private final ActiveStandbyElectorCallback appClient;
@@ -246,6 +247,11 @@ public class ActiveStandbyElector implem
 if (data == null) {
   throw new HadoopIllegalArgumentException(data cannot be null);
 }
+
+if (wantToBeInElection) {
+  LOG.info(Already in election. Not re-connecting.);
+  return;
+}
 
 appData = new byte[data.length];
 System.arraycopy(data, 0, appData, 0, data.length);
@@ -615,7 +621,7 @@ public class ActiveStandbyElector implem
 // watcher after constructing ZooKeeper, we may miss that event. Instead,
 // we construct the watcher first, and have it block any events it receives
 // before we can set its ZooKeeper reference.
-WatcherWithClientRef watcher = new WatcherWithClientRef();
+watcher = new WatcherWithClientRef();
 ZooKeeper zk = new ZooKeeper(zkHostPort, zkSessionTimeout, watcher);
 watcher.setZooKeeperRef(zk);
 
@@ -753,6 +759,7 @@ public class ActiveStandbyElector implem
 e);
   }
   zkClient = null;
+  watcher = null;
 }
 zkClient = getNewZooKeeper();
 LOG.debug(Created new connection for  + this);
@@ -765,12 +772,14 @@ public class ActiveStandbyElector implem
 LOG.debug(Terminating ZK connection for  + this);
 ZooKeeper tempZk = zkClient;
 zkClient = null;
+watcher = null;
 try {
   tempZk.close();
 } catch(InterruptedException e) {
   LOG.warn(e);
 }
 zkConnectionState = ConnectionState.TERMINATED;
+wantToBeInElection = false;
   }
 
   private void reset() {
@@ -914,7 +923,7 @@ public class ActiveStandbyElector implem
 
   private void monitorLockNodeAsync() {
 zkClient.exists(zkLockFilePath, 
-new WatcherWithClientRef(zkClient), this,
+watcher, this,
 zkClient);
   }
 
@@ -1015,13 +1024,6 @@ public class ActiveStandbyElector implem
  * Latch used to wait until the reference to ZooKeeper is set.
  */
 private CountDownLatch hasSetZooKeeper = new CountDownLatch(1);
-
-private WatcherWithClientRef() {
-}
-
-private WatcherWithClientRef(ZooKeeper zk) {
-  setZooKeeperRef(zk);
-}
 
 /**
  * Waits for the next event from ZooKeeper to arrive.

Modified: 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java?rev=1482401r1=1482400r2=1482401view=diff

svn commit: r1482402 - in /hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common: ./ src/main/java/org/apache/hadoop/ha/ src/test/java/org/apache/hadoop/ha/

2013-05-14 Thread todd
Author: todd
Date: Tue May 14 15:37:18 2013
New Revision: 1482402

URL: http://svn.apache.org/r1482402
Log:
HADOOP-9220. Unnecessary transition to standby in ActiveStandbyElector. 
Contributed by Tom White and Todd Lipcon.

Modified:

hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt

hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java

hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java

hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java

Modified: 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1482402r1=1482401r2=1482402view=diff
==
--- 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt 
(original)
+++ 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt 
Tue May 14 15:37:18 2013
@@ -165,6 +165,9 @@ Release 2.0.5-beta - UNRELEASED
 HADOOP-9307. BufferedFSInputStream.read returns wrong results
 after certain seeks. (todd)
 
+HADOOP-9220. Unnecessary transition to standby in ActiveStandbyElector.
+(tom and todd via todd)
+
 Release 2.0.4-alpha - 2013-04-25 
 
   INCOMPATIBLE CHANGES

Modified: 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java?rev=1482402r1=1482401r2=1482402view=diff
==
--- 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java
 (original)
+++ 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ActiveStandbyElector.java
 Tue May 14 15:37:18 2013
@@ -159,6 +159,7 @@ public class ActiveStandbyElector implem
   private int createRetryCount = 0;
   private int statRetryCount = 0;
   private ZooKeeper zkClient;
+  private WatcherWithClientRef watcher;
   private ConnectionState zkConnectionState = ConnectionState.TERMINATED;
 
   private final ActiveStandbyElectorCallback appClient;
@@ -246,6 +247,11 @@ public class ActiveStandbyElector implem
 if (data == null) {
   throw new HadoopIllegalArgumentException(data cannot be null);
 }
+
+if (wantToBeInElection) {
+  LOG.info(Already in election. Not re-connecting.);
+  return;
+}
 
 appData = new byte[data.length];
 System.arraycopy(data, 0, appData, 0, data.length);
@@ -615,7 +621,7 @@ public class ActiveStandbyElector implem
 // watcher after constructing ZooKeeper, we may miss that event. Instead,
 // we construct the watcher first, and have it block any events it receives
 // before we can set its ZooKeeper reference.
-WatcherWithClientRef watcher = new WatcherWithClientRef();
+watcher = new WatcherWithClientRef();
 ZooKeeper zk = new ZooKeeper(zkHostPort, zkSessionTimeout, watcher);
 watcher.setZooKeeperRef(zk);
 
@@ -753,6 +759,7 @@ public class ActiveStandbyElector implem
 e);
   }
   zkClient = null;
+  watcher = null;
 }
 zkClient = getNewZooKeeper();
 LOG.debug(Created new connection for  + this);
@@ -765,12 +772,14 @@ public class ActiveStandbyElector implem
 LOG.debug(Terminating ZK connection for  + this);
 ZooKeeper tempZk = zkClient;
 zkClient = null;
+watcher = null;
 try {
   tempZk.close();
 } catch(InterruptedException e) {
   LOG.warn(e);
 }
 zkConnectionState = ConnectionState.TERMINATED;
+wantToBeInElection = false;
   }
 
   private void reset() {
@@ -914,7 +923,7 @@ public class ActiveStandbyElector implem
 
   private void monitorLockNodeAsync() {
 zkClient.exists(zkLockFilePath, 
-new WatcherWithClientRef(zkClient), this,
+watcher, this,
 zkClient);
   }
 
@@ -1015,13 +1024,6 @@ public class ActiveStandbyElector implem
  * Latch used to wait until the reference to ZooKeeper is set.
  */
 private CountDownLatch hasSetZooKeeper = new CountDownLatch(1);
-
-private WatcherWithClientRef() {
-}
-
-private WatcherWithClientRef(ZooKeeper zk) {
-  setZooKeeperRef(zk);
-}
 
 /**
  * Waits for the next event from ZooKeeper to arrive.

Modified: 
hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/DummyHAService.java
URL: 

svn commit: r1482503 - /hadoop/common/branches/branch-2.0-alpha/

2013-05-14 Thread acmurthy
Author: acmurthy
Date: Tue May 14 18:07:44 2013
New Revision: 1482503

URL: http://svn.apache.org/r1482503
Log:
Copying branch 2.0.4-alpha to 2.0-alpha for future 2.0.x-alpha releases.

Added:
hadoop/common/branches/branch-2.0-alpha/   (props changed)
  - copied from r1482502, hadoop/common/branches/branch-2.0.4-alpha/

Propchange: hadoop/common/branches/branch-2.0-alpha/
--
--- svn:ignore (added)
+++ svn:ignore Tue May 14 18:07:44 2013
@@ -0,0 +1,5 @@
+.classpath
+.git
+.project
+.settings
+target

Propchange: hadoop/common/branches/branch-2.0-alpha/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue May 14 18:07:44 2013
@@ -0,0 +1,3 @@
+/hadoop/common/branches/HDFS-3042:1306184-1342109
+/hadoop/common/branches/branch-0.23-PB:1227776-1294021
+/hadoop/common/trunk:1161777,1161781,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163490,1163768,1163852,1163858,1163981,1164255,1164301,1164339,1166009,1166402,1167001,1167383,1167662,1170085,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1243065,1243104,1244766,1245751,1245762,1293419,1295061,1295227,1296556,1298044,1298696,1298700,1299045,1299434,1299963,1301308,1301312,1301820,1301871,1302624,
 
1302704-1302705,1303474,1304063,1304099,1304112,1304118,1305230,1309625,1310185,1311556,1312029,1329319,1333557,1334216,1342112,1348207,1349124,1349616,1351818,1361813,1373683,1374696,1375450,1375829,1379646,1400347,1430682,1430688,1440245,1445965,1455316,1465121




svn commit: r1482685 - in /hadoop/common/branches: branch-2.0-alpha/ branch-2.0.5/

2013-05-14 Thread shv
Author: shv
Date: Wed May 15 05:53:46 2013
New Revision: 1482685

URL: http://svn.apache.org/r1482685
Log:
Rename branch-2.0-alpha to branch-2.0.5

Added:
hadoop/common/branches/branch-2.0.5/   (props changed)
  - copied from r1482684, hadoop/common/branches/branch-2.0-alpha/
Removed:
hadoop/common/branches/branch-2.0-alpha/

Propchange: hadoop/common/branches/branch-2.0.5/
--
--- svn:ignore (added)
+++ svn:ignore Wed May 15 05:53:46 2013
@@ -0,0 +1,5 @@
+.classpath
+.git
+.project
+.settings
+target

Propchange: hadoop/common/branches/branch-2.0.5/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed May 15 05:53:46 2013
@@ -0,0 +1,3 @@
+/hadoop/common/branches/HDFS-3042:1306184-1342109
+/hadoop/common/branches/branch-0.23-PB:1227776-1294021
+/hadoop/common/trunk:1161777,1161781,1162188,1162421,1162491,1162499,1162613,1162928,1162954,1162979,1163050,1163069,1163490,1163768,1163852,1163858,1163981,1164255,1164301,1164339,1166009,1166402,1167001,1167383,1167662,1170085,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1189613,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1239752,1240897,1240928,1243065,1243104,1244766,1245751,1245762,1293419,1295061,1295227,1296556,1298044,1298696,1298700,1299045,1299434,1299963,1301308,1301312,1301820,1301871,1302624,
 
1302704-1302705,1303474,1304063,1304099,1304112,1304118,1305230,1309625,1310185,1311556,1312029,1329319,1333557,1334216,1342112,1348207,1349124,1349616,1351818,1361813,1373683,1374696,1375450,1375829,1379646,1400347,1430682,1430688,1440245,1445965,1455316,1465121