This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 35fb6c0 change parallelism in timeseries metadata cache (#2289)
35fb6c0 is described below
commit 35fb6c091881932776d83753776263a353d4b00b
Author: Jackie Tien <[email protected]>
AuthorDate: Sat Dec 19 14:02:35 2020 +0800
change parallelism in timeseries metadata cache (#2289)
---
.../org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
index 62eee4b..474ba38 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
@@ -64,7 +64,9 @@ public class TimeSeriesMetadataCache {
private final ReadWriteLock lock = new ReentrantReadWriteLock();
- private final Map<String, WeakReference<String>> devices =
Collections.synchronizedMap(new WeakHashMap<>());
+ private final Map<String, WeakReference<String>> devices = Collections
+ .synchronizedMap(new WeakHashMap<>());
+ private static final String SEPARATOR = "$";
private TimeSeriesMetadataCache() {
if (CACHE_ENABLE) {
@@ -132,7 +134,8 @@ public class TimeSeriesMetadataCache {
printCacheLog(true);
} else {
// allow for the parallelism of different devices
- synchronized (devices.computeIfAbsent(key.device, WeakReference::new)) {
+ synchronized (devices
+ .computeIfAbsent(key.device + SEPARATOR + key.filePath,
WeakReference::new)) {
// double check
lock.readLock().lock();
try {