/** * Send dropped partition notifications. Subscribers can receive these notifications for a * particular table by listening on a topic named "dbName.tableName" with message selector * string {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_PARTITION_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 onDropPartition(DropPartitionEvent partitionEvent) throws MetaException { if (partitionEvent.getStatus()) { String topicName = getTopicName(partitionEvent.getTable()); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildDropPartitionMessage(partitionEvent.getTable(), partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
assertEquals(notifyList.size(), listSize); DropPartitionEvent dropPartEvent = (DropPartitionEvent)notifyList.get(listSize - 1); assert dropPartEvent.getStatus(); assertEquals(envContext, dropPartEvent.getEnvironmentContext()); assertEquals(notifyList.size(), listSize); DropPartitionEvent dropPartByNameEvent = (DropPartitionEvent)notifyList.get(listSize - 1); assert dropPartByNameEvent.getStatus(); assertEquals(envContext, dropPartByNameEvent.getEnvironmentContext());
Assert.assertTrue(dropPart.getStatus()); validateDropPartition(Collections.singletonList(part).iterator(), dropPart.getPartitionIterator()); validateTableInDropPartition(tbl, dropPart.getTable());
@Override public void onDropPartition(DropPartitionEvent partitionEvent) throws MetaException { // don't sync path if the operation has failed if (!partitionEvent.getStatus()) { LOGGER.debug("Skip syncing path with Sentry server for onDropPartition event," + " since the operation failed. \n"); return; } String authzObj = partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName(); String path = partitionEvent.getPartition().getSd().getLocation(); for (SentryMetastoreListenerPlugin plugin : sentryPlugins) { plugin.removePath(authzObj, path); } super.onDropPartition(partitionEvent); }
/** * Send dropped partition notifications. Subscribers can receive these notifications for a * particular table by listening on a topic named "dbName.tableName" with message selector * string {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_PARTITION_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 onDropPartition(DropPartitionEvent partitionEvent) throws MetaException { if (partitionEvent.getStatus()) { String topicName = getTopicName(partitionEvent.getTable()); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildDropPartitionMessage(partitionEvent.getTable(), partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
/** * Send dropped partition notifications. Subscribers can receive these notifications for a * particular table by listening on a topic named "dbName.tableName" with message selector * string {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_PARTITION_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 onDropPartition(DropPartitionEvent partitionEvent) throws MetaException { if (partitionEvent.getStatus()) { String topicName = getTopicName(partitionEvent.getTable()); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildDropPartitionMessage(partitionEvent.getTable(), partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
/** * Send dropped partition notifications. Subscribers can receive these notifications for a * particular table by listening on a topic named "dbName.tableName" with message selector * string {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_EVENT} = * {@value org.apache.hive.hcatalog.common.HCatConstants#HCAT_DROP_PARTITION_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 onDropPartition(DropPartitionEvent partitionEvent) throws MetaException { if (partitionEvent.getStatus()) { String topicName = getTopicName(partitionEvent.getTable()); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildDropPartitionMessage(partitionEvent.getTable(), partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }