添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
独立的胡萝卜  ·  Mysql Aurora 8.0 and ...·  4 天前    · 
强健的蚂蚁  ·  智能门锁钥匙使用帮助·  8 月前    · 
阳刚的烤地瓜  ·  iif · GitHub Topics · ...·  1 年前    · 

Mysql Aurora 8.0 and PyMySQL issue with autocommit

0

Hello,

I will try to explain as briefly as possible. We have a MySQL Aurora 8.0 server(version 3.05.1 if you want to reproduce it), where the server default variable value for autocommit is set to "0", meaning it's OFF. I connect with Python's PyMySQL module(v1.1.0, which is the latest one) and I set autocommit=True like so:

pymysql.connect(host='some-host.vpc.abc.com', user='abc', password="cba", autocommit=True)

and when I try to insert/update/delete something it actually doesn't apply the changes, despite autocommit being set to True. This is very strange behavior. Having that in mind I started digging in the module itself and turns out that it's reading some binary is returned from the Mysql server when connection which contains something they refer as to "server_status" . It should return 0 when autocommit is OFF and 2 when it's ON by default, but in case of Aurora it's returning always 2 even if it's actually OFF and the breaks the logic of the module that sets autocommit which results of really confusing consequences.

Can you please check and investigate that issue, because that is really concerning having in mind that this module is used by thousands of processes using RDS.

asked a year ago 636 views
1 Answer
0

Hi, I hope my answer would help you. Confirm the autocommit status directly in the Aurora database by checking the global variable value. This will validate if the server setting is actually being overridden. (SHOW VARIABLES LIKE 'autocommit';) By default, autocommit is enabled in Aurora MySQL, so the server_status value returned would be 2. This indicates that all SQL statements are committed implicitly, without the need for an explicit COMMIT statement.