albertogpz commented on pull request #7003:
URL: https://github.com/apache/geode/pull/7003#issuecomment-1008943908
> If the region has concurrency-checks-enabled=false, the mustDiscardEntry
method throws an NPE like:
>
> ```
> [error 2022/01/07 13:57:27.095 PST ln-1 <WAN Copy Region Function
Execution Processor1> tid=0x87] Exception occurred attempting to wan-copy region
> java.lang.NullPointerException
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunctionDelegate$EventCreatorImpl.mustDiscardEntry(WanCopyRegionFunctionDelegate.java:440)
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunctionDelegate$EventCreatorImpl.createEvent(WanCopyRegionFunctionDelegate.java:387)
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunctionDelegate$EventCreatorImpl.createEventForReplicatedRegion(WanCopyRegionFunctionDelegate.java:359)
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunctionDelegate$EventCreatorImpl.createGatewaySenderEvent(WanCopyRegionFunctionDelegate.java:341)
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunctionDelegate.createBatch(WanCopyRegionFunctionDelegate.java:179)
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunctionDelegate.wanCopyRegion(WanCopyRegionFunctionDelegate.java:106)
> at
org.apache.geode.management.internal.cli.functions.WanCopyRegionFunction.lambda$executeFunctionInService$0(WanCopyRegionFunction.java:159)
> ```
>
> To get that stack in the server log, I added this catch block to
WanCopyRegionFunctionDelegate.wanCopyRegion:
>
> ```
> } catch (Exception e) {
> logger.error("Exception occurred attempting to wan-copy region", e);
> return new CliFunctionResult(memberName,
CliFunctionResult.StatusState.ERROR,
> "Exception occurred attempting to wan-copy region: " + e);
> ```
>
> That produced this in the gfsh output:
>
> ```
> Member | Status | Message
> ------ | ------ |
--------------------------------------------------------------------------------
> ln-2 | OK | Sender ny-serial is serial and not primary. 0 entries
copied.
> ln-1 | ERROR | Exception occurred attempting to wan-copy region:
java.lang.NullPointerException
> ```
>
> You might want to add something similar to catch any other random
exceptions.
>
> In the replicated and partitioned with parallel sender cases, the version
stamp is null:
>
> ```
> ((NonTXEntry) entry).getRegionEntry().getVersionStamp()
> ```
>
> In the partitioned with serial sender case, the version tag is null:
>
> ```
> ((EntrySnapshot) entry).getVersionTag()
> ```
>
> I think the mustDiscardEntry method will have to return false in these
cases.
Good catch!
--
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]