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,7 +137,8 @@ public class TbEntityDataSubCtx extends TbAbstractDataSubCtx<EntityDataQuery> { | ||
137 | for (TsValue update : new ArrayList<>(updateList)) { | 137 | for (TsValue update : new ArrayList<>(updateList)) { |
138 | if (update.getTs() < v.getTs()) { | 138 | if (update.getTs() < v.getTs()) { |
139 | log.trace("[{}][{}][{}] Removed stale update for key: {} and ts: {}", sessionId, cmdId, subscriptionUpdate.getSubscriptionId(), k, update.getTs()); | 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 | } else if ((update.getTs() == v.getTs() && update.getValue().equals(v.getValue()))) { | 142 | } else if ((update.getTs() == v.getTs() && update.getValue().equals(v.getValue()))) { |
142 | log.trace("[{}][{}][{}] Removed duplicate update for key: {} and ts: {}", sessionId, cmdId, subscriptionUpdate.getSubscriptionId(), k, update.getTs()); | 143 | log.trace("[{}][{}][{}] Removed duplicate update for key: {} and ts: {}", sessionId, cmdId, subscriptionUpdate.getSubscriptionId(), k, update.getTs()); |
143 | updateList.remove(update); | 144 | updateList.remove(update); |
@@ -123,7 +123,7 @@ public class SqlTimeseriesLatestDao extends BaseAbstractSqlTimeseriesDao impleme | @@ -123,7 +123,7 @@ public class SqlTimeseriesLatestDao extends BaseAbstractSqlTimeseriesDao impleme | ||
123 | Map<TsKey, TsKvLatestEntity> trueLatest = new HashMap<>(); | 123 | Map<TsKey, TsKvLatestEntity> trueLatest = new HashMap<>(); |
124 | v.forEach(ts -> { | 124 | v.forEach(ts -> { |
125 | TsKey key = new TsKey(ts.getEntityId(), ts.getKey()); | 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 | List<TsKvLatestEntity> latestEntities = new ArrayList<>(trueLatest.values()); | 128 | List<TsKvLatestEntity> latestEntities = new ArrayList<>(trueLatest.values()); |
129 | if (batchSortEnabled) { | 129 | if (batchSortEnabled) { |