Mysql Prepared statement needs to be re-prepared
這個是我自己的筆記沒有閱讀性。也沒仔細看。但是記錄下斷點以後好研究。
朋友遇到這個錯修改了引數
| table_definition_cache | 1400 |
| table_open_cache | 2000 |
均設定為16384就好了。
但是他搞不明白有什麼關係。我就看了一下這個報錯的錯誤碼
{ "ER_NEED_REPREPARE", 1615, "Prepared statement needs to be re-prepared" },
分析後他應該是在函式check_and_update_table_version中丟擲來的。
其註釋有
Compare metadata versions of an element obtained from the table
definition cache and its corresponding node in the parse tree.
其邏輯有
static bool
check_and_update_table_version(THD *thd,
TABLE_LIST *tables, TABLE_SHARE *table_share)
{ if (! tables->is_table_ref_id_equal(table_share))
{
Reprepare_observer *reprepare_observer= thd->get_reprepare_observer(); if (reprepare_observer &&
reprepare_observer->report_error(thd)) //這裡如果前面的指標為NULL則觸發這個報錯邏輯 { /*
Version of the table share is different from the
previous execution of the prepared statement, and it is
unacceptable for this SQLCOM. Error has been reported.
*/ DBUG_ASSERT(thd->is_error()); return TRUE;
} /* Always maintain the latest version and type */ tables->set_table_ref_id(table_share);
}
DBUG_EXECUTE_IF("reprepare_each_statement", return inject_reprepare(thd);); return FALSE;
}
看來他們確實有聯絡,但是怎麼聯絡的說不上來,這個觀察者搞毛線的我也不知道。以後再說。
斷點設定
1 breakpoint keep y 0x0000000000ebd5f3 in main(int, char**) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/main.cc:25 breakpoint already hit 1 time 4 breakpoint keep y 0x00000000016a04bd in open_table_from_share(THD*, TABLE_SHARE*, char const*, uint, uint, uint, TABLE*, bool)
at /root/mysql5.7.14/percona-server-5.7.14-7/sql/table.cc:3038 breakpoint already hit 4 times 5 breakpoint keep y 0x0000000001519a10 in check_and_update_table_version(THD*, TABLE_LIST*, TABLE_SHARE*)
at /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_base.cc:4219 breakpoint already hit 4 times 6 breakpoint keep y 0x00000000015285bb in Table_cache::add_used_table(THD*, TABLE*) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/table_cache.h:353 breakpoint already hit 2 times 7 breakpoint keep y 0x0000000001527427 in TABLE_LIST::set_table_ref_id(enum_table_ref_type, ulonglong)
at /root/mysql5.7.14/percona-server-5.7.14-7/sql/table.h:2100 8 breakpoint keep y 0x00000000015273e3 in TABLE_LIST::set_table_ref_id(TABLE_SHARE*) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/table.h:2095 breakpoint already hit 1 time
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-2149689/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-preparedSQLError
- Oracle vs PostgreSQL Develop(16) - Prepared StatementOracleSQLdev
- java.sql.SQLException: Prepared or callable statement has more than 2000 parameter markers及解決方案JavaSQLException
- 追溯 MySQL Statement Cancellation TimerMySql
- Import all grant statement of users in mysql schema !ImportMySql
- Prepared SQL 效能測試SQL
- MySQL:You must reset your password using ALTER USER statement before executing this statement.MySql
- Statement
- ACM — Prepared for New Acmer 快速冪法ACM
- MySQL日誌警告'[Warning] Unsafe statement written to the binary log'MySql
- OpenStack Open Source Cloud Needs To Pick Up The PaceCloud
- JS - if else and else if statementJS
- HDU - 1702 - ACboy needs your help again!AI
- Mysql異常刨析:Could not commit JDBC transaction;No operations allowed after statement closedMySqlMITJDBC
- GCC編譯遇到“a label can only be part of a statement and a declaration is not a statement”問題GC編譯
- Statement (操作 SQL 語句)SQL
- jdbc Statement和PrepareStatement操作JDBCREST
- India Karnataka Government is prepared to set up textile parks in each districtGo
- 20 compliments that needs to be said to my girl from time to timeAI
- eclipse error .This project needs to migrate WTP metadata.EclipseErrorProject
- ORA-00845 memory_target needs larger /dev/shmdev
- JDBC入門(一):Statement物件JDBC物件
- JDBC - Statement物件 - executeBatch()和executeUpdate()JDBC物件BAT
- statement 、prepareStatement的用法和解釋REST
- Understanding the CREATE DATABASE Statement (69)Database
- prepare statement cache size influence databaseDatabase
- JDBCTM 指南:入門4 - Statement (轉)JDBC
- Step 7: Issue the CREATE DATABASE Statement (65)Database
- statement, session , transaction ,consistency 等概念Session
- Percona MySQL 5.6 語句加鎖報錯"ERROR 1665 (HY000): Cannot execute statement"MySqlError
- Open DB failed-DATAFILE NEEDS MORE RECOVERY TO BE CONSISTENT_1528788.1AI
- mybatis3:Invalid bound statement (not found)MyBatisS3
- MyBatis 錯誤:Invalid bound statement (not found)MyBatis
- mybatis 報錯: Invalid bound statement (not found)MyBatis
- PrepareStatement與Statement之間的區別REST
- 【翻譯】Specifying CREATE DATABASE Statement ClausesDatabase
- 【OH】Creating a Database with the CREATE DATABASE StatementDatabase
- Statement和PreparedStatement之間的區別