且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySql Amazon RDS:来自应用程序的“Innodb 功能已禁用"错误

更新时间:2022-10-18 07:39:47

我通过 AWS 技术支持验证了这一点 - 读取器集群上的临时表是 MyISAM.我最初的问题涉及 MyISAM 数据库上的索引,但我会将其作为自己的问题发布.AWS RDS/Aurora 团队的回应如下:

这是在 Aurora 中的设计,这是因为当使用 InnoDB 在 writer 上创建临时表或系统生成的内部临时表时,它需要转到集群中的 reader 的底层存储,但是当您创建临时表时读取器上的表,它仅用于该特定读取器实例,不会填充到其他节点,因此默认情况下读取器实例将选择 MyISAM 引擎.这种行为归因于变量innodb_read_only"的值对读者设置为ON,对写者设置为OFF,从而限制了在reader实例上创建InnoDB表

初始响应:看来问题出在读者身上.读取器 RDS 实例中存储过程的临时表不是 InnoDB,即使在任何地方都没有记录,并且读取器和写入器的实例类型/价格相同.我不知道它们到底是什么,我对 AWS 有一个问题.如果他们回复,我会在这里发布.

Edit: the answer to the first question is that the application calls the reader instance of the cluster. I can reproduce the problem with workbench if I execute the procedure on the reader instance.

I have a stored procedure with a temporary table. I am using Amazon AWS RDS (Aurora) MySql. I create the temporary table like:

create temporary table if not exists tmpResources(
 pkKey varchar(50) NOT NULL, PRIMARY KEY(resource), UNIQUE KEY(resource), 
 ...
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

When I call the procedure from MySql workbench it executes fine. When I call it from my application, I receive the following error:

The 'InnoDB' feature is disabled; you need MySQL built with 'InnoDB' to have it working

I have an asp.net web application, using the Oracle c# drivers version 8.0.20. AWS RDS is currently MySql version 5.7.12.

There are 2 very perplexing questions: 1. Why does it work differently when called from workbench? The error seems to be coming from server side. 2. Why do I get this error about InnoDB disabled, when it is clearly not disabled?

Thanks for any insight...

Edit: I verified this with AWS technical support - temp tables on reader clusters are MyISAM. My initial problem involves indices on MyISAM databases, but I will post that as its own question. The response from AWS RDS/Aurora team follows:

this is by design in Aurora, and it is because when a temporary table or a system generated internal temp table is created on writer with InnoDB, it needs to go to underlying storage for readers in the cluster, but when you create temporary table on the reader, it is just for that particular reader instance and does not populate to other nodes, hence by default reader instances will pick up MyISAM engine. This behavior is attributed to the fact that the value of the variable "innodb_read_only" is set as ON for readers and OFF for writers, thus restricting the creation of InnoDB tables on the reader instances

Initial response: It appears the issue is with readers. Temporary tables on stored procedures in the reader RDS instances are not InnoDB, even though this is not documented anywhere and the instance type/price is the same for readers as for the writer. What they are exactly I don't know, I have a question to AWS about it. If they respond I'll post here.