Uploaded image for project: 'Apache IoTDB'
  1. Apache IoTDB
  2. IOTDB-125

[potential] a concurrency conflict may occur when a delete command and insertion command appears concurrently

    XMLWordPrintableJSON

Details

    Description

      • Hi, 

      we find a potential bug,

      Suppose client A calls a delete time series root.sg1.*, then  OverflowQPExecutor.java's operateMetadata() will be called.

       At the same time, client B calls a insertion command insert into root.sg1.d1.s1 ..., then the bug may appear:

      1. B checks the schema and find sg1.d1.s1 is valid, then B is waiting for the write lock of related StorageGroupProcessor,

      2. A removes the definition of time series in SG1,  all data files of SG1 and then return back;

      3. B gets the write lock and write data successfully; finally, the data is flushed on disk.

      Then, if client C calls `select * from root.sg1`, C gets nothing because there is no time series defined under the storage group.

      Now client C creates sg1.d1.s1 again, and then executes `select * from root.sg1`, C will find the data that B wrote....

       

      A solution is set a database-level read write lock. For all operations which will modify the schema, the write lock is needed; For all other operations (e.g., insertion), the read lock is needed.

      (We need to consider the cost of calling the read lock for each insertion operation)

       

       

      Attachments

        Issue Links

          Activity

            People

              jackietien Yuan Tian
              jixuan1989 xiangdong Huang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: