Skip to content

[IOTDB-5620] Fix flush stuck when there is a lot of time partitions in each DataRegion#9218

Merged
HTHou merged 5 commits intomasterfrom
fix_time_partition
Mar 6, 2023
Merged

[IOTDB-5620] Fix flush stuck when there is a lot of time partitions in each DataRegion#9218
HTHou merged 5 commits intomasterfrom
fix_time_partition

Conversation

@HTHou
Copy link
Contributor

@HTHou HTHou commented Mar 6, 2023

Description

When set Max_heap_size=2G and insert data of 7 years. The flush thread will be stuck.

There is a simple way to reproduce.

Set max_heap_size of data node to 200M, set write_memory_proportion to 10000000:1.

Then start standalone iotdb and execute the following sqls:

insert into root.sg.d1(time,s1) values(1,2);
flush;
insert into root.sg.d1(time,s1) values(2,2);
insert into root.sg.d1(time,s1) values(604800001,2);
flush;

Finally, you will see the last flush cannot execute successfully.

Reason

The evictOldPartition method in TimePartitionManager always peek the first TimePartitionInfo in the TreeSet in the while loop. However, the memSize of the TimePartitionInfo may be 0. In this case, the loop won't be ended.

Solution

Change the treeSet.first() to treeSet.pollFirst().

@HTHou HTHou changed the title [IOTDB-5620] Fix cannot flush when there is a lot of time partitions in each DataRegion [IOTDB-5620] Fix flush stuck when there is a lot of time partitions in each DataRegion Mar 6, 2023
…java

Co-authored-by: Jackie Tien <jackietien97@gmail.com>
@HTHou HTHou requested a review from JackieTien97 March 6, 2023 03:15
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants