Skip to content
Browse files

fix master coordinator to correctly parse the stored attempt ids

  • Loading branch information...
1 parent 137b908 commit d92ab837c0c767be4ba3df78aee494fbf416af2a @nathanmarz committed Oct 1, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/jvm/storm/trident/topology/MasterBatchCoordinator.java
View
14 src/jvm/storm/trident/topology/MasterBatchCoordinator.java
@@ -12,6 +12,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.TreeMap;
import org.apache.log4j.Logger;
import storm.trident.spout.ITridentSpout;
@@ -241,14 +242,17 @@ private Long getStoredCurrTransaction() {
for(TransactionalState state: _states) {
Map<Object, Number> attempts = (Map) state.getData(CURRENT_ATTEMPTS);
if(attempts==null) attempts = new HashMap();
- for(Object o: attempts.keySet()) {
+ for(Entry<Object, Number> e: attempts.entrySet()) {
// this is because json doesn't allow numbers as keys...
// TODO: replace json with a better form of encoding
- if(o instanceof String) {
- o = Long.parseLong((String) o);
+ Number txidObj;
+ if(e.getKey() instanceof String) {
+ txidObj = Long.parseLong((String) e.getKey());
+ } else {
+ txidObj = (Number) e.getKey();
}
- long txid = ((Number) o).longValue();
- int attemptId = ((Number) attempts.get(txid)).intValue();
+ long txid = ((Number) txidObj).longValue();
+ int attemptId = ((Number) e.getValue()).intValue();
Integer curr = ret.get(txid);
if(curr==null || attemptId > curr) {
ret.put(txid, attemptId);

0 comments on commit d92ab83

Please sign in to comment.
Something went wrong with that request. Please try again.