[
https://issues.apache.org/jira/browse/GEODE-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16282149#comment-16282149
]
ASF GitHub Bot commented on GEODE-4062:
---------------------------------------
jhuynh1 commented on a change in pull request #1139: Feature/GEODE-4062:clear
method implementation for ParallelGatewaySender queue
URL: https://github.com/apache/geode/pull/1139#discussion_r155577828
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
##########
@@ -1781,4 +1784,43 @@ ParallelGatewaySenderQueueMetaRegion
newMetataRegion(InternalCache cache, final
return meta;
}
}
+
+ public void clearQueue() {
+
+ this.sender.pause();// it wil take internal read-write-lock
+ try {
+ for (PartitionedRegion prQ : this.userRegionNameToshadowPRMap.values()) {
+ clearPartitionedRegion((PartitionedRegion) prQ);
+ }
+ } finally {
+ if (this.sender.isPaused())
+ this.sender.resume();
+ }
+ }
+
+ // clear the partition region
+ private void clearPartitionedRegion(PartitionedRegion partitionedRegion) {
+ LocalDataSet lds = (LocalDataSet)
PartitionRegionHelper.getLocalPrimaryData(partitionedRegion);
+ Set<Integer> set = lds.getBucketSet(); // this returns bucket ids in the
function context
+ for (Integer bucketId : set) {
+ Bucket bucket = partitionedRegion.getRegionAdvisor().getBucket(bucketId);
+ if ((bucket instanceof ProxyBucketRegion == false) && bucket instanceof
BucketRegion) {
+ BucketRegion bucketRegion = (BucketRegion) bucket;
+ clearBucketRegion(bucketRegion);
+ }
+ }
+ }
+
+ private void clearBucketRegion(BucketRegion bucketRegion) {
+ Set keySet = bucketRegion.keySet();
+ for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
Review comment:
What happens if something is added to the queue while iterating the key set?
What happens if multiple threads attempt to clear. I am assuming one or
both will do a partial clear and blow up with a concurrent modification
exception, which I don't think is acceptable...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> clear method implementation for ParallelGatewaySender class
> -----------------------------------------------------------
>
> Key: GEODE-4062
> URL: https://issues.apache.org/jira/browse/GEODE-4062
> Project: Geode
> Issue Type: Bug
> Components: core
> Reporter: dinesh ak
>
> clear function is missing for ParallelGatewaySender.
> ParallelGatewaySender clear functionality is missing to clear the queue.
> why need: when receiver stuck . sender having lots of backlog in queue .
> we need clear method implementation which clear this queue.
> future use : we will create a gfsh command to clear the queue using this call.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)