Commit 430e96cdb220d0186035af2f009415a5f8c48046
1 parent
593f6381
Fix Latest TS Dao to save newest record with same timestamp. Enabled updates for…
… old timeseries data.
Showing
2 changed files
with
3 additions
and
2 deletions
... | ... | @@ -137,7 +137,8 @@ public class TbEntityDataSubCtx extends TbAbstractDataSubCtx<EntityDataQuery> { |
137 | 137 | for (TsValue update : new ArrayList<>(updateList)) { |
138 | 138 | if (update.getTs() < v.getTs()) { |
139 | 139 | log.trace("[{}][{}][{}] Removed stale update for key: {} and ts: {}", sessionId, cmdId, subscriptionUpdate.getSubscriptionId(), k, update.getTs()); |
140 | - updateList.remove(update); | |
140 | + // Looks like this is redundant feature and our UI is ready to merge the updates. | |
141 | + //updateList.remove(update); | |
141 | 142 | } else if ((update.getTs() == v.getTs() && update.getValue().equals(v.getValue()))) { |
142 | 143 | log.trace("[{}][{}][{}] Removed duplicate update for key: {} and ts: {}", sessionId, cmdId, subscriptionUpdate.getSubscriptionId(), k, update.getTs()); |
143 | 144 | updateList.remove(update); | ... | ... |
... | ... | @@ -123,7 +123,7 @@ public class SqlTimeseriesLatestDao extends BaseAbstractSqlTimeseriesDao impleme |
123 | 123 | Map<TsKey, TsKvLatestEntity> trueLatest = new HashMap<>(); |
124 | 124 | v.forEach(ts -> { |
125 | 125 | TsKey key = new TsKey(ts.getEntityId(), ts.getKey()); |
126 | - trueLatest.merge(key, ts, (oldTs, newTs) -> oldTs.getTs() < newTs.getTs() ? newTs : oldTs); | |
126 | + trueLatest.merge(key, ts, (oldTs, newTs) -> oldTs.getTs() <= newTs.getTs() ? newTs : oldTs); | |
127 | 127 | }); |
128 | 128 | List<TsKvLatestEntity> latestEntities = new ArrayList<>(trueLatest.values()); |
129 | 129 | if (batchSortEnabled) { | ... | ... |