accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1180093 - in /incubator/accumulo: branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
Date Fri, 07 Oct 2011 16:34:48 GMT
Author: kturner
Date: Fri Oct  7 16:34:48 2011
New Revision: 1180093

URL: http://svn.apache.org/viewvc?rev=1180093&view=rev
Log:
ACCUMULO-5 made log recovery convert tablet files to absolute paths

Modified:
    incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
    incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java

Modified: incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java?rev=1180093&r1=1180092&r2=1180093&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
(original)
+++ incubator/accumulo/branches/1.3/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
Fri Oct  7 16:34:48 2011
@@ -516,6 +516,10 @@ public class Tablet {
 		return extent.getTableId().toString().equals(Constants.METADATA_TABLE_ID);
 	}
 
+	private static String rel2abs(String relPath, KeyExtent extent){
+		return Constants.getTablesDir() + "/" + extent.getTableId() + relPath;
+	}
+	
 	class DatafileManager {
 		private TreeMap<String, DataFileValue> datafileSizes;
 		private SortedMap<String, DataFileValue> unModMap;
@@ -525,7 +529,7 @@ public class Tablet {
 
 			for(Entry<String, DataFileValue> datafiles : datafileSizes.entrySet()) {
 				try {
-					tabletResources.addMapFile(Constants.getTablesDir() + "/" + extent.getTableId() + datafiles.getKey(),datafiles.getValue().getSize());
+					tabletResources.addMapFile(rel2abs(datafiles.getKey(), extent), datafiles.getValue().getSize());
 				}
 				catch (IOException e) {
 					log.error("ioexception trying to open " + datafiles);
@@ -1311,7 +1315,11 @@ public class Tablet {
 		    final CommitSession commitSession = tabletMemory.getCommitSession();
 		    count[1] = Long.MIN_VALUE;
 		    try {
-		        tabletServer.recover(this, logEntries, datafiles.keySet(), new MutationReceiver()
{
+		    	Set<String> absPaths = new HashSet<String>();
+		    	for(String relPath : datafiles.keySet())
+		    		absPaths.add(rel2abs(relPath, extent));
+		    	
+		        tabletServer.recover(this, logEntries, absPaths, new MutationReceiver() {
 		        	public void receive(Mutation m) {
 		        		//LogReader.printMutation(m);
 		        		Collection<ColumnUpdate> muts = m.getUpdates();

Modified: incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java?rev=1180093&r1=1180092&r2=1180093&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
(original)
+++ incubator/accumulo/trunk/src/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
Fri Oct  7 16:34:48 2011
@@ -470,17 +470,20 @@ public class Tablet {
 		return extent.getTableId().toString().equals(Constants.METADATA_TABLE_ID);
 	}
 
+	private static String rel2abs(String relPath, KeyExtent extent){
+		if(relPath.startsWith("../"))
+			return ServerConstants.getTablesDir() + relPath.substring(2);
+		else
+			return ServerConstants.getTablesDir() + "/" + extent.getTableId() + relPath;
+	}
+	
 	class DatafileManager {
 		private TreeMap<Path, DataFileValue> datafileSizes;
 		DatafileManager(SortedMap<String, DataFileValue> datafileSizes){
 			this.datafileSizes = new TreeMap<Path, DataFileValue>();
 			
-			for(Entry<String, DataFileValue> datafiles : datafileSizes.entrySet()) {
-				if(datafiles.getKey().startsWith("../"))
-					this.datafileSizes.put(new Path(ServerConstants.getTablesDir() + datafiles.getKey().substring(2)),datafiles.getValue());
-				else
-					this.datafileSizes.put(new Path(ServerConstants.getTablesDir() + "/" + extent.getTableId()
+ datafiles.getKey()),datafiles.getValue());
-			}
+			for(Entry<String, DataFileValue> datafiles : datafileSizes.entrySet()) 
+				this.datafileSizes.put(new Path(rel2abs(datafiles.getKey(), extent)), datafiles.getValue());
 		}
 
 		Path mergingMinorCompactionFile = null;
@@ -1434,7 +1437,11 @@ public class Tablet {
 		    final CommitSession commitSession = tabletMemory.getCommitSession();
 		    count[1] = Long.MIN_VALUE;
 		    try {
-		        tabletServer.recover(this, logEntries, datafiles.keySet(), new MutationReceiver()
{
+		    	Set<String> absPaths = new HashSet<String>();
+		    	for(String relPath : datafiles.keySet())
+		    		absPaths.add(rel2abs(relPath, extent));
+		    	
+		        tabletServer.recover(this, logEntries, absPaths, new MutationReceiver() {
 		        	public void receive(Mutation m) {
 		        		//LogReader.printMutation(m);
 		        		Collection<ColumnUpdate> muts = m.getUpdates();



Mime
View raw message