You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2019/07/13 11:04:54 UTC

[incubator-iotdb] branch jinrzhan_fix_issue_124 created (now 6066fc0)

This is an automated email from the ASF dual-hosted git repository.

xingtanzjr pushed a change to branch jinrzhan_fix_issue_124
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at 6066fc0  add pathExist() check after obtain lock when trying to add path to metadata tree

This branch includes the following new commits:

     new 6066fc0  add pathExist() check after obtain lock when trying to add path to metadata tree

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: add pathExist() check after obtain lock when trying to add path to metadata tree

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xingtanzjr pushed a commit to branch jinrzhan_fix_issue_124
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 6066fc0dcece8565cb6b099e53afc46407f406db
Author: xingtanzjr <xi...@163.com>
AuthorDate: Sat Jul 13 19:03:48 2019 +0800

    add pathExist() check after obtain lock when trying to add path to metadata tree
---
 iotdb/src/main/java/org/apache/iotdb/db/metadata/MManager.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/metadata/MManager.java b/iotdb/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index 0ae3434..72346ce 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -289,6 +289,11 @@ public class MManager {
     boolean isNewMeasurement = true;
     // Thread safety: just one thread can access/modify the schemaMap
     synchronized (schemaMap) {
+      // Need to check the path again to avoid duplicated inserting by multi concurrent thread
+      if (pathExist(path.getFullPath())) {
+        throw new MetadataErrorException(
+            String.format("Timeseries %s already exist", path.getFullPath()));
+      }
       if (schemaMap.containsKey(lastNode)) {
         isNewMeasurement = false;
         MeasurementSchema columnSchema = schemaMap.get(lastNode);