Author: kturner
Date: Tue Jun 19 22:19:21 2012
New Revision: 1351885

URL: http://svn.apache.org/viewvc?rev=1351885&view=rev
Log:
ACCUMULO-628 fixed unintended deletion of tablets last location

Modified:
    
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java

Modified: 
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java?rev=1351885&r1=1351884&r2=1351885&view=diff
==============================================================================
--- 
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
 (original)
+++ 
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
 Tue Jun 19 22:19:21 2012
@@ -191,12 +191,12 @@ public class MetadataTable extends org.a
     if (dfv.getNumEntries() > 0) {
       m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new 
Value(dfv.encode()));
       ColumnFQ.put(m, Constants.METADATA_TIME_COLUMN, new 
Value(time.getBytes()));
-      // erase the old location
-      if (lastLocation != null)
-        lastLocation.clearLastLocation(m);
       // stuff in this location
       TServerInstance self = getTServerInstance(address, zooLock);
       self.putLastLocation(m);
+      // erase the old location
+      if (lastLocation != null && !lastLocation.equals(self))
+        lastLocation.clearLastLocation(m);
     }
     if (unusedWalLogs != null) {
       for (String entry : unusedWalLogs) {
@@ -465,11 +465,12 @@ public class MetadataTable extends org.a
     if (compactionId != null)
       ColumnFQ.put(m, Constants.METADATA_COMPACT_COLUMN, new Value(("" + 
compactionId).getBytes()));
     
-    // remove the old location
-    if (lastLocation != null)
-      lastLocation.clearLastLocation(m);
     TServerInstance self = getTServerInstance(address, zooLock);
     self.putLastLocation(m);
+
+    // remove the old location
+    if (lastLocation != null && !lastLocation.equals(self))
+      lastLocation.clearLastLocation(m);
     
     update(credentials, zooLock, m);
   }


Reply via email to