accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1437820 [1/4] - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/client/admin/ proxy/ proxy/src/main/java/org/apache/accumulo/proxy/ proxy/src/main/java/org/apache/accumulo/proxy/thrift/ proxy/src/main/thrift/ proxy/src/test...
Date Thu, 24 Jan 2013 01:13:25 GMT
Author: ecn
Date: Thu Jan 24 01:13:24 2013
New Revision: 1437820

URL: http://svn.apache.org/viewvc?rev=1437820&view=rev
Log:
ACCUMULO-969 cleaned up the thrift spec file, added column filtering to scanners, moved all
column options to a new data type, checkpointing

Added:
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/BatchScanOptions.java
  (with props)
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanColumn.java  
(with props)
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ScanOptions.java 
 (with props)
Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
    accumulo/trunk/proxy/pom.xml
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveCompaction.java
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveScan.java
    accumulo/trunk/proxy/src/main/thrift/proxy.thrift
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1437820&r1=1437819&r2=1437820&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
Thu Jan 24 01:13:24 2013
@@ -620,6 +620,12 @@ public class TableOperationsImpl extends
     if (flush)
       _flush(srcTableId, null, null, true);
     
+    if (propertiesToExclude == null)
+      propertiesToExclude = Collections.emptySet();
+    
+    if (propertiesToSet == null)
+      propertiesToSet = Collections.emptyMap();
+    
     if (!Collections.disjoint(propertiesToExclude, propertiesToSet.keySet()))
       throw new IllegalArgumentException("propertiesToSet and propertiesToExclude not disjoint");
     

Modified: accumulo/trunk/proxy/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/pom.xml?rev=1437820&r1=1437819&r2=1437820&view=diff
==============================================================================
--- accumulo/trunk/proxy/pom.xml (original)
+++ accumulo/trunk/proxy/pom.xml Thu Jan 24 01:13:24 2013
@@ -101,6 +101,11 @@
     	<version>1.5.0-SNAPSHOT</version>
     	<scope>test</scope>
     </dependency>
+    <dependency>
+    	<groupId>org.apache.accumulo</groupId>
+    	<artifactId>examples-simple</artifactId>
+    	<scope>test</scope>
+    </dependency>
   </dependencies>
 
   <profiles>

Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1437820&r1=1437819&r2=1437820&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Thu Jan
24 01:13:24 2013
@@ -66,12 +66,15 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.proxy.thrift.AccumuloProxy;
+import org.apache.accumulo.proxy.thrift.BatchScanOptions;
 import org.apache.accumulo.proxy.thrift.KeyValueAndPeek;
 import org.apache.accumulo.proxy.thrift.ColumnUpdate;
 import org.apache.accumulo.proxy.thrift.CompactionReason;
 import org.apache.accumulo.proxy.thrift.CompactionType;
 import org.apache.accumulo.proxy.thrift.KeyValue;
 import org.apache.accumulo.proxy.thrift.NoMoreEntriesException;
+import org.apache.accumulo.proxy.thrift.ScanColumn;
+import org.apache.accumulo.proxy.thrift.ScanOptions;
 import org.apache.accumulo.proxy.thrift.ScanResult;
 import org.apache.accumulo.proxy.thrift.ScanState;
 import org.apache.accumulo.proxy.thrift.ScanType;
@@ -674,31 +677,41 @@ public class ProxyServer implements Accu
   }
   
   @Override
