You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2022/03/17 07:47:29 UTC
[iotdb] 31/45: fix the bug of deleting storage groups
This is an automated email from the ASF dual-hosted git repository.
jianyun pushed a commit to branch rocksdb/dev
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit c9e84b8f9918dae8a3192549731333ba9d3e22cd
Author: lisijia <li...@360.cn>
AuthorDate: Fri Mar 11 16:19:00 2022 +0800
fix the bug of deleting storage groups
---
.../iotdb/db/metadata/rocksdb/MRocksDBManager.java | 28 ++++++++++++----------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/rocksdb/MRocksDBManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/rocksdb/MRocksDBManager.java
index 8139977..c0dd427 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/rocksdb/MRocksDBManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/rocksdb/MRocksDBManager.java
@@ -882,24 +882,26 @@ public class MRocksDBManager implements IMetaManager {
// wait for all executing createTimeseries operations are complete
Thread.sleep(MAX_LOCK_WAIT_TIME * MAX_PATH_DEPTH);
String[] nodes = path.getNodes();
- Arrays.asList(ALL_NODE_TYPE_ARRAY).stream()
+ Arrays.stream(ALL_NODE_TYPE_ARRAY)
.parallel()
.forEach(
type -> {
try {
- String startPath =
- RocksDBUtils.getLevelPathPrefix(
- nodes, nodes.length - 1, nodes.length);
- byte[] startKey = RocksDBUtils.toRocksDBKey(startPath, type);
- String endPath =
- RocksDBUtils.getLevelPathPrefix(
- nodes, nodes.length - 1, MAX_PATH_DEPTH);
- byte[] endKey = RocksDBUtils.toRocksDBKey(endPath, type);
- if (type == NODE_TYPE_MEASUREMENT) {
- readWriteHandler.deleteNodeByPrefix(
- readWriteHandler.getCFHByName(TABLE_NAME_TAGS), startKey, endKey);
+ for (int i = nodes.length; i <= MAX_PATH_DEPTH; i++) {
+ String startPath =
+ RocksDBUtils.getLevelPathPrefix(nodes, nodes.length - 1, i);
+ byte[] startKey = RocksDBUtils.toRocksDBKey(startPath, type);
+ byte[] endKey = new byte[startKey.length];
+ System.arraycopy(startKey, 0, endKey, 0, startKey.length - 1);
+ endKey[endKey.length - 1] = 127;
+ if (type == NODE_TYPE_MEASUREMENT) {
+ readWriteHandler.deleteNodeByPrefix(
+ readWriteHandler.getCFHByName(TABLE_NAME_TAGS),
+ startKey,
+ endKey);
+ }
+ readWriteHandler.deleteNodeByPrefix(startKey, endKey);
}
- readWriteHandler.deleteNodeByPrefix(startKey, endKey);
} catch (RocksDBException e) {
logger.error("delete storage error {}", path.getFullPath(), e);
}