Shopify / ghostferry

The swiss army knife of live data migrations
https://shopify.github.io/ghostferry
MIT License
694 stars 65 forks source link

tried to advance to a zero log position #291

Closed HemeraOne closed 3 years ago

HemeraOne commented 3 years ago

I'm trying to move a database from one server to another (development environment) however the same error keeps occuring

select version()

server 1: 10.3.30-MariaDB-1:10.3.30+maria~focal-log
server 2: 10.3.30-MariaDB-1:10.3.30+maria~focal

config:

{
  "Source": {
    "Host": "10.0.0.2",
    "Port": 3306,
    "User": "***",
    "Pass": "***",
    "Collation": "utf8mb4_unicode_ci",
    "Params": {
      "charset": "utf8mb4"
    }
  },
  "Target": {
    "Host": "10.0.0.2",
    "Port": 3306,
    "User": "***",
    "Pass": "***",
    "Collation": "utf8mb4_unicode_ci",
    "Params": {
      "charset": "utf8mb4"
    }
  },
  "Databases": {
    "Whitelist": ["database_1"]
  },
  "Tables": {
    "blacklist": ["random_table"]
  },
  "DumpStateOnSignal": true,
  "SkipTargetVerification": true,
  "VerifierType": "ChecksumTable"
}

Log output:

INFO[0000] starting binlog streaming                     file=mysql-bin.000002 host=10.0.0.1 port=3306 position=32530762 tag=source_binlog_streamer
INFO[0000] creating databases and tables on target
INFO[0001] starting ferry run                            tag=ferry
INFO[0001] starting data iterator run                    tablesCount=74 tag=data_iterator
INFO[0001] running on 0.0.0.0:8000                       tag=control_server
INFO[0001] starting binlog streamer                      tag=source_binlog_streamer
DEBU[0001] reached position                              file=mysql-bin.000002 lastStreamedBinlogPosition="(mysql-bin.000002, 32530762)" position=0 tag=source_binlog_streamer type="*replication.RotateEvent"
INFO[0001] binlog file rotated                           last_filename=mysql-bin.000002 last_position=32530762 new_filename=mysql-bin.000002 new_position=32530762 tag=source_binlog_streamer
DEBU[0001] reached position                              file=mysql-bin.000002 lastStreamedBinlogPosition="(mysql-bin.000002, 32530762)" position=0 tag=source_binlog_streamer type="*replication.FormatDescriptionEvent"
DEBU[0001] reached position                              file=mysql-bin.000002 lastStreamedBinlogPosition="(mysql-bin.000002, 32530762)" position=0 tag=source_binlog_streamer type="*replication.GenericEvent"
PANI[0001] tried to advance to a zero log position: mysql-bin.000002 0 string  tag=source_binlog_streamer
INFO[0001] exiting binlog streamer                       lastStreamedBinlogPosition="(mysql-bin.000002, 32530762)" stopAtBinlogPosition="(, 0)" tag=source_binlog_streamer
panic: (*logrus.Entry) (0x991c60,0xc0004583f0)

goroutine 23 [running]:
github.com/sirupsen/logrus.(*Entry).log(0xc0002e27e0, 0x0, 0xc0004106e0, 0x42)
        /root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:259 +0x2e2
github.com/sirupsen/logrus.(*Entry).Log(0xc0002e27e0, 0x0, 0xc0000e5940, 0x1, 0x1)
        /root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:293 +0x86
github.com/sirupsen/logrus.(*Entry).Logf(0xc0002e27e0, 0x0, 0x9b9f3f, 0x31, 0xc0000e59c8, 0x3, 0x3)
        /root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:338 +0xe2
github.com/sirupsen/logrus.(*Entry).Panicf(...)
        /root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:376
github.com/Shopify/ghostferry.(*BinlogStreamer).updateLastStreamedPosAndTime(0xc0002b46c0, 0x60deffb6, 0xc000446020, 0x10, 0x0, 0xc0003fda40, 0x19, 0x0)
        /root/ghostferry/binlog_streamer.go:316 +0x39c
github.com/Shopify/ghostferry.(*BinlogStreamer).Run(0xc0002b46c0)
        /root/ghostferry/binlog_streamer.go:275 +0x727
github.com/Shopify/ghostferry.(*Ferry).Run.func8(0xc000395e30, 0xc00011a000)
        /root/ghostferry/ferry.go:710 +0x63
created by github.com/Shopify/ghostferry.(*Ferry).Run
        /root/ghostferry/ferry.go:707 +0x311

I'm not sure what is going wrong

HemeraOne commented 3 years ago

After changing the config to copy data from Target to Source (switched around in the config) it worked. I started to compare the settings of these mariadb instances, it ended up being binlog encryption