julien-duponchelle / python-mysql-replication

Pure Python Implementation of MySQL replication protocol build on top of PyMYSQL
2.31k stars 678 forks source link

Update README to indicate that the project has been tested on MariaDB 10.6 #609

Closed lottaquestions closed 7 months ago

lottaquestions commented 7 months ago

Description

The project was tested on MariDB 10.6 and Python 3.7 and worked correctly.

The current documentation does not indicate that the project works with MariaDB, so this documentation update will provide more clarity for other users and hopefully expand the user base.

Testing

  1. Install MariaDB 10.6 (any minor revision) and install python-mysql-replication.
  2. Run the example script dump_events.py
  3. Log into the MariaDB database and run the following sample SQL statements
    CREATE DATABASE test;
    use test;
    CREATE TABLE test4 (id int NOT NULL AUTO_INCREMENT, data VARCHAR(255), data2 VARCHAR(255), PRIMARY KEY(id));
    INSERT INTO test4 (data,data2) VALUES ("Hello", "World");
    UPDATE test4 SET data = "World", data2="Hello" WHERE id = 1;
    DELETE FROM test4 WHERE id = 1;
  1. Look at the output of dump_events.py. It will display the following replication events that correspond to the user queries on the database:
    === QueryEvent ===
    Date: 2023-06-01T19:50:43
    Log position: 534
    Event size: 64
    Read bytes: 64
    Schema: b'test'
    Execution time: 0
    Query: CREATE DATABASE test

    === MariadbGtidEvent ===
    Date: 2023-06-01T19:52:22
    Log position: 576
    Event size: 19
    Read bytes: 13
    Flags: 41
    GTID: 0-806987191-297

    === QueryEvent ===
    Date: 2023-06-01T19:52:22
    Log position: 759
    Event size: 160
    Read bytes: 160
    Schema: b'test'
    Execution time: 0
    Query: CREATE TABLE test4 (id int NOT NULL AUTO_INCREMENT, data VARCHAR(255), data2 VARCHAR(255), PRIMARY KEY(id))

    === MariadbGtidEvent ===
    Date: 2023-06-01T19:52:45
    Log position: 801
    Event size: 19
    Read bytes: 13
    Flags: 12
    GTID: 0-806987191-298

    === QueryEvent ===
    Date: 2023-06-01T19:52:45
    Log position: 956
    Event size: 100
    Read bytes: 100
    Schema: b'test'
    Execution time: 0
    Query: INSERT INTO test4 (data,data2) VALUES ("Hello", "World")

    === XidEvent ===
    Date: 2023-06-01T19:52:45
    Log position: 987
    Event size: 8
    Read bytes: 8
    Transaction ID: 55531

    === MariadbGtidEvent ===
    Date: 2023-06-01T19:53:08
    Log position: 1029
    Event size: 19
    Read bytes: 13
    Flags: 12
    GTID: 0-806987191-299

    === QueryEvent ===
    Date: 2023-06-01T19:53:08
    Log position: 1155
    Event size: 103
    Read bytes: 103
    Schema: b'test'
    Execution time: 0
    Query: UPDATE test4 SET data = "World", data2="Hello" WHERE id = 1

    === XidEvent ===
    Date: 2023-06-01T19:53:08
    Log position: 1186
    Event size: 8
    Read bytes: 8
    Transaction ID: 55549

    === MariadbGtidEvent ===
    Date: 2023-06-01T19:53:31
    Log position: 1228
    Event size: 19
    Read bytes: 13
    Flags: 12
    GTID: 0-806987191-300

    === QueryEvent ===
    Date: 2023-06-01T19:53:31
    Log position: 1325
    Event size: 74
    Read bytes: 74
    Schema: b'test'
    Execution time: 0
    Query: DELETE FROM test4 WHERE id = 1

    === XidEvent ===
    Date: 2023-06-01T19:53:31
    Log position: 1356
    Event size: 8
    Read bytes: 8
    Transaction ID: 55556

    === MariadbGtidEvent ===
    Date: 2023-06-01T19:53:38
    Log position: 1398
    Event size: 19
    Read bytes: 13
    Flags: 12
    GTID: 0-806987191-301
julien-duponchelle commented 7 months ago

Thanks !!!