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:

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)