In code, I drop a table and then create the table, and do the same in multi databases at one server, everything works ok. And then I query tables with the SQL " SHOW TABLES ", sometimes this sql throw exception: Fatal error encountered during command execution
, sometimes it works ok. And I am sure this is not raised by COMMAND TIMEOUT. It should be other reasons.
here is the drop table and create table sql:
DROP TABLE IF EXISTS `a`;
CREATE TABLE IF NOT EXISTS `a`
SELECT
id,
IF (mapping.name IS NULL, ne.autoname, mapping.name) AS autoname FROM b ne
LEFT JOIN test.a_mapping mapping ON ne.autoName = mapping.autoname;
ALTER TABLE `a` ADD INDEX `id_idx` (`id`);
DELETE FROM `a` WHERE id = 1000000;
INSERT INTO `a`(id, autoname) VALUES(1000000, @count);
here is the show tables codes:
MySqlDataReader dataReader = null;
try{
MySqlCommand cmd = new MySqlCommand(MySqlUtils.SQL_GET_TABLES, connection);
cmd.CommandTimeout = BaseOptimonConfig.Instance.CommandTimeout;
dataReader = MySqlUtils.ExecuteReader(cmd); // just add try catch in this method.
while (dataReader.Read())
{
if (MySqlUtils.GetSqlString(dataReader, 0).ToLower().Equals(tableName))
{
return true;
}
}
}
finally
{
MySqlUtils.CloseSqlReader(dataReader);
}