/** * 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); } }
/** * @param tableEvent table event. * @throws MetaException */ @Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { Table t = tableEvent.getTable(); DropTableMessage msg = MessageBuilder.getInstance().buildDropTableMessage(t); NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_TABLE.toString(), msgEncoder.getSerializer().serialize(msg)); event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); process(event, tableEvent); }
validateDropTable(tbl, dropTbl.getTable()); validateDropTable(tbl, preDropTbl.getTable());
/** * Listener which fires when a table is dropped. * * <p>For auditing purposes the read/write differential is the existence and * non-existence of the dropped table respectively.</p> * * @param event The drop table event */ @Override public void onDropTable(DropTableEvent event) throws MetaException { try { Set<ReadEntity> readEntities = new HashSet<>(); readEntities.add(new ReadEntity(new Table(event.getTable()))); Set<WriteEntity> writeEntities = new HashSet<>(); run(readEntities, writeEntities, HiveOperation.THRIFT_DROP_TABLE); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Listener which fires when a table is dropped. * * <p>For auditing purposes the read/write differential is the existence and * non-existence of the dropped table respectively.</p> * * @param event The drop table event */ @Override public void onDropTable(DropTableEvent event) throws MetaException { try { Set<ReadEntity> readEntities = new HashSet<>(); readEntities.add(new ReadEntity(new Table(event.getTable()))); Set<WriteEntity> writeEntities = new HashSet<>(); run(readEntities, writeEntities, HiveOperation.THRIFT_DROP_TABLE); } catch (Exception e) { throw new RuntimeException(e); } }
@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()); }
/** * @param tableEvent table event. * @throws MetaException */ public void onDropTable (DropTableEvent tableEvent) throws MetaException { Table t = tableEvent.getTable(); NotificationEvent event = new NotificationEvent(0, now(), HCatConstants.HCAT_DROP_TABLE_EVENT, msgFactory.buildDropTableMessage(t).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); enqueue(event); }
/** * @param tableEvent table event. * @throws MetaException */ public void onDropTable (DropTableEvent tableEvent) throws MetaException { Table t = tableEvent.getTable(); NotificationEvent event = new NotificationEvent(0, now(), HCatConstants.HCAT_DROP_TABLE_EVENT, msgFactory.buildDropTableMessage(t).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); enqueue(event); }
/** * 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); } }
/** * @param tableEvent table event. * @throws MetaException */ @Override public void onDropTable(DropTableEvent tableEvent) throws MetaException { Table t = tableEvent.getTable(); NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_TABLE.toString(), msgFactory .buildDropTableMessage(t).toString()); event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); process(event, tableEvent); }