-  public String createScanner(UserPass userpass, String tableName, Set<ByteBuffer>
authorizations, List<org.apache.accumulo.proxy.thrift.IteratorSetting> iterators, org.apache.accumulo.proxy.thrift.Range
prange)
+  public String createScanner(UserPass userpass, String tableName, ScanOptions opts)
       throws TException {
     try {
       Connector connector = getConnector(userpass);
       
       Authorizations auth;
-      if (authorizations != null) {
-        auth = getAuthorizations(authorizations);
+      if (opts != null && opts.isSetAuthorizations()) {
+        auth = getAuthorizations(opts.authorizations);
       } else {
         auth = connector.securityOperations().getUserAuthorizations(userpass.getUsername());
       }
-      
       Scanner scanner = connector.createScanner(tableName, auth);
       
-      if (iterators != null) {
-        for (org.apache.accumulo.proxy.thrift.IteratorSetting iter : iterators) {
-          IteratorSetting is = new IteratorSetting(iter.getPriority(), iter.getName(), iter.getIteratorClass(),
iter.getProperties());
-          scanner.addScanIterator(is);
+      if (opts != null) {
+        if (opts.iterators != null) {
+          for (org.apache.accumulo.proxy.thrift.IteratorSetting iter : opts.iterators) {
+            IteratorSetting is = new IteratorSetting(iter.getPriority(), iter.getName(),
iter.getIteratorClass(), iter.getProperties());
+            scanner.addScanIterator(is);
+          }
+        }
+        org.apache.accumulo.proxy.thrift.Range prange = opts.range;
+        Range range = prange == null ? new Range() : (new Range(prange.getStart() == null
? null : Util.fromThrift(prange.getStart()), true,
+            prange.getStop() == null ? null : Util.fromThrift(prange.getStop()), false));
+        
+        scanner.setRange(range);
+        if (opts.columns != null) {
+          for (ScanColumn col : opts.columns) {
+            if (col.isSetColQualifier())
+              scanner.fetchColumn(ByteBufferUtil.toText(col.colFamily), ByteBufferUtil.toText(col.colQualifier));
+            else
+              scanner.fetchColumnFamily(ByteBufferUtil.toText(col.colFamily));
+          }
         }
       }
       
-      Range range = prange == null ? new Range() : (new Range(prange.getStart() == null ?
null : Util.fromThrift(prange.getStart()), true,
-          prange.getStop() == null ? null : Util.fromThrift(prange.getStop()), false));
-      
-      scanner.setRange(range);
       UUID uuid = UUID.randomUUID();
       
       ScannerPlusIterator spi = new ScannerPlusIterator();
@@ -712,39 +725,44 @@ public class ProxyServer implements Accu
   }
   
   @Override
-  public String createBatchScanner(UserPass userpass, String tableName, Set<ByteBuffer>
authorizations, List<org.apache.accumulo.proxy.thrift.IteratorSetting> iterators, List<org.apache.accumulo.proxy.thrift.Range>
pranges)
+  public String createBatchScanner(UserPass userpass, String tableName, BatchScanOptions
opts)
       throws TException {
     try {
       Connector connector = getConnector(userpass);
       
+      int batchSize = 10;
       Authorizations auth;
-      if (authorizations != null) {
-        auth = getAuthorizations(authorizations);
+      if (opts != null && opts.isSetAuthorizations()) {
+        auth = getAuthorizations(opts.authorizations);
       } else {
         auth = connector.securityOperations().getUserAuthorizations(userpass.getUsername());
       }
+      if (opts != null && opts.isSetBufferSize() && opts.bufferSize >
0)
+        batchSize = opts.bufferSize;
+
+      BatchScanner scanner = connector.createBatchScanner(tableName, auth, batchSize);
       
-      BatchScanner scanner = connector.createBatchScanner(tableName, auth, 10);
-      
-      if (iterators != null) {
-        for (org.apache.accumulo.proxy.thrift.IteratorSetting iter : iterators) {
-          IteratorSetting is = new IteratorSetting(iter.getPriority(), iter.getName(), iter.getIteratorClass(),
iter.getProperties());
-          scanner.addScanIterator(is);
+      if (opts != null) {
+        if (opts.iterators != null) {
+          for (org.apache.accumulo.proxy.thrift.IteratorSetting iter : opts.iterators) {
+            IteratorSetting is = new IteratorSetting(iter.getPriority(), iter.getName(),
iter.getIteratorClass(), iter.getProperties());
+            scanner.addScanIterator(is);
+          }
         }
-      }
-      
-      ArrayList<Range> ranges = new ArrayList<Range>();
-      
-      if (pranges == null) {
-        ranges.add(new Range());
-      } else {
-        for (org.apache.accumulo.proxy.thrift.Range range : pranges) {
-          Range aRange = new Range(range.getStart() == null ? null : Util.fromThrift(range.getStart()),
true, range.getStop() == null ? null
-              : Util.fromThrift(range.getStop()), false);
-          ranges.add(aRange);
+        
+        ArrayList<Range> ranges = new ArrayList<Range>();
+        
+        if (opts.ranges == null) {
+          ranges.add(new Range());
+        } else {
+          for (org.apache.accumulo.proxy.thrift.Range range : opts.ranges) {
+            Range aRange = new Range(range.getStart() == null ? null : Util.fromThrift(range.getStart()),
true, range.getStop() == null ? null
+                : Util.fromThrift(range.getStop()), false);
+            ranges.add(aRange);
+          }
         }
+        scanner.setRanges(ranges);
       }
-      scanner.setRanges(ranges);
       UUID uuid = UUID.randomUUID();
       
       ScannerPlusIterator spi = new ScannerPlusIterator();

Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java?rev=1437820&r1=1437819&r2=1437820&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java Thu
Jan 24 01:13:24 2013
@@ -143,7 +143,7 @@ public class TestProxyClient {
     
     Key stop = new Key();
     stop.setRow("5".getBytes());
-    String cookie = tpc.proxy().createBatchScanner(userpass, testTable, null, null, null);
+    String cookie = tpc.proxy().createBatchScanner(userpass, testTable, null);
     
     int i = 0;
     start = new Date();



Mime
View raw message