Skip to content

Commit

Permalink
[BugFix] Consistency checker should use local time zone (#45749)
Browse files Browse the repository at this point in the history
Signed-off-by: Dejun Xia <[email protected]>
  • Loading branch information
nshangyiming authored May 17, 2024
1 parent 81081eb commit 78c5593
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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.common.util.concurrent.lock.LockType;
import com.starrocks.common.util.concurrent.lock.Locker;
Expand All @@ -60,6 +59,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 @@ -108,8 +109,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 78c5593

Please sign in to comment.