@Override
    public TCreatePartitionResult createPartition(TCreatePartitionRequest request) throws TException {

        LOG.info("Receive create partition: {}", request);

        TCreatePartitionResult result;
        try {
            if (partitionRequestNum.incrementAndGet() >= Config.thrift_server_max_worker_threads / 4) {
                result = new TCreatePartitionResult();
                TStatus errorStatus = new TStatus(SERVICE_UNAVAILABLE);
                errorStatus.setError_msgs(Lists.newArrayList(
                        String.format("Too many create partition requests, please try again later txn_id=%d",
                                request.getTxn_id())));
                result.setStatus(errorStatus);
                return result;
            }

            result = createPartitionProcess(request);
        } catch (Exception t) {
            LOG.warn(DebugUtil.getStackTrace(t));
            result = new TCreatePartitionResult();
            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);
        } finally {
            partitionRequestNum.decrementAndGet();
        }

        return result;
    }
@Test
    public void testCreatePartitionApiBorder() throws TException {
        new MockUp<GlobalTransactionMgr>() {
            @Mock
            public TransactionState getTransactionState(long dbId, long transactionId) {
                return new TransactionState();
            }
        };

        Database db = GlobalStateMgr.getCurrentState().getDb("test");
        Table table = db.getTable("site_access_border");
        List<List<String>> partitionValues = Lists.newArrayList();
        List<String> values = Lists.newArrayList();
        values.add("NULL");
        partitionValues.add(values);
        List<String> values1 = Lists.newArrayList();
        values1.add("0000-01-01");
        partitionValues.add(values1);
        List<String> values2 = Lists.newArrayList();
        values2.add("9999-12-31");
        partitionValues.add(values2);

        FrontendServiceImpl impl = new FrontendServiceImpl(exeEnv);
        TCreatePartitionRequest request = new TCreatePartitionRequest();
        request.setDb_id(db.getId());
        request.setTable_id(table.getId());
        request.setPartition_values(partitionValues);
        TCreatePartitionResult partition = impl.createPartition(request);

        Assert.assertEquals(TStatusCode.OK, partition.getStatus().getStatus_code());
        Partition p00000101 = table.getPartition("p00000101");
        Assert.assertNotNull(p00000101);
        Partition p99991231 = table.getPartition("p99991231");
        Assert.assertNotNull(p99991231);
        partition = impl.createPartition(request);
        Assert.assertEquals(2, partition.partitions.size());
    }