accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject git commit: ACCUMULO-1732 fixed input format w/ mock
Date Wed, 23 Oct 2013 03:15:44 GMT
Updated Branches:
  refs/heads/master 7f6e51227 -> 941e3cb1a


ACCUMULO-1732 fixed input format w/ mock


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

Branch: refs/heads/master
Commit: 941e3cb1acbdb3ad2047e512d5fe3c95e595496b
Parents: 7f6e512
Author: Keith Turner <kturner@apache.org>
Authored: Tue Oct 22 23:15:33 2013 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Tue Oct 22 23:15:33 2013 -0400

----------------------------------------------------------------------
 .../accumulo/core/client/mapred/AbstractInputFormat.java | 11 ++++++++---
 .../core/client/mapreduce/AbstractInputFormat.java       | 11 ++++++++---
 2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/941e3cb1/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
index c89c5d7..eaf99cb 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
@@ -371,6 +371,8 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V>
{
         log.debug("Authorizations are: " + authorizations);
         if (tableConfig.isOfflineScan()) {
           scanner = new OfflineScanner(instance, new Credentials(principal, token), split.getTableId(),
authorizations);
+        } else if (instance instanceof MockInstance) {
+          scanner = instance.getConnector(principal, token).createScanner(split.getTableName(),
authorizations);
         } else {
           scanner = new ScannerImpl(instance, new Credentials(principal, token), split.getTableId(),
authorizations);
         }
@@ -382,7 +384,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V>
{
           log.info("Using local iterators");
           scanner = new ClientSideIteratorScanner(scanner);
         }
-        setupIterators(job, scanner, split.getTableId());
+        setupIterators(job, scanner, split.getTableName());
       } catch (Exception e) {
         throw new IOException(e);
       }
@@ -460,7 +462,11 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V>
{
       TabletLocator tl;
       try {
         // resolve table name to id once, and use id from this point forward
-        tableId = Tables.getTableId(getInstance(job), tableName);
+        Instance instance = getInstance(job);
+        if (instance instanceof MockInstance)
+          tableId = "";
+        else
+          tableId = Tables.getTableId(instance, tableName);
         if (tableConfig.isOfflineScan()) {
           binnedRanges = binOfflineTable(job, tableId, ranges);
           while (binnedRanges == null) {
@@ -469,7 +475,6 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V>
{
             binnedRanges = binOfflineTable(job, tableId, ranges);
           }
         } else {
-          Instance instance = getInstance(job);
           tl = getTabletLocator(job, tableId);
           // its possible that the cache could contain complete, but old information about
a tables tablets... so clear it
           tl.invalidateCache();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/941e3cb1/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
index 74f8f8b..d426caf 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
@@ -386,6 +386,8 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V>
{
         log.debug("Authorizations are: " + authorizations);
         if (tableConfig.isOfflineScan()) {
           scanner = new OfflineScanner(instance, new Credentials(principal, token), split.getTableId(),
authorizations);
+        } else if (instance instanceof MockInstance) {
+          scanner = instance.getConnector(principal, token).createScanner(split.getTableName(),
authorizations);
         } else {
           scanner = new ScannerImpl(instance, new Credentials(principal, token), split.getTableId(),
authorizations);
         }
@@ -397,7 +399,7 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V>
{
           log.info("Using local iterators");
           scanner = new ClientSideIteratorScanner(scanner);
         }
-        setupIterators(attempt, scanner, split.getTableId());
+        setupIterators(attempt, scanner, split.getTableName());
       } catch (Exception e) {
         throw new IOException(e);
       }
@@ -488,7 +490,11 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V>
{
       TabletLocator tl;
       try {
         // resolve table name to id once, and use id from this point forward
-        tableId = Tables.getTableId(getInstance(context), tableName);
+        Instance instance = getInstance(context);
+        if (instance instanceof MockInstance)
+          tableId = "";
+        else
+          tableId = Tables.getTableId(instance, tableName);
         if (tableConfig.isOfflineScan()) {
           binnedRanges = binOfflineTable(context, tableId, ranges);
           while (binnedRanges == null) {
@@ -498,7 +504,6 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V>
{
 
           }
         } else {
-          Instance instance = getInstance(context);
           tl = getTabletLocator(context, tableId);
           // its possible that the cache could contain complete, but old information about
a tables tablets... so clear it
           tl.invalidateCache();


Mime
View raw message