hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r689208 - in /hadoop/hbase/branches/0.2: ./ src/java/org/apache/hadoop/hbase/ src/java/org/apache/hadoop/hbase/client/ src/java/org/apache/hadoop/hbase/io/ src/java/org/apache/hadoop/hbase/master/ src/java/org/apache/hadoop/hbase/regionserv...
Date Tue, 26 Aug 2008 20:33:06 GMT
Author: jimk
Date: Tue Aug 26 13:33:05 2008
New Revision: 689208

URL: http://svn.apache.org/viewvc?rev=689208&view=rev
Log:
HBASE-799  Deprecate all remaining methods that take Text as a parameter (Jean-Daniel Cryans
via Jim Kellerman)

Modified:
    hadoop/hbase/branches/0.2/CHANGES.txt
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HMsg.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/Scanner.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/master/RegionManager.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/Bytes.java
    hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/migration/v5/HColumnDescriptor.java

Modified: hadoop/hbase/branches/0.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/CHANGES.txt?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.2/CHANGES.txt Tue Aug 26 13:33:05 2008
@@ -45,6 +45,8 @@
               instead of Map (Jonathan Gray via Stack)
    HBASE-830  Debugging HCM.locateRegionInMeta is painful
    HBASE-752  HBase 0.2.1 should be based on Hadoop 0.17.2
+   HBASE-799  Deprecate all remaining methods that take Text as a parameter
+              (Jean-Daniel Cryans via Jim Kellerman)
 
   NEW FEATURES
   OPTIMIZATIONS

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java Tue
Aug 26 13:33:05 2008
@@ -142,6 +142,7 @@
    * The other attributes are defaulted.
    * 
    * @param columnName - column family name
+   * @deprecated Use String or byte [] overload instead
    */
   public HColumnDescriptor(final Text columnName) {
     this(columnName.getBytes());

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HMsg.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HMsg.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HMsg.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/HMsg.java Tue Aug 26 13:33:05
2008
@@ -24,6 +24,7 @@
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 
@@ -97,7 +98,7 @@
 
   private Type type = null;
   private HRegionInfo info = null;
-  private Text message = null;
+  private byte[] message = null;
 
   // Some useful statics.  Use these rather than create a new HMsg each time.
   public static final HMsg REPORT_EXITING = new HMsg(Type.MSG_REPORT_EXITING);
@@ -121,7 +122,7 @@
    * @param type Message type
    */
   public HMsg(final HMsg.Type type) {
-    this(type, new HRegionInfo(), null);
+    this(type, new HRegionInfo(), (byte[])null);
   }
   
   /**
@@ -130,18 +131,30 @@
    * @param hri Region to which message <code>type</code> applies
    */
   public HMsg(final HMsg.Type type, final HRegionInfo hri) {
-    this(type, hri, null);
+    this(type, hri, (byte[])null);
   }
-  
+
   /**
-   * Construct a message with the specified message and HRegionInfo
    * 
    * @param type Message type
    * @param hri Region to which message <code>type</code> applies.  Cannot be
    * null.  If no info associated, used other Constructor.
    * @param msg Optional message (Stringified exception, etc.)
+   * @deprecated Use byte [] overload instead
    */
   public HMsg(final HMsg.Type type, final HRegionInfo hri, final Text msg) {
+    this(type, hri, (msg == null)? null : msg.getBytes());
+  }
+
+  /**
+   * Construct a message with the specified message and HRegionInfo
+   * 
+   * @param type Message type
+   * @param hri Region to which message <code>type</code> applies.  Cannot be
+   * null.  If no info associated, used other Constructor.
+   * @param msg Optional message (Stringified exception, etc.)
+   */
+  public HMsg(final HMsg.Type type, final HRegionInfo hri, final byte[] msg) {
     if (type == null) {
       throw new NullPointerException("Message type cannot be null");
     }
@@ -172,7 +185,7 @@
     return this.type.equals(other);
   }
   
-  public Text getMessage() {
+  public byte[] getMessage() {
     return this.message;
   }
 
@@ -188,7 +201,7 @@
       sb.append(": ");
       sb.append(this.info.getRegionNameAsString());
     }
-    if (this.message != null && this.message.getLength() > 0) {
+    if (this.message != null && this.message.length > 0) {
       sb.append(": " + this.message);
     }
     return sb.toString();
@@ -221,11 +234,11 @@
   public void write(DataOutput out) throws IOException {
      out.writeInt(this.type.ordinal());
      this.info.write(out);
-     if (this.message == null || this.message.getLength() == 0) {
+     if (this.message == null || this.message.length == 0) {
        out.writeBoolean(false);
      } else {
        out.writeBoolean(true);
-       this.message.write(out);
+       Bytes.writeByteArray(out, this.message);
      }
    }
 
@@ -238,10 +251,7 @@
      this.info.readFields(in);
      boolean hasMessage = in.readBoolean();
      if (hasMessage) {
-       if (this.message == null) {
-         this.message = new Text();
-       }
-       this.message.readFields(in);
+       this.message = Bytes.readByteArray(in);
      }
    }
-}
\ No newline at end of file
+}

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Tue
Aug 26 13:33:05 2008
@@ -85,6 +85,7 @@
    * @param tableName Table to check.
    * @return True if table exists already.
    * @throws MasterNotRunningException
