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


##########
hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java:
##########
@@ -378,19 +383,45 @@ protected Option<Pair<String, CompactionOperation>> 
getPendingLogCompactionOpera
 
   @Override
   protected boolean isPartitionAvailableInStore(String partitionPath) {
-    return partitionToFileGroupsMap.containsKey(partitionPath);
+    fsLock.readLock();
+    try {
+      return partitionToFileGroupsMap.containsKey(partitionPath);
+    } finally {
+      fsLock.readUnlock();
+    }
   }
 
   @Override
   protected void storePartitionView(String partitionPath, 
List<HoodieFileGroup> fileGroups) {
-    LOG.debug("Adding file-groups for partition :" + partitionPath + ", 
#FileGroups=" + fileGroups.size());
-    List<HoodieFileGroup> newList = new ArrayList<>(fileGroups);
-    partitionToFileGroupsMap.put(partitionPath, newList);
+    fsLock.writeLock();
+    try {
+      LOG.debug("Adding file-groups for partition :" + partitionPath + ", 
#FileGroups=" + fileGroups.size());
+      List<HoodieFileGroup> newList = new ArrayList<>(fileGroups);
+      partitionToFileGroupsMap.put(partitionPath, newList);
+    } finally {
+      fsLock.writeUnlock();
+    }
+  }
+
+  @Override
+  protected void removePartitionView(String partitionPath) {
+    fsLock.writeLock();

Review Comment:
   Same here - this is also being called alrady from the critical section in 
`cleanFileGroupsInPartitions`. Why take lock again?



##########
hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java:
##########
@@ -378,19 +383,45 @@ protected Option<Pair<String, CompactionOperation>> 
getPendingLogCompactionOpera
 
   @Override
   protected boolean isPartitionAvailableInStore(String partitionPath) {
-    return partitionToFileGroupsMap.containsKey(partitionPath);
+    fsLock.readLock();
+    try {
+      return partitionToFileGroupsMap.containsKey(partitionPath);
+    } finally {
+      fsLock.readUnlock();
+    }
   }
 
   @Override
   protected void storePartitionView(String partitionPath, 
List<HoodieFileGroup> fileGroups) {
-    LOG.debug("Adding file-groups for partition :" + partitionPath + ", 
#FileGroups=" + fileGroups.size());
-    List<HoodieFileGroup> newList = new ArrayList<>(fileGroups);
-    partitionToFileGroupsMap.put(partitionPath, newList);
+    fsLock.writeLock();

Review Comment:
   Isn't this already being called under write lock?



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