/** * Listener which fires when a partition is added. * * <p>For auditing purposes the read/write differential is the non-existence * and existence of the added partition respectively.</p> * * @param event The add partition event */ @Override public void onAddPartition(AddPartitionEvent event) throws MetaException { try { Table table = new Table(event.getTable()); Set<ReadEntity> readEntities = new HashSet<>(); Set<WriteEntity> writeEntities = new HashSet<>(); for (org.apache.hadoop.hive.metastore.api.Partition partition : event.getPartitions()) { writeEntities.add( new WriteEntity( new Partition(table, partition), WriteType.INSERT ) ); } run(readEntities, writeEntities, HiveOperation.THRIFT_ADD_PARTITION); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Listener which fires when a partition is added. * * <p>For auditing purposes the read/write differential is the non-existence * and existence of the added partition respectively.</p> * * @param event The add partition event */ @Override public void onAddPartition(AddPartitionEvent event) throws MetaException { try { Table table = new Table(event.getTable()); Set<ReadEntity> readEntities = new HashSet<>(); Set<WriteEntity> writeEntities = new HashSet<>(); for (org.apache.hadoop.hive.metastore.api.Partition partition : event.getPartitions()) { writeEntities.add( new WriteEntity( new Partition(table, partition), WriteType.INSERT ) ); } run(readEntities, writeEntities, HiveOperation.THRIFT_ADD_PARTITION); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { // don't sync path if the operation has failed if (!partitionEvent.getStatus()) { LOGGER.debug("Skip syncing path with Sentry server for onAddPartition event," + " since the operation failed. \n"); return; } for (Partition part : partitionEvent.getPartitions()) { if (part.getSd() != null && part.getSd().getLocation() != null) { String authzObj = part.getDbName() + "." + part.getTableName(); String path = part.getSd().getLocation(); for (SentryMetastoreListenerPlugin plugin : sentryPlugins) { plugin.addPath(authzObj, path); } } } super.onAddPartition(partitionEvent); }