On big production servers that are heavily in use, the default maximum number of prepared statements is 16382. it seems this provider does not close its connection frequently enough and prepare too many queries that hit that limit randomly and very frequently on our servers.
Terraform Version
Terraform v0.12.20
provider.mysql v1.8.0
mysql 5.7
Affected Resource(s)
mysql_database, maybe all other resources too since it is related to the database connection.
This error happens randomly on running apply. since the max_prepared_stmt_count is a server-wide limit that potentially could cause problems for other applications who want to prepare statements.
show global status like 'com_stmt%';
'Com_stmt_execute', '6506784240'
'Com_stmt_close', '185741724'
'Com_stmt_fetch', '0'
'Com_stmt_prepare', '199476683'
'Com_stmt_reset', '85496'
'Com_stmt_send_long_data', '85846'
'Com_stmt_reprepare', '126'
show variables like 'max_prepared_stmt_count';
'max_prepared_stmt_count', '16382'
Expected Behavior
Import happens
it does happen with the same error on apply.
Steps to Reproduce
Run the terraform apply or terraform import a database resource in a busy server.
On big production servers that are heavily in use, the default maximum number of prepared statements is 16382. it seems this provider does not close its connection frequently enough and prepare too many queries that hit that limit randomly and very frequently on our servers.
Terraform Version
Terraform v0.12.20
Affected Resource(s)
mysql_database, maybe all other resources too since it is related to the database connection.
Debug Output
This error happens randomly on running apply. since the max_prepared_stmt_count is a server-wide limit that potentially could cause problems for other applications who want to prepare statements.
Expected Behavior
Import happens it does happen with the same error on apply.
Steps to Reproduce
Run the terraform apply or terraform import a database resource in a busy server.