Open ngocson2vn opened 3 years ago
Two reasons cause this problem.
time_zone
is SYSTEM
Because we already set time_zone
to SYSTEM
in session, Lightning will use the local system TZ which is Asia/Tokyo
.
To solve this problem quickly. you can set Lightning the same TZ with the TiDB cluster.
Next, We can fix it by set Lightning session TZ to TiDB cluster's system_time_zone
when TiDB cluster's time_zone
is SYSTEM
.
Thanks for the reports!
Bug Report
What did you do? If possible, provide a recipe for reproducing the error. Using the tidb-lightning tool to restore a full backup data.
In the full backup data, there is a table that has
timestamp
columns like this:Set all servers (TiDB, PD, TiKV, Lightning, ...)' timezone to UTC
In the script
deploy/scripts/start_lightning.sh
, set timezone toAsia/Tokyo
export RUST_BACKTRACE=1
export TZ=Asia/Tokyo
echo -n 'sync ... ' stat=$(time sync) echo ok echo $stat
nohup ./bin/tidb-lightning -config ./conf/tidb-lightning.toml &> log/tidb_lightning_stderr.log &
echo $! > "status/tidb-lightning.pid"
What did you expect to see? The tidb-lightning tool should respect the original data (in the full backup), import the original data as it is.
What did you see instead? The tidb-lightning tool has altered the values of
timestamp
columns. For examples,Original data (from the full backup):
Imported data:
So the tidb-lightning tool has altered the values of columns
created_at
andupdated_at
. The original values have been subtracted by 9 hours.Versions of the cluster
TiDB-Lightning version (run
tidb-lightning -V
):TiKV-Importer version (run
tikv-importer -V
)TiKV version (run
tikv-server -V
):TiDB cluster version (execute
SELECT tidb_version();
in a MySQL client):Other interesting information (system version, hardware config, etc):
Operation logs
tidb-lightning.log
for TiDB-Lightning if possibletikv-importer.log
from TiKV-Importer if possibleConfiguration of the cluster and the task
tidb-lightning.toml
for TiDB-Lightning if possible[lightning] file = "/home/tidb/deploy/log/tidb_lightning.log" index-concurrency = 2 io-concurrency = 5 level = "info" max-backups = 14 max-days = 28 max-size = 128 pprof-port = 8289 table-concurrency = 6
[checkpoint] enable = true schema = "tidb_lightning_checkpoint" driver = "file"
[tikv-importer] backend = "local" sorted-kv-dir = "/home/tidb/deploy/sorted-kv-dir"
[mydumper] data-source-dir = "/home/tidb/deploy/mydumper/scheduled-backup-20210120-044816" no-schema = false read-block-size = 65536
[tidb] build-stats-concurrency = 20 checksum-table-concurrency = 16 distsql-scan-concurrency = 100 host = "TIDB_HOST" index-serial-scan-concurrency = 20 log-level = "error" password = "xxxxx" port = 4000 status-port = 10080 user = "root" pd-addr = "PD_HOST:2379"
[post-restore] analyze = true checksum = true
[cron] log-progress = "5m" switch-mode = "5m"
Screenshot/exported-PDF of Grafana dashboard or metrics' graph in Prometheus for TiDB-Lightning if possible