Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

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


Copy link to this message
-
Re: Using HBaseAdmin.getAlterStatus
Yeah, I forgot to mention that important bit:
the pair returned is always 0 on the firstKey and never changes.

So if I understand you correctly, I need to use get AlterStatus between the modifyTable and enableTable ?

On Dec 9, 2012, at 10:53 PM, Harsh J wrote:

> Can you clarify on what "doesn't work" a bit more?
>
> Do you get an exception or are you not receiving some data that you
> are expecting?
>
> AFAICT, this API is helpful for a parallel monitoring of an issued
> schema update. In your code bits, which I will assume is serial, you
> already disable-update-enable table and complete the alter transaction
> before querying it (such that there isn't any pending operation to
> report). If the querying is done in a parallel process/monitor thread,
> then you may see in-flight results.
>
> On Mon, Dec 10, 2012 at 2:04 AM, Mesika, Asaf <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> 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.removeCoprocessor(observerClassname);
>>                }
>>                tableDescriptor.addCoprocessor(observerClassname, hdfsJarPath, RegionObserver.PRIORITY_USER, null);
>>
>>                logger.info("Disabling table "+tableName);
>>                admin.disableTable(tableNameBytes);
>>                logger.info("Modifying table "+tableName);
>>                admin.modifyTable(Bytes.toBytes(tableName), tableDescriptor);
>>                logger.info("Enabling table "+tableName);
>>                admin.enableTable(tableNameBytes);
>>
>> Using alterStatus
>>                byte[] tableName = it.next();
>>                try {
>>                    Pair<Integer,Integer> alterStatus = admin.getAlterStatus(tableName);
>>                    if (alterStatus.getFirst() == alterStatus.getSecond()) {
>>                        it.remove();
>>                        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?
>>
>> Asaf
>>
>
>
>
> --
> Harsh J
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB