Deleting HBase Global Secondary Indexes
Function
Manage HBase global secondary indexes by calling the method in org.apache.hadoop.hbase.hindex.global.GlobalIndexAdmin. dropIndices is used to delete indexes.
Code Sample
The following code snippets are in the dropIndices method in the GlobalSecondaryIndexSample class of the com.huawei.bigdata.hbase.examples package.
In this case, the idx_id_age index is deleted from the user_table table.
/**
* dropIndex
*/
public void testDropIndex() {
LOG.info("Entering testDropIndex.");
List<String> indexNameList = Lists.newArrayList("idx_id_age");
// Instantiate HIndexAdmin Object
try (GlobalIndexAdmin iAdmin = GlobalIndexClient.newIndexAdmin(conn.getAdmin())) {
// Delete Secondary Index
iAdmin.dropIndices(tableName, indexNameList);
LOG.info("Drop index successfully.");
} catch (IOException e) {
LOG.error("Drop index failed ", e);
}
LOG.info("Exiting testDropIndex.");
} What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot