{"id":19832,"date":"2019-11-21T15:00:55","date_gmt":"2019-11-21T06:00:55","guid":{"rendered":"https:\/\/labs.gree.jp\/blog\/?p=19832"},"modified":"2020-01-09T19:59:57","modified_gmt":"2020-01-09T10:59:57","slug":"post19832","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2019\/11\/19832\/","title":{"rendered":"\u30c1\u30e7\u30c3\u30c8\u30ef\u30ab\u30eb Row-Based Replication\u30fb\u305d\u306e\uff14"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3002\u305b\u3058\u307e\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u3082 replication \u306e\u8a71\u3092\u3057\u307e\u3059\u3002<\/p>\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>\u7b2c\u56db\u56de\u3067\u3059\u3002<\/p>\n<p>\u524d\u56de\u3001 Row-Based Replication \u3067\u306f Column \u306e\u540d\u524d\u3092\u610f\u8b58\u3057\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306f Row-Based Replication \u3067 online schema change \u3067\u304d\u306a\u3044\u304b\u3001\u305d\u306e\u3078\u3093\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u307e\u305a\u306f\u53b3\u91cd\u6ce8\u610f<\/h2>\n<p>\u3053\u308c\u304b\u3089\u8a18\u8ff0\u3059\u308b\u5185\u5bb9\u3092\u672c\u756a\u74b0\u5883\u3067\u5b9f\u65bd\u3059\u308b\u5834\u5408\u3001\u30ea\u30b9\u30af\u3092\u3068\u3082\u306a\u3044\u307e\u3059\u3002\u307e\u305a\u306f\u691c\u8a3c\u74b0\u5883\u3067\u8a66\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u3044\u3061\u304a\u3046\u307e\u3068\u3081<\/h2>\n<ul>\n<li>master \u306e\u65b9\u304c Column \u304c\u5c11\u306a\u304b\u3063\u305f\u5834\u5408\u3001 slave \u306b\u3057\u304b\u5b58\u5728\u3057\u3066\u3044\u306a\u3044 Column \u306e\u632f\u308b\u821e\u3044\u306f\u3001 <a href=\"https:\/\/dev.mysql.com\/worklog\/task\/?id=5092\">Worklog 5092<\/a> \u3067\u898f\u5b9a\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u3082\u306e\u3067\u3057\u305f\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5024\u3067\u66f4\u65b0\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>\u3088\u3063\u3066\u3001 slave \u3067table\u306e\u672b\u5c3e\u306b add column \u3059\u308b\u7a0b\u5ea6\u306a\u3089\u52d5\u304f\u6c17\u304c\u3057\u307e\u3059\u3002\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u3082\u305d\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3059\u3002<a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/replication-features-differing-tables.html\">16.4.1.10 Replication with Differing Table Definitions on Master and Slave<\/a><\/li>\n<li>\u305f\u3060\u3001 stored \u306a generated column \u306f\u3001Row-Based Replication \u3067\u306f  binlog event \u3067\u66f4\u65b0\u3059\u3079\u304d\u3088\u3046\u3067\u3001 slave \u3067 table \u306e\u672b\u5c3e\u306b stored \u306a generated column \u8ffd\u52a0\u3057\u3066\u3082\u3001\u66f4\u65b0\u306e\u305f\u3073\u306b\u8a55\u4fa1\u3055\u308c\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u3088\u3046\u3067\u3059\u3002<\/li>\n<li>RBR\u3067\u306f\u300c\u5f0f\u3092\u8a55\u4fa1\u3059\u308b\u306e\u306f\u3001\u5f0f\u304c\u767a\u884c\u3055\u308c\u305fmaster\u3067\u306e\u307f\u884c\u3046\u300d\u3063\u3066\u8003\u3048\u65b9\u306a\u3093\u3067\u3057\u3087\u3046\u306d\u3002<\/li>\n<\/ul>\n<h2>\u3067\u306f\u306f\u3058\u3081\u307e\u3059<\/h2>\n<p>master\/slave \u3067\u3053\u306e\u3088\u3046\u306a table \u304c\u3042\u308a\u307e\u3059<\/p>\n<p>master<\/p>\n<pre><code>mysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  1 |    1 |    10 |\n|  2 |  100 |  1000 |\n|  3 |    1 | 24000 |\n|  4 |  100 |  2000 |\n|  5 |    1 |    10 |\n|  6 |  100 |   100 |\n+----+------+-------+\n6 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  1 |    1 |    10 |\n|  2 |  100 |  1000 |\n|  3 |    1 | 24000 |\n|  4 |  100 |  2000 |\n|  5 |    1 |    10 |\n|  6 |  100 |   100 |\n+----+------+-------+\n6 rows in set (0.00 sec)\n\nmysql> show slave status\\G\n*************************** 1. row ***************************\n               Slave_IO_State: Waiting for master to send event\n                  Master_Host: 172.18.0.2\n                  Master_User: repl\n                  Master_Port: 3306\n                Connect_Retry: 60\n              Master_Log_File: binlog.000029\n          Read_Master_Log_Pos: 155\n               Relay_Log_File: 8230d2822d2f-relay-bin.000012\n                Relay_Log_Pos: 363\n        Relay_Master_Log_File: binlog.000029\n             Slave_IO_Running: Yes\n            Slave_SQL_Running: Yes\n              Replicate_Do_DB:\n          Replicate_Ignore_DB:\n           Replicate_Do_Table:\n       Replicate_Ignore_Table:\n      Replicate_Wild_Do_Table:\n  Replicate_Wild_Ignore_Table:\n                   Last_Errno: 0\n                   Last_Error:\n                 Skip_Counter: 0\n          Exec_Master_Log_Pos: 155\n              Relay_Log_Space: 622\n              Until_Condition: None\n               Until_Log_File:\n                Until_Log_Pos: 0\n           Master_SSL_Allowed: No\n           Master_SSL_CA_File:\n           Master_SSL_CA_Path:\n              Master_SSL_Cert:\n            Master_SSL_Cipher:\n               Master_SSL_Key:\n        Seconds_Behind_Master: 0\nMaster_SSL_Verify_Server_Cert: No\n                Last_IO_Errno: 0\n                Last_IO_Error:\n               Last_SQL_Errno: 0\n               Last_SQL_Error:\n  Replicate_Ignore_Server_Ids:\n             Master_Server_Id: 1\n                  Master_UUID: 385a832a-ef37-11e9-a332-0242ac120002\n             Master_Info_File: mysql.slave_master_info\n                    SQL_Delay: 0\n          SQL_Remaining_Delay: NULL\n      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates\n           Master_Retry_Count: 86400\n                  Master_Bind:\n      Last_IO_Error_Timestamp:\n     Last_SQL_Error_Timestamp:\n               Master_SSL_Crl:\n           Master_SSL_Crlpath:\n           Retrieved_Gtid_Set:\n            Executed_Gtid_Set:\n                Auto_Position: 0\n         Replicate_Rewrite_DB:\n                 Channel_Name:\n           Master_TLS_Version:\n       Master_public_key_path:\n        Get_master_public_key: 0\n            Network_Namespace:\n1 row in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<h3>slave \u306b add column \u3057\u3066 INSERT<\/h3>\n<p>slave \u3067\u672b\u5c3e\u306b add column  \u3057\u307e\u3059\u3002<\/p>\n<pre><code>mysql> alter table takanori add column val30 int not null;\nQuery OK, 0 rows affected (0.03 sec)\nRecords: 0  Duplicates: 0  Warnings: 0\n\nmysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  `val30` int(11) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val30 |\n+----+------+-------+-------+\n|  1 |    1 |    10 |     0 |\n|  2 |  100 |  1000 |     0 |\n|  3 |    1 | 24000 |     0 |\n|  4 |  100 |  2000 |     0 |\n|  5 |    1 |    10 |     0 |\n|  6 |  100 |   100 |     0 |\n+----+------+-------+-------+\n6 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>master \u3067\u30ab\u30e9\u30e0\u540d\u6307\u5b9a\u3067 INSERT  \u3057\u307e\u3059<\/p>\n<pre><code>mysql> insert into takanori (val1,val2) values (2,20),(300,3000);\nQuery OK, 2 rows affected (0.01 sec)\nRecords: 2  Duplicates: 0  Warnings: 0\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  1 |    1 |    10 |\n|  2 |  100 |  1000 |\n|  3 |    1 | 24000 |\n|  4 |  100 |  2000 |\n|  5 |    1 |    10 |\n|  6 |  100 |   100 |\n|  7 |    2 |    20 |\n|  8 |  300 |  3000 |\n+----+------+-------+\n8 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave\u306breplication\u3067\u304d\u307e\u3059\u3002master\u306b\u5b58\u5728\u3057\u306a\u3044Column\u306b\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5024\u304c\u5165\u308a\u307e\u3057\u305f\u3002\u3053\u306e\u632f\u308b\u821e\u3044\u306f\u3001WL#5092\u306eDEFAULT VALUES\u306e\u7bc0\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u3068\u304a\u308a\u3067\u3059\u306d\u3002<\/p>\n<pre><code>mysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val30 |\n+----+------+-------+-------+\n|  1 |    1 |    10 |     0 |\n|  2 |  100 |  1000 |     0 |\n|  3 |    1 | 24000 |     0 |\n|  4 |  100 |  2000 |     0 |\n|  5 |    1 |    10 |     0 |\n|  6 |  100 |   100 |     0 |\n|  7 |    2 |    20 |     0 |\n|  8 |  300 |  3000 |     0 |\n+----+------+-------+-------+\n8 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<h3>\uff08slave \u306b add column \u3057\u305f\u72b6\u614b\u3067\uff09UPDATE<\/h3>\n<p>update \u3057\u3001 replication \u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 RBR \u3067\u306e update \u306f\u3001\u300c\u4f55\u756a\u76ee\u306eColumn\u3092\u66f4\u65b0\u3059\u308b\u304b\u300d\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067<\/p>\n<p>master<\/p>\n<pre><code>mysql> update takanori set val2=val2+2000 where id=3;\nQuery OK, 1 row affected (0.02 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  1 |    1 |    10 |\n|  2 |  100 |  1000 |\n|  3 |    1 | 26000 |\n|  4 |  100 |  2000 |\n|  5 |    1 |    10 |\n|  6 |  100 |   100 |\n|  7 |    2 |    20 |\n|  8 |  300 |  3000 |\n+----+------+-------+\n8 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val30 |\n+----+------+-------+-------+\n|  1 |    1 |    10 |     0 |\n|  2 |  100 |  1000 |     0 |\n|  3 |    1 | 26000 |     0 |\n|  4 |  100 |  2000 |     0 |\n|  5 |    1 |    10 |     0 |\n|  6 |  100 |   100 |     0 |\n|  7 |    2 |    20 |     0 |\n|  8 |  300 |  3000 |     0 |\n+----+------+-------+-------+\n8 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<h3>slave \u306b Generated column \u8ffd\u52a0\u3057\u3066 INSERT \u3084 UPDATE<\/h3>\n<p>\u6700\u8fd1\u306eMySQL\u306f Generated column \u4f7f\u3048\u308b\u306e\u3067\u3001\u8a66\u3057\u306b slave\u3067 Generated column \u4f7f\u3063\u3066\u307f\u307e\u3059 <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/alter-table-generated-columns.html\">13.1.8.2 ALTER TABLE and Generated Columns<\/a><\/p>\n<p>slave<\/p>\n<pre><code>mysql> alter table takanori drop column val30;\nQuery OK, 0 rows affected (0.19 sec)\nRecords: 0  Duplicates: 0  Warnings: 0\n\nmysql> ALTER TABLE takanori ADD COLUMN val30 INT GENERATED ALWAYS AS (val1 + val2) STORED NOT NULL;\nQuery OK, 8 rows affected (0.08 sec)\nRecords: 8  Duplicates: 0  Warnings: 0\n\nmysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  `val30` int(11) GENERATED ALWAYS AS ((`val1` + `val2`)) STORED NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val30 |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 26000 | 26001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n8 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>master \u304b\u3089 insert \u3057\u305f\u308a update \u3057\u305f\u308a\u3057\u307e\u3059<\/p>\n<pre><code>mysql>  insert into takanori (val1,val2) values (2,20),(300,3000);\nQuery OK, 2 rows affected (0.01 sec)\nRecords: 2  Duplicates: 0  Warnings: 0\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  1 |    1 |    10 |\n|  2 |  100 |  1000 |\n|  3 |    1 | 26000 |\n|  4 |  100 |  2000 |\n|  5 |    1 |    10 |\n|  6 |  100 |   100 |\n|  7 |    2 |    20 |\n|  8 |  300 |  3000 |\n|  9 |    2 |    20 |\n| 10 |  300 |  3000 |\n+----+------+-------+\n10 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val30 |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 26000 | 26001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  3000 |  3300 |\n|  9 |    2 |    20 |     0 |\n| 10 |  300 |  3000 |     0 |\n+----+------+-------+-------+\n10 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>master \u3067 update<\/p>\n<pre><code>mysql> update takanori set val2=val2+2000 where id=3;\nQuery OK, 1 row affected (0.01 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nmysql> update takanori set val2=val2+2000 where id=8;\nQuery OK, 1 row affected (0.01 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nmysql> select @@server_id,@@version;select * from takanori where id in (3,8);\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  3 |    1 | 28000 |\n|  8 |  300 |  5000 |\n+----+------+-------+\n2 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> select @@server_id,@@version;select * from takanori where id in (3,8);\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val30 |\n+----+------+-------+-------+\n|  3 |    1 | 28000 | 26001 |\n|  8 |  300 |  5000 |  3300 |\n+----+------+-------+-------+\n2 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>\u306a\u308b\u307b\u3069\u3002Generated column\u3067\u306f\u4e0d\u6574\u5408\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>master \u3067 Generated column \u8ffd\u52a0\u3057\u3066 INSERT \u3084 UPDATE<\/h3>\n<p>STORED \u306a generated column \u3078\u306e\u66f4\u65b0\u306f\u3001RBR\u3067\u306f binlog \u306e event \u3068\u3057\u3066 master \u304b\u3089\u964d\u3063\u3066\u3053\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3088\u3046\u3067\u3059\u306d\u3002<br \/>\nslave \u3067 drop column \u3057\u305f\u306e\u3061\u3001 master \u304b\u3089 add column \u3057\u3066\u8a66\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>slave<\/p>\n<pre><code>mysql> alter table takanori drop column val30;\nQuery OK, 0 rows affected (0.10 sec)\nRecords: 0  Duplicates: 0  Warnings: 0\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+\n| id | val1 | val2  |\n+----+------+-------+\n|  1 |    1 |    10 |\n|  2 |  100 |  1000 |\n|  3 |    1 | 28000 |\n|  4 |  100 |  2000 |\n|  5 |    1 |    10 |\n|  6 |  100 |   100 |\n|  7 |    2 |    20 |\n|  8 |  300 |  5000 |\n|  9 |    2 |    20 |\n| 10 |  300 |  3000 |\n+----+------+-------+\n10 rows in set (0.00 sec)\n\nmysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>master<\/p>\n<pre><code>mysql> ALTER TABLE takanori ADD COLUMN val3 INT GENERATED ALWAYS AS (val1 + val2) STORED NOT NULL;\nQuery OK, 10 rows affected (0.10 sec)\nRecords: 10  Duplicates: 0  Warnings: 0\n\nmysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  `val3` int(11) GENERATED ALWAYS AS ((`val1` + `val2`)) STORED NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 28000 | 28001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n10 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> show create table takanori\\G\n*************************** 1. row ***************************\n       Table: takanori\nCreate Table: CREATE TABLE `takanori` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `val1` int(11) NOT NULL,\n  `val2` int(11) NOT NULL,\n  `val3` int(11) GENERATED ALWAYS AS ((`val1` + `val2`)) STORED NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci\n1 row in set (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 28000 | 28001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n10 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<h4>binlog_row_image=full<\/h4>\n<p>master<\/p>\n<pre><code>mysql> insert into takanori (val1,val2) values (2,20),(300,3000);\nQuery OK, 2 rows affected (0.01 sec)\nRecords: 2  Duplicates: 0  Warnings: 0\n\nmysql> update takanori set val2=val2+2000 where id=3;\nQuery OK, 1 row affected (0.02 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 30000 | 30001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n| 11 |    2 |    20 |    22 |\n| 12 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n12 rows in set (0.01 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 30000 | 30001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n| 11 |    2 |    20 |    22 |\n| 12 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n12 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>mysqlbinlog -vv \u3067\u78ba\u8a8d\u3059\u308b\u3068<\/p>\n<pre><code>$ .\/mysqlbinlog \/var\/lib\/mysql\/binlog.000031 -vv\n\/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*\/;\n\/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*\/;\nDELIMITER \/*!*\/;\n# at 4\n#191112  6:41:27 server id 1  end_log_pos 124 CRC32 0x80b81408  Start: binlog v 4, server v 8.0.18 created 191112  6:41:27\n# Warning: this binlog is either in use or was not closed properly.\nBINLOG '\nF1TKXQ8BAAAAeAAAAHwAAAABAAQAOC4wLjE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAEwANAAgAAAAABAAEAAAAYAAEGggAAAAICAgCAAAACgoKKioAEjQA\nCgEIFLiA\n'\/*!*\/;\n# at 124\n#191112  6:41:27 server id 1  end_log_pos 155 CRC32 0xec3c007c  Previous-GTIDs\n# [empty]\n# at 155\n#191112  6:41:45 server id 1  end_log_pos 234 CRC32 0x82ecf8c4  Anonymous_GTID  last_committed=0        sequence_number=1                                                                                                                                                                                                                                                                                                                 rbr_only=yes     original_committed_timestamp=1573540905364290   immediate_commit_timestamp=1573540905364290                                                                                                                                                                                                                                                                                                                               transaction_length=311\n\/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*\/\/*!*\/;\n# original_commit_timestamp=1573540905364290 (2019-11-12 06:41:45.364290 UTC)\n# immediate_commit_timestamp=1573540905364290 (2019-11-12 06:41:45.364290 UTC)\n\/*!80001 SET @@session.original_commit_timestamp=1573540905364290*\/\/*!*\/;\n\/*!80014 SET @@session.original_server_version=80018*\/\/*!*\/;\n\/*!80014 SET @@session.immediate_server_version=80018*\/\/*!*\/;\nSET @@SESSION.GTID_NEXT= 'ANONYMOUS'\/*!*\/;\n# at 234\n#191112  6:41:45 server id 1  end_log_pos 309 CRC32 0x08695b67  Query   thread_id=9     exec_time=0     error_code=0\nSET TIMESTAMP=1573540905\/*!*\/;\nSET @@session.pseudo_thread_id=9\/*!*\/;\nSET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1\/*!*\/;\nSET @@session.sql_mode=1168113696\/*!*\/;\nSET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1\/*!*\/;\n\/*!\\C latin1 *\/\/*!*\/;\nSET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=255\/*!*\/;\nSET @@session.lc_time_names=0\/*!*\/;\nSET @@session.collation_database=DEFAULT\/*!*\/;\n\/*!80011 SET @@session.default_collation_for_utf8mb4=255*\/\/*!*\/;\nBEGIN\n\/*!*\/;\n# at 309\n#191112  6:41:45 server id 1  end_log_pos 366 CRC32 0x7491f9eb  Table_map: `test`.`takanori` mapped to number 101\n# at 366\n#191112  6:41:45 server id 1  end_log_pos 435 CRC32 0x0f184969  Write_rows: table id 101 flags: STMT_END_F\n\nBINLOG '\nKVTKXRMBAAAAOQAAAG4BAAAAAGUAAAAAAAEABHRlc3QACHRha2Fub3JpAAQDAwMDAAABAQDr+ZF0\nKVTKXR4BAAAARQAAALMBAAAAAGUAAAAAAAEAAgAE\/wALAAAAAgAAABQAAAAWAAAAAAwAAAAsAQAA\nuAsAAOQMAABpSRgP\n'\/*!*\/;\n### INSERT INTO `test`.`takanori`\n### SET\n###   @1=11 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @2=2 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @3=20 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=22 \/* INT meta=0 nullable=0 is_null=0 *\/\n### INSERT INTO `test`.`takanori`\n### SET\n###   @1=12 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @2=300 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @3=3000 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=3300 \/* INT meta=0 nullable=0 is_null=0 *\/\n# at 435\n#191112  6:41:45 server id 1  end_log_pos 466 CRC32 0x499d20f0  Xid = 274\nCOMMIT\/*!*\/;\n# at 466\n#191112  6:41:51 server id 1  end_log_pos 545 CRC32 0xf86e4c18  Anonymous_GTID  last_committed=1        sequence_number=2                                                                                                                                                                                                                                                                                                                 rbr_only=yes     original_committed_timestamp=1573540911064593   immediate_commit_timestamp=1573540911064593                                                                                                                                                                                                                                                                                                                               transaction_length=321\n\/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*\/\/*!*\/;\n# original_commit_timestamp=1573540911064593 (2019-11-12 06:41:51.064593 UTC)\n# immediate_commit_timestamp=1573540911064593 (2019-11-12 06:41:51.064593 UTC)\n\/*!80001 SET @@session.original_commit_timestamp=1573540911064593*\/\/*!*\/;\n\/*!80014 SET @@session.original_server_version=80018*\/\/*!*\/;\n\/*!80014 SET @@session.immediate_server_version=80018*\/\/*!*\/;\nSET @@SESSION.GTID_NEXT= 'ANONYMOUS'\/*!*\/;\n# at 545\n#191112  6:41:51 server id 1  end_log_pos 629 CRC32 0x7ff0c37e  Query   thread_id=9     exec_time=0     error_code=0\nSET TIMESTAMP=1573540911\/*!*\/;\nBEGIN\n\/*!*\/;\n# at 629\n#191112  6:41:51 server id 1  end_log_pos 686 CRC32 0xd52a4759  Table_map: `test`.`takanori` mapped to number 101\n# at 686\n#191112  6:41:51 server id 1  end_log_pos 756 CRC32 0x04dd11e1  Update_rows: table id 101 flags: STMT_END_F\n\nBINLOG '\nL1TKXRMBAAAAOQAAAK4CAAAAAGUAAAAAAAEABHRlc3QACHRha2Fub3JpAAQDAwMDAAABAQBZRyrV\nL1TKXR8BAAAARgAAAPQCAAAAAGUAAAAAAAEAAgAE\/\/8AAwAAAAEAAABgbQAAYW0AAAADAAAAAQAA\nADB1AAAxdQAA4RHdBA==\n'\/*!*\/;\n### UPDATE `test`.`takanori`\n### WHERE\n###   @1=3 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @2=1 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @3=28000 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=28001 \/* INT meta=0 nullable=0 is_null=0 *\/\n### SET\n###   @1=3 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @2=1 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @3=30000 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=30001 \/* INT meta=0 nullable=0 is_null=0 *\/\n# at 756\n#191112  6:41:51 server id 1  end_log_pos 787 CRC32 0x06f73187  Xid = 275\nCOMMIT\/*!*\/;\nSET @@SESSION.GTID_NEXT= 'AUTOMATIC' \/* added by mysqlbinlog *\/ \/*!*\/;\nDELIMITER ;\n# End of log file\n\/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*\/;\n\/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*\/;\n$<\/code><\/pre>\n<h4>binlog_row_image=minimal<\/h4>\n<pre><code>mysql> set session binlog_row_image=minimal;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 30000 | 30001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n| 11 |    2 |    20 |    22 |\n| 12 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n12 rows in set (0.00 sec)\n\nmysql> insert into takanori (val1,val2) values (2,20),(300,3000);\nQuery OK, 2 rows affected (0.01 sec)\nRecords: 2  Duplicates: 0  Warnings: 0\n\nmysql> update takanori set val2=val2+2000 where id=3;\nQuery OK, 1 row affected (0.01 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nmysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           1 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 32000 | 32001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n| 11 |    2 |    20 |    22 |\n| 12 |  300 |  3000 |  3300 |\n| 13 |    2 |    20 |    22 |\n| 14 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n14 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>slave<\/p>\n<pre><code>mysql> select @@server_id, @@version;select * from takanori;\n+-------------+-----------+\n| @@server_id | @@version |\n+-------------+-----------+\n|           2 | 8.0.18    |\n+-------------+-----------+\n1 row in set (0.00 sec)\n\n+----+------+-------+-------+\n| id | val1 | val2  | val3  |\n+----+------+-------+-------+\n|  1 |    1 |    10 |    11 |\n|  2 |  100 |  1000 |  1100 |\n|  3 |    1 | 32000 | 32001 |\n|  4 |  100 |  2000 |  2100 |\n|  5 |    1 |    10 |    11 |\n|  6 |  100 |   100 |   200 |\n|  7 |    2 |    20 |    22 |\n|  8 |  300 |  5000 |  5300 |\n|  9 |    2 |    20 |    22 |\n| 10 |  300 |  3000 |  3300 |\n| 11 |    2 |    20 |    22 |\n| 12 |  300 |  3000 |  3300 |\n| 13 |    2 |    20 |    22 |\n| 14 |  300 |  3000 |  3300 |\n+----+------+-------+-------+\n14 rows in set (0.00 sec)\n\nmysql><\/code><\/pre>\n<p>mysqlbinlog -vv \u306f<\/p>\n<pre><code>$ .\/mysqlbinlog \/var\/lib\/mysql\/binlog.000032 -vv\n\/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*\/;\n\/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*\/;\nDELIMITER \/*!*\/;\n# at 4\n#191112  6:45:07 server id 1  end_log_pos 124 CRC32 0x1fff9ca8  Start: binlog v 4, server v 8.0.18 created 191112  6:45:07\n# Warning: this binlog is either in use or was not closed properly.\nBINLOG '\n81TKXQ8BAAAAeAAAAHwAAAABAAQAOC4wLjE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAEwANAAgAAAAABAAEAAAAYAAEGggAAAAICAgCAAAACgoKKioAEjQA\nCgGonP8f\n'\/*!*\/;\n# at 124\n#191112  6:45:07 server id 1  end_log_pos 155 CRC32 0x0d01c6ed  Previous-GTIDs\n# [empty]\n# at 155\n#191112  6:45:30 server id 1  end_log_pos 234 CRC32 0x732171d2  Anonymous_GTID  last_committed=0        sequence_number=1                                                                                                                                                                                                                                                                                                                 rbr_only=yes     original_committed_timestamp=1573541130135794   immediate_commit_timestamp=1573541130135794                                                                                                                                                                                                                                                                                                                               transaction_length=311\n\/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*\/\/*!*\/;\n# original_commit_timestamp=1573541130135794 (2019-11-12 06:45:30.135794 UTC)\n# immediate_commit_timestamp=1573541130135794 (2019-11-12 06:45:30.135794 UTC)\n\/*!80001 SET @@session.original_commit_timestamp=1573541130135794*\/\/*!*\/;\n\/*!80014 SET @@session.original_server_version=80018*\/\/*!*\/;\n\/*!80014 SET @@session.immediate_server_version=80018*\/\/*!*\/;\nSET @@SESSION.GTID_NEXT= 'ANONYMOUS'\/*!*\/;\n# at 234\n#191112  6:45:30 server id 1  end_log_pos 309 CRC32 0xa2aaa020  Query   thread_id=9     exec_time=0     error_code=0\nSET TIMESTAMP=1573541130\/*!*\/;\nSET @@session.pseudo_thread_id=9\/*!*\/;\nSET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1\/*!*\/;\nSET @@session.sql_mode=1168113696\/*!*\/;\nSET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1\/*!*\/;\n\/*!\\C latin1 *\/\/*!*\/;\nSET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=255\/*!*\/;\nSET @@session.lc_time_names=0\/*!*\/;\nSET @@session.collation_database=DEFAULT\/*!*\/;\n\/*!80011 SET @@session.default_collation_for_utf8mb4=255*\/\/*!*\/;\nBEGIN\n\/*!*\/;\n# at 309\n#191112  6:45:30 server id 1  end_log_pos 366 CRC32 0x45dbe94c  Table_map: `test`.`takanori` mapped to number 101\n# at 366\n#191112  6:45:30 server id 1  end_log_pos 435 CRC32 0x0a0a27af  Write_rows: table id 101 flags: STMT_END_F\n\nBINLOG '\nClXKXRMBAAAAOQAAAG4BAAAAAGUAAAAAAAEABHRlc3QACHRha2Fub3JpAAQDAwMDAAABAQBM6dtF\nClXKXR4BAAAARQAAALMBAAAAAGUAAAAAAAEAAgAEDwANAAAAAgAAABQAAAAWAAAAAA4AAAAsAQAA\nuAsAAOQMAACvJwoK\n'\/*!*\/;\n### INSERT INTO `test`.`takanori`\n### SET\n###   @1=13 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @2=2 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @3=20 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=22 \/* INT meta=0 nullable=0 is_null=0 *\/\n### INSERT INTO `test`.`takanori`\n### SET\n###   @1=14 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @2=300 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @3=3000 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=3300 \/* INT meta=0 nullable=0 is_null=0 *\/\n# at 435\n#191112  6:45:30 server id 1  end_log_pos 466 CRC32 0xfd10bcdf  Xid = 301\nCOMMIT\/*!*\/;\n# at 466\n#191112  6:45:42 server id 1  end_log_pos 545 CRC32 0x430100c7  Anonymous_GTID  last_committed=1        sequence_number=2                                                                                                                                                                                                                                                                                                                 rbr_only=yes     original_committed_timestamp=1573541142240435   immediate_commit_timestamp=1573541142240435                                                                                                                                                                                                                                                                                                                               transaction_length=301\n\/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*\/\/*!*\/;\n# original_commit_timestamp=1573541142240435 (2019-11-12 06:45:42.240435 UTC)\n# immediate_commit_timestamp=1573541142240435 (2019-11-12 06:45:42.240435 UTC)\n\/*!80001 SET @@session.original_commit_timestamp=1573541142240435*\/\/*!*\/;\n\/*!80014 SET @@session.original_server_version=80018*\/\/*!*\/;\n\/*!80014 SET @@session.immediate_server_version=80018*\/\/*!*\/;\nSET @@SESSION.GTID_NEXT= 'ANONYMOUS'\/*!*\/;\n# at 545\n#191112  6:45:42 server id 1  end_log_pos 629 CRC32 0xe20b65a1  Query   thread_id=9     exec_time=0     error_code=0\nSET TIMESTAMP=1573541142\/*!*\/;\nBEGIN\n\/*!*\/;\n# at 629\n#191112  6:45:42 server id 1  end_log_pos 686 CRC32 0xd9b9a4e2  Table_map: `test`.`takanori` mapped to number 101\n# at 686\n#191112  6:45:42 server id 1  end_log_pos 736 CRC32 0xe7c66ed1  Update_rows: table id 101 flags: STMT_END_F\n\nBINLOG '\nFlXKXRMBAAAAOQAAAK4CAAAAAGUAAAAAAAEABHRlc3QACHRha2Fub3JpAAQDAwMDAAABAQDipLnZ\nFlXKXR8BAAAAMgAAAOACAAAAAGUAAAAAAAEAAgAEAQwAAwAAAAAAfQAAAX0AANFuxuc=\n'\/*!*\/;\n### UPDATE `test`.`takanori`\n### WHERE\n###   @1=3 \/* INT meta=0 nullable=0 is_null=0 *\/\n### SET\n###   @3=32000 \/* INT meta=0 nullable=0 is_null=0 *\/\n###   @4=32001 \/* INT meta=0 nullable=0 is_null=0 *\/\n# at 736\n#191112  6:45:42 server id 1  end_log_pos 767 CRC32 0x497cc9eb  Xid = 302\nCOMMIT\/*!*\/;\nSET @@SESSION.GTID_NEXT= 'AUTOMATIC' \/* added by mysqlbinlog *\/ \/*!*\/;\nDELIMITER ;\n# End of log file\n\/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*\/;\n\/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*\/;\n$<\/code><\/pre>\n<h2>\u88dc\u8db3<\/h2>\n<p><a href=\"https:\/\/dev.mysql.com\/worklog\/task\/?id=3915\">WL#3915: Fewer columns on slave<\/a> \u3068\u3044\u3046 WorkLog \u3092\u898b\u308b\u3068\u3001\u529b\u5f37\u304f\u6b21\u306e\u3088\u3046\u306b\u66f8\u3044\u3066\u3042\u308a<\/p>\n<blockquote><p>\n  It should be possible to replicate a table that has more columns on the master<br \/>\n  than on the slave, i.e., there are M columns in the table on the master and N<br \/>\n  columns in the table on the slave and M > N.<\/p>\n<p>  When replicating in this manner, the contents of the extra columns on the master<br \/>\n  is lost, but replication will accept the situation and keep running.\n<\/p><\/blockquote>\n<p>WorkLog 3259 \u306f\u516c\u958b\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046\u3067\u3059\u304c\u3001 WL#3915 \u306b\u306f\u6b21\u306e\u3088\u3046\u306b\u3082\u66f8\u3044\u3066\u3042\u308b\u306e\u3067<\/p>\n<blockquote><p>\n  This work is related to WL#3259 (RBR with more columns on slave than on master)<br \/>\n  in that implementation of this worklog is necessary to support on-line table<br \/>\n  definition changes (a.k.a., \"schema upgrade\") when using circular replication.\n<\/p><\/blockquote>\n<p>Row-Based Replication \u3067\u3001 master \u3068 slave \u306e Column \u306e\u6570\u304c\u4e00\u81f4\u3057\u3066\u3044\u306a\u304f\u3066\u3082 replication \u3067\u304d\u308b\u3079\u304d\u3060\u3068\u3001 MySQL \u306e Replication team\u306f\u8003\u3048\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<h3>\u500b\u4eba\u7684\u898b\u89e3\u306e\u3088\u3046\u306a\u88dc\u8db3<\/h3>\n<p>\u3053\u3053\u3067\u3082\u3046\u4e00\u5ea6 <a href=\"https:\/\/dev.mysql.com\/worklog\/task\/?id=5092\">WL#5092: RBR: Options for writing partial or full row images in RBR events<\/a> \u3092\u632f\u308a\u8fd4\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u6b21\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"start-line:165\" ><code>  NOTE\n  ----\n\n  As a side remark, there was another option considered:\n\n    - reversible \n       means PKE and changed columns in before and after image\n\n  Nevertheless, it was decided that this will not be implemented\n  for now, as there is no practical use for it (think Undo\n  operations). So, for not risking to get the user confused, and\n  because the 'noblob' option supersedes this one, we will put\n  this on hold.\n\n  Decision was made over Skype meeting: \n   - attendees: Alfranio, Mats and Lu\u00eds\n   - date: 09\/09\/09 (11:00 am CEST) <\/code><\/pre>\n<p>binlog_format=ROW \u306a binlog \u306b\u306f AI \u3068 BI \u304c\u3042\u308b\u306e\u3067\u3001 binlog \u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u5dfb\u304d\u623b\u3059\u3053\u3068\u304c\u53ef\u80fd\u3067\u306f\u306a\u3044\u304b\u3001\u3068\u3044\u3046\u8a71\u3067\u3059\u304c<\/p>\n<ul>\n<li>master \u3068 slave \u306e Column \u306e\u6570\u304c\u9055\u3063\u3066\u3082 replication \u3067\u304d\u308b<\/li>\n<li>master \u306a\u3044\u3057 slave \u306b\u3057\u304b\u5b58\u5728\u3057\u306a\u3044 generated column \u304c\u3042\u3063\u305f\u5834\u5408\u3001 binlog \u3067\u305d\u306e\u66f4\u65b0\u3092\u30b1\u30a2\u3067\u304d\u308b\u306e\u304b<\/li>\n<li>MySQL\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u53e4\u304b\u3063\u305f\u5834\u5408\u3001\u578b\u5909\u63db\u3067\u304d\u308b\u306e\u304b\u3002\u3042\u308b\u3044\u306f\u3001 binlog \u3092\u9069\u7528\u4f7f\u7528\u3057\u3066\u3044\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3001\u66f4\u65b0\u5bfe\u8c61\u306eColumn\u306e\u578b\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u304b<\/li>\n<li>DML\u306f\u3068\u3082\u304b\u304f\u3001DDL\u306f\u3069\u3046\u3059\u308b\u306e\u304b<\/li>\n<\/ul>\n<p>\u3068\u3044\u3063\u305f\u3042\u305f\u308a\u8e0f\u307e\u3048\u308b\u3068\u3001binlog_format=ROW \u3092\u719f\u77e5\u3057\u3066\u3044\u306a\u3044\u3068\u3001\u6df7\u4e71\u3092\u62db\u304f\u6a5f\u80fd\u3067\u306f\u306a\u3044\u304b\u306a\u3041\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>Alfranio\u3001 Mats\u3001Lu\u00eds \u306e\u4e09\u4eba\u306f\u3001reversible \u3088\u308a noblob \u306e\u65b9\u304c\u30e6\u30fc\u30b6\u306b\u3068\u3063\u3066\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u3068\u8003\u3048\u3066\u304f\u308c\u305f\u306e\u3067\u3057\u3087\u3046\u3002\u500b\u4eba\u7684\u306b\u3001\u826f\u3044\u6c7a\u65ad\u3060\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u4eca\u65e5\u306f\u3053\u308c\u307e\u3067<\/h2>\n<p>\u4eca\u56de\u306f\u3061\u3087\u3063\u3068\u30e4\u30f3\u30c1\u30e3\u306a\u3053\u3068\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u3002 master \u3068 slave \u3067\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u304c\u7570\u306a\u3063\u3066\u3044\u3066\u3082\u3001Row-based Replication \u306f\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u304c\u3001 STORED \u306a Generated Column \u306f\u3001\u305d\u306e\u9650\u308a\u3067\u306f\u306a\u3044\u3088\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001Row-based Replication \u3067 Column \u306e\u578b\u30c1\u30a7\u30c3\u30af\u304c\u884c\u308f\u308c\u308b\u3068\u3053\u308d\u306a\u3069\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3002\u305b\u3058\u307e\u3067\u3059\u3002 \u4eca\u56de\u3082 replication \u306e\u8a71\u3092\u3057\u307e\u3059\u3002 \u306f\u3058\u3081\u306b \u7b2c\u56db\u56de\u3067\u3059\u3002 \u524d\u56de\u3001 Row-Based Replication \u3067\u306f Column \u306e\u540d\u524d\u3092\u610f\u8b58\u3057\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306f  [&hellip;]<\/p>\n","protected":false},"author":137,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[17],"class_list":["post-19832","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-info","tag-mysql"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/19832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/137"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=19832"}],"version-history":[{"count":3,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/19832\/revisions"}],"predecessor-version":[{"id":20397,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/19832\/revisions\/20397"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=19832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=19832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=19832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}