hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r686568 [1/3] - in /hadoop/hbase/trunk: ./ lib/ src/java/org/apache/hadoop/hbase/thrift/ src/java/org/apache/hadoop/hbase/thrift/generated/
Date Sat, 16 Aug 2008 22:04:17 GMT
Author: stack
Date: Sat Aug 16 15:04:16 2008
New Revision: 686568

URL: http://svn.apache.org/viewvc?rev=686568&view=rev
Log:
HBASE-697 thrift idl needs update/edit to match new 0.2 API (and to fix bugs)

Added:
    hadoop/hbase/trunk/lib/libthrift-20080411p1.jar   (with props)
Removed:
    hadoop/hbase/trunk/lib/libthrift-r746.jar
Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/NotFound.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/RegionDescriptor.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/ScanEntry.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Sat Aug 16 15:04:16 2008
@@ -3,6 +3,9 @@
 Release 0.3.0 - Unreleased
 
   INCOMPATIBLE CHANGES
+   HBASE-697   Thrift idl needs update/edit to match new 0.2 API (and to fix bugs)
+               (Tim Sell via Stack)
+
   BUG FIXES
    HBASE-805   Remove unnecessary getRow overloads in HRS (Jonathan Gray via
                Jim Kellerman) (Fix whitespace diffs in HRegionServer)

Added: hadoop/hbase/trunk/lib/libthrift-20080411p1.jar
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/lib/libthrift-20080411p1.jar?rev=686568&view=auto
==============================================================================
Binary file - no diff available.

Propchange: hadoop/hbase/trunk/lib/libthrift-20080411p1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift Sat Aug 16 15:04:16
2008
@@ -31,9 +31,10 @@
 // used to generate the *.java files checked into the Hbase project.
 // ----------------------------------------------------------------
 
-java_package org.apache.hadoop.hbase.thrift.generated
-cpp_namespace apache.hadoop.hbase.thrift
-ruby_namespace Apache.Hadoop.Hbase.Thrift
+namespace java org.apache.hadoop.hbase.thrift.generated
+namespace cpp  apache.hadoop.hbase.thrift
+namespace rb Apache.Hadoop.Hbase.Thrift
+
 // note: other language namespaces tbd...
 
 //
@@ -50,6 +51,16 @@
 typedef binary Bytes
 typedef i32    ScannerID
 
+/**
+ * TCell - Used to transport a cell value (byte[]) and the timestamp it was 
+ * stored with together as a result for get and getRow methods. This promotes
+ * the timestamp of a cell to a first-class value, making it easy to take 
+ * note of temporal data. Cell is used all the way from HStore up to HTable.
+ */
+struct TCell{
+  1:Bytes value,
+  2:i64 timestamp
+}
 
 /**
  * An HColumnDescriptor contains information about a column family
@@ -70,11 +81,14 @@
 }
 
 /**
- * A RegionDescriptor contains informationa about an HTable region.
- * Currently, this is just the startKey of the region.
+ * A TRegionInfo contains information about an HTable region.
  */
