Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase >> mail # user >> Using HBaseAdmin.getAlterStatus

Copy link to this message
Using HBaseAdmin.getAlterStatus

I've tried using HBaseAdmin.getAlterStatus to check on a HBaseAdmin.modifyTable command I've issued, but it doesn't work.

Sample Code:

Modifying Table
                tableDescriptor = admin.getTableDescriptor(tableNameBytes);
                if (tableDescriptor.hasCoprocessor(observerClassname)) {
                    logger.info("Coprocessor installed already. Removing to update jar location in any case");
                tableDescriptor.addCoprocessor(observerClassname, hdfsJarPath, RegionObserver.PRIORITY_USER, null);

                logger.info("Disabling table "+tableName);
                logger.info("Modifying table "+tableName);
                admin.modifyTable(Bytes.toBytes(tableName), tableDescriptor);
                logger.info("Enabling table "+tableName);

Using alterStatus
                byte[] tableName = it.next();
                try {
                    Pair<Integer,Integer> alterStatus = admin.getAlterStatus(tableName);
                    if (alterStatus.getFirst() == alterStatus.getSecond()) {
                        logger.info("Table "+Bytes.toString(tableName)+" was altered successfully. "+notLoadedTables.size()+" tables remaining...");
                    } else {
                        if (logger.isDebugEnabled()) {
                            logger.debug("Table "+Bytes.toString(tableName)+" was not yet altered. Alter Status: "+
                                    alterStatus.getFirst()+" regions altered, "+alterStatus.getSecond()+" total regions on table");
                } catch (IOException e) {
                    throw new RuntimeException("Failed getting alter status for table name: "+Bytes.toString(tableName));

Does anyone know how to use it?


Harsh J 2012-12-09, 20:53
Mesika, Asaf 2012-12-09, 21:02
Harsh J 2012-12-09, 22:43