From 2cedf78bacb4bc317ce522bc7ef3d024903e7fda Mon Sep 17 00:00:00 2001 From: liuyuanmu Date: Mon, 18 Nov 2019 16:03:13 +0800 Subject: [PATCH] source/fix rocksdb compile error in windows --- source/manager/manager-model/pom.xml | 1 + source/pom.xml | 2 +- source/storage/storage-composite/pom.xml | 2 +- source/storage/storage-rocksdb/pom.xml | 3 ++- .../service/impl/rocksdb/RocksDBConnectionFactory.java | 7 ++----- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/source/manager/manager-model/pom.xml b/source/manager/manager-model/pom.xml index 314477d3..347e8a9b 100644 --- a/source/manager/manager-model/pom.xml +++ b/source/manager/manager-model/pom.xml @@ -65,6 +65,7 @@ org.rocksdb rocksdbjni + ${rocksdb.version} diff --git a/source/pom.xml b/source/pom.xml index 777775fc..d63f487d 100644 --- a/source/pom.xml +++ b/source/pom.xml @@ -67,7 +67,7 @@ 3.3.6 3.0.1 2.9.0 - 5.15.10 + 6.3.6 3.4.6 3.5.12 3.5.3 diff --git a/source/storage/storage-composite/pom.xml b/source/storage/storage-composite/pom.xml index 499c1c0b..8973e65a 100644 --- a/source/storage/storage-composite/pom.xml +++ b/source/storage/storage-composite/pom.xml @@ -56,7 +56,7 @@ \ No newline at end of file diff --git a/source/storage/storage-rocksdb/src/main/java/com/jd/blockchain/storage/service/impl/rocksdb/RocksDBConnectionFactory.java b/source/storage/storage-rocksdb/src/main/java/com/jd/blockchain/storage/service/impl/rocksdb/RocksDBConnectionFactory.java index 46165c47..eb5b09f2 100644 --- a/source/storage/storage-rocksdb/src/main/java/com/jd/blockchain/storage/service/impl/rocksdb/RocksDBConnectionFactory.java +++ b/source/storage/storage-rocksdb/src/main/java/com/jd/blockchain/storage/service/impl/rocksdb/RocksDBConnectionFactory.java @@ -26,7 +26,7 @@ public class RocksDBConnectionFactory implements DbConnectionFactory { public static final String URI_SCHEME = "rocksdb"; public static final Pattern URI_PATTER = Pattern - .compile("^\\w+\\://(/)?\\w+(/.*)*$"); + .compile("^\\w+\\://(/)?\\w+(\\:)?([/\\\\].*)*$"); private Map connections = new ConcurrentHashMap<>(); @@ -40,7 +40,7 @@ public class RocksDBConnectionFactory implements DbConnectionFactory { if (!URI_PATTER.matcher(dbConnectionString).matches()) { throw new IllegalArgumentException("Illegal format of rocksdb connection string!"); } - URI dbUri = URI.create(dbConnectionString); + URI dbUri = URI.create(dbConnectionString.replace("\\", "/")); if (!support(dbUri.getScheme())) { throw new IllegalArgumentException( String.format("Not supported db connection string with scheme \"%s\"!", dbUri.getScheme())); @@ -49,9 +49,6 @@ public class RocksDBConnectionFactory implements DbConnectionFactory { String uriHead = dbPrefix(); int beginIndex = dbConnectionString.indexOf(uriHead); String dbPath = dbConnectionString.substring(beginIndex + uriHead.length()); - if (!dbPath.startsWith(File.separator)) { - dbPath = File.separator + dbPath; - } RocksDBConnection conn = connections.get(dbPath); if (conn != null) {