-struct RegionDescriptor {
+struct TRegionInfo {
   1:Text startKey,
+  2:Text endKey,
+  3:i64 id,
+  4:Text name,
+  5:byte version 
 }
 
 /**
@@ -97,12 +111,11 @@
 
 
 /**
- * A ScanEntry contains the row, column, and value information for a scanner's
- * current location.
+ * Holds row name and then a map of columns to cells. 
  */
-struct ScanEntry {
+struct TRowResult {
   1:Text row,
-  2:map<Text, Bytes> columns
+  2:map<Text, TCell> columns
 }
 
 //
@@ -146,8 +159,29 @@
 //
 
 service Hbase {
+  /**
+   * Brings a table on-line (enables it)
+   * @param tableName name of the table
+   */
+  void enableTable(1:Bytes tableName)
+    throws (1:IOError io)
+    
+  /**
+   * Disables a table (takes it off-line) If it is being served, the master
+   * will tell the servers to stop serving it.
+   * @param tableName name of the table
+   */
+  void disableTable(1:Bytes tableName)
+    throws (1:IOError io)
 
   /**
+   * @param tableName name of table to check
+   * @return true if table is on-line
+   */
+  bool isTableEnabled(1:Bytes tableName)
+    throws (1:IOError io)
+    
+  /**
    * List all the userspace tables.
    * @return - returns a list of names
    */
@@ -167,7 +201,7 @@
    * @param tableName table name
    * @return list of region descriptors
    */
-  list<RegionDescriptor> getTableRegions(1:Text tableName) 
+  list<TRegionInfo> getTableRegions(1:Text tableName) 
     throws (1:IOError io)
 
   /**
@@ -194,7 +228,7 @@
     throws (1:IOError io, 2:NotFound nf)
 
   /** 
-   * Get a single value for the specified table, row, and column at the
+   * Get a single TCell for the specified table, row, and column at the
    * latest timestamp.
    *
    * @param tableName name of table
@@ -202,7 +236,7 @@
    * @param column column name
    * @return value for specified row/column
    */
-  Bytes get(1:Text tableName, 2:Text row, 3:Text column) 
+  TCell get(1:Text tableName, 2:Text row, 3:Text column) 
     throws (1:IOError io, 2:NotFound nf)
 
   /** 
@@ -213,9 +247,9 @@
    * @param row row key
    * @param column column name
    * @param numVersions number of versions to retrieve
-   * @return list of values for specified row/column
+   * @return list of cells for specified row/column
    */
-  list<Bytes> getVer(1:Text tableName, 2:Text row, 3:Text column, 4:i32 numVersions)

+  list<TCell> getVer(1:Text tableName, 2:Text row, 3:Text column, 4:i32 numVersions)

     throws (1:IOError io, 2:NotFound nf)
 
   /** 
@@ -228,9 +262,9 @@
    * @param column column name
    * @param timestamp timestamp
    * @param numVersions number of versions to retrieve
-   * @return list of values for specified row/column
+   * @return list of cells for specified row/column
    */
-  list<Bytes> getVerTs(1:Text tableName, 2:Text row, 3:Text column, 4:i64 timestamp,
 5:i32 numVersions)
+  list<TCell> getVerTs(1:Text tableName, 2:Text row, 3:Text column, 4:i64 timestamp,
 5:i32 numVersions)
     throws (1:IOError io, 2:NotFound nf)
 
   /** 
@@ -239,9 +273,9 @@
    * 
    * @param tableName name of table
    * @param row row key
-   * @return Map of columns to values.  Map is empty if row does not exist.
+   * @return TRowResult containing the row and map of columns to TCells. Map is empty if
row does not exist.
    */
-  map<Text, Bytes> getRow(1:Text tableName, 2:Text row)
+  TRowResult getRow(1:Text tableName, 2:Text row)
     throws (1:IOError io)
 
   /** 
@@ -251,25 +285,12 @@
    * @param tableName of table
    * @param row row key
    * @param timestamp timestamp
-   * @return Map of columns to values.  Map is empty if row does not exist.
+   * @return TRowResult containing the row and map of columns to TCells. Map is empty if
row does not exist.
    */
-  map<Text, Bytes> getRowTs(1:Text tableName, 2:Text row, 3:i64 timestamp)
+  TRowResult getRowTs(1:Text tableName, 2:Text row, 3:i64 timestamp)
     throws (1:IOError io)
 
   /** 
-   * Put a single value at the specified table, row, and column.
-   * To put muliple values in a single transaction, or to specify 
-   * a non-default timestamp, use {@link #mutateRow} and/or
-   * {@link #mutateRowTs}
-   *
-   * @param tableName name of table
-   * @param row row key
-   * @param column column name
-   */
-  void put(1:Text tableName, 2:Text row, 3:Text column, 4:Bytes value)
-    throws (1:IOError io, 2:IllegalArgument ia)
-
-  /** 
    * Apply a series of mutations (updates/deletes) to a row in a
    * single transaction.  If an exception is thrown, then the
    * transaction is aborted.  Default current timestamp is used, and
@@ -456,11 +477,11 @@
    * a NotFound exception is returned.
    *
    * @param id id of a scanner returned by scannerOpen
-   * @return a ScanEntry object representing the current row's values
+   * @return a TRowResult containing the current row and a map of the columns to TCells.
    * @throws IllegalArgument if ScannerID is invalid
    * @throws NotFound when the scanner reaches the end
    */
-  ScanEntry scannerGet(1:ScannerID id)
+  TRowResult scannerGet(1:ScannerID id)
     throws (1:IOError io, 2:IllegalArgument ia, 3:NotFound nf)
 
   /**

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Sat Aug 16
15:04:16 2008
@@ -20,18 +20,19 @@
 
 import java.io.IOException;
 import java.nio.charset.MalformedInputException;
-import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-import java.util.Map.Entry;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HServerAddress;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -48,8 +49,9 @@
 import org.apache.hadoop.hbase.thrift.generated.IllegalArgument;
 import org.apache.hadoop.hbase.thrift.generated.Mutation;
 import org.apache.hadoop.hbase.thrift.generated.NotFound;
-import org.apache.hadoop.hbase.thrift.generated.RegionDescriptor;
-import org.apache.hadoop.hbase.thrift.generated.ScanEntry;
+import org.apache.hadoop.hbase.thrift.generated.TRegionInfo;
+import org.apache.hadoop.hbase.thrift.generated.TCell;
+import org.apache.hadoop.hbase.thrift.generated.TRowResult;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.Text;
 
@@ -164,7 +166,34 @@
     // used to generate the interface.
     //
     
-    public ArrayList<byte[]> getTableNames() throws IOError {
+    public void enableTable(final byte[] tableName) throws IOError {
+      LOG.debug("enableTable");
+      try{
+        admin.enableTable(tableName);
+      } catch (IOException e) {
+        throw new IOError(e.getMessage());
+      }
+    }
+    
+    public void disableTable(final byte[] tableName) throws IOError{
+      LOG.debug("disableTable");
+      try{
+        admin.disableTable(tableName);
+      } catch (IOException e) {
+        throw new IOError(e.getMessage());
+      }
+    }
+    
+    public boolean isTableEnabled(final byte[] tableName) throws IOError {
+      LOG.debug("isTableEnabled");
+      try {
+        return HTable.isTableEnabled(tableName);
+      } catch (IOException e) {
+        throw new IOError(e.getMessage());
+      }
+    }
+    
+    public List<byte[]> getTableNames() throws IOError {
       LOG.debug("getTableNames");
       try {
         HTableDescriptor[] tables = this.admin.listTables();
@@ -178,25 +207,31 @@
       }
     }
     
-    public ArrayList<RegionDescriptor> getTableRegions(byte[] tableName)
-        throws IOError {
-      LOG.debug("getTableRegions: " + new String(tableName));
-      try {
+    public List<TRegionInfo> getTableRegions(byte[] tableName)
+    throws IOError {
+      try{
+        LOG.debug("getTableRegions: " + new String(tableName));
+
         HTable table = getTable(tableName);
-        byte [][] startKeys = table.getStartKeys();
-        ArrayList<RegionDescriptor> regions = new ArrayList<RegionDescriptor>();
-        for (int i = 0; i < startKeys.length; i++) {
-          RegionDescriptor region = new RegionDescriptor();
-          region.startKey = startKeys[i];
+        Map<HRegionInfo, HServerAddress> regionsInfo = table.getRegionsInfo();
+        List<TRegionInfo> regions = new ArrayList<TRegionInfo>();
+
+        for (HRegionInfo regionInfo : regionsInfo.keySet()){
+          TRegionInfo region = new TRegionInfo();
+          region.startKey = regionInfo.getStartKey();
+          region.endKey = regionInfo.getEndKey();
+          region.id = regionInfo.getRegionId();
+          region.name = regionInfo.getRegionName();
+          region.version = regionInfo.getVersion();
           regions.add(region);
         }
         return regions;
-      } catch (IOException e) {
+      } catch (IOException e){
         throw new IOError(e.getMessage());
       }
     }
     
-    public byte[] get(byte[] tableName, byte[] row, byte[] column)
+    public TCell get(byte[] tableName, byte[] row, byte[] column)
         throws NotFound, IOError {
       if (LOG.isDebugEnabled()) {
         LOG.debug("get: table=" + new String(tableName) + ", row="
@@ -204,17 +239,17 @@
       }
       try {
         HTable table = getTable(tableName);
-        Cell value = table.get(getText(row), getText(column));
-        if (value == null) {
+        Cell cell = table.get(getText(row), getText(column));
+        if (cell == null) {
           throw new NotFound();
         }
-        return value.getValue();
+        return ThriftUtilities.cellFromHBase(cell);
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       }
     }
     
-    public ArrayList<byte[]> getVer(byte[] tableName, byte[] row,
+    public List<TCell> getVer(byte[] tableName, byte[] row,
         byte[] column, int numVersions) throws IOError, NotFound {
       if (LOG.isDebugEnabled()) {
         LOG.debug("getVer: table=" + new String(tableName) + ", row="
@@ -223,14 +258,14 @@
       }
       try {
         HTable table = getTable(tableName);
-        Cell[] values = 
+        Cell[] cells = 
           table.get(getText(row), getText(column), numVersions);
-        if (values == null) {
+        if (cells == null) {
           throw new NotFound();
         }
-        ArrayList<byte[]> list = new ArrayList<byte[]>();
-        for (int i = 0; i < values.length; i++) {
-          list.add(values[i].getValue());
+        List<TCell> list = new ArrayList<TCell>();
+        for (int i = 0; i < cells.length; i++) {
+          list.add(ThriftUtilities.cellFromHBase(cells[i]));
         }
         return list;
       } catch (IOException e) {
@@ -238,7 +273,7 @@
       }
     }
     
-    public ArrayList<byte[]> getVerTs(byte[] tableName, byte[] row,
+    public List<TCell> getVerTs(byte[] tableName, byte[] row,
         byte[] column, long timestamp, int numVersions) throws IOError,
         NotFound {
       if (LOG.isDebugEnabled()) {
@@ -248,14 +283,14 @@
       }
       try {
         HTable table = getTable(tableName);
-        Cell[] values = table.get(getText(row), 
+        Cell[] cells = table.get(getText(row), 
           getText(column), timestamp, numVersions);
-        if (values == null) {
+        if (cells == null) {
           throw new NotFound();
         }
-        ArrayList<byte[]> list = new ArrayList<byte[]>();
-        for (int i = 0; i < values.length; i++) {
-          list.add(values[i].getValue());
+        List<TCell> list = new ArrayList<TCell>();
+        for (int i = 0; i < cells.length; i++) {
+          list.add(ThriftUtilities.cellFromHBase(cells[i]));
         }
         return list;
       } catch (IOException e) {
@@ -263,12 +298,12 @@
       }
     }
     
-    public AbstractMap<byte[], byte[]> getRow(byte[] tableName, byte[] row)
+    public TRowResult getRow(byte[] tableName, byte[] row)
         throws IOError {
       return getRowTs(tableName, row, HConstants.LATEST_TIMESTAMP);
     }
     
-    public AbstractMap<byte[], byte[]> getRowTs(byte[] tableName, byte[] row,
+    public TRowResult getRowTs(byte[] tableName, byte[] row,
         long timestamp) throws IOError {
       if (LOG.isDebugEnabled()) {
         LOG.debug("getRowTs: table=" + new String(tableName) + ", row="
@@ -276,36 +311,9 @@
       }
       try {
         HTable table = getTable(tableName);
-        Map<byte [], Cell> values = 
-          table.getRow(getText(row), timestamp);
-        // copy the map from type <Text, Cell> to <byte[], byte[]>
-        TreeMap<byte[], byte[]> returnValues =
-          new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
-        for (Entry<byte [], Cell> e : values.entrySet()) {
-          returnValues.put(e.getKey(), e.getValue().getValue());
-        }
-        return returnValues;
-      } catch (IOException e) {
-        throw new IOError(e.getMessage());
-      }
-    }
-    
-    public void put(byte[] tableName, byte[] row, byte[] column, byte[] value)
-      throws IOError, IllegalArgument {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("put: table=" + new String(tableName) + ", row="
-            + new String(row) + ", col=" + new String(column)
-            + ", value.length=" + value.length);
-      }
-      try {
-        HTable table = getTable(tableName);
-        BatchUpdate batchUpdate = new BatchUpdate(getText(row));
-        batchUpdate.put(getText(column), value);
-        table.commit(batchUpdate);
+        return ThriftUtilities.rowResultFromHBase(table.getRow(getText(row), timestamp));
       } catch (IOException e) {
         throw new IOError(e.getMessage());
-      } catch (IllegalArgumentException e) {
-        throw new IllegalArgument(e.getMessage());
       }
     }
     
@@ -348,7 +356,7 @@
     }
     
     public void createTable(byte[] tableName,
-        ArrayList<ColumnDescriptor> columnFamilies) throws IOError,
+        List<ColumnDescriptor> columnFamilies) throws IOError,
         IllegalArgument, AlreadyExists {
       if (LOG.isDebugEnabled()) {
         LOG.debug("createTable: table=" + new String(tableName));
@@ -363,7 +371,7 @@
           HColumnDescriptor colDesc = ThriftUtilities.colDescFromThrift(col);
           desc.addFamily(colDesc);
           if (LOG.isDebugEnabled()) {
-            LOG.debug("createTable:     col=" + colDesc.getName());
+            LOG.debug("createTable:     col=" + new String(colDesc.getName()));
           }
         }
         admin.createTable(desc);
@@ -390,29 +398,27 @@
     }
     
     public void mutateRow(byte[] tableName, byte[] row,
-        ArrayList<Mutation> mutations) throws IOError, IllegalArgument {
+        List<Mutation> mutations) throws IOError, IllegalArgument {
       mutateRowTs(tableName, row, mutations, HConstants.LATEST_TIMESTAMP);
     }
     
     public void mutateRowTs(byte[] tableName, byte[] row,
-        ArrayList<Mutation> mutations, long timestamp) throws IOError, IllegalArgument
{
+        List<Mutation> mutations, long timestamp) throws IOError, IllegalArgument {
       if (LOG.isDebugEnabled()) {
         LOG.debug("mutateRowTs: table=" + new String(tableName) + ", row="
             + new String(row) + ", ts=" + timestamp + " mutations="
             + mutations.size());
         for (Mutation m : mutations) {
           if (m.isDelete) {
-            LOG.debug("mutateRowTs:    : delete - " + getText(m.column));
+            LOG.debug("mutateRowTs:    : delete - " + new String(getText(m.column)));
           } else {
-            LOG.debug("mutateRowTs:    : put - " + getText(m.column) + " => "
-                + m.value);
+            LOG.debug("mutateRowTs:    : put - " + new String(getText(m.column)) + " =>
"
+                + new String(m.value));
           }
         }
       }
       
-      Long lockid = null;
       HTable table = null;
-      
       try {
         table = getTable(tableName);
         BatchUpdate batchUpdate = new BatchUpdate(getText(row), timestamp);
@@ -431,29 +437,30 @@
       }
     }
     
- 
-    public void mutateRows(byte[] tableName, ArrayList<BatchMutation> rowBatches) 
+    public void mutateRows(byte[] tableName, List<BatchMutation> rowBatches) 
         throws IOError, IllegalArgument, TException {
       mutateRowsTs(tableName, rowBatches, HConstants.LATEST_TIMESTAMP);
     }
  
-    public void mutateRowsTs(byte[] tableName, ArrayList<BatchMutation> rowBatches,
long timestamp)
+    public void mutateRowsTs(byte[] tableName, List<BatchMutation> rowBatches, long
timestamp)
         throws IOError, IllegalArgument, TException {
-      ArrayList<BatchUpdate> batchUpdates = new ArrayList<BatchUpdate>();
+      List<BatchUpdate> batchUpdates = new ArrayList<BatchUpdate>();
        
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("mutateRowsTs: table=" + new String(tableName) + ", rows=" 
+            + rowBatches.size() + ", ts=" + timestamp);
+      }
       for (BatchMutation batch : rowBatches) {
         byte[] row = batch.row;
-        ArrayList<Mutation> mutations = batch.mutations;
+        List<Mutation> mutations = batch.mutations;
         if (LOG.isDebugEnabled()) {
-          LOG.debug("mutateRowTs: table=" + new String(tableName) + ", row="
-              + new String(row) + ", ts=" + timestamp + " mutations="
-              + mutations.size());
+          LOG.debug("mutateRowsTs:    : row=" + new String(row) + " mutations=" + mutations.size());
           for (Mutation m : mutations) {
             if (m.isDelete) {
-              LOG.debug("mutateRowTs:    : delete - " + getText(m.column));
+              LOG.debug("mutateRowsTs:    : delete - " + new String(getText(m.column)));
             } else {
-              LOG.debug("mutateRowTs:    : put - " + getText(m.column) + " => "
-                  + m.value);
+              LOG.debug("mutateRowsTs:    : put - " + new String(getText(m.column)) + " =>
"
+                  + new String(m.value));
             }
           }
         }
@@ -489,7 +496,7 @@
       removeScanner(id);
     }
     
-    public ScanEntry scannerGet(int id) throws IllegalArgument, NotFound,
+    public TRowResult scannerGet(int id) throws IllegalArgument, NotFound,
         IOError {
       LOG.debug("scannerGet: id=" + id);
       Scanner scanner = getScanner(id);
@@ -507,22 +514,14 @@
       } catch (IOException e) {
         throw new IOError(e.getMessage());
       }
-      
-      ScanEntry retval = new ScanEntry();
-      retval.row = results.getRow();
-      retval.columns = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
-      
-      for (Map.Entry<byte [], Cell> e : results.entrySet()) {
-        retval.columns.put(e.getKey(), e.getValue().getValue());
-      }
-      return retval;
+      return ThriftUtilities.rowResultFromHBase(results);
     }
     
     public int scannerOpen(byte[] tableName, byte[] startRow,
-        ArrayList<byte[]> columns) throws IOError {
+        List<byte[]> columns) throws IOError {
       if (LOG.isDebugEnabled()) {
-        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
-            + getText(startRow) + ", columns=" + columns.toString());
+        LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+            + new String(getText(startRow)) + ", columns=" + columns.toString());
       }
       try {
         HTable table = getTable(tableName);
@@ -539,10 +538,10 @@
     }
     
     public int scannerOpenWithStop(byte[] tableName, byte[] startRow,
-        byte[] stopRow, ArrayList<byte[]> columns) throws IOError, TException {
+        byte[] stopRow, List<byte[]> columns) throws IOError, TException {
       if (LOG.isDebugEnabled()) {
-        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
-            + getText(startRow) + ", stop=" + getText(stopRow) + ", columns="
+        LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+            + new String(getText(startRow)) + ", stop=" + new String(getText(stopRow)) +
", columns="
             + columns.toString());
       }
       try {
@@ -560,10 +559,10 @@
     }
     
     public int scannerOpenTs(byte[] tableName, byte[] startRow,
-        ArrayList<byte[]> columns, long timestamp) throws IOError, TException {
+        List<byte[]> columns, long timestamp) throws IOError, TException {
       if (LOG.isDebugEnabled()) {
-        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
-            + getText(startRow) + ", columns=" + columns.toString()
+        LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+            + new String(getText(startRow)) + ", columns=" + columns.toString()
             + ", timestamp=" + timestamp);
       }
       try {
@@ -581,11 +580,11 @@
     }
     
     public int scannerOpenWithStopTs(byte[] tableName, byte[] startRow,
-        byte[] stopRow, ArrayList<byte[]> columns, long timestamp)
+        byte[] stopRow, List<byte[]> columns, long timestamp)
         throws IOError, TException {
       if (LOG.isDebugEnabled()) {
-        LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
-            + getText(startRow) + ", stop=" + getText(stopRow) + ", columns="
+        LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+            + new String(getText(startRow)) + ", stop=" + new String(getText(stopRow)) +
", columns="
             + columns.toString() + ", timestamp=" + timestamp);
       }
       try {
@@ -602,7 +601,7 @@
       }
     }
     
-    public AbstractMap<byte[], ColumnDescriptor> getColumnDescriptors(
+    public Map<byte[], ColumnDescriptor> getColumnDescriptors(
         byte[] tableName) throws IOError, TException {
       if (LOG.isDebugEnabled()) {
         LOG.debug("getColumnDescriptors: table=" + new String(tableName));
@@ -612,7 +611,7 @@
           new TreeMap<byte[], ColumnDescriptor>(Bytes.BYTES_COMPARATOR);
         
         HTable table = getTable(tableName);
-        HTableDescriptor desc = table.getMetadata();
+        HTableDescriptor desc = table.getTableDescriptor();
         
         for (HColumnDescriptor e : desc.getFamilies()) {
           ColumnDescriptor col = ThriftUtilities.colDescFromHbase(e);

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java Sat Aug
16 15:04:16 2008
@@ -18,10 +18,21 @@
 
 package org.apache.hadoop.hbase.thrift;
 
+import java.io.IOException;
+import java.util.Map;
+import java.util.TreeMap;
+
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HColumnDescriptor.CompressionType;
+import org.apache.hadoop.hbase.io.Cell;
+import org.apache.hadoop.hbase.io.RowResult;
 import org.apache.hadoop.hbase.thrift.generated.ColumnDescriptor;
+import org.apache.hadoop.hbase.thrift.generated.IOError;
 import org.apache.hadoop.hbase.thrift.generated.IllegalArgument;
+import org.apache.hadoop.hbase.thrift.generated.NotFound;
+import org.apache.hadoop.hbase.thrift.generated.TCell;
+import org.apache.hadoop.hbase.thrift.generated.TRowResult;
+import org.apache.hadoop.hbase.util.Bytes;
 
 public class ThriftUtilities {
   
@@ -71,4 +82,34 @@
     return col;
   }
   
-}
\ No newline at end of file
+  /**
+   * This utility method creates a new Thrift TCell "struct" based on
+   * an Hbase Cell object.
+   * 
+   * @param in
+   *          Hbase Cell object
+   * @return Thrift TCell
+   */
+  static public TCell cellFromHBase(Cell in) {
+    return new TCell(in.getValue(), in.getTimestamp());
+  }
+  
+  /**
+   * This utility method creates a new Thrift TRowResult "struct" based on
+   * an Hbase RowResult object.
+   * 
+   * @param in
+   *          Hbase RowResult object
+   * @return Thrift TRowResult
+   */
+  static public TRowResult rowResultFromHBase(RowResult in) {
+    TRowResult result = new TRowResult();
+    result.row = in.getRow();
+    result.columns = new TreeMap<byte[], TCell>(Bytes.BYTES_COMPARATOR);
+    for (Map.Entry<byte[], Cell> entry : in.entrySet()){
+      result.columns.put(entry.getKey(), ThriftUtilities.cellFromHBase(entry.getValue()));
+    }
+    return result;
+  }
+}
+

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
Sat Aug 16 15:04:16 2008
@@ -23,9 +23,11 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import java.util.List;
 import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
 import java.util.HashSet;
 import com.facebook.thrift.*;
 
@@ -40,7 +42,7 @@
   public String message;
 
   public final Isset __isset = new Isset();
-  public static final class Isset {
+  public static final class Isset implements java.io.Serializable {
     public boolean message = false;
   }
 
@@ -55,6 +57,34 @@
     this.__isset.message = true;
   }
 
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof AlreadyExists)
+      return this.equals((AlreadyExists)that);
+    return false;
+  }
+
+  public boolean equals(AlreadyExists that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_message = true && (this.message != null);
+    boolean that_present_message = true && (that.message != null);
+    if (this_present_message || that_present_message) {
+      if (!(this_present_message && that_present_message))
+        return false;
+      if (!this.message.equals(that.message))
+        return false;
+    }
+
+    return true;
+  }
+
+  public int hashCode() {
+    return 0;
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
Sat Aug 16 15:04:16 2008
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 /**
  * Autogenerated by Thrift
  *
@@ -23,9 +23,11 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import java.util.List;
 import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
 import java.util.HashSet;
 import com.facebook.thrift.*;
 
@@ -37,10 +39,10 @@
  */
 public class BatchMutation implements TBase, java.io.Serializable {
   public byte[] row;
-  public ArrayList<Mutation> mutations;
+  public List<Mutation> mutations;
 
   public final Isset __isset = new Isset();
-  public static final class Isset {
+  public static final class Isset implements java.io.Serializable {
     public boolean row = false;
     public boolean mutations = false;
   }
@@ -50,7 +52,7 @@
 
   public BatchMutation(
     byte[] row,
-    ArrayList<Mutation> mutations)
+    List<Mutation> mutations)
   {
     this();
     this.row = row;
@@ -59,6 +61,43 @@
     this.__isset.mutations = true;
   }
 
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof BatchMutation)
+      return this.equals((BatchMutation)that);
+    return false;
+  }
+
+  public boolean equals(BatchMutation that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_row = true && (this.row != null);
+    boolean that_present_row = true && (that.row != null);
+    if (this_present_row || that_present_row) {
+      if (!(this_present_row && that_present_row))
+        return false;
+      if (!java.util.Arrays.equals(this.row, that.row))
+        return false;
+    }
+
+    boolean this_present_mutations = true && (this.mutations != null);
+    boolean that_present_mutations = true && (that.mutations != null);
+    if (this_present_mutations || that_present_mutations) {
+      if (!(this_present_mutations && that_present_mutations))
+        return false;
+      if (!this.mutations.equals(that.mutations))
+        return false;
+    }
+
+    return true;
+  }
+
+  public int hashCode() {
+    return 0;
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
Sat Aug 16 15:04:16 2008
@@ -23,9 +23,11 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import java.util.List;
 import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
 import java.util.HashSet;
 import com.facebook.thrift.*;
 
@@ -50,7 +52,7 @@
   public int timeToLive;
 
   public final Isset __isset = new Isset();
-  public static final class Isset {
+  public static final class Isset implements java.io.Serializable {
     public boolean name = false;
     public boolean maxVersions = false;
     public boolean compression = false;
@@ -119,6 +121,115 @@
     this.__isset.timeToLive = true;
   }
 
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof ColumnDescriptor)
+      return this.equals((ColumnDescriptor)that);
+    return false;
+  }
+
+  public boolean equals(ColumnDescriptor that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_name = true && (this.name != null);
+    boolean that_present_name = true && (that.name != null);
+    if (this_present_name || that_present_name) {
+      if (!(this_present_name && that_present_name))
+        return false;
+      if (!java.util.Arrays.equals(this.name, that.name))
+        return false;
+    }
+
+    boolean this_present_maxVersions = true;
+    boolean that_present_maxVersions = true;
+    if (this_present_maxVersions || that_present_maxVersions) {
+      if (!(this_present_maxVersions && that_present_maxVersions))
+        return false;
+      if (this.maxVersions != that.maxVersions)
+        return false;
+    }
+
+    boolean this_present_compression = true && (this.compression != null);
+    boolean that_present_compression = true && (that.compression != null);
+    if (this_present_compression || that_present_compression) {
+      if (!(this_present_compression && that_present_compression))
+        return false;
+      if (!this.compression.equals(that.compression))
+        return false;
+    }
+
+    boolean this_present_inMemory = true;
+    boolean that_present_inMemory = true;
+    if (this_present_inMemory || that_present_inMemory) {
+      if (!(this_present_inMemory && that_present_inMemory))
+        return false;
+      if (this.inMemory != that.inMemory)
+        return false;
+    }
+
+    boolean this_present_maxValueLength = true;
+    boolean that_present_maxValueLength = true;
+    if (this_present_maxValueLength || that_present_maxValueLength) {
+      if (!(this_present_maxValueLength && that_present_maxValueLength))
+        return false;
+      if (this.maxValueLength != that.maxValueLength)
+        return false;
+    }
+
+    boolean this_present_bloomFilterType = true && (this.bloomFilterType != null);
+    boolean that_present_bloomFilterType = true && (that.bloomFilterType != null);
+    if (this_present_bloomFilterType || that_present_bloomFilterType) {
+      if (!(this_present_bloomFilterType && that_present_bloomFilterType))
+        return false;
+      if (!this.bloomFilterType.equals(that.bloomFilterType))
+        return false;
+    }
+
+    boolean this_present_bloomFilterVectorSize = true;
+    boolean that_present_bloomFilterVectorSize = true;
+    if (this_present_bloomFilterVectorSize || that_present_bloomFilterVectorSize) {
+      if (!(this_present_bloomFilterVectorSize && that_present_bloomFilterVectorSize))
+        return false;
+      if (this.bloomFilterVectorSize != that.bloomFilterVectorSize)
+        return false;
+    }
+
+    boolean this_present_bloomFilterNbHashes = true;
+    boolean that_present_bloomFilterNbHashes = true;
+    if (this_present_bloomFilterNbHashes || that_present_bloomFilterNbHashes) {
+      if (!(this_present_bloomFilterNbHashes && that_present_bloomFilterNbHashes))
+        return false;
+      if (this.bloomFilterNbHashes != that.bloomFilterNbHashes)
+        return false;
+    }
+
+    boolean this_present_blockCacheEnabled = true;
+    boolean that_present_blockCacheEnabled = true;
+    if (this_present_blockCacheEnabled || that_present_blockCacheEnabled) {
+      if (!(this_present_blockCacheEnabled && that_present_blockCacheEnabled))
+        return false;
+      if (this.blockCacheEnabled != that.blockCacheEnabled)
+        return false;
+    }
+
+    boolean this_present_timeToLive = true;
+    boolean that_present_timeToLive = true;
+    if (this_present_timeToLive || that_present_timeToLive) {
+      if (!(this_present_timeToLive && that_present_timeToLive))
+        return false;
+      if (this.timeToLive != that.timeToLive)
+        return false;
+    }
+
+    return true;
+  }
+
+  public int hashCode() {
+    return 0;
+  }
+
   public void read(TProtocol iprot) throws TException {
     TField field;
     iprot.readStructBegin();
@@ -203,13 +314,13 @@
           }
           break;
         case 10:
-            if (field.type == TType.I32) {
-              this.timeToLive = iprot.readI32();
-              this.__isset.timeToLive = true;
-            } else { 
-              TProtocolUtil.skip(iprot, field.type);
-            }
-            break;
+          if (field.type == TType.I32) {
+            this.timeToLive = iprot.readI32();
+            this.__isset.timeToLive = true;
+          } else { 
+            TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
         default:
           TProtocolUtil.skip(iprot, field.type);
           break;

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java?rev=686568&r1=686567&r2=686568&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java Sat
Aug 16 15:04:16 2008
@@ -23,9 +23,11 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import java.util.List;
 import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
 import java.util.HashSet;
 import com.facebook.thrift.*;
 



Mime
View raw message