boolean success = false;
try {
openTransaction();
name = name.toLowerCase();
dbname = dbname.toLowerCase();
MPartition oldp = getMPartition(dbname, name, newPart.getValues());
MPartition newp = convertToMPart(newPart);
if (oldp == null || newp == null) {
throw new InvalidObjectException("partition does not exist.");
}
oldp.setParameters(newPart.getParameters());
copyMSD(newp.getSd(), oldp.getSd());
if (newp.getCreateTime() != oldp.getCreateTime())
oldp.setCreateTime(newp.getCreateTime());
if (newp.getLastAccessTime() != oldp.getLastAccessTime())
oldp.setLastAccessTime(newp.getLastAccessTime());
// commit the changes
success = commitTransaction();
} finally {
if(!success) {
rollbackTransaction();