Skip to content
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

Index is not updated after entry processors change values #9801

Closed
mmedenjak opened this issue Feb 5, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@mmedenjak
Copy link
Contributor

commented Feb 5, 2017

Reproducer :

    @Test
    public void issue() throws Exception {
        Config config = new Config();
        MapConfig testMapConfig = config.getMapConfig("testMap");
        testMapConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
        testMapConfig.getMapIndexConfigs().add(new MapIndexConfig("lastValue", true));
        HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
        try {
            IMap<Object, Object> testMap = instance.getMap("testMap");

            testMap.set(1L, new MyData(10));

            testMap.executeOnKey(1L, new MyProcessor(15));

            Predicate betweenPredicate = Predicates.between("lastValue", 0, 11);
            Collection<Object> values = testMap.values(betweenPredicate);
            final Collection<Object> vals = testMap.values();

            Assert.assertEquals(0, values.size());
        } finally {
            instance.shutdown();
        }
    }

    static class MyData implements Serializable {
        private long lastValue;

        public MyData(long lastValue) {
            this.lastValue = lastValue;
        }

        public long getLastValue() {
            return lastValue;
        }

        public void setLastValue(long lastValue) {
            this.lastValue = lastValue;
        }
    }

    static class MyProcessor extends AbstractEntryProcessor<Long, MyData> {
        private long newValue;

        public MyProcessor(long newValue) {
            this.newValue = newValue;
        }

        @Override
        public Object process(Map.Entry<Long, MyData> entry) {
            MyData data = entry.getValue();
            data.setLastValue(newValue);
            entry.setValue(data);
            return null;
        }
    }

@mmedenjak mmedenjak added this to the 3.8 milestone Feb 5, 2017

@tombujok

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2017

Hi Matko. Thx for reporting this, but it's a duplicate of this one.
I've already managed to reproduce it on Friday.
#9798

@mmedenjak

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2017

Closed as duplicate

@mmedenjak mmedenjak closed this Feb 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.