inception icon indicating copy to clipboard operation
inception copied to clipboard

ddl时调用osc异常:Execute: Got an error reading communication packets.

Open pandakll opened this issue 8 years ago • 3 comments

Hi, 各位有遇到么,有什么解决办法么! 直接脚本执行,例子很简单,报错如下: ['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 'sequence', 'backup_dbname', 'execute_time', 'sqlsha1'] 1 | RERUN | 0 | Execute Successfully | None | 2 | EXECUTED | 2 | Execute failed | Execute: Got an error reading communication packets. |

pandakll avatar Sep 13 '17 10:09 pandakll

比较小的表执行成功,不过看到osc进程变成了僵尸进程 image

pandakll avatar Sep 14 '17 03:09 pandakll

这个问题已解决:仔细分析是由于inception会有一个连接直接去数据库查询,没有释放连接,导致触发到wait_timeout时间设置; 具体解决办法:将sql目录下的sql_parse.cc文件下的mysql_get_remote_variables函数修改为如下: int mysql_get_remote_variables(THD* thd) { char set_format[1024]; MYSQL_RES * source_res; MYSQL_ROW source_row; MYSQL* mysql;

DBUG_ENTER("mysql_get_remote_variables");

mysql= thd->get_audit_connection(); if (mysql == NULL) DBUG_RETURN(ER_NO);

sprintf(set_format, "show variables where
Variable_name in ('explicit_defaults_for_timestamp', 'sql_mode');"); if (mysql_real_query(mysql, set_format, strlen(set_format))) { my_message(mysql_errno(mysql), mysql_error(mysql), MYF(0)); DBUG_RETURN(ER_NO); }

if ((source_res = mysql_store_result(mysql)) == NULL) { my_message(mysql_errno(mysql), mysql_error(mysql), MYF(0)); DBUG_RETURN(ER_NO); }

source_row = mysql_fetch_row(source_res); while(source_row) { if (strcasecmp(source_row[0], "explicit_defaults_for_timestamp") == 0) thd->variables.explicit_defaults_for_timestamp=strcmp("OFF", source_row[1]) ? 1 : 0; else if (strcasecmp(source_row[0], "sql_mode") == 0) get_sql_mode(thd, source_row[1]);

source_row = mysql_fetch_row(source_res);

}

mysql_free_result(source_res); sprintf(set_format,"set session wait_timeout=3600;"); if (mysql_real_query(mysql, set_format, strlen(set_format))) { my_message(mysql_errno(mysql), mysql_error(mysql), MYF(0)); DBUG_RETURN(ER_NO); }

DBUG_RETURN(false); }

xialuo1990 avatar Dec 01 '17 08:12 xialuo1990

你好,这种解决办法,表面上解决了,但是僵尸进程仍然在递增,请问有没有靠谱的解决办法,谢谢。

lazzyfu avatar Mar 09 '18 09:03 lazzyfu