Java Code Examples for org.apache.rocketmq.store.config.MessageStoreConfig#setStorePathRootDir()

The following examples show how to use org.apache.rocketmq.store.config.MessageStoreConfig#setStorePathRootDir() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntegrationTestBase.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
public static BrokerController createAndStartBroker(String nsAddr) {
    String baseDir = createBaseDir();
    BrokerConfig brokerConfig = new BrokerConfig();
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
    brokerConfig.setBrokerIP1("127.0.0.1");
    brokerConfig.setNamesrvAddr(nsAddr);
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(8000 + random.nextInt(1000));
    nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
    BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
    try {
        Assert.assertTrue(brokerController.initialize());
        logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
        brokerController.start();
    } catch (Exception e) {
        logger.info("Broker start failed");
        System.exit(1);
    }
    BROKER_CONTROLLERS.add(brokerController);
    return brokerController;
}
 
Example 2
Source File: HATest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() throws Exception {
    StoreHost = new InetSocketAddress(InetAddress.getLocalHost(), 8123);
    BornHost = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0);
    masterMessageStoreConfig = new MessageStoreConfig();
    masterMessageStoreConfig.setBrokerRole(BrokerRole.SYNC_MASTER);
    masterMessageStoreConfig.setStorePathRootDir(storePathRootDir+File.separator+"master");
    masterMessageStoreConfig.setStorePathCommitLog(storePathRootDir+File.separator+"master"+ File.separator+"commitlog");
    buildMessageStoreConfig(masterMessageStoreConfig);
    slaveStoreConfig = new MessageStoreConfig();
    slaveStoreConfig.setBrokerRole(BrokerRole.SLAVE);
    slaveStoreConfig.setStorePathRootDir(storePathRootDir+File.separator+"slave");
    slaveStoreConfig.setStorePathCommitLog(storePathRootDir+File.separator+"slave"+ File.separator+"commitlog");
    slaveStoreConfig.setHaListenPort(10943);
    buildMessageStoreConfig(slaveStoreConfig);
    messageStore = buildMessageStore(masterMessageStoreConfig,0L);
    slaveMessageStore = buildMessageStore(slaveStoreConfig,1L);
    boolean load = messageStore.load();
    boolean slaveLoad = slaveMessageStore.load();
    slaveMessageStore.updateHaMasterAddress("127.0.0.1:10912");
    assertTrue(load);
    assertTrue(slaveLoad);
    messageStore.start();
    slaveMessageStore.start();
    Thread.sleep(6000L);//because the haClient will wait 5s after the first connectMaster failed,sleep 6s
}
 
Example 3
Source File: AppendCallbackTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    //too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
 
Example 4
Source File: AppendCallbackTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws Exception{
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    //too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
 
Example 5
Source File: IntegrationTestBase.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public static BrokerController createAndStartBroker(String nsAddr) {
    String baseDir = createBaseDir();
    BrokerConfig brokerConfig = new BrokerConfig();
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
    brokerConfig.setBrokerIP1("127.0.0.1");
    brokerConfig.setNamesrvAddr(nsAddr);
    brokerConfig.setEnablePropertyFilter(true);
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(8000 + random.nextInt(1000));
    storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
    storeConfig.setMaxIndexNum(INDEX_NUM);
    storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
    nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
    BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
    try {
        Assert.assertTrue(brokerController.initialize());
        logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
        brokerController.start();
    } catch (Exception e) {
        logger.info("Broker start failed");
        System.exit(1);
    }
    BROKER_CONTROLLERS.add(brokerController);
    return brokerController;
}
 
Example 6
Source File: MessageStoreWithFilterTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 7
Source File: ConsumeQueueTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
    boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 8
Source File: AppendCallbackTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    //too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
 
Example 9
Source File: IntegrationTestBase.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static BrokerController createAndStartBroker(String nsAddr) {
    String baseDir = createBaseDir();
    BrokerConfig brokerConfig = new BrokerConfig();
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
    brokerConfig.setBrokerIP1("127.0.0.1");
    brokerConfig.setNamesrvAddr(nsAddr);
    brokerConfig.setEnablePropertyFilter(true);
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(8000 + random.nextInt(1000));
    storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
    storeConfig.setMaxIndexNum(INDEX_NUM);
    storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
    nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
    BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
    try {
        Assert.assertTrue(brokerController.initialize());
        logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
        brokerController.start();
    } catch (Exception e) {
        logger.info("Broker start failed");
        System.exit(1);
    }
    BROKER_CONTROLLERS.add(brokerController);
    return brokerController;
}
 
Example 10
Source File: BatchPutMessageTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private MessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMappedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMappedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    messageStoreConfig.setFlushIntervalConsumeQueue(1);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "putmessagesteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "putmessagesteststore" + File.separator + "commitlog");
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), new MyMessageArrivingListener(), new BrokerConfig());
}
 
Example 11
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 12
Source File: IntegrationTestBase.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static BrokerController createAndStartBroker(String nsAddr) {
    String baseDir = createBaseDir();
    BrokerConfig brokerConfig = new BrokerConfig();
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
    brokerConfig.setBrokerIP1("127.0.0.1");
    brokerConfig.setNamesrvAddr(nsAddr);
    brokerConfig.setEnablePropertyFilter(true);
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(8000 + random.nextInt(1000));
    storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
    storeConfig.setMaxIndexNum(INDEX_NUM);
    storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
    nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
    BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
    try {
        Assert.assertTrue(brokerController.initialize());
        logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
        brokerController.start();
    } catch (Exception e) {
        logger.info("Broker start failed");
        System.exit(1);
    }
    BROKER_CONTROLLERS.add(brokerController);
    return brokerController;
}
 
Example 13
Source File: MessageStoreWithFilterTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 14
Source File: ConsumeQueueTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
    boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 15
Source File: ConsumeQueueTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 16
Source File: DLedgerProduceAndConsumeIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(String brokerName, String peers, String selfId) {
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    String baseDir =  IntegrationTestBase.createBaseDir();
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(nextPort());
    storeConfig.setMappedFileSizeCommitLog(10 * 1024 * 1024);
    storeConfig.setEnableDLegerCommitLog(true);
    storeConfig.setdLegerGroup(brokerName);
    storeConfig.setdLegerSelfId(selfId);
    storeConfig.setdLegerPeers(peers);
    return storeConfig;
}
 
Example 17
Source File: AppendCallbackTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMappedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMappedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    //too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
 
Example 18
Source File: AppendCallbackTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    //too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
 
Example 19
Source File: IntegrationTestBase.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static BrokerController createAndStartBroker(String nsAddr) {
    String baseDir = createBaseDir();
    BrokerConfig brokerConfig = new BrokerConfig();
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
    brokerConfig.setBrokerIP1("127.0.0.1");
    brokerConfig.setNamesrvAddr(nsAddr);
    brokerConfig.setEnablePropertyFilter(true);
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(8000 + random.nextInt(1000));
    storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
    storeConfig.setMaxIndexNum(INDEX_NUM);
    storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
    nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
    BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
    try {
        Assert.assertTrue(brokerController.initialize());
        logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
        brokerController.start();
    } catch (Exception e) {
        logger.info("Broker start failed");
        System.exit(1);
    }
    BROKER_CONTROLLERS.add(brokerController);
    return brokerController;
}
 
Example 20
Source File: MessageStoreTestBase.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
protected DefaultMessageStore createDledgerMessageStore(String base, String group, String selfId, String peers, String leaderId, boolean createAbort, int deleteFileNum) throws Exception {
    System.setProperty("dledger.disk.ratio.check", "0.95");
    System.setProperty("dledger.disk.ratio.clean", "0.95");
    baseDirs.add(base);
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    storeConfig.setMappedFileSizeCommitLog(1024 * 100);
    storeConfig.setMappedFileSizeConsumeQueue(1024);
    storeConfig.setMaxHashSlotNum(100);
    storeConfig.setMaxIndexNum(100 * 10);
    storeConfig.setStorePathRootDir(base);
    storeConfig.setStorePathCommitLog(base + File.separator + "commitlog");
    storeConfig.setFlushDiskType(FlushDiskType.ASYNC_FLUSH);

    storeConfig.setEnableDLegerCommitLog(true);
    storeConfig.setdLegerGroup(group);
    storeConfig.setdLegerPeers(peers);
    storeConfig.setdLegerSelfId(selfId);
    DefaultMessageStore defaultMessageStore = new DefaultMessageStore(storeConfig,  new BrokerStatsManager("DLedgerCommitlogTest"), (topic, queueId, logicOffset, tagsCode, msgStoreTime, filterBitMap, properties) -> {

    }, new BrokerConfig());
    DLedgerServer dLegerServer = ((DLedgerCommitLog) defaultMessageStore.getCommitLog()).getdLedgerServer();
    if (leaderId != null) {
        dLegerServer.getdLedgerConfig().setEnableLeaderElector(false);
        if (selfId.equals(leaderId)) {
            dLegerServer.getMemberState().changeToLeader(-1);
        } else {
            dLegerServer.getMemberState().changeToFollower(-1, leaderId);
        }

    }
    if (createAbort) {
        String fileName = StorePathConfigHelper.getAbortFile(storeConfig.getStorePathRootDir());
        makeSureFileExists(fileName);
    }
    if (deleteFileNum > 0) {
        DLedgerConfig config = dLegerServer.getdLedgerConfig();
        if (deleteFileNum > 0) {
            File dir = new File(config.getDataStorePath());
            File[] files = dir.listFiles();
            if (files != null) {
                Arrays.sort(files);
                for (int i = files.length - 1; i >= 0; i--) {
                    File file = files[i];
                    file.delete();
                    if (files.length - i >= deleteFileNum) {
                        break;
                    }
                }
            }
        }
    }
    Assert.assertTrue(defaultMessageStore.load());
    defaultMessageStore.start();
    return defaultMessageStore;
}