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]>
(cherry picked from commit 78c5593)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/consistency/ConsistencyChecker.java
  • Loading branch information
nshangyiming authored and mergify[bot] committed May 17, 2024
1 parent 4fa5299 commit e806280
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,24 @@
import com.starrocks.catalog.Partition;
import com.starrocks.catalog.Table;
import com.starrocks.common.Config;
<<<<<<< HEAD
import com.starrocks.common.util.LeaderDaemon;
import com.starrocks.common.util.TimeUtils;
=======
import com.starrocks.common.util.FrontendDaemon;
import com.starrocks.common.util.concurrent.FairReentrantReadWriteLock;
import com.starrocks.common.util.concurrent.lock.LockType;
import com.starrocks.common.util.concurrent.lock.Locker;
>>>>>>> 78c55933d6 ([BugFix] Consistency checker should use local time zone (#45749))
import com.starrocks.consistency.CheckConsistencyJob.JobState;
import com.starrocks.persist.ConsistencyCheckInfo;
import com.starrocks.server.GlobalStateMgr;
import com.starrocks.task.CheckConsistencyTask;
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 @@ -90,8 +99,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 e806280

Please sign in to comment.