readysettech / readyset

Readyset is a MySQL and Postgres wire-compatible caching layer that sits in front of existing databases to speed up queries and horizontally scale read throughput. Under the hood, ReadySet caches the results of cached select statements and incrementally updates these results over time as the underlying data changes.
https://readyset.io
Other
4.54k stars 125 forks source link

MySQL replicated Timestamp fields are always UTC #1285

Closed altmannmarcelo closed 5 months ago

altmannmarcelo commented 5 months ago

Description

MySQL stores timestamp internally as UTC and convert them to timezone specified at time_zone variable.

During snapshot we are getting the correct value for timestamp fields as we are running a select. However, during replication we are always getting UTC.

create table test.t (ts timestamp);
insert into t values ('2024-01-01 10:00:00');
-- start readyset
insert into t values ('2024-01-01 10:00:00');
CREATE CACHE FROM SELECT * FROM t;
SELECT * FROM t;

-- result on my system (UTC-3)
mysql> SELECT * FROM t;
+---------------------+
| ts                  |
+---------------------+
| 2024-01-01 10:00:00 |
| 2024-01-01 13:00:00 |
+---------------------+
2 rows in set (0,00 sec)

Change in user-visible behavior

Requires documentation change