Repository: accumulo
Updated Branches:
  refs/heads/master e912cdde0 -> 0412f7b55


ACCUMULO-3282 Read file column for tablet from map instead of re-scanning 
metadata table.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/0412f7b5
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0412f7b5
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0412f7b5

Branch: refs/heads/master
Commit: 0412f7b559bbc9678e175489ed8b70f4b9a46ba9
Parents: e912cdd
Author: Josh Elser <els...@apache.org>
Authored: Thu Nov 13 10:42:14 2014 -0800
Committer: Josh Elser <els...@apache.org>
Committed: Sun Nov 16 20:13:49 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/tserver/tablet/Tablet.java  | 36 +++++++-------------
 1 file changed, 13 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/0412f7b5/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
----------------------------------------------------------------------
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 9490903..1f3306e 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -46,7 +46,6 @@ import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Durability;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.impl.DurabilityImpl;
-import org.apache.accumulo.core.client.impl.ScannerImpl;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.ConfigurationCopy;
@@ -74,7 +73,6 @@ import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.metadata.schema.DataFileValue;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
-import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
 import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.LogColumnFamily;
 import 
org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ScanFileColumnFamily;
 import org.apache.accumulo.core.protobuf.ProtobufUtil;
@@ -352,29 +350,21 @@ public class Tablet implements TabletCommitter {
         datafiles.put(ref, dfv);
       }
     } else {
+      final Text buffer = new Text();
+      final Text row = extent.getMetadataEntry();
 
-      Text rowName = extent.getMetadataEntry();
-
-      String tableId = extent.isMeta() ? RootTable.ID : MetadataTable.ID;
-      ScannerImpl mdScanner = new ScannerImpl(HdfsZooInstance.getInstance(), 
SystemCredentials.get(), tableId, Authorizations.EMPTY);
-
-      // Commented out because when no data file is present, each tablet will 
scan through metadata table and return nothing
-      // reduced batch size to improve performance
-      // changed here after endKeys were implemented from 10 to 1000
-      mdScanner.setBatchSize(1000);
-
-      // leave these in, again, now using endKey for safety
-      mdScanner.fetchColumnFamily(DataFileColumnFamily.NAME);
-
-      mdScanner.setRange(new Range(rowName));
-
-      for (Entry<Key,Value> entry : mdScanner) {
-        if (entry.getKey().compareRow(rowName) != 0) {
-          break;
+      for (Entry<Key,Value> entry : tabletsKeyValues.entrySet()) {
+        Key k = entry.getKey();
+        k.getRow(buffer);
+        // Double-check that we have the expected row
+        if (row.equals(buffer)) {
+          k.getColumnFamily(buffer);
+          // Ignore anything but file:
+          if (TabletsSection.DataFileColumnFamily.NAME.equals(buffer)) {
+            FileRef ref = new FileRef(fs, k);
+            datafiles.put(ref, new DataFileValue(entry.getValue().get()));
+          }
         }
-
-        FileRef ref = new FileRef(fs, entry.getKey());
-        datafiles.put(ref, new DataFileValue(entry.getValue().get()));
       }
     }
     return datafiles;

Reply via email to