You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/02/28 22:01:24 UTC
svn commit: r1451340 - in /accumulo/trunk: ./ assemble/ core/ examples/
fate/src/main/java/org/apache/accumulo/fate/
fate/src/main/java/org/apache/accumulo/fate/zookeeper/ server/
server/src/main/java/org/apache/accumulo/server/tabletserver/ src/
Author: ecn
Date: Thu Feb 28 21:01:24 2013
New Revision: 1451340
URL: http://svn.apache.org/r1451340
Log:
ACCUMULO-1110 avoid locking the tablet to get file counts
Modified:
accumulo/trunk/ (props changed)
accumulo/trunk/assemble/ (props changed)
accumulo/trunk/core/ (props changed)
accumulo/trunk/examples/ (props changed)
accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (props changed)
accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java (props changed)
accumulo/trunk/server/ (props changed)
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
accumulo/trunk/src/ (props changed)
Propchange: accumulo/trunk/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5:r1451339
Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/assemble:r1451339
Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/core:r1451339
Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/examples:r1451339
Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1451339
Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1451339
Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/server:r1451339
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java?rev=1451340&r1=1451339&r2=1451340&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java Thu Feb 28 21:01:24 2013
@@ -406,7 +406,7 @@ public class Tablet {
private KeyExtent extent;
private TabletResourceManager tabletResources;
- private DatafileManager datafileManager;
+ final private DatafileManager datafileManager;
private volatile boolean majorCompactionInProgress = false;
private volatile boolean majorCompactionWaitingToStart = false;
private Set<MajorCompactionReason> majorCompactionQueued = Collections.synchronizedSet(EnumSet.noneOf(MajorCompactionReason.class));
@@ -508,11 +508,10 @@ public class Tablet {
}
class DatafileManager {
- private TreeMap<Path,DataFileValue> datafileSizes;
+ // access to datafilesizes needs to be synchronized: see CompactionRunner#getNumFiles
+ final private Map<Path,DataFileValue> datafileSizes = Collections.synchronizedMap(new TreeMap<Path,DataFileValue>());
DatafileManager(SortedMap<String,DataFileValue> datafileSizes) {
- this.datafileSizes = new TreeMap<Path,DataFileValue>();
-
for (Entry<String,DataFileValue> datafiles : datafileSizes.entrySet())
this.datafileSizes.put(new Path(rel2abs(datafiles.getKey(), extent)), datafiles.getValue());
}
@@ -2890,10 +2889,14 @@ public class Tablet {
}
}
+ // We used to synchronize on the Tablet before fetching this information,
+ // but this method is called by the compaction queue thread to re-order the compactions.
+ // The compaction queue holds a lock during this sort.
+ // A tablet lock can be held while putting itself on the queue, so we can't lock the tablet
+ // while pulling information used to sort the tablets in the queue, or we may get deadlocked.
+ // See ACCUMULO-1110.
private int getNumFiles() {
- synchronized (Tablet.this) {
- return datafileManager.datafileSizes.size();
- }
+ return datafileManager.datafileSizes.size();
}
@Override
Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/src:r1451339