throws MetaException, NoSuchObjectException, IOException {
boolean success = false;
Path partPath = null;
Table tbl = null;
Partition part = null;
boolean isArchived = false;
Path archiveParentDir = null;
try {
ms.openTransaction();
part = ms.getPartition(db_name, tbl_name, part_vals);
if (part == null) {
throw new NoSuchObjectException("Partition doesn't exist. "
+ part_vals);
}
isArchived = MetaStoreUtils.isArchived(part);
if (isArchived) {
archiveParentDir = MetaStoreUtils.getOriginalLocation(part);
if (!wh.isWritable(archiveParentDir.getParent())) {
throw new MetaException("Table partition not deleted since " +
archiveParentDir.getParent() + " is not writable by " +
hiveConf.getUser());
}
}
if (!ms.dropPartition(db_name, tbl_name, part_vals)) {
throw new MetaException("Unable to drop partition");
}
success = ms.commitTransaction();
if ((part.getSd() != null) && (part.getSd().getLocation() != null)) {
partPath = new Path(part.getSd().getLocation());
if (!wh.isWritable(partPath.getParent())) {
throw new MetaException("Table partition not deleted since " +
partPath.getParent() + " is not writable by " +
hiveConf.getUser());
}