[ 
https://issues.apache.org/jira/browse/GEODE-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17111551#comment-17111551
 ] 

ASF GitHub Bot commented on GEODE-7678:
---------------------------------------

agingade commented on a change in pull request #5124:
URL: https://github.com/apache/geode/pull/5124#discussion_r427616222



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
##########
@@ -575,16 +575,23 @@ public void cmnClearRegion(RegionEventImpl regionEvent, 
boolean cacheWrite, bool
     // get rvvLock
     Set<InternalDistributedMember> participants =
         getCacheDistributionAdvisor().adviseInvalidateRegion();
+    boolean isLockedAlready = 
this.partitionedRegion.getPartitionedRegionClear()
+        .isLockedForListenerAndClientNotification();
+
     try {
-      obtainWriteLocksForClear(regionEvent, participants);
+      if (!isLockedAlready) {
+        obtainWriteLocksForClear(regionEvent, participants);
+      }
       // no need to dominate my own rvv.
       // Clear is on going here, there won't be GII for this member
       clearRegionLocally(regionEvent, cacheWrite, null);
       distributeClearOperation(regionEvent, rvv, participants);
 
       // TODO: call reindexUserDataRegion if there're lucene indexes
     } finally {
-      releaseWriteLocksForClear(regionEvent, participants);
+      if (!isLockedAlready) {

Review comment:
       If you look into the line where the lock is taken its based on the 
"if(!isLockedAlready)" the same logic is used to unlock the 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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Partitioned Region clear operations must invoke cache level listeners
> ---------------------------------------------------------------------
>
>                 Key: GEODE-7678
>                 URL: https://issues.apache.org/jira/browse/GEODE-7678
>             Project: Geode
>          Issue Type: Sub-task
>          Components: regions
>            Reporter: Nabarun Nag
>            Assignee: Anilkumar Gingade
>            Priority: Major
>              Labels: GeodeCommons, GeodeOperationAPI
>
> Clear operations are successful and CacheListener.afterRegionClear(), 
> CacheWriter.beforeRegionClear() are invoked.
>  
> Acceptance :
>  * DUnit tests validating the above behavior.
>  * Test coverage to when a member departs in this scenario
>  * Test coverage to when a member restarts in this scenario
>  * Unit tests with complete code coverage for the newly written code.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to