HTHou opened a new pull request, #11276:
URL: https://github.com/apache/iotdb/pull/11276

   ## Description
   
   After OS system shutdown and restart IoTDB service, there is a broken TsFile 
cannot be compacted.
   
   
![image](https://github.com/apache/iotdb/assets/25913899/beb2ff28-3c15-4404-9e84-c0290078b4f9)
   
   It caused by this 0-level TsFile contains two chunk groups with same device 
id. And there are several issues to fix. 
   
   1. Before restart IoTDB, this TsFile ended with a lot of zero bytes. However 
the current selfcheck logic will treated these zero bytes as correct chunk 
group, which cause the truncate position is not correct.
   2. In TsFilePlanRedoer, there is a wrong logic of filter the InsertPlan from 
wal. Some InsertPlans which should be filtered are inserted into the recovering 
memtable. Therefore, the TsFile will contains two chunk groups with same device 
id.
   3. in UnsealedTsFileRecoverPerformer, there is an outdated redundant logic 
should be removed. 
   
   ## How to test
   
   1. Add `System.exit(-1);` at the end of syncFlushMemTable method of 
MemtableFlushTask. 
   2. Modify configs, set DataRegionPolicy as CUSTOM and DataRegionNumPerDB to 1
   3. Start IoTDB, execute the following sql, then the dataNode will shutdown 
because of step 1
   ```sql
   insert into root.sg.d1(time,s1,s2) aligned values(1,2,3)
   insert into root.sg.d2(time,s1,s2) aligned values(1,2,3)
   flush
   ```
   4. Remove the line added in step 1, restart IoTDB. Then execute `select * 
from root.**`. Before fixing, the query will be stuck.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to