+   * @deprecated Use String or byte [] overload instead
    */
   public boolean tableExists(final Text tableName)
   throws MasterNotRunningException {
@@ -200,6 +201,7 @@
    * 
    * @param tableName name of table to delete
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public void deleteTable(final Text tableName) throws IOException {
     deleteTable(tableName.getBytes());
@@ -297,6 +299,7 @@
    * 
    * @param tableName name of the table
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public void enableTable(final Text tableName) throws IOException {
     enableTable(tableName.getBytes());
@@ -359,6 +362,7 @@
    * 
    * @param tableName name of table
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public void disableTable(final Text tableName) throws IOException {
     disableTable(tableName.getBytes());
@@ -420,6 +424,7 @@
    * @param tableName name of table to check
    * @return true if table is on-line
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public boolean isTableEnabled(Text tableName) throws IOException {
     return isTableEnabled(tableName.getBytes());
@@ -447,6 +452,7 @@
    * @param tableName name of the table to add column to
    * @param column column descriptor of column to be added
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public void addColumn(final Text tableName, HColumnDescriptor column)
   throws IOException {
@@ -491,6 +497,7 @@
    * @param tableName name of table
    * @param columnName name of column to be deleted
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public void deleteColumn(final Text tableName, final Text columnName)
   throws IOException {
@@ -536,6 +543,7 @@
    * @param columnName name of column to be modified
    * @param descriptor new column descriptor to use
    * @throws IOException
+   * @deprecated Use String or byte [] overload instead
    */
   public void modifyColumn(final Text tableName, final Text columnName, 
       HColumnDescriptor descriptor)

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/Scanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/Scanner.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/Scanner.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/client/Scanner.java Tue Aug
26 13:33:05 2008
@@ -30,7 +30,7 @@
 public interface Scanner extends Closeable, Iterable<RowResult> {
   /**
    * Grab the next row's worth of values. The scanner will return a RowResult
-   * that contains both the row's key and a map of Text column names to Cell 
+   * that contains both the row's key and a map of byte[] column names to Cell 
    * value objects. The data returned will only contain the most recent data 
    * value for each row that is not newer than the target time passed when the
    * scanner was created.

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/io/BatchUpdate.java Tue Aug
26 13:33:05 2008
@@ -60,6 +60,7 @@
    * now.
    * 
    * @param row
+   * @deprecated Use String or byte [] overload instead
    */
   public BatchUpdate(final Text row) {
     this(row, HConstants.LATEST_TIMESTAMP);
@@ -98,6 +99,7 @@
    * Initialize a BatchUpdate operation on a row with a specific timestamp.
    * 
    * @param row
+   * @deprecated Use String or byte [] overload instead
    */
   public BatchUpdate(final Text row, long timestamp){
     this(row.getBytes(), timestamp);
@@ -138,6 +140,7 @@
    *
    * @param column column whose value is being set
    * @param val new value for column.  Cannot be null (can be empty).
+   * @deprecated Use String or byte [] overload instead
    */
   public synchronized void put(final Text column, final byte val[]) {
     put(column.getBytes(), val);
@@ -172,6 +175,7 @@
    * Deletes the cell whose row/column/commit-timestamp match those of the
    * delete.
    * @param column name of column whose value is to be deleted
+   * @deprecated Use String or byte [] overload instead
    */
   public void delete(final Text column) {
     delete(column.getBytes());

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/master/RegionManager.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/master/RegionManager.java Tue
Aug 26 13:33:05 2008
@@ -74,7 +74,7 @@
     Collections.synchronizedSortedMap(new TreeMap<byte [],
       MetaRegion>(Bytes.BYTES_COMPARATOR));
 
-  private static final Text OVERLOADED = new Text("Overloaded");
+  private static final byte[] OVERLOADED = Bytes.toBytes("Overloaded");
 
   /**
    * The 'unassignedRegions' table maps from a HRegionInfo to a timestamp that

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Tue Aug 26 13:33:05 2008
@@ -738,14 +738,19 @@
 
   /* Add to the outbound message buffer */
   private void reportClose(HRegionInfo region) {
-    reportClose(region, null);
+    reportClose(region, (byte[])null);
   }
 
   /* Add to the outbound message buffer */
+  @Deprecated
   private void reportClose(final HRegionInfo region, final Text message) {
     outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_CLOSE, region, message));
   }
 
+  /* Add to the outbound message buffer */
+  private void reportClose(final HRegionInfo region, final byte[] message) {
+    outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_CLOSE, region, message));
+  }
   
   /**
    * Add to the outbound message buffer

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/Bytes.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/Bytes.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/Bytes.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/Bytes.java Tue Aug 26
13:33:05 2008
@@ -243,6 +243,7 @@
   /**
    * @param t
    * @return Array of byte arrays made from passed array of Text
+   * @deprecated Use String overload instead
    */
   public static byte [][] toByteArrays(final Text [] t) {
     byte [][] result = new byte[t.length][];

Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/migration/v5/HColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/migration/v5/HColumnDescriptor.java?rev=689208&r1=689207&r2=689208&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/migration/v5/HColumnDescriptor.java
(original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/util/migration/v5/HColumnDescriptor.java
Tue Aug 26 13:33:05 2008
@@ -144,6 +144,7 @@
    * The other attributes are defaulted.
    * 
    * @param columnName - column family name
+   * @deprecated Use String or byte [] overload instead
    */
   public HColumnDescriptor(final Text columnName) {
     this(columnName.getBytes());
@@ -341,9 +342,7 @@
   public void readFields(DataInput in) throws IOException {
     int versionNumber = in.readByte();
     if (versionNumber <= 2) {
-      Text t = new Text();
-      t.readFields(in);
-      this.name = t.getBytes();
+      this.name = Bytes.readByteArray(in);
       if (HStoreKey.getFamilyDelimiterIndex(this.name) > 0) {
         this.name = stripColon(this.name);
       }



Mime
View raw message