You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by cj...@apache.org on 2013/08/30 04:31:58 UTC

git commit: Fixing Bill Slacum's patch to work with recent updates to the codebase including moving the METADATA_TABLE constants to a MetadataSchema class and moving AuthInfo methods for ColFQ and other internal classes to use Credentials instead.

Updated Branches:
  refs/heads/ACCUMULO-391 81a65f3ca -> 9e021f7eb


Fixing Bill Slacum's patch to work with recent updates to the codebase including moving the METADATA_TABLE constants to a MetadataSchema class and moving AuthInfo methods for ColFQ and other internal classes to use Credentials instead.


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

Branch: refs/heads/ACCUMULO-391
Commit: 9e021f7eb229a6f82055a45b933004913b30c386
Parents: 81a65f3
Author: Corey J. Nolet <cj...@gmail.com>
Authored: Thu Aug 29 22:28:51 2013 -0400
Committer: Corey J. Nolet <cj...@gmail.com>
Committed: Thu Aug 29 22:28:51 2013 -0400

----------------------------------------------------------------------
 .../client/mapreduce/multi/InputFormatBase.java | 32 +++++++++++---------
 .../core/iterators/TypedValueCombiner.java      | 13 +++-----
 .../accumulo/core/util/TTimeoutTransport.java   | 18 ++++-------
 3 files changed, 29 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9e021f7e/core/src/main/java/org/apache/accumulo/core/client/mapreduce/multi/InputFormatBase.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/multi/InputFormatBase.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/multi/InputFormatBase.java
index 76070ed..dcbbed9 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/multi/InputFormatBase.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/multi/InputFormatBase.java
@@ -16,26 +16,27 @@
  */
 package org.apache.accumulo.core.client.mapreduce.multi;
 
+import static org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily.*;
+
 import java.io.*;
 import java.math.*;
 import java.net.*;
-import java.nio.*;
 import java.util.*;
 import java.util.Map.*;
 
-import com.sun.tools.internal.ws.wscompile.*;
 import org.apache.accumulo.core.*;
 import org.apache.accumulo.core.client.*;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.impl.*;
 import org.apache.accumulo.core.client.mock.*;
+import org.apache.accumulo.core.client.security.tokens.*;
 import org.apache.accumulo.core.data.*;
 import org.apache.accumulo.core.iterators.*;
 import org.apache.accumulo.core.iterators.user.VersioningIterator;
 import org.apache.accumulo.core.master.state.tables.*;
 import org.apache.accumulo.core.metadata.*;
+import org.apache.accumulo.core.metadata.schema.*;
 import org.apache.accumulo.core.security.*;
-import org.apache.accumulo.core.security.thrift.*;
 import org.apache.accumulo.core.util.*;
 import org.apache.commons.codec.binary.*;
 import org.apache.commons.lang.StringUtils;
@@ -758,10 +759,11 @@ public abstract class InputFormatBase<K,V> extends InputFormat<K,V> {
       try {
         log.debug("Creating connector with user: " + user);
         Connector conn = instance.getConnector(user, password);
-        log.debug("Creating scanner for table: " + split.getTableName());
+        log.debug("Creating scanner for table: " + split.getTableName ());
         log.debug("Authorizations are: " + authorizations);
         if (isOfflineScan(conf)) {
-          scanner = new OfflineScanner(instance, new AuthInfo(user, ByteBuffer.wrap(password), instance.getInstanceID()), Tables.getTableId(instance,
+          // TODO: This used AuthInfo before- figure out a better equivalent
+          scanner = new OfflineScanner(instance, new Credentials(user, new PasswordToken(password)), Tables.getTableId(instance,
               split.getTableName()), authorizations);
         } else {
           scanner = conn.createScanner(split.getTableName(), authorizations);
@@ -849,10 +851,11 @@ public abstract class InputFormatBase<K,V> extends InputFormat<K,V> {
       
       Range metadataRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false);
       Scanner scanner = conn.createScanner(MetadataTable.NAME, Constants.NO_AUTHS);
-      ColumnFQ.fetch(scanner, MetadataTable.METADATA_PREV_ROW_COLUMN);
-      scanner.fetchColumnFamily(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY);
-      scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
-      scanner.fetchColumnFamily(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY);
+
+      MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch (scanner);
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LastLocationColumnFamily.NAME);
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.FutureLocationColumnFamily.NAME);
       scanner.setRange(metadataRange);
       
       RowIterator rowIter = new RowIterator(scanner);
@@ -871,16 +874,16 @@ public abstract class InputFormatBase<K,V> extends InputFormat<K,V> {
           Entry<Key,Value> entry = row.next();
           Key key = entry.getKey();
           
-          if (key.getColumnFamily().equals(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY)) {
+          if (key.getColumnFamily().equals(MetadataSchema.TabletsSection.LastLocationColumnFamily.NAME)) {
             last = entry.getValue().toString();
           }
           
-          if (key.getColumnFamily().equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)
-              || key.getColumnFamily().equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
+          if (key.getColumnFamily().equals(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME)
+              || key.getColumnFamily().equals(MetadataSchema.TabletsSection.FutureLocationColumnFamily.NAME)) {
             location = entry.getValue().toString();
           }
           
-          if (Constants.METADATA_PREV_ROW_COLUMN.hasColumns(key)) {
+          if (PREV_ROW_COLUMN.hasColumns(key)) {
             extent = new KeyExtent(key.getRow(), entry.getValue());
           }
           
@@ -968,7 +971,8 @@ public abstract class InputFormatBase<K,V> extends InputFormat<K,V> {
           tl = getTabletLocator(conf, tableName);
           // its possible that the cache could contain complete, but old information about a tables tablets... so clear it
           tl.invalidateCache();
-          while (!tl.binRanges(ranges, binnedRanges).isEmpty()) {
+          Credentials creds = new Credentials (getUsername (conf), new PasswordToken(getPassword (conf)));
+          while (!tl.binRanges(creds, ranges, binnedRanges).isEmpty()) {
             if (!(instance instanceof MockInstance)) {
               if (tableId == null)
                 tableId = Tables.getTableId(instance, tableName);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9e021f7e/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java b/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
index 54a1333..fe81796 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/TypedValueCombiner.java
@@ -16,15 +16,12 @@
  */
 package org.apache.accumulo.core.iterators;
 
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
+import java.io.*;
+import java.util.*;
 
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
+import org.apache.accumulo.core.client.*;
+import org.apache.accumulo.core.data.*;
+import org.apache.accumulo.start.classloader.vfs.*;
 
 /**
  * A Combiner that decodes each Value to type V before reducing, then encodes the result of typedReduce back to Value.

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9e021f7e/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java b/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java
index 0aebc39..fc6668c 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java
@@ -16,19 +16,13 @@
  */
 package org.apache.accumulo.core.util;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Method;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.nio.channels.spi.SelectorProvider;
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.nio.channels.spi.*;
 
-import org.apache.hadoop.net.NetUtils;
-import org.apache.thrift.transport.TIOStreamTransport;
-import org.apache.thrift.transport.TTransport;
+import org.apache.hadoop.net.*;
+import org.apache.thrift.transport.*;
 
 public class TTimeoutTransport {