geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-3937) Fix NPE when executing removeFromDisk
Date Thu, 02 Nov 2017 17:28:00 GMT

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

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

kirklund commented on a change in pull request #1002: GEODE-3937:Fix NPE when executing removeFromDisk
URL: https://github.com/apache/geode/pull/1002#discussion_r148603154
 
 

 ##########
 File path: geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
 ##########
 @@ -1781,4 +1785,47 @@ ParallelGatewaySenderQueueMetaRegion newMetataRegion(InternalCache
cache, final
       return meta;
     }
   }
+
+
+
+  public void clearQueueTestOnly() {
+
+    this.sender.pause();// it wil take internal read-write-lock
+    try {
+      for (PartitionedRegion prQ : this.userRegionNameToshadowPRMap.values()) {
+        clearPartitionedRegionTestOnly((PartitionedRegion) prQ);
+      }
+    } catch (Exception ee) {
+      throw ee;
+    } finally {
+      if (this.sender.isPaused())
+        this.sender.resume();
+    }
+  }
+
+  // clear the partition region
+  private void clearPartitionedRegionTestOnly(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) {
+        if (bucket instanceof BucketRegion) {
+          BucketRegion bucketRegion = (BucketRegion) bucket;
+          Set keySet = bucketRegion.keySet();
+          for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
 
 Review comment:
   Nested for-loop, if-block, if-block, for-loop is too deep. Please combine the two if-blocks
into one if-block. Consider breaking out if-block or inner for-loop to a new private method
to improve readability.

----------------------------------------------------------------
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:
users@infra.apache.org


> Fix NPE when executing  removeFromDisk
> --------------------------------------
>
>                 Key: GEODE-3937
>                 URL: https://issues.apache.org/jira/browse/GEODE-3937
>             Project: Geode
>          Issue Type: Bug
>          Components: core
>            Reporter: dinesh akhand
>
> While executing the test case or clearQueueTestOnly method. we can see exception
> [vm4] java.lang.NullPointerException
> [vm4] 	at org.apache.geode.internal.cache.entries.DiskEntry$Helper.removeFromDisk(DiskEntry.java:1519)
> [vm4] 	at org.apache.geode.internal.cache.entries.AbstractOplogDiskRegionEntry.removePhase1(AbstractOplogDiskRegionEntry.java:50)
> [vm4] 	at org.apache.geode.internal.cache.entries.AbstractRegionEntry.destroy(AbstractRegionEntry.java:914)
> [vm4] 	at org.apache.geode.internal.cache.AbstractRegionMap.destroyEntry(AbstractRegionMap.java:3100)
> [vm4] 	at org.apache.geode.internal.cache.AbstractRegionMap.destroy(AbstractRegionMap.java:1429)
> [vm4] 	at org.apache.geode.internal.cache.LocalRegion.mapDestroy(LocalRegion.java:6465)
> [vm4] 	at org.apache.geode.internal.cache.LocalRegion.mapDestroy(LocalRegion.java:6439)
> [vm4] 	at org.apache.geode.internal.cache.BucketRegion.basicDestroy(BucketRegion.java:1167)
> [vm4] 	at org.apache.geode.internal.cache.AbstractBucketRegionQueue.basicDestroy(AbstractBucketRegionQueue.java:352)
> [vm4] 	at org.apache.geode.internal.cache.BucketRegionQueue.basicDestroy(BucketRegionQueue.java:366)
> [vm4] 	at org.apache.geode.internal.cache.LocalRegion.validatedDestroy(LocalRegion.java:1101)
> [vm4] 	at org.apache.geode.internal.cache.DistributedRegion.validatedDestroy(DistributedRegion.java:942)
> [vm4] 	at org.apache.geode.internal.cache.LocalRegion.destroy(LocalRegion.java:1086)
> [vm4] 	at org.apache.geode.internal.cache.AbstractRegion.destroy(AbstractRegion.java:315)
> [vm4] 	at org.apache.geode.internal.cache.LocalRegion.remove(LocalRegion.java:8870)
> [vm4] 	at org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueue.clearPartitionedRegion(ParallelGatewaySenderQueue.java:1820)
> [vm4] 	at org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueue.clearQueue(ParallelGatewaySenderQueue.java:1795)
> [vm4] 	at org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue.clearQueue(ConcurrentParallelGatewaySenderQueue.java:236)
> [vm4] 	at org.apache.geode.internal.cache.wan.WANTestBase.clearGatewaySender(WANTestBase.java:256)
> [vm4] 	at org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueueOverflowDUnitTest.lambda$8(ParallelGatewaySenderQueueOverflowDUnitTest.java:96)
> [vm4] 	at org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueueOverflowDUnitTest$$Lambda$42/144498586.run(Unknown
Source)
> [vm4] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message