Skip to content

Commit

Permalink
file separator error in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fujian-zfj committed Jul 25, 2023
1 parent 5d3ff5d commit 49505a1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void decode0(final byte[] key, final byte[] body) {

@Override
public String configFilePath() {
return this.brokerController.getMessageStoreConfig().getStorePathRootDir() + File.separator + "config" + File.separator + "consumerOffsets/";
return this.brokerController.getMessageStoreConfig().getStorePathRootDir() + File.separator + "config" + File.separator + "consumerOffsets" + File.separator;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ public synchronized void persist() {

@Override
public String configFilePath() {
return this.brokerController.getMessageStoreConfig().getStorePathRootDir() + File.separator + "config" + File.separator + "subscriptionGroups/";
return this.brokerController.getMessageStoreConfig().getStorePathRootDir() + File.separator + "config" + File.separator + "subscriptionGroups" + File.separator;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void decode0(byte[] key, byte[] body) {

@Override
public String configFilePath() {
return this.brokerController.getMessageStoreConfig().getStorePathRootDir() + File.separator + "config" + File.separator + "topics/";
return this.brokerController.getMessageStoreConfig().getStorePathRootDir() + File.separator + "config" + File.separator + "topics" + File.separator;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.rocketmq.common.config;

import java.io.File;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -197,12 +198,14 @@ public DBOptions createConfigDBOptions() {
setUseDirectReads(true);
}

private static String getDBLogDir() {
public static String getDBLogDir() {
String rootPath = System.getProperty("user.home");
if (StringUtils.isEmpty(rootPath)) {
return "";
}
return rootPath + "/logs/rocketmqlogs/";
rootPath = rootPath + File.separator + "logs";
UtilAll.ensureDirOK(rootPath);
return rootPath + File.separator + "rocketmqlogs" + File.separator;
}

public void put(final byte[] keyBytes, final int keyLen, final byte[] valueBytes) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public interface ConsumeQueueInterface extends FileQueueLifeCycle {
* Assign queue offset.
* @param queueOffsetAssigner the delegated queue offset assigner
* @param msg message itself
* @throws Exception only in rocksdb mode
*/
void assignQueueOffset(QueueOffsetOperator queueOffsetAssigner, MessageExtBrokerInner msg) throws Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package org.apache.rocketmq.store.rocksdb;

import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.common.config.ConfigRocksDBStorage;
import org.apache.rocketmq.store.MessageStore;
import org.rocksdb.BlockBasedTableConfig;
import org.rocksdb.BloomFilter;
Expand Down Expand Up @@ -134,7 +134,7 @@ public static DBOptions createDBOptions() {
Statistics statistics = new Statistics();
statistics.setStatsLevel(StatsLevel.EXCEPT_DETAILED_TIMERS);
return options.
setDbLogDir(getDBLogDir()).
setDbLogDir(ConfigRocksDBStorage.getDBLogDir()).
setInfoLogLevel(InfoLogLevel.INFO_LEVEL).
setWalRecoveryMode(WALRecoveryMode.PointInTimeRecovery).
setManualWalFlush(true).
Expand All @@ -158,12 +158,4 @@ public static DBOptions createDBOptions() {
setUseDirectIoForFlushAndCompaction(false).
setUseDirectReads(false);
}

private static String getDBLogDir() {
String rootPath = System.getProperty("user.home");
if (StringUtils.isEmpty(rootPath)) {
return "";
}
return rootPath + "/logs/rocketmqlogs/";
}
}

0 comments on commit 49505a1

Please sign in to comment.