accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1393876 - in /accumulo/trunk: ./ core/ fate/src/main/java/org/apache/accumulo/fate/ZooStore.java server/ server/src/main/java/org/apache/accumulo/server/test/functional/FateStarvationTest.java src/ test/system/auto/simple/fateStartvation.py
Date Thu, 04 Oct 2012 02:00:28 GMT
Author: kturner
Date: Thu Oct  4 02:00:27 2012
New Revision: 1393876

URL: http://svn.apache.org/viewvc?rev=1393876&view=rev
Log:
ACCUMULO-779 fixed Fate starvation bug (merged from 1.4)

Added:
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/FateStarvationTest.java
      - copied unchanged from r1393868, accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/test/functional/FateStarvationTest.java
    accumulo/trunk/test/system/auto/simple/fateStartvation.py
      - copied unchanged from r1393868, accumulo/branches/1.4/test/system/auto/simple/fateStartvation.py
Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (contents,
props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4:r1393868

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/core:r1393868

Modified: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java?rev=1393876&r1=1393875&r2=1393876&view=diff
==============================================================================
--- accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (original)
+++ accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java Thu Oct  4 02:00:27
2012
@@ -47,6 +47,7 @@ public class ZooStore<T> implements TSto
   
   private String path;
   private IZooReaderWriter zk;
+  private String lastReserved = "";
   private Set<Long> reserved;
   private Map<Long,Long> defered;
   private SecureRandom idgenerator;
@@ -123,20 +124,33 @@ public class ZooStore<T> implements TSto
           events = statusChangeEvents;
         }
         
-        List<String> txdirs = zk.getChildren(path);
+        List<String> txdirs = new ArrayList<String>(zk.getChildren(path));
+        Collections.sort(txdirs);
+        
+        synchronized (this) {
+          if (txdirs.size() > 0 && txdirs.get(txdirs.size() - 1).compareTo(lastReserved)
<= 0)
+            lastReserved = "";
+        }
         
         for (String txdir : txdirs) {
           long tid = parseTid(txdir);
           
           synchronized (this) {
+            // this check makes reserve pick up where it left off, so that it cycles through
all as it is repeatedly called.... failing to do so can lead to
+            // starvation where fate ops that sort higher and hold a lock are never reserved.
+            if (txdir.compareTo(lastReserved) <= 0)
+              continue;
+
             if (defered.containsKey(tid)) {
               if (defered.get(tid) < System.currentTimeMillis())
                 defered.remove(tid);
               else
                 continue;
             }
-            if (!reserved.contains(tid))
+            if (!reserved.contains(tid)) {
               reserved.add(tid);
+              lastReserved = txdir;
+            }
             else
               continue;
           }

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Oct  4 02:00:27 2012
@@ -0,0 +1,16 @@
+/accumulo/branches/1.3/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1309369,1328076,1330246,1330264,1330944,1349971,1354669
+/accumulo/branches/1.3/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1309369,1328076,1330246,1349971,1354669
+/accumulo/branches/1.4/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1305403-1382577,1382613,1388120,1388629,1393868
+/accumulo/branches/1.4/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1305403-1356900,1358206,1363430,1364778,1365213,1382566,1382923,1388120
+/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/fate/ZooStore.java:1393868
+/accumulo/branches/ACCUMULO-672/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1357826,1357829,1357842,1357858,1358236,1359163
+/accumulo/trunk/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1329425,1332224,1332278,1332347,1333047,1333070,1341000,1342373,1350779,1351691,1356400,1359721
+/incubator/accumulo/branches/1.3/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043,1236873,1245632
+/incubator/accumulo/branches/1.3/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195,1230180,1230736,1231043,1236873,1245632
+/incubator/accumulo/branches/1.3.5rc/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1209938
+/incubator/accumulo/branches/1.3.5rc/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1209938
+/incubator/accumulo/branches/1.4/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1201902-1305402
+/incubator/accumulo/branches/1.4/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1201899-1305402
+/incubator/accumulo/branches/1.4.0rc/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1304025,1305326
+/incubator/accumulo/branches/1.4.0rc/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1304025,1305326
+/incubator/accumulo/trunk/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:1178656-1201898,1205476,1205570,1208726,1222413,1222719,1222725,1222733-1222734,1296160-1296495

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/server:r1393868
  Merged /accumulo/branches/1.4/src/server:r1393868

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src:r1393868



Mime
View raw message