[
https://issues.apache.org/jira/browse/GEODE-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16282150#comment-16282150
]
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_r155578364
##########
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();) {
+ Object key = iterator.next();
+ try {
+ ((BucketRegionQueue) bucketRegion).destroyKey(key);
Review comment:
I am not sure if there is other book keeping that needs to be done. From
the last pull request this was used as a way to show that remove(key) was not
the correct api to call, but I didn't do any research into seeing if this was
the only call that needed to be made...
----------------------------------------------------------------
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)