Hi, After reviewing the code of delete storage group SQL statement, i have some questions about the implementation.
First, when deleting several storage groups in one statement, the metadata in MManger will be deleted together after all storage groups are deleted. But, if there are concurrent write operations, the write operations will use old metadata, after the 'delete storage group' statement is executed successfully and the metadata is deleted from MManger, the data written in this period cannot be queried any more. Secondly, processorMap in StorageEngine class may need a ReentrantReadWriteLock. For example, if we execute delete storage group statement in cli and there are concurrent write operations to these storage groups. Current code first remove storage group from processorMap and then delete it, so other write operations will create a new VirtualStorageGroupManager in processorMap and the new VSGManager's recover method will conflict with the delete procedure, because tsfile may be truncated in recover and delete needs flushing memtable to the same tsfile. However, if we first delete a storage group and then remove it from processorMap, other write operations may create a new TsFileProcessor in the interval, making this delete statement incorrect. So, we need a ReentrantReadWriteLock to lock processorMap. Best, ------------------------------------ Haiming Zhu School of Software, Tsinghua University 朱海铭 清华大学 软件学院
