You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Akber Choudhry (JIRA)" <ji...@apache.org> on 2014/01/30 18:00:11 UTC

[jira] [Issue Comment Deleted] (GORA-292) Upgrade dependency to Accumulo 1.5

     [ https://issues.apache.org/jira/browse/GORA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Akber Choudhry updated GORA-292:
--------------------------------

    Comment: was deleted

(was: diff --git a/gora-accumulo/pom.xml b/gora-accumulo/pom.xml
index a7f9f34..f0d23b1 100644
--- a/gora-accumulo/pom.xml
+++ b/gora-accumulo/pom.xml
@@ -114,7 +114,7 @@
         <dependency>
            <groupId>org.apache.accumulo</groupId>
            <artifactId>accumulo-core</artifactId>
-           <version>1.4.0</version>
+           <version>1.5.0</version>
         </dependency>
 
         <!-- Hadoop Dependencies -->
diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
index 32dd4db..b3dc4cd 100644
--- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
+++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
@@ -30,6 +30,7 @@
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -38,6 +39,7 @@
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.IsolatedScanner;
 import org.apache.accumulo.core.client.IteratorSetting;
@@ -54,6 +56,7 @@
 import org.apache.accumulo.core.client.mock.MockConnector;
 import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.mock.MockTabletLocator;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -64,7 +67,7 @@
 import org.apache.accumulo.core.iterators.user.TimestampFilter;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.core.util.UtilWaitThread;
@@ -116,7 +119,7 @@
   private Connector conn;
   private BatchWriter batchWriter;
   private AccumuloMapping mapping;
-  private AuthInfo authInfo;
+  private TCredentials credentials;
   private Encoder encoder;
   
   public static final Logger LOG = LoggerFactory.getLogger(AccumuloStore.class);
@@ -230,7 +233,11 @@
   private BatchWriter getBatchWriter() throws IOException {
     if (batchWriter == null)
       try {
-        batchWriter = conn.createBatchWriter(mapping.tableName, 10000000, 60000l, 4);
+        BatchWriterConfig writerConfig = new BatchWriterConfig();
+        writerConfig.setMaxMemory(10000000);
+        writerConfig.setMaxLatency(60000l, TimeUnit.MILLISECONDS);
+        writerConfig.setMaxWriteThreads(4);
+        batchWriter = conn.createBatchWriter(mapping.tableName, writerConfig);
       } catch (TableNotFoundException e) {
         throw new IOException(e);
       }
@@ -267,10 +274,13 @@
         if (mock == null || !mock.equals("true")) {
           String instance = DataStoreFactory.findProperty(properties, this, INSTANCE_NAME_PROPERTY, null);
           String zookeepers = DataStoreFactory.findProperty(properties, this, ZOOKEEPERS_NAME_PROPERTY, null);
-          conn = new ZooKeeperInstance(instance, zookeepers).getConnector(user, password);
-          authInfo = new AuthInfo(user, ByteBuffer.wrap(password.getBytes()), conn.getInstance().getInstanceID());
+          conn = new ZooKeeperInstance(instance, zookeepers).getConnector(user, new PasswordToken(password));
+          credentials = new TCredentials(user, "org.apache.accumulo.core.client.security.tokens.PasswordToken", 
+              ByteBuffer.wrap(password.getBytes()), conn.getInstance().getInstanceID());
         } else {
-          conn = new MockInstance().getConnector(user, password);
+          conn = new MockInstance().getConnector(user, new PasswordToken(password));
+          credentials = new TCredentials(user, "org.apache.accumulo.core.client.security.tokens.PasswordToken", 
+              ByteBuffer.wrap(password.getBytes()), conn.getInstance().getInstanceID());
         }
   
         if (autoCreateSchema)
@@ -721,12 +731,12 @@
       if (conn instanceof MockConnector)
         tl = new MockTabletLocator();
       else
-        tl = TabletLocator.getInstance(conn.getInstance(), authInfo, new Text(Tables.getTableId(conn.getInstance(), mapping.tableName)));
+        tl = TabletLocator.getInstance(conn.getInstance(), new Text(Tables.getTableId(conn.getInstance(), mapping.tableName)));
       
       Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
       
       tl.invalidateCache();
-      while (tl.binRanges(Collections.singletonList(createRange(query)), binnedRanges).size() > 0) {
+      while (tl.binRanges(Collections.singletonList(createRange(query)), binnedRanges, credentials).size() > 0) {
         // TODO log?
         if (!Tables.exists(conn.getInstance(), Tables.getTableId(conn.getInstance(), mapping.tableName)))
           throw new TableDeletedException(Tables.getTableId(conn.getInstance(), mapping.tableName));)

> Upgrade dependency to Accumulo 1.5
> ----------------------------------
>
>                 Key: GORA-292
>                 URL: https://issues.apache.org/jira/browse/GORA-292
>             Project: Apache Gora
>          Issue Type: Improvement
>          Components: gora-accumulo
>    Affects Versions: 0.3
>            Reporter: Akber Choudhry
>            Priority: Minor
>              Labels: deprecated, newdev, patch
>             Fix For: 0.4
>
>




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)