@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 testAddListPartitionConcurrency() throws UserException, 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_list");
        List<List<String>> partitionValues = Lists.newArrayList();
        List<String> values = Lists.newArrayList();
        values.add("1990-04-24");
        partitionValues.add(values);
        List<String> values2 = Lists.newArrayList();
        values2.add("1990-04-25");
        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);

        GlobalStateMgr currentState = GlobalStateMgr.getCurrentState();
        Database testDb = currentState.getDb("test");
        OlapTable olapTable = (OlapTable) testDb.getTable("site_access_list");
        PartitionInfo partitionInfo = olapTable.getPartitionInfo();
        DistributionInfo defaultDistributionInfo = olapTable.getDefaultDistributionInfo();
        List<PartitionDesc> partitionDescs = Lists.newArrayList();
        Partition p19910425 = olapTable.getPartition("p19900425");

        partitionDescs.add(new ListPartitionDesc(Lists.newArrayList("p19900425"),
                Lists.newArrayList(new SingleItemListPartitionDesc(true, "p19900425",
                        Lists.newArrayList("1990-04-25"), Maps.newHashMap()))));

        AddPartitionClause addPartitionClause = new AddPartitionClause(partitionDescs.get(0),
                defaultDistributionInfo.toDistributionDesc(table.getIdToColumn()), Maps.newHashMap(), false);

        List<Partition> partitionList = Lists.newArrayList();
        partitionList.add(p19910425);

        currentState.getLocalMetastore().addListPartitionLog(testDb, olapTable, partitionDescs,
                addPartitionClause.isTempPartition(), partitionInfo, partitionList, Sets.newSet("p19900425"));

    }