simonbence commented on a change in pull request #4883:
URL: https://github.com/apache/nifi/pull/4883#discussion_r592142276



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/EmbeddedQuestDbRolloverHandler.java
##########
@@ -105,19 +112,13 @@ private void deletePartition(final CharSequence 
tableName, final String partitio
             }
         }
 
+        Collections.sort(result);
         return result;
     }
 
-    private Set<String> getPartitionsToKeep() {
-        final Instant now = Instant.now();
-
-        // Note: as only full partitions might be deleted and the status 
history repository works with day based partitions,
-        // a partition must remain until any part of it might be the subject 
of request.
-        final Set<String> result = new HashSet<>();
-        for (int i = 0; i < daysToKeepData + 1; i++) {
-            result.add(DATE_FORMATTER.format(now.minus(i, ChronoUnit.DAYS)));
-        }
-
-        return result;
+    private String getOldestPartitionToKeep() {
+        final ZonedDateTime now = timeSource.get();
+        final ZonedDateTime utc = 
now.minusDays(daysToKeepData).withZoneSameInstant(ZoneId.of("UTC"));

Review comment:
       Nice, I was looking for a constant like this




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to