Github user arunmahadevan commented on a diff in the pull request:
https://github.com/apache/storm/pull/1470#discussion_r68537734
--- Diff:
external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java
---
@@ -161,7 +176,11 @@ public void prepareCommit(long txid) {
commands = jedisContainer.getInstance();
if (commands.exists(prepareNamespace)) {
LOG.debug("Prepared txn already exists, will merge", txid);
- pendingPrepare.putAll(pendingCommit);
+ for (Map.Entry<String, String> e:
pendingCommit.entrySet()) {
+ if (!pendingPrepare.containsKey(e.getKey())) {
+ pendingPrepare.put(e.getKey(), e.getValue());
+ }
+ }
}
if (!pendingPrepare.isEmpty()) {
commands.hmset(prepareNamespace, pendingPrepare);
--- End diff --
A potential issue (already existing) which could be fixed here or in a
separate JIRA. If the pendingPrepare is updated after the hmset but before its
assigned to pendingCommit, the pendingCommit will not reflect the entities in
prepareNamespace. I think if the pendingPrepare is snapshotted/copied before
hmset and the copy is used for both hmset and assigned to pendingCommit it
would avoid this race condition.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---