xiangdong Huang created IOTDB-125:
-------------------------------------
Summary: [potential] a concurrency conflict may occur when a
delete command and insertion command appears concurrently
Key: IOTDB-125
URL: https://issues.apache.org/jira/browse/IOTDB-125
Project: Apache IoTDB
Issue Type: Bug
Reporter: xiangdong Huang
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)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)