Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement rows query event #112

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

DZunke
Copy link
Contributor

@DZunke DZunke commented Mar 13, 2024

Sometimes there is a usage for the optional binlog event Rows_query. It contains the original query that triggered other events that change something within the database. It is a "logging" mechanism of MySQL. So by enabling binlog_rows_query_log_events within the MySQL Settings those events will be stored to the database.

With the enabled option the Binlog for a single update query would look like

mysql-bin.000006	2105    Query	                1	       2178	        BEGIN
mysql-bin.000006	2178    Rows_query	        1	       2423	        # /*foo:bar;*/ UPDATE `test` SET foo = 'Foo Bar' WHERE id = 1
mysql-bin.000006	2423    Table_map	        1	       2530	        table_id: 109 (test.test)
mysql-bin.000006	2530    Update_rows	        1	       2950	        table_id: 109 flags: STMT_END_F
mysql-bin.000006	2950    Xid	                1	       2981	        COMMIT /* xid=4779 */

So the query does allow additional additional information for a change. In MariaDB the event is named Annotate_Rows with a different type identifier and so can be surely implemented later if someone needs it.

For more information:

src/MySQLReplication/Event/DTO/RowsQueryDTO.php Outdated Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
@DZunke DZunke force-pushed the implement-rows-query-event branch from 3889633 to f13378b Compare March 13, 2024 09:24
@DZunke DZunke requested a review from krowinski March 13, 2024 09:29
@krowinski krowinski merged commit 6150f0e into krowinski:master Mar 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants