ColumnListMutation<SlotState> mutation = mutationBatch.withRow(CassandraModel.CF_METRICS_STATE, (long)shard);
for (Map.Entry<Granularity, Map<Integer, UpdateStamp>> granEntry : updates.entrySet()) {
Granularity g = granEntry.getKey();
for (Map.Entry<Integer, UpdateStamp> entry : granEntry.getValue().entrySet()) {
// granularity,slot,state
SlotState slotState = new SlotState(g, entry.getKey(), entry.getValue().getState());
mutation.putColumn(slotState, entry.getValue().getTimestamp());
/*
Note: we used to set the timestamp of the column to entry.getValue().getTimestamp() * 1000 over here.
This block of code is dangerous. Consider you are getting out of order metrics M1 and M2, with collection times T1 and T2 with T2>T1, belonging to same slot
Assume M2 arrives first. The slot gets marked active and rolled up and the state is set as Rolled. Now, assume M1 arrives. We update the slot state to active,