zhuanshenbsj1 commented on code in PR #10002:
URL: https://github.com/apache/hudi/pull/10002#discussion_r1399248053


##########
hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java:
##########
@@ -305,8 +305,13 @@ void 
removeFileGroupsInPendingClustering(Stream<Pair<HoodieFileGroupId, HoodieIn
    */
   @Override
   Stream<HoodieFileGroup> fetchAllStoredFileGroups(String partition) {
-    final List<HoodieFileGroup> fileGroups = new 
ArrayList<>(partitionToFileGroupsMap.get(partition));
-    return fileGroups.stream();
+    readLock.lock();
+    try {
+      final List<HoodieFileGroup> fileGroups = new 
ArrayList<>(partitionToFileGroupsMap.get(partition));
+      return fileGroups.stream();
+    } finally {
+      readLock.unlock();
+    }

Review Comment:
   Ensure thread safety for partitionToFileGroupsMap.However, some read locks 
can indeed be removed because they are maps themselves



##########
hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java:
##########
@@ -305,8 +305,13 @@ void 
removeFileGroupsInPendingClustering(Stream<Pair<HoodieFileGroupId, HoodieIn
    */
   @Override
   Stream<HoodieFileGroup> fetchAllStoredFileGroups(String partition) {
-    final List<HoodieFileGroup> fileGroups = new 
ArrayList<>(partitionToFileGroupsMap.get(partition));
-    return fileGroups.stream();
+    readLock.lock();
+    try {
+      final List<HoodieFileGroup> fileGroups = new 
ArrayList<>(partitionToFileGroupsMap.get(partition));
+      return fileGroups.stream();
+    } finally {
+      readLock.unlock();
+    }

Review Comment:
   Ensure thread safety for partitionToFileGroupsMap.However, some read locks 
can indeed be removed because they are maps themselves



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