@Override
    public TImmutablePartitionResult updateImmutablePartition(TImmutablePartitionRequest request) throws TException {
        LOG.info("Receive update immutable partition: {}", request);

        TImmutablePartitionResult result;
        try {
            result = updateImmutablePartitionInternal(request);
        } catch (Throwable t) {
            LOG.warn(t.getMessage(), t);
            result = new TImmutablePartitionResult();
            TStatus errorStatus = new TStatus(RUNTIME_ERROR);
            errorStatus.setError_msgs(Lists.newArrayList(String.format("txn_id=%d failed. %s",
                    request.getTxn_id(), t.getMessage())));
            result.setStatus(errorStatus);
        }

        LOG.info("Finish update immutable partition: {}", result);

        return result;
    }
@Test
    public void testImmutablePartitionException() throws TException {
        Database db = GlobalStateMgr.getCurrentState().getDb("test");
        OlapTable table = (OlapTable) db.getTable("site_access_exception");
        List<Long> partitionIds = Lists.newArrayList();
        FrontendServiceImpl impl = new FrontendServiceImpl(exeEnv);
        TImmutablePartitionRequest request = new TImmutablePartitionRequest();
        TImmutablePartitionResult partition = impl.updateImmutablePartition(request);
        Table t = db.getTable("v");

        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.RUNTIME_ERROR);

        request.setDb_id(db.getId());
        partition = impl.updateImmutablePartition(request);
        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.RUNTIME_ERROR);

        request.setTable_id(t.getId());
        partition = impl.updateImmutablePartition(request);
        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.RUNTIME_ERROR);

        request.setTable_id(table.getId());
        partition = impl.updateImmutablePartition(request);
        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.RUNTIME_ERROR);

        request.setPartition_ids(partitionIds);
        partition = impl.updateImmutablePartition(request);
        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.OK);

        partitionIds.add(1L);
        request.setPartition_ids(partitionIds);
        partition = impl.updateImmutablePartition(request);
        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.OK);

        partitionIds = table.getPhysicalPartitions().stream()
                .map(PhysicalPartition::getId).collect(Collectors.toList());
        request.setPartition_ids(partitionIds);
        partition = impl.updateImmutablePartition(request);
        Assert.assertEquals(partition.getStatus().getStatus_code(), TStatusCode.OK);
    }