danny0405 commented on code in PR #8631:
URL: https://github.com/apache/hudi/pull/8631#discussion_r1185653080


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -491,7 +491,7 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() 
throws IOException {
         String latestCommitToArchive = 
instantsToArchive.get(instantsToArchive.size() - 1).getTimestamp();
         try {
           Instant latestCommitInstant = 
HoodieActiveTimeline.parseDateFromInstantTime(commitTimeline.lastInstant().get().getTimestamp()).toInstant();
-          ZonedDateTime currentDateTime = 
ZonedDateTime.ofInstant(latestCommitInstant, ZoneId.systemDefault());
+          ZonedDateTime currentDateTime = 
ZonedDateTime.ofInstant(latestCommitInstant, 
HoodieInstantTimeGenerator.getTimelineTimeZone().getZoneId());
           String earliestTimeToRetain = 
HoodieActiveTimeline.formatDate(Date.from(currentDateTime.minusHours(config.getCleanerHoursRetained()).toInstant()));

Review Comment:
   The code only works when `HoodieInstantTimeGenerator.setCommitTimeZone` is 
executed in the same JVM process, we must asure that. Either set it up 
explicitly or instantiate a `HoodieTableConfig` within which the timezone is 
set up.



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -510,7 +510,7 @@ public Option<HoodieInstant> getEarliestCommitToRetain() {
       }
     } else if (config.getCleanerPolicy() == 
HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS) {
       Instant instant = Instant.now();
-      ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(instant, 
ZoneId.systemDefault());
+      ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(instant, 
HoodieInstantTimeGenerator.getTimelineTimeZone().getZoneId());
       String earliestTimeToRetain = 
HoodieActiveTimeline.formatDate(Date.from(currentDateTime.minusHours(hoursRetained).toInstant()));

Review Comment:
   The code only works when `HoodieInstantTimeGenerator.setCommitTimeZone` is 
executed in the same JVM process, we must asure that. Either set it up 
explicitly or instantiate a `HoodieTableConfig` within which the timezone is 
set up.



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to