<commit_before>/**
 * Copyright (C) 2010-2013 Alibaba Group Holding Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alibaba.rocketmq.store.config;

import java.io.File;

import com.alibaba.rocketmq.common.annotation.ImportantField;
import com.alibaba.rocketmq.store.ConsumeQueue;
import com.alibaba.rocketmq.store.transaction.TransactionStateService;


/**
 * 洢ļ
 * 
 * @author shijia.wxr<<EMAIL>>
 * @since 2013-7-21
 */
public class MessageStoreConfig {
    // CommitLog洢Ŀ¼
    @ImportantField
    private String storePathCommitLog = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "commitlog";
    // ConsumeQueue洢Ŀ¼
    @ImportantField
    private String storePathConsumeQueue = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "consumequeue";
    // ļ洢Ŀ¼
    @ImportantField
    private String storePathIndex = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "index";
    // 쳣˳ļ
    @ImportantField
    private String storeCheckpoint = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "storeCheckpoint";
    // 쳣˳ļ
    @ImportantField
    private String abortFile = System.getProperty("user.home") + File.separator + "store" + File.separator
            + "storeAbort";
    // CommitLogÿļС 1G
    private int mapedFileSizeCommitLog = 1024 * 1024 * 1024;
    // ConsumeQueueÿļС Ĭϴ洢50WϢ
    private int mapedFileSizeConsumeQueue = 500000 * ConsumeQueue.CQStoreUnitSize;
    // CommitLogˢ̼ʱ䣨λ룩
    private int flushIntervalCommitLog = 1000;
    // ConsumeQueueˢ̼ʱ䣨λ룩
    private int flushIntervalConsumeQueue = 1000;
    // Դʱ䣨λ룩
    private int cleanResourceInterval = 10000;
    // ɾCommitLogļļʱ䣨λ룩
    private int deleteCommitLogFilesInterval = 100;
    // ɾConsumeQueueļļʱ䣨λ룩
    private int deleteConsumeQueueFilesInterval = 100;
    // ǿɾļʱ䣨λ룩
    private int destroyMapedFileIntervalForcibly = 1000 * 120;
    // ڼHangedļʱ䣨λ룩
    private int redeleteHangedFileInterval = 1000 * 120;
    // ʱɾļ, Ĭ賿4ɾļ
    @ImportantField
    private String deleteWhen = "04";
    // ̿ռʹ
    private int diskMaxUsedSpaceRatio = 75;
    // ļʱ䣨λСʱ
    @ImportantField
    private int fileReservedTime = 12;

    // дϢConsumeQueueˮλʼ
    private int putMsgIndexHightWater = 600000;
    // ϢСĬ512K
    private int maxMessageSize = 1024 * 512;
    // ʱǷУCRC
    private boolean checkCRCOnRecover = true;
    // ˢCommitLogˢPAGE
    private int flushCommitLogLeastPages = 4;
    // ˢConsumeQueueˢPAGE
    private int flushConsumeQueueLeastPages = 2;
    // ˢCommitLogˢ̼ʱ
    private int flushCommitLogThoroughInterval = 1000 * 10;
    // ˢConsumeQueueˢ̼ʱ
    private int flushConsumeQueueThoroughInterval = 1000 * 60;
    // ȡϢֽϢڴ
    @ImportantField
    private int maxTransferBytesOnMessageInMemory = 1024 * 256;
    // ȡϢϢڴ
    @ImportantField
    private int maxTransferCountOnMessageInMemory = 32;
    // ȡϢֽϢڴ
    @ImportantField
    private int maxTransferBytesOnMessageInDisk = 1024 * 64;
    // ȡϢϢڴ
    @ImportantField
    private int maxTransferCountOnMessageInDisk = 8;
    // Ϣڴ
    @ImportantField
    private int accessMessageInMemoryMaxRatio = 30;

