/** * Send dropped table notifications. Subscribers can receive these notifications for * dropped tables by listening on topic "HCAT" with message selector string * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_TABLE_EVENT} * </br> * TODO: DataNucleus 2.0.3, currently used by the HiveMetaStore for persistence, has been * found to throw NPE when serializing objects that contain null. For this reason we override * some fields in the StorageDescriptor of this notification. This should be fixed after * HIVE-2084 "Upgrade datanucleus from 2.0.3 to 3.0.1" is resolved. */ @Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { // Subscriber can get notification about drop of a table in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_TABLE" // Datanucleus throws NPE when we try to serialize a table object // retrieved from metastore. To workaround that we reset following objects if (tableEvent.getStatus()) { Table table = tableEvent.getTable(); // I think this is wrong, the drop table statement should come on the table topic not the // DB topic - Alan. String topicName = getTopicPrefix(tableEvent.getIHMSHandler().getConf()) + "." + table.getDbName().toLowerCase(); send(messageFactory.buildDropTableMessage(table), topicName); } }
assertEquals(notifyList.size(), listSize); DropTableEvent dropTblEvent = (DropTableEvent)notifyList.get(listSize-1); assert dropTblEvent.getStatus(); assertEquals(envContext, dropTblEvent.getEnvironmentContext());
Assert.assertTrue(dropTbl.getStatus()); validateDropTable(tbl, dropTbl.getTable()); validateDropTable(tbl, preDropTbl.getTable());
/** * Send dropped table notifications. Subscribers can receive these notifications for * dropped tables by listening on topic "HCAT" with message selector string * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_TABLE_EVENT} * </br> * TODO: DataNucleus 2.0.3, currently used by the HiveMetaStore for persistence, has been * found to throw NPE when serializing objects that contain null. For this reason we override * some fields in the StorageDescriptor of this notification. This should be fixed after * HIVE-2084 "Upgrade datanucleus from 2.0.3 to 3.0.1" is resolved. */ @Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { // Subscriber can get notification about drop of a table in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_TABLE" // Datanucleus throws NPE when we try to serialize a table object // retrieved from metastore. To workaround that we reset following objects if (tableEvent.getStatus()) { Table table = tableEvent.getTable(); // I think this is wrong, the drop table statement should come on the table topic not the // DB topic - Alan. String topicName = getTopicPrefix(tableEvent.getIHMSHandler().getConf()) + "." + table.getDbName().toLowerCase(); send(messageFactory.buildDropTableMessage(table), topicName); } }
/** * Send dropped table notifications. Subscribers can receive these notifications for * dropped tables by listening on topic "HCAT" with message selector string * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_TABLE_EVENT} * </br> * TODO: DataNucleus 2.0.3, currently used by the HiveMetaStore for persistence, has been * found to throw NPE when serializing objects that contain null. For this reason we override * some fields in the StorageDescriptor of this notification. This should be fixed after * HIVE-2084 "Upgrade datanucleus from 2.0.3 to 3.0.1" is resolved. */ @Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { // Subscriber can get notification about drop of a table in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_TABLE" // Datanucleus throws NPE when we try to serialize a table object // retrieved from metastore. To workaround that we reset following objects if (tableEvent.getStatus()) { Table table = tableEvent.getTable(); // I think this is wrong, the drop table statement should come on the table topic not the // DB topic - Alan. String topicName = getTopicPrefix(tableEvent.getHandler().getHiveConf()) + "." + table.getDbName().toLowerCase(); send(messageFactory.buildDropTableMessage(table), topicName); } }
/** * Send dropped table notifications. Subscribers can receive these notifications for * dropped tables by listening on topic "HCAT" with message selector string * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_TABLE_EVENT} * </br> * TODO: DataNucleus 2.0.3, currently used by the HiveMetaStore for persistence, has been * found to throw NPE when serializing objects that contain null. For this reason we override * some fields in the StorageDescriptor of this notification. This should be fixed after * HIVE-2084 "Upgrade datanucleus from 2.0.3 to 3.0.1" is resolved. */ @Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { // Subscriber can get notification about drop of a table in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_TABLE" // Datanucleus throws NPE when we try to serialize a table object // retrieved from metastore. To workaround that we reset following objects if (tableEvent.getStatus()) { Table table = tableEvent.getTable(); // I think this is wrong, the drop table statement should come on the table topic not the // DB topic - Alan. String topicName = getTopicPrefix(tableEvent.getHandler().getHiveConf()) + "." + table.getDbName().toLowerCase(); send(messageFactory.buildDropTableMessage(table), topicName); } }
@Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { // don't sync paths/privileges if the operation has failed if (!tableEvent.getStatus()) { LOGGER.debug("Skip syncing paths/privileges with Sentry server for onDropTable event," + " since the operation failed. \n"); return; } if (tableEvent.getTable().getSd().getLocation() != null) { String authzObj = tableEvent.getTable().getDbName() + "." + tableEvent.getTable().getTableName(); for (SentryMetastoreListenerPlugin plugin : sentryPlugins) { plugin.removeAllPaths(authzObj, null); } } // drop the privileges on the given table if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_DROP_WITH_POLICY_STORE)) { return; } if (!tableEvent.getStatus()) { return; } dropSentryTablePrivilege(tableEvent.getTable().getDbName(), tableEvent.getTable().getTableName()); }