@Override public void onDropDatabase (DropDatabaseEvent dbEvent) throws MetaException { // We can loop thru all the tables to check if they are ACID first and then perform cleanup, // but it's more efficient to unconditionally perform cleanup for the database, especially // when there are a lot of tables txnHandler = getTxnHandler(); txnHandler.cleanupRecords(HiveObjectType.DATABASE, dbEvent.getDatabase(), null, null); }
@Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { // Subscriber can get notification about drop of a database in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_DATABASE" if (dbEvent.getStatus()) { String topicName = getTopicPrefix(dbEvent.getIHMSHandler().getConf()); send(messageFactory.buildDropDatabaseMessage(dbEvent.getDatabase()), topicName); } }
/** * @param dbEvent database event * @throws MetaException */ @Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { Database db = dbEvent.getDatabase(); DropDatabaseMessage msg = MessageBuilder.getInstance() .buildDropDatabaseMessage(db); NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_DATABASE.toString(), msgEncoder.getSerializer().serialize(msg)); event.setCatName(db.isSetCatalogName() ? db.getCatalogName() : DEFAULT_CATALOG_NAME); event.setDbName(db.getName()); process(event, dbEvent); }
validateDropDb(db, dropDB.getDatabase()); validateDropDb(db, preDropDB.getDatabase());
/** * Listener which fires when a database (schema) is dropped. * * <p>For auditing purposes the read/write differential is the existence and * non-existence of the dropped database respectively.</p> * * @param event The drop database event */ @Override public void onDropDatabase(DropDatabaseEvent event) throws MetaException { try { Set<ReadEntity> readEntities = new HashSet<>(); readEntities.add(new ReadEntity(event.getDatabase())); Set<WriteEntity> writeEntities = new HashSet<>(); run(readEntities, writeEntities, HiveOperation.THRIFT_DROP_DATABASE); } catch (Exception e) { throw new MetaException(e.getMessage()); } }
/** * Listener which fires when a database (schema) is dropped. * * <p>For auditing purposes the read/write differential is the existence and * non-existence of the dropped database respectively.</p> * * @param event The drop database event */ @Override public void onDropDatabase(DropDatabaseEvent event) throws MetaException { try { Set<ReadEntity> readEntities = new HashSet<>(); readEntities.add(new ReadEntity(event.getDatabase())); Set<WriteEntity> writeEntities = new HashSet<>(); run(readEntities, writeEntities, HiveOperation.THRIFT_DROP_DATABASE); } catch (Exception e) { throw new MetaException(e.getMessage()); } }
/** * @param dbEvent database event * @throws MetaException */ public void onDropDatabase (DropDatabaseEvent dbEvent) throws MetaException { Database db = dbEvent.getDatabase(); NotificationEvent event = new NotificationEvent(0, now(), HCatConstants.HCAT_DROP_DATABASE_EVENT, msgFactory.buildDropDatabaseMessage(db).toString()); event.setDbName(db.getName()); enqueue(event); }
/** * @param dbEvent database event * @throws MetaException */ public void onDropDatabase (DropDatabaseEvent dbEvent) throws MetaException { Database db = dbEvent.getDatabase(); NotificationEvent event = new NotificationEvent(0, now(), HCatConstants.HCAT_DROP_DATABASE_EVENT, msgFactory.buildDropDatabaseMessage(db).toString()); event.setDbName(db.getName()); enqueue(event); }
/** * Drop the privileges on the database. Note that child tables will be * dropped individually by client, so we just need to handle the removing * the db privileges. The table drop should cleanup the table privileges. */ @Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { // don't sync paths/privileges if the operation has failed if (!dbEvent.getStatus()) { LOGGER.debug("Skip syncing paths/privileges with Sentry server for onDropDatabase event," + " since the operation failed. \n"); return; } String authzObj = dbEvent.getDatabase().getName(); for (SentryMetastoreListenerPlugin plugin : sentryPlugins) { List<String> tNames = dbEvent.getHandler().get_all_tables(authzObj); plugin.removeAllPaths(authzObj, tNames); } if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_DROP_WITH_POLICY_STORE)) { return; } dropSentryDbPrivileges(dbEvent.getDatabase().getName()); }
@Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { // Subscriber can get notification about drop of a database in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_DATABASE" if (dbEvent.getStatus()) { String topicName = getTopicPrefix(dbEvent.getIHMSHandler().getConf()); send(messageFactory.buildDropDatabaseMessage(dbEvent.getDatabase()), topicName); } }
@Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { // Subscriber can get notification about drop of a database in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_DATABASE" if (dbEvent.getStatus()) { String topicName = getTopicPrefix(dbEvent.getHandler().getHiveConf()); send(messageFactory.buildDropDatabaseMessage(dbEvent.getDatabase()), topicName); } }
@Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { // Subscriber can get notification about drop of a database in HCAT // by listening on a topic named "HCAT" and message selector string // as "HCAT_EVENT = HCAT_DROP_DATABASE" if (dbEvent.getStatus()) { String topicName = getTopicPrefix(dbEvent.getHandler().getHiveConf()); send(messageFactory.buildDropDatabaseMessage(dbEvent.getDatabase()), topicName); } }
/** * @param dbEvent database event * @throws MetaException */ @Override public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException { Database db = dbEvent.getDatabase(); NotificationEvent event = new NotificationEvent(0, now(), EventType.DROP_DATABASE.toString(), msgFactory .buildDropDatabaseMessage(db).toString()); event.setCatName(db.isSetCatalogName() ? db.getCatalogName() : DEFAULT_CATALOG_NAME); event.setDbName(db.getName()); process(event, dbEvent); }