    // ǷϢ
    @ImportantField
    private boolean messageIndexEnable = true;
    private int maxHashSlotNum = 5000000;
    private int maxIndexNum = 5000000 * 4;
    private int maxMsgsNumBatch = 32;

    // HA
    private int haListenPort = 10912;
    private int haSendHeartbeatInterval = 1000 * 5;
    private int haHousekeepingInterval = 1000 * 20;
    private int haTransferBatchSize = 1024 * 32;
    // ãNameServerȡMaster HAַ
    @ImportantField
    private String haMasterAddress = null;

    // SlaveMasterֵΪ쳣
    private int haSlaveFallbehindMax = 1024 * 1024 * 256;

    @ImportantField
    private BrokerRole brokerRole = BrokerRole.ASYNC_MASTER;
    @ImportantField
    private FlushDiskType flushDiskType = FlushDiskType.ASYNC_FLUSH;

    // ͬˢ̳ʱʱ
    private int syncFlushTimeout = 1000 * 5;

    // ʱϢ
    private String messageDelayLevel =
            "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 40m 50m 1h 2h 6h 12h 1d";

    private long flushDelayOffsetInterval = 1000 * 10;
    private String delayOffsetStorePath = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "config" + File.separator + "delayOffset.json";

    // ֲʽ
    private String tranStateTableStorePath = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "transaction" + File.separator + "statetable";
    private int tranStateTableMapedFileSize = 2000000 * TransactionStateService.TSStoreUnitSize;

    private String tranRedoLogStorePath = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "transaction" + File.separator + "redolog";
    private int tranRedoLogMapedFileSize = 2000000 * ConsumeQueue.CQStoreUnitSize;

    // زټʱ
    private long checkTransactionMessageAtleastInterval = 1000 * 40;
    // ز鶨ʱʱ
    private long checkTransactionMessageTimerInterval = 1000 * 20;<commit_msg>#4 修改存储层默认配置。<commit_after>/**
 * Copyright (C) 2010-2013 Alibaba Group Holding Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alibaba.rocketmq.store.config;

import java.io.File;

import com.alibaba.rocketmq.common.annotation.ImportantField;
import com.alibaba.rocketmq.store.ConsumeQueue;
import com.alibaba.rocketmq.store.transaction.TransactionStateService;


/**
 * 洢ļ
 * 
 * @author shijia.wxr<<EMAIL>>
 * @since 2013-7-21
 */
public class MessageStoreConfig {
    // CommitLog洢Ŀ¼
    @ImportantField
    private String storePathCommitLog = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "commitlog";
    // ConsumeQueue洢Ŀ¼
    @ImportantField
    private String storePathConsumeQueue = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "consumequeue";
    // ļ洢Ŀ¼
    @ImportantField
    private String storePathIndex = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "index";
    // 쳣˳ļ
    @ImportantField
    private String storeCheckpoint = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "checkpoint";
    // 쳣˳ļ
    @ImportantField
    private String abortFile = System.getProperty("user.home") + File.separator + "store" + File.separator
            + "abort";
    // CommitLogÿļС 1G
    private int mapedFileSizeCommitLog = 1024 * 1024 * 1024;
    // ConsumeQueueÿļС Ĭϴ洢50WϢ
    private int mapedFileSizeConsumeQueue = 500000 * ConsumeQueue.CQStoreUnitSize;
    // CommitLogˢ̼ʱ䣨λ룩
    private int flushIntervalCommitLog = 1000;
    // ConsumeQueueˢ̼ʱ䣨λ룩
    private int flushIntervalConsumeQueue = 1000;
    // Դʱ䣨λ룩
    private int cleanResourceInterval = 10000;
    // ɾCommitLogļļʱ䣨λ룩
    private int deleteCommitLogFilesInterval = 100;
    // ɾConsumeQueueļļʱ䣨λ룩
    private int deleteConsumeQueueFilesInterval = 100;
    // ǿɾļʱ䣨λ룩
    private int destroyMapedFileIntervalForcibly = 1000 * 120;
    // ڼHangedļʱ䣨λ룩
    private int redeleteHangedFileInterval = 1000 * 120;
    // ʱɾļ, Ĭ賿4ɾļ
    @ImportantField
    private String deleteWhen = "04";
    // ̿ռʹ
    private int diskMaxUsedSpaceRatio = 75;
    // ļʱ䣨λСʱ
    @ImportantField
    private int fileReservedTime = 12;

