Caideyipi commented on code in PR #18223:
URL: https://github.com/apache/iotdb/pull/18223#discussion_r3593135713


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/disk/TierManager.java:
##########
@@ -204,13 +211,16 @@ public synchronized void initFolders() {
 
   public synchronized void resetFolders() {
     long startTime = System.currentTimeMillis();
-    seqTiers.clear();
-    unSeqTiers.clear();
-    objectTiers.clear();
+    List<FolderManager> newSeqTiers = new ArrayList<>();
+    List<FolderManager> newUnSeqTiers = new ArrayList<>();
+    List<FolderManager> newObjectTiers = new ArrayList<>();
     seqDir2TierLevel.clear();

Review Comment:
   **[P1] Build and publish the directory maps with the tier lists** 
`seqDir2TierLevel` and `unSeqDir2TierLevel` are still cleared and repopulated 
in place while their readers are unsynchronized. During 
`loadHotModifiedProps()`, readers such as `getAllFilesFolders()` can observe an 
empty or partial map, while `getFileTierLevel()` can race with `HashMap` 
mutation and throw `ConcurrentModificationException`. Please build replacement 
maps locally and publish them together with the folder-manager lists, and cover 
these accessors in the regression test.



-- 
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