From 57de905c66b6992aefb2051708fa83898fa82cec Mon Sep 17 00:00:00 2001 From: trialiya <41265764+trialiya@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:33:58 +0300 Subject: [PATCH] fix(retention): fix time-based retention (#10118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Хазиев Ленар --- .../metadata/entity/cassandra/CassandraRetentionService.java | 2 +- .../linkedin/metadata/entity/ebean/EbeanRetentionService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata-io/src/main/java/com/linkedin/metadata/entity/cassandra/CassandraRetentionService.java b/metadata-io/src/main/java/com/linkedin/metadata/entity/cassandra/CassandraRetentionService.java index 91e3197529877..bc6ee6ddd5026 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/entity/cassandra/CassandraRetentionService.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/entity/cassandra/CassandraRetentionService.java @@ -195,7 +195,7 @@ private void applyTimeBasedRetention( @Nonnull final Urn urn, @Nonnull final String aspectName, @Nonnull final TimeBasedRetention retention) { - Timestamp threshold = new Timestamp(_clock.millis() - retention.getMaxAgeInSeconds() * 1000); + Timestamp threshold = new Timestamp(_clock.millis() - retention.getMaxAgeInSeconds() * 1000L); SimpleStatement ss = deleteFrom(CassandraAspect.TABLE_NAME) .whereColumn(CassandraAspect.URN_COLUMN) diff --git a/metadata-io/src/main/java/com/linkedin/metadata/entity/ebean/EbeanRetentionService.java b/metadata-io/src/main/java/com/linkedin/metadata/entity/ebean/EbeanRetentionService.java index 250a81d9c8edc..77752153aad47 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/entity/ebean/EbeanRetentionService.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/entity/ebean/EbeanRetentionService.java @@ -156,7 +156,7 @@ private Expression getTimeBasedRetentionQuery(@Nonnull final TimeBasedRetention return new SimpleExpression( EbeanAspectV2.CREATED_ON_COLUMN, Op.LT, - new Timestamp(_clock.millis() - retention.getMaxAgeInSeconds() * 1000)); + new Timestamp(_clock.millis() - retention.getMaxAgeInSeconds() * 1000L)); } private void applyRetention(