    // дϢConsumeQueueˮλʼ
    private int putMsgIndexHightWater = 600000;
    // ϢСĬ512K
    private int maxMessageSize = 1024 * 512;
    // ʱǷУCRC
    private boolean checkCRCOnRecover = true;
    // ˢCommitLogˢPAGE
    private int flushCommitLogLeastPages = 4;
    // ˢConsumeQueueˢPAGE
    private int flushConsumeQueueLeastPages = 2;
    // ˢCommitLogˢ̼ʱ
    private int flushCommitLogThoroughInterval = 1000 * 10;
    // ˢConsumeQueueˢ̼ʱ
    private int flushConsumeQueueThoroughInterval = 1000 * 60;
    // ȡϢֽϢڴ
    @ImportantField
    private int maxTransferBytesOnMessageInMemory = 1024 * 256;
    // ȡϢϢڴ
    @ImportantField
    private int maxTransferCountOnMessageInMemory = 32;
    // ȡϢֽϢڴ
    @ImportantField
    private int maxTransferBytesOnMessageInDisk = 1024 * 64;
    // ȡϢϢڴ
    @ImportantField
    private int maxTransferCountOnMessageInDisk = 8;
    // Ϣڴ
    @ImportantField
    private int accessMessageInMemoryMaxRatio = 30;

    // ǷϢ
    @ImportantField
    private boolean messageIndexEnable = true;
    private int maxHashSlotNum = 5000000;
    private int maxIndexNum = 5000000 * 4;
    private int maxMsgsNumBatch = 32;

    // HA
    private int haListenPort = 10912;
    private int haSendHeartbeatInterval = 1000 * 5;
    private int haHousekeepingInterval = 1000 * 20;
    private int haTransferBatchSize = 1024 * 32;
    // ãNameServerȡMaster HAַ
    @ImportantField
    private String haMasterAddress = null;

    // SlaveMasterֵΪ쳣
    private int haSlaveFallbehindMax = 1024 * 1024 * 256;

    @ImportantField
    private BrokerRole brokerRole = BrokerRole.ASYNC_MASTER;
    @ImportantField
    private FlushDiskType flushDiskType = FlushDiskType.ASYNC_FLUSH;

    // ͬˢ̳ʱʱ
    private int syncFlushTimeout = 1000 * 5;

    // ʱϢ
    private String messageDelayLevel =
            "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 40m 50m 1h 2h 6h 12h 1d";

    private long flushDelayOffsetInterval = 1000 * 10;
    private String delayOffsetStorePath = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "config" + File.separator + "delayOffset.json";

    // ֲʽ
    private String tranStateTableStorePath = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "transaction" + File.separator + "statetable";
    private int tranStateTableMapedFileSize = 2000000 * TransactionStateService.TSStoreUnitSize;

    private String tranRedoLogStorePath = System.getProperty("user.home") + File.separator + "store"
            + File.separator + "transaction" + File.separator + "redolog";
    private int tranRedoLogMapedFileSize = 2000000 * ConsumeQueue.CQStoreUnitSize;

    // زټʱ
    private long checkTransactionMessageAtleastInterval = 1000 * 60;
    // ز鶨ʱʱ
    private long checkTransactionMessageTimerInterval = 1000 * 60;
{'fraction_non_alphanumeric': 0.0844397238449283, 'fraction_numerical': 0.04363604177730572, 'mean_word_length': 3.2097615499254846, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '423442', 'n_tokens_mistral': 4246, 'n_tokens_neox': 3758, 'n_words': 896}