New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entry not removed from backup store when deleted using entry processor #1687

Closed
torkeld opened this Issue Jan 31, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@torkeld

torkeld commented Jan 31, 2014

When deleting an entry from an entry processor, by setting the value to null, it isn't removed from the backup store. As a consequence, any following entry operation with a predicate will throw an IllegalArgumentException when creating the QueryEntry since the value is null.

This issue was found on 3.2 with two or more nodes in the cluster.

Without being too familiar with the code, the following change seems to fix the issue:

--- a/hazelcast/src/main/java/com/hazelcast/map/operation/PartitionWideEntryBackupOperation.java
+++ b/hazelcast/src/main/java/com/hazelcast/map/operation/PartitionWideEntryBackupOperation.java
@@ -60,7 +60,11 @@ public class PartitionWideEntryBackupOperation extends AbstractMapOperation impl
}
entry = new AbstractMap.SimpleEntry(objectKey, valueBeforeProcess);
entryProcessor.processBackup(entry);

  •        recordStore.put(new AbstractMap.SimpleImmutableEntry<Data, Object>(dataKey, entry.getValue()));
    
  •        if(entry.getValue() == null) {
    
  •            recordStore.remove(dataKey);
    
  •        } else {
    
  •            recordStore.put(new AbstractMap.SimpleImmutableEntry<Data, Object>(dataKey, entry.getValue()));
    
  •        }
     }
    
    }

Below is the exception that is thrown the next time an entry processor is executed.

! java.lang.IllegalArgumentException: value cannot be null
! at com.hazelcast.query.impl.QueryEntry.(QueryEntry.java:41) ~[classes/:na]
! at com.hazelcast.map.operation.PartitionWideEntryOperation.run(PartitionWideEntryOperation.java:70) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicOperationService.doRunOperation(BasicOperationService.java:355) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicOperationService.access$4(BasicOperationService.java:316) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicOperationService$RemoteOperationProcessor.run(BasicOperationService.java:849) ~[classes/:na]
! at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0-ea]
! at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0-ea]
! at java.lang.Thread.run(Thread.java:744) [na:1.8.0-ea]
! at com.hazelcast.spi.impl.BasicOperationService$OperationThread.run(BasicOperationService.java:943) ~[classes/:na]
! at ------ End remote and begin local stack-trace ------.(Unknown Source) ~[na:na]
! at com.hazelcast.spi.impl.BasicInvocation$InvocationFuture.resolveResponse(BasicInvocation.java:693) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicInvocation$InvocationFuture.get(BasicInvocation.java:619) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicInvocation$InvocationFuture.get(BasicInvocation.java:601) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicOperationService.invokeOnPartitions(BasicOperationService.java:652) ~[classes/:na]
! at com.hazelcast.spi.impl.BasicOperationService.invokeOnAllPartitions(BasicOperationService.java:589) ~[classes/:na]
! at com.hazelcast.map.proxy.MapProxySupport.executeOnEntries(MapProxySupport.java:711) ~[classes/:na]
! at com.hazelcast.map.proxy.MapProxyImpl.executeOnEntries(MapProxyImpl.java:1) ~[classes/:na]
...

@gurbuzali

This comment has been minimized.

Member

gurbuzali commented Jan 31, 2014

could you please submit a test-code to reproduce the issue?
it would be a lot easier to detect and fix the bugs

@ghost ghost assigned gurbuzali Jan 31, 2014

@torkeld

This comment has been minimized.

torkeld commented Feb 1, 2014

Here is a reproducer: https://github.com/torkeld/hazelcast-issue-reproducer
I think the same bug exists in EntryBackupOperation.java too.

@gurbuzali

This comment has been minimized.

Member

gurbuzali commented Feb 1, 2014

thank you for the test, I can reproduce too.

mesutcelik pushed a commit to mesutcelik/hazelcast that referenced this issue Feb 4, 2014

mesutcelik pushed a commit to mesutcelik/hazelcast that referenced this issue Feb 4, 2014

@gurbuzali gurbuzali closed this Feb 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment