Differences between revisions 4 and 5
Revision 4 as of 2008-07-22 04:15:03
Size: 6946
Editor: stack
Comment: Minor edit
Revision 5 as of 2009-09-20 23:55:06
Size: 6948
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
The APIs for both `HBaseAdmin` and `HTable` have significantly changed between versions 0.1.3 and 0.2.x. 0.2.x is NOT backward-compatible. The following document summarizes the key differences that are most important for developers wishing to use these classes. For more information, see the full API documentations for [http://hadoop.apache.org/hbase/docs/current/api/index.html 0.1.3] and [0.2]. The APIs for both `HBaseAdmin` and `HTable` have significantly changed between versions 0.1.3 and 0.2.x. 0.2.x is NOT backward-compatible. The following document summarizes the key differences that are most important for developers wishing to use these classes. For more information, see the full API documentations for [[http://hadoop.apache.org/hbase/docs/current/api/index.html|0.1.3]] and [0.2].
Line 10: Line 10:
[[BR]] {{{public void addColumn(Text, HColumnDescriptor);}}}
[[BR]] {{{public void deleteColumn(Text, Text);}}}
<<BR>> {{{public void addColumn(Text, HColumnDescriptor);}}}
<<BR>> {{{public void deleteColumn(Text, Text);}}}
Line 14: Line 14:
[[BR]] {{{public void addColumn(Text, HColumnDescriptor);}}}
[[BR]] {{{public void addColumn(String, HColumnDescriptor);}}}
[[BR]] {{{public void addColumn(byte[], HColumnDescriptor);}}}
[[BR]] {{{public void deleteColumn(Text, Text);}}}
[[BR]] {{{public void deleteColumn(String, String);}}}
[[BR]] {{{public void deleteColumn(byte[], byte[]);}}}
<<BR>> {{{public void addColumn(Text, HColumnDescriptor);}}}
<<BR>> {{{public void addColumn(String, HColumnDescriptor);}}}
<<BR>> {{{public void addColumn(byte[], HColumnDescriptor);}}}
<<BR>> {{{public void deleteColumn(Text, Text);}}}
<<BR>> {{{public void deleteColumn(String, String);}}}
<<BR>> {{{public void deleteColumn(byte[], byte[]);}}}
Line 26: Line 26:
[[BR]] {{{public boolean isTableEnabled(Text);}}}
[[BR]] {{{public boolean isTableEnabled(String);}}}
[[BR]] {{{public boolean isTableEnabled(byte[]);}}}
[[BR]] {{{public void modifyTableMeta(byte[] HTableDescriptor);}}}
<<BR>> {{{public boolean isTableEnabled(Text);}}}
<<BR>> {{{public boolean isTableEnabled(String);}}}
<<BR>> {{{public boolean isTableEnabled(byte[]);}}}
<<BR>> {{{public void modifyTableMeta(byte[] HTableDescriptor);}}}
Line 38: Line 38:
[[BR]] {{{public synchronized long startUpdate(Text);}}}
[[BR]] {{{public void put(long, Text, byte[]);}}}
[[BR]] {{{public void put(long, Text, Writable);}}}
[[BR]] {{{public void delete(long, Text);}}}
[[BR]] {{{public synchronized void checkUpdateInProgress();}}}
[[BR]] {{{public synchronized void abort(long);}}}
[[BR]] {{{public synchronized void commit(long, long);}}}
[[BR]] {{{public void commit(long);}}}
<<BR>> {{{public synchronized long startUpdate(Text);}}}
<<BR>> {{{public void put(long, Text, byte[]);}}}
<<BR>> {{{public void put(long, Text, Writable);}}}
<<BR>> {{{public void delete(long, Text);}}}
<<BR>> {{{public synchronized void checkUpdateInProgress();}}}
<<BR>> {{{public synchronized void abort(long);}}}
<<BR>> {{{public synchronized void commit(long, long);}}}
<<BR>> {{{public void commit(long);}}}
Line 52: Line 52:
[[BR]] {{{public synchronized void commit(BatchUpdate);}}}
[[BR]] {{{public synchronized void commit(List<BatchUpdate>);}}}
<<BR>> {{{public synchronized void commit(BatchUpdate);}}}
<<BR>> {{{public synchronized void commit(List<BatchUpdate>);}}}
Line 70: Line 70:
[[BR]] {{{public static boolean isTableEnabled(Text);}}}
[[BR]] {{{public static boolean isTableEnabled(String);}}}
[[BR]] {{{public static boolean isTableEnabled(byte[]);}}}
[[BR]] {{{public static boolean isTableEnabled(HBaseConfiguration, Text);}}}
[[BR]] {{{public static boolean isTableEnabled(HBaseConfiguration, String);}}}
[[BR]] {{{public static boolean isTableEnabled(HBaseConfiguration, byte[]);}}}
<<BR>> {{{public static boolean isTableEnabled(Text);}}}
<<BR>> {{{public static boolean isTableEnabled(String);}}}
<<BR>> {{{public static boolean isTableEnabled(byte[]);}}}
<<BR>> {{{public static boolean isTableEnabled(HBaseConfiguration, Text);}}}
<<BR>> {{{public static boolean isTableEnabled(HBaseConfiguration, String);}}}
<<BR>> {{{public static boolean isTableEnabled(HBaseConfiguration, byte[]);}}}

Changes to HBaseAdmin and HTable between HBase 0.1.3 and 0.2

General Changes

The APIs for both HBaseAdmin and HTable have significantly changed between versions 0.1.3 and 0.2.x. 0.2.x is NOT backward-compatible. The following document summarizes the key differences that are most important for developers wishing to use these classes. For more information, see the full API documentations for 0.1.3 and [0.2].

A general difference in both HBaseAdmin and HTable is a transition away from using Hadoop's Text class (package org.apache.hadoop.io) and toward using byte[] as a replacement. All methods from 0.1.3 that returned either Text or Text[] now return either byte[] or byte[][] or the fatter RowResult. HBase 0.2 has not completely abandoned the use of Text. All methods that once accepted parameters of type Text are now overloaded to support Text, String, or byte[] as parameters. The following API changes from HBaseAdmin demonstrate this overloading:

0.1.3:
public void addColumn(Text, HColumnDescriptor);
public void deleteColumn(Text, Text);

0.2:
public void addColumn(Text, HColumnDescriptor);
public void addColumn(String, HColumnDescriptor);
public void addColumn(byte[], HColumnDescriptor);
public void deleteColumn(Text, Text);
public void deleteColumn(String, String);
public void deleteColumn(byte[], byte[]);

HBaseAdmin

Aside from the method overloading described above, HBaseAdmin has not significantly changed. HBase 0.2 adds the following new methods to HBaseAdmin:

0.2:
public boolean isTableEnabled(Text);
public boolean isTableEnabled(String);
public boolean isTableEnabled(byte[]);
public void modifyTableMeta(byte[] HTableDescriptor);

The only method in HBaseAdmin from 0.1.3 that no longer exists in HBase 0.2 is checkReservedTableName(Text). These changes aside, the API and functional capability of HBaseAdmin has not drastically changed between versions 0.1.3 and 0.2.

HTable

HTable has experienced far more significant changes to its API and functional capability. The biggest change is the way in which row updates are performed. In HBase 0.1.3, HTable had its own support for atomic row insertions and changes. The following methods existed in HTable and aided the row updating process:

0.1.3:
public synchronized long startUpdate(Text);
public void put(long, Text, byte[]);
public void put(long, Text, Writable);
public void delete(long, Text);
public synchronized void checkUpdateInProgress();
public synchronized void abort(long);
public synchronized void commit(long, long);
public void commit(long);

startUpdate(Text) was used to start an atomic row update on the passed row name, and a "lock id" (long) was returned to identify the update. put(...) and delete(...) could be called using the lock id, and any changes made with that lock id could be aborted or committed.

HBase 0.2 has completely changed the way in which atomic row updates take place. To update a row, the user first creates a BatchUpdate object. put(...) and delete(...) operations are applied to the BatchUpdate, not the HTable. Once finished, the user commits the BatchUpdate with one of the following new HTable methods:

0.2:
public synchronized void commit(BatchUpdate);
public synchronized void commit(List<BatchUpdate>);

Aside from the transition from Text toward byte[] and the addition of the BatchUpdate structure, HTable has experienced a number of other API changes:

  • In 0.1.3, package-private getRegionLocation(...) took parameters of either (Text) or (Text, boolean). In 0.2, getRegionLocation(...) has become public and only accepts parameters of either (Text), (String), or (byte[]); the boolean "reload" option no longer exists.

  • In 0.1.3, the HTable constructor took parameters of either (HBaseConfiguration, Text). In 0.2, the HBaseConfiguration parameter has become optional and as such there are now 6 different constructors (with or without the HBaseConfiguration parameter, and with the Text parameter varying as either Text, String, or byte[]).

  • public HTableDescriptor getMetadata() has been replaced in 0.2 by public HTableDescriptor getTableDescriptor(); getMetadata() still exists in 0.2, although it is marked as deprecated. Additionally, both getTableDescriptor() and getMetadata() now return UnmodifyableHTableDescriptor (new to 0.2, package org.apache.hadoop.hbase.client, a subclass of HTableDescriptor), although the return type of both methods is still HTableDescriptor.

  • In 0.1.3, all get(...) methods had a return type of byte[]. In 0.2, these methods now return a Cell (new to 0.2, package org.apache.hadoop.hbase.io).

  • In 0.1.3, all getRow(...) methods had a return type of SortedMap<Text, byte[]>. In 0.2, these methods now return a RowResult (new to 0.2, package org.apache.hadoop.hbase.io).

  • The methods obtainScanner(...) from 0.1.3 have been renamed getScanner(...) in 0.2. Moreover, getScanner(...) has a return type of Scanner (new to 0.2, package org.apache.hadoop.hbase.client), whereas obtainScanner(...) had a return type of HScannerInterface (a class that no longer exists in 0.2).

  • In 0.1.3, deteleFamily(...) took parameters of either (Text, Text, long) or (Text, Text). In 0.2, deleteFamily(...) only accepts parameters of either (Text, Text, long), (String, String, long), or (byte[], byte[], long); the long "timestamp" must be included as a parameter.

  • The HTable subclass ServerCallable<T> from 0.1.3 has been moved to its own separate class in 0.2, located in package org.apache.hadoop.hbase.client.

  • The method getRegionServerWithRetries(ServerCallable<T>) from 0.1.3 has been moved to the HConnection interface in 0.2.

Finally, the following methods have been added to HTable in HBase 0.2:

0.2:
public static boolean isTableEnabled(Text);
public static boolean isTableEnabled(String);
public static boolean isTableEnabled(byte[]);
public static boolean isTableEnabled(HBaseConfiguration, Text);
public static boolean isTableEnabled(HBaseConfiguration, String);
public static boolean isTableEnabled(HBaseConfiguration, byte[]);

Once again, for greater detail on API changes to HBaseAdmin, HTable, and all classes new to HBase 0.2, please refer to the [HBase 0.2 API].

Hbase/Plan-0.2/APIChanges (last edited 2009-09-20 23:55:06 by localhost)