Skip to content

Commit

Permalink
[BugFix] Consistency checker should use local time zone (backport #45749
Browse files Browse the repository at this point in the history
) (#45823)

Co-authored-by: yiming <[email protected]>
  • Loading branch information
mergify[bot] and nshangyiming authored May 17, 2024
1 parent aaa8611 commit 5be4e1c
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import com.starrocks.catalog.Table;
import com.starrocks.common.Config;
import com.starrocks.common.util.FrontendDaemon;
import com.starrocks.common.util.TimeUtils;
import com.starrocks.common.util.concurrent.FairReentrantReadWriteLock;
import com.starrocks.consistency.CheckConsistencyJob.JobState;
import com.starrocks.persist.ConsistencyCheckInfo;
Expand All @@ -56,6 +55,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
Expand Down Expand Up @@ -104,8 +105,19 @@ public ConsistencyChecker() {
}

private boolean initWorkTime() {
Date startDate = TimeUtils.getTimeAsDate(Config.consistency_check_start_time);
Date endDate = TimeUtils.getTimeAsDate(Config.consistency_check_end_time);
// Using system time zone.
SimpleDateFormat hourFormat = new SimpleDateFormat("HH");
Date startDate;
Date endDate;
try {
startDate = hourFormat.parse(Config.consistency_check_start_time);
endDate = hourFormat.parse(Config.consistency_check_end_time);
LOG.info("parsed startDate: {}, endDate: {}", startDate, endDate);
} catch (ParseException e) {
LOG.error("failed to parse start/end time: {}, {}", Config.consistency_check_start_time,
Config.consistency_check_end_time, e);
return false;
}

if (startDate == null || endDate == null) {
return false;
Expand Down

0 comments on commit 5be4e1c

Please sign in to comment.