Github user arunmahadevan commented on a diff in the pull request: https://github.com/apache/storm/pull/1470#discussion_r66785022 --- Diff: external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java --- @@ -116,20 +123,30 @@ private void initPendingCommit() { @Override public void put(K key, V value) { LOG.debug("put key '{}', value '{}'", key, value); - pendingPrepare.put(encode(keySerializer.serialize(key)), - encode(valueSerializer.serialize(value))); + String redisKey = encode(keySerializer.serialize(key)); + synchronized (this) { + pendingPrepare.put(redisKey, + encode(valueSerializer.serialize(value))); + pendingDeletePrepare.remove(redisKey); + } } @Override public V get(K key) { LOG.debug("get key '{}'", key); String redisKey = encode(keySerializer.serialize(key)); String redisValue = null; - if (pendingPrepare.containsKey(redisKey)) { - redisValue = pendingPrepare.get(redisKey); - } else if (pendingCommit.containsKey(redisKey)) { - redisValue = pendingCommit.get(redisKey); - } else { + boolean found = false; + synchronized (this) { + if (pendingPrepare.containsKey(redisKey) || pendingDeletePrepare.contains(redisKey)) { --- End diff -- if pendingDeletePrepare contains the key the value should not be returned.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---