From: Mayank Prasad Date: August 8 2011 6:12am Subject: bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3374 to 3375) WL#5767 List-Archive: http://lists.mysql.com/commits/140548 Message-Id: <201108080612.p786C9bn002579@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3375 Mayank Prasad 2011-08-08 wl#5767 : PERFORMANCE SCHEMA, statement digest Details: additional Code changes for getting tokens from Lexer to PS function. modified: sql/sql_lex.cc sql/sql_lex.h 3374 Mayank Prasad 2011-08-03 WL#5767 : PERFORMANCE SCHEMA, statement digest Changes: -------- 1. Code changes to Adjust "SHOW ENGINE PERFORMANCE_SCHEMA STATUS". 2. Code changes to pass every token from Lexer to PS. modified: include/mysql/psi/psi.h include/mysql/psi/psi_abi_v1.h.pp include/mysql/psi/psi_abi_v2.h.pp mysys/psi_noop.cc sql/sql_lex.cc sql/sql_lex.h storage/perfschema/pfs.cc storage/perfschema/pfs_digest.cc storage/perfschema/pfs_digest.h storage/perfschema/pfs_engine_table.cc storage/perfschema/pfs_instr.cc storage/perfschema/pfs_instr.h === modified file 'sql/sql_lex.cc' --- a/sql/sql_lex.cc 2011-08-02 20:02:22 +0000 +++ b/sql/sql_lex.cc 2011-08-08 06:10:03 +0000 @@ -908,11 +908,17 @@ int MYSQLlex(void *arg, void *yythd) Passing token to PS function to calculate statement digest for this statement. */ - if( PSI_server != NULL && token != END_OF_INPUT && token != 0) + if(token != END_OF_INPUT && token != 0) { - uint yylen; + uint yylen=0,yylen_temp=0; char yychar[TOCK_NAME_LENGTH]={'\0'}; - yylen = lip->yyLength() + 1; + /* + get the length of processed token and make sure it doesn't exceed + TOCK_NAME_LENGTH. If it does, truncate it to TOCK_NAME_LENGTH. + */ + yylen_temp = lip->yyLength_PS(); + yylen = yylen_temp < TOCK_NAME_LENGTH ? yylen_temp : TOCK_NAME_LENGTH-1; + strncpy(yychar, lip->get_cpp_tok_start(), yylen); PSI_server->digest_add_token(lip->m_digest_psi,token,yychar,yylen); } === modified file 'sql/sql_lex.h' --- a/sql/sql_lex.h 2011-08-02 20:02:22 +0000 +++ b/sql/sql_lex.h 2011-08-08 06:10:03 +0000 @@ -1882,6 +1882,18 @@ public: DBUG_ASSERT(m_ptr > m_tok_start); return (uint) ((m_ptr - m_tok_start) - 1); } + + uint yyLength_PS() + { + /* + Length of the last token processed. + This new function is introduced because while using yylength(), there + were cases when (m_ptr < m_tok_start) and due to which it was aborting + when was called from SQLlex() for PS. + */ + DBUG_ASSERT(m_cpp_ptr >= m_cpp_tok_start); + return (uint) (m_cpp_ptr - m_cpp_tok_start); + } /** Get the utf8-body string. */ const char *get_body_utf8_str() No bundle (reason: useless for push emails).