Comments (4)
What's the source and target server's timezones?
from ghostferry.
This is a known bug when not using UTC, see this test. I have a patch that requires upstream changes in go-mysql.
From 0f34553aabe1183670c892cb27f2b113e2c26bee Mon Sep 17 00:00:00 2001
From: Justin Li <[email protected]>
Date: Wed, 6 Dec 2017 16:04:58 -0500
Subject: [PATCH] Fix replication of rows with a nonnull TIMESTAMP column on
non-UTC machines
---
binlog_streamer.go | 4 ++++
test/types_integration_test.go | 6 +++---
vendor/github.com/siddontang/go-mysql/replication/time.go | 9 +++++++--
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/binlog_streamer.go b/binlog_streamer.go
index 9a26483..0951909 100644
--- a/binlog_streamer.go
+++ b/binlog_streamer.go
@@ -353,3 +353,7 @@ func idsOnServer(db *sql.DB) ([]uint32, error) {
return server_ids, nil
}
+
+func init() {
+ replication.TimeStringLocation = time.UTC
+}
diff --git a/test/types_integration_test.go b/test/types_integration_test.go
index c3699d0..fc2d91c 100644
--- a/test/types_integration_test.go
+++ b/test/types_integration_test.go
@@ -20,7 +20,7 @@ func addTypesToTable(db *sql.DB, dbName, tableName string) {
"ADD date_col DATE," +
"ADD time_col TIME," +
"ADD dt_col DATETIME," +
- "ADD ts_col TIMESTAMP," + // TODO broken on master
+ "ADD ts_col TIMESTAMP," +
"ADD varchar_col VARCHAR(128)," +
"ADD enum_col ENUM('foo', 'bar')," +
"ADD set_col SET('foo', 'bar', 'baz')," +
@@ -46,8 +46,8 @@ func setupMultiTypeTable(f *testhelpers.TestFerry) {
for i := 0; i < 100; i++ {
query := "INSERT INTO gftest.table1 " +
- "(id, data, tiny_col, float_col, double_col, decimal_col, year_col, date_col, time_col, dt_col, varchar_col, enum_col, set_col, utfmb4_col, blob_col)" +
- "VALUES (NULL, ?, ?, 3.14, 2.72, 42.42, NOW(), NOW(), NOW(), NOW(), ?, ?, 'foo,baz', ?, ?)"
+ "(id, data, tiny_col, float_col, double_col, decimal_col, year_col, date_col, time_col, dt_col, ts_col, varchar_col, enum_col, set_col, utfmb4_col, blob_col)" +
+ "VALUES (NULL, ?, ?, 3.14, 2.72, 42.42, NOW(), NOW(), NOW(), NOW(), NOW(), ?, ?, 'foo,baz', ?, ?)"
enumVal := "foo"
if i%2 == 0 {
diff --git a/vendor/github.com/siddontang/go-mysql/replication/time.go b/vendor/github.com/siddontang/go-mysql/replication/time.go
index 8869106..9d495be 100644
--- a/vendor/github.com/siddontang/go-mysql/replication/time.go
+++ b/vendor/github.com/siddontang/go-mysql/replication/time.go
@@ -7,7 +7,8 @@ import (
)
var (
- fracTimeFormat []string
+ TimeStringLocation *time.Location
+ fracTimeFormat []string
)
// fracTime is a help structure wrapping Golang Time.
@@ -19,7 +20,11 @@ type fracTime struct {
}
func (t fracTime) String() string {
- return t.Format(fracTimeFormat[t.Dec])
+ tt := t.Time
+ if TimeStringLocation != nil {
+ tt = tt.In(TimeStringLocation)
+ }
+ return tt.Format(fracTimeFormat[t.Dec])
}
func formatZeroTime(frac int, dec int) string {
from ghostferry.
This is tracked upstream at go-mysql-org/go-mysql#63 and I pushed the commit above as a PR to upstream at go-mysql-org/go-mysql#295. Once that's merged, I'll update this repository with that fix, pending the merge of #45.
from ghostferry.
The fix for this has not been merged yet.
from ghostferry.
Related Issues (20)
- tried to advance to a zero log position HOT 1
- mediumint not recognized as numeric type HOT 2
- MariaDB SHOW SLAVE HOSTS output differs from MySQL
- MariaDB binlog events differ from MySQL
- unsigned mediumint value through binlog streamer wrongfully parsed HOT 2
- Cannot follow tutorial due to incompatible docker-compose.yml HOT 1
- Ghostferry misses data for PK values of <= 0 HOT 4
- Investigate removing the cursor and merge it back with the DataIterator
- BinlogStreamerLag in ControlServer's progress API is not seconds as it says it is HOT 1
- Ghostferry control server's webui shows the time taken as now - start
- TestThrottlerThrottlesAndUnthrottles flaky
- Ghostferry should abort if it sees a DDL command that can compromise data integrity
- Ensure BinlogEventBuffer Channel is initialized before running the BinlogStreamer
- Ghostferry binlog streamer lag with large source write volume due to misconfigured BinlogEventBatchSize? HOT 1
- Alternate exit criteria for DataIterators
- InlineVerifyer: invalid memory address or nil pointer dereference
- Trouble with virtual generated columns HOT 6
- Potentially "overlocking" in cursor?
- Config value for copydb `ReplicatedMasterPositionQuery` with vanilla MysQL replication
- Resuming can caused missed replication events HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghostferry.