{"id":228,"date":"2015-12-15T16:50:25","date_gmt":"2015-12-15T07:50:25","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/12\/15\/aurora_transaction_isolation_level"},"modified":"2015-12-15T16:50:25","modified_gmt":"2015-12-15T07:50:25","slug":"aurora_transaction_isolation_level","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/12\/15\/aurora_transaction_isolation_level\/","title":{"rendered":"Amazon Aurora\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u30ec\u30d9\u30eb\u306fREPEATABLE READ\u3060\u3051\u3058\u3083\u306a\u3044\u3063\u307d\u3044"},"content":{"rendered":"

MySQL\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u30ec\u30d9\u30eb\u306fREPEATABLE READ<\/code>\u3067\u3042\u308b\u3002\u305f\u3060\u3001\u6700\u8fd1\u4f5c\u3063\u3066\u3044\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3001READ COMMITED<\/code>\u306b\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u72b6\u6cc1\u304c\u3042\u3063\u305f\u3002\u73fe\u72b6\u3067\u306f\u3001Amazon RDS\u306eMySQL\u3092\u4f7f\u3063\u3066\u304a\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u3054\u3068\u306bREAD COMMITED<\/code>\u306b\u5909\u66f4\u3059\u308b\u5bfe\u5fdc\u3092\u3057\u305f\u3002\u305f\u3060\u305d\u306e\u4e00\u65b9\u3001\u4eca\u5f8c\u30b5\u30fc\u30d3\u30b9\u306e\u62e1\u5927\u306b\u3068\u3082\u306a\u3063\u3066Amazon Aurora\u3078\u306e\u79fb\u884c\u3082\u8003\u3048\u3089\u308c\u308b\u304b\u306a\u3068\u601d\u3044\u3061\u3087\u3053\u3061\u3087\u3053\u3068\u8abf\u3079\u3066\u3044\u305f\u6240\u3001Amazon Aurora\u3067\u306f\u5206\u96e2\u30ec\u30d9\u30eb\u3092REPEATABLE READ<\/code>\u304b\u3089\u5909\u66f4\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u6c17\u306b\u306a\u308b\u5642\u304c\u3042\u3063\u305f\u3002<\/p>\n

\n

It seems that the only TRANSACTION ISOLATION level supported is REPEATABLE-READ. When I try to change to SERIALIZABLE or READ-COMMITTED, Aurora accepts this without an error, but silently ignores it. tx_isolation stays REPEATABLE-READ.<\/p>\n<\/blockquote>\n

Amazon Aurora \u2013 Looking Deeper<\/a>
\n
\u65e5\u672c\u8a9e\u8a33<\/a><\/p>\n

2015\u5e7411\u670816\u65e5\u306e\u8a18\u4e8b\u3067\u3042\u308b\u304c\u3001SERIALIZABLE<\/code>\u306b\u3082READ-COMMITTED<\/code>\u306b\u3082\u5909\u66f4\u3067\u304d\u306a\u304b\u3063\u305f\u3068\u306e\u3053\u3068\u3002<\/p>\n

\u3055\u3089\u306b\u306f\u3001<\/p>\n

\n

Actually, there I face another worrisome behaviour: silent changes in Aurora without notification.
\nI am pretty sure, that when a couple of weeks ago I tried to use SERIALIZABLE level, it failed with an error: \u201cSERIALIZABLE is not supported\u201d. Now it just silently ignores it.<\/p>\n<\/blockquote>\n

\u305d\u306e\u524d\u306b\u306f\u307e\u305f\u5225\u306e\u52d5\u304d\u3067\u3001SERIALIZABLE<\/code>\u306b\u5909\u66f4\u3057\u3088\u3046\u3068\u3057\u305f\u6642\u70b9\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3068\u306e\u3053\u3068\u3002<\/p>\n

\u6c17\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u79c1\u3082\u3068\u308a\u3042\u3048\u305aREAD COMMITED<\/code>\u306b\u3067\u304d\u308b\u304b\u3092\u8a66\u3057\u3066\u307f\u305f\u3002\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001\u73fe\u5728\u306f___\u3067\u304d\u308b___\u3002<\/p>\n

\u307e\u305a\u306fMySQL\u3067\u8a66\u3057\u3066\u307f\u308b<\/h2>\n

MySQL\u3067\u3001REPEATABLE READ<\/code>\u3068READ COMMITED<\/code>\u306e\u9055\u3044\u3092\u5b9f\u969b\u306e\u52d5\u304d\u3067\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3059\u308b\u3002<\/p>\n

\u307e\u305a\u306f\u5206\u96e2\u30ec\u30d9\u30eb\u78ba\u8a8d\u3002MySQL\u30c7\u30d5\u30a9\u30eb\u30c8\u306a\u306e\u3067REPEATABLE READ<\/code>\u3067\u3042\u308b\u3002<\/p>\n

mysql> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+-----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation  |\n+-----------------------+-----------------+\n| REPEATABLE-READ       | REPEATABLE-READ |\n+-----------------------+-----------------+\n1 row in set (0.02 sec)<\/code><\/pre>\n

\u30c6\u30fc\u30d6\u30eb\u3092\u7528\u610f\u3059\u308b\u3002<\/p>\n

mysql> create table test(id int(8) not null primary key, name varchar(64));<\/code><\/pre>\n

\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u633f\u5165\u3002<\/p>\n

mysql> insert into test values (1, 'hoge');<\/code><\/pre>\n

\u4ee5\u964d\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u30922\u3064\u5f35\u308a\u30012\u3064\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u3092\u5e73\u884c\u306b\u8d70\u3089\u305b\u308b\u3002<\/p>\n

REPEATABLE READ\u306e\u5834\u5408<\/h4>\n

\u73fe\u5728\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u30ec\u30d9\u30eb\u3092\u78ba\u8a8d\u3002<\/p>\n

mysql1> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+-----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation  |\n+-----------------------+-----------------+\n| REPEATABLE-READ       | REPEATABLE-READ |\n+-----------------------+-----------------+\n1 row in set (0.00 sec)\n\nmysql2> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+-----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation  |\n+-----------------------+-----------------+\n| REPEATABLE-READ       | REPEATABLE-READ |\n+-----------------------+-----------------+\n1 row in set (0.00 sec)<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30922\u3064\u958b\u59cb\u3002<\/p>\n

mysql1> start transaction;\nmysql2> start transaction;<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f31\u3067update<\/p>\n

mysql1> update test set name='fuga';\nQuery OK, 1 row affected (0.00 sec)\nRows matched: 1  Changed: 1  Warnings: 0<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f32\u3067select<\/p>\n

mysql2> select * from test;\n+----+------+\n| id | name |\n+----+------+\n|  1 | hoge |\n+----+------+\n1 row in set (0.00 sec)<\/code><\/pre>\n

\u66f4\u65b0\u3055\u308c\u305f\u5024\u306f\u898b\u3048\u306a\u3044\u3002<\/p>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f31\u3067commit\u3002<\/p>\n

mysql1> commit;\nQuery OK, 0 rows affected (0.01 sec)<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f32\u3067select\u3002<\/p>\n

mysql2> select * from test;\n+----+------+\n| id | name |\n+----+------+\n|  1 | hoge |\n+----+------+\n1 row in set (0.01 sec)<\/code><\/pre>\n

\u66f4\u65b0\u3055\u308c\u305f\u5024\u306f\u3084\u306f\u308a\u898b\u3048\u306a\u3044\u3002\u3053\u3053\u304cREAD COMMITED<\/code>\u3068\u306e\u9055\u3044\u3002READ COMMITED<\/code>\u3067\u306f\u3053\u306e\u6642\u70b9\u3067\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f31\u3067\u306e\u66f4\u65b0\u7d50\u679c\u304c\u898b\u3048\u308b\u3002<\/em><\/strong><\/p>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f32\u3092\u7d42\u4e86\u3055\u305b\u3066select\u3002<\/p>\n

mysql2> commit;\nQuery OK, 0 rows affected (0.00 sec)\nmysql2> select * from test;\n+----+------+\n| id | name |\n+----+------+\n|  1 | fuga |\n+----+------+\n1 row in set (0.00 sec)<\/code><\/pre>\n

\u66f4\u65b0\u3055\u308c\u305f\u5024\u304c\u898b\u3048\u308b\u3002<\/p>\n

READ COMMITED\u306e\u5834\u5408<\/h4>\n

\u5206\u96e2\u30ec\u30d9\u30eb\u5909\u66f4\u3002<\/p>\n

mysql1> set session transaction isolation level read committed;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql2> set session transaction isolation level read committed;\nQuery OK, 0 rows affected (0.00 sec)<\/code><\/pre>\n
mysql1> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation |\n+-----------------------+----------------+\n| REPEATABLE-READ       | READ-COMMITTED |\n+-----------------------+----------------+\n1 row in set (0.00 sec)\n\nmysql2> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation |\n+-----------------------+----------------+\n| REPEATABLE-READ       | READ-COMMITTED |\n+-----------------------+----------------+\n1 row in set (0.00 sec)<\/code><\/pre>\n

name\u3092hoge<\/code>\u306b\u623b\u3057\u3066\u304a\u3044\u305f\u4e0a\u3067\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30922\u3064\u958b\u59cb\u3002<\/p>\n

mysql1> start transaction;\nmysql2> start transaction;<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f31\u3067update\u3002<\/p>\n

mysql1> update test set name='fuga';<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f32\u3067select\u3002<\/p>\n

mysql2> select * from test;\n+----+------+\n| id | name |\n+----+------+\n|  1 | hoge |\n+----+------+\n1 row in set (0.00 sec)<\/code><\/pre>\n

\u66f4\u65b0\u3055\u308c\u305f\u5024\u306f\u898b\u3048\u306a\u3044\u3002<\/p>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f31\u3067commit\u3002<\/p>\n

mysql1> commit;\nQuery OK, 0 rows affected (0.01 sec)<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f32\u3067select\u3002<\/p>\n

mysql2> select * from test;\n+----+------+\n| id | name |\n+----+------+\n|  1 | fuga |\n+----+------+\n1 row in set (0.00 sec)<\/code><\/pre>\n

\u66f4\u65b0\u3055\u308c\u305f\u5024\u3092\u53d6\u5f97\u3067\u304d\u308b\u3002<\/p>\n

Amazon Aurora\u306e\u5834\u5408<\/h2>\n

\u9577\u3044\u524d\u7f6e\u304d\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u304c\u3001Amazon Aurora\u306e\u5834\u5408\u3002<\/p>\n

\u307e\u305a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5206\u96e2\u30ec\u30d9\u30eb\u3092\u78ba\u8a8d\u3002\u3084\u306f\u308a\u30c7\u30d5\u30a9\u30eb\u30c8\u306fREPEATABLE-READ<\/code>\u3002<\/p>\n

mysql> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+-----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation  |\n+-----------------------+-----------------+\n| REPEATABLE-READ       | REPEATABLE-READ |\n+-----------------------+-----------------+\n1 row in set (0.01 sec)<\/code><\/pre>\n

\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u30ec\u30d9\u30eb\u3092READ COMMITED<\/code>\u306b\u5909\u66f4\u3002<\/p>\n

mysql> set session transaction isolation level read committed;\nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> select @@GLOBAL.tx_isolation, @@tx_isolation;\n+-----------------------+----------------+\n| @@GLOBAL.tx_isolation | @@tx_isolation |\n+-----------------------+----------------+\n| REPEATABLE-READ       | READ-COMMITTED |\n+-----------------------+----------------+\n1 row in set (0.01 sec)<\/code><\/pre>\n

\u5909\u66f4\u3067\u304d\u3066\u3044\u308b\u3088\u3046\u3067\u3042\u308b\u3002\u3053\u306e\u5f8c\u3001\u4e0a\u8ff0\u3057\u305fMySQL\u3068\u540c\u3058\u624b\u9806\u30672\u3064\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3067\u5b9f\u969b\u306e\u52d5\u304d\u3092\u78ba\u8a8d\u3057\u305f\u304c\u3001\u304d\u3061\u3093\u3068READ-COMMITED<\/code>\u306e\u52d5\u304d\u306b\u306a\u3063\u3066\u3044\u305f\u3002\u6700\u521d\u306b\u7d39\u4ecb\u3057\u305f\u30d6\u30ed\u30b0\u306e\u6642\u70b9\u304b\u3089\u4fee\u6b63\u304c\u5165\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3002\uff08\u3061\u306a\u307f\u306b\u3001\u4ed6\u306e\u5206\u96e2\u30ec\u30d9\u30eb\u306b\u3082\u5909\u66f4\u3057\u3066\u307f\u305f\u304c\u3001\u5909\u66f4\u3067\u304d\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u305f\u3002\u305f\u3060\u3001\u5b9f\u969b\u306e\u52d5\u304d\u306f\u691c\u8a3c\u3057\u3066\u3044\u306a\u3044\u3002\uff09<\/p>\n

\u3053\u3053\u3089\u3078\u3093\u306e\u91cd\u8981\u306a\u8a71\u306f\u4fee\u6b63\u5185\u5bb9\u3092\u30a2\u30ca\u30a6\u30f3\u30b9\u3057\u3066\u307b\u3057\u3044\u6c17\u3082\u3059\u308b\u304c\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u30ec\u30d9\u30eb\u304c\u3084\u308f\u3044\u73fe\u72b6\u3067\u306fAmazon Aurora\u3092\u5546\u7528\u30b5\u30fc\u30d3\u30b9\u3067\u4f7f\u3046\u306e\u306f\u3061\u3087\u3063\u3068\u307e\u3060\u6642\u671f\u5c1a\u65e9\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n

Amazon Aurora\u306a\u3069AWS\u3092\u6d3b\u7528\u3057\u305f\u30b7\u30b9\u30c6\u30e0\u69cb\u7bc9\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a<\/a>\u3092\u3054\u691c\u8a0e\u306e\u4f01\u696d\u69d8\u306f\u3001\u662f\u975eMMM\u306b\u3054\u76f8\u8ac7\u4e0b\u3055\u3044\u307e\u305b\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

MySQL\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u5206\u96e2\u30ec\u30d9\u30eb\u306fREPEATABLE READ\u3067\u3042\u308b\u3002\u305f\u3060\u3001\u6700\u8fd1\u4f5c\u3063\u3066\u3044\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3001READ COMMITED\u306b\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u72b6\u6cc1\u304c\u3042\u3063\u305f\u3002\u73fe\u72b6\u3067\u306f\u3001Amazon RDS\u306eMySQL\u3092\u4f7f\u3063\u3066\u304a\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u3054\u3068\u306bREAD COMMITED\u306b\u5909\u66f4\u3059\u308b\u5bfe\u5fdc\u3092\u3057\u305f\u3002\u305f\u3060\u305d\u306e\u4e00\u65b9\u3001\u4eca\u5f8c\u30b5\u30fc\u30d3\u30b9\u306e\u62e1\u5927\u306b\u3068\u3082\u306a\u3063\u3066Amazon Aur […]<\/p>\n","protected":false},"author":4,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[145],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/228"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=228"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/228\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}