List:Commits« Previous MessageNext Message »
From:Mayank Prasad Date:February 2 2012 8:20am
Subject:bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3421 to 3422) WL#5767
View as plain text  
 3422 Mayank Prasad	2012-02-02
      WL#5767 Performance Schema, Statements Digest
      
      Details:
      - Moved digest text calculation (get_digest_text call) from
        "during statement execution" to "during querying digest table".

    modified:
      storage/perfschema/pfs_digest.cc
      storage/perfschema/pfs_digest.h
      storage/perfschema/table_esms_by_digest.cc
      storage/perfschema/table_events_statements.cc
      storage/perfschema/table_helper.cc
 3421 Marc Alff	2012-02-01 [merge]
      Merge mysql-trunk --> mysql-trunk-wl5767

    added:
      mysql-test/include/function_defaults.inc
      mysql-test/include/function_defaults_notembedded.inc
      mysql-test/include/libdaemon_example.ini
      mysql-test/r/function_defaults.result
      mysql-test/r/function_defaults_notembedded.result
      mysql-test/std_data/onerow.xml
      mysql-test/suite/rpl/r/rpl_function_defaults.result
      mysql-test/suite/rpl/t/rpl_function_defaults.test
      mysql-test/t/function_defaults.test
      mysql-test/t/function_defaults_notembedded.test
      mysql-test/wl5874_updown
      sql/delayable_insert_operation.h
      unittest/gunit/copy_info-t.cc
      unittest/gunit/create_field-t.cc
      unittest/gunit/delayable_insert_operation-t.cc
      unittest/gunit/fake_table.h
      unittest/gunit/field_timestamp-t.cc
      unittest/gunit/item_func_now_local-t.cc
      unittest/gunit/mock_create_field.h
      unittest/gunit/mock_field_datetime.h
      unittest/gunit/mock_field_timestamp.h
      unittest/gunit/mock_field_timestampf.h
      unittest/gunit/sql_table-t.cc
    modified:
      client/mysql_plugin.c
      include/my_bitmap.h
      mysql-test/collections/default.daily
      mysql-test/collections/default.weekly
      mysql-test/include/subquery_sj.inc
      mysql-test/r/change_user.result
      mysql-test/r/create.result
      mysql-test/r/derived.result
      mysql-test/r/func_in_all.result
      mysql-test/r/group_by.result
      mysql-test/r/group_min_max.result
      mysql-test/r/index_merge_myisam.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_mrr_all.result
      mysql-test/r/innodb_mrr_cost_all.result
      mysql-test/r/join_cache_bka.result
      mysql-test/r/join_cache_bka_nixbnl.result
      mysql-test/r/join_cache_bkaunique.result
      mysql-test/r/join_cache_bnl.result
      mysql-test/r/join_cache_nojb.result
      mysql-test/r/myisam_explain_non_select_all.result
      mysql-test/r/mysql_plugin.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/mysqldump.result
      mysql-test/r/optimizer_debug_sync.result
      mysql-test/r/order_by_all.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_mat.result
      mysql-test/r/subquery_mat_none.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      mysql-test/r/subselect_innodb.result
      mysql-test/r/type_temporal_fractional.result
      mysql-test/r/type_timestamp.result
      mysql-test/suite/innodb/r/innodb_mysql.result
      mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
      mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
      mysql-test/t/change_user.test
      mysql-test/t/create.test
      mysql-test/t/group_by.test
      mysql-test/t/mysql_plugin.test
      mysql-test/t/mysqldump.test
      mysql-test/t/optimizer_debug_sync.test
      mysql-test/t/type_temporal_fractional.test
      mysql-test/t/type_timestamp.test
      mysys/my_bitmap.c
      sql/event_db_repository.cc
      sql/field.cc
      sql/field.h
      sql/field_conv.cc
      sql/ha_ndbcluster.cc
      sql/ha_partition.cc
      sql/item.cc
      sql/item.h
      sql/item_timefunc.cc
      sql/item_timefunc.h
      sql/log_event.cc
      sql/log_event_old.cc
      sql/rpl_info_table.cc
      sql/sp.cc
      sql/sp_head.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_executor.cc
      sql/sql_insert.cc
      sql/sql_insert.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_priv.h
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sql_table.h
      sql/sql_update.cc
      sql/table.cc
      sql/table.h
      sql/unireg.cc
      storage/archive/ha_archive.cc
      storage/csv/ha_tina.cc
      storage/example/ha_example.cc
      storage/federated/ha_federated.cc
      storage/heap/ha_heap.cc
      storage/innobase/fil/fil0fil.cc
      storage/innobase/handler/ha_innodb.cc
      storage/myisam/ha_myisam.cc
      storage/myisammrg/ha_myisammrg.cc
      unittest/gunit/CMakeLists.txt
=== modified file 'storage/perfschema/pfs_digest.cc'
--- a/storage/perfschema/pfs_digest.cc	2012-01-17 10:15:06 +0000
+++ b/storage/perfschema/pfs_digest.cc	2012-02-02 08:15:42 +0000
@@ -153,11 +153,6 @@ unsigned int digest_index= 1;
 static LF_HASH digest_hash;
 static bool digest_hash_inited= false;
 
-
-static void get_digest_text(char* digest_text,
-                            char* token_array,
-                            int byte_count);
-
 /**
   Initialize table EVENTS_STATEMENTS_SUMMARY_BY_DIGEST.
   @param digest_sizing      
@@ -291,11 +286,14 @@ find_or_create_digest(PFS_thread* thread
     */
     pfs= &statements_digest_stat_array[digest_index];
     
-    /* Calculate and set digest text. */
-    get_digest_text(pfs->m_digest_text,
-                    digest_storage->m_token_array,
-                    digest_storage->m_byte_count);
-    pfs->m_digest_text_length= strlen(pfs->m_digest_text);
+    /* 
+      Copy digest storage to statement_digest_stat_array so that it could be
+      used later to generate digest text.
+    */
+    pfs->m_digest_storage.m_byte_count= digest_storage->m_byte_count;
+    pfs->m_digest_storage.m_last_id_index= digest_storage->m_last_id_index;
+    memcpy(pfs->m_digest_storage.m_token_array, digest_storage->m_token_array, PFS_MAX_DIGEST_STORAGE_SIZE);
+    memcpy(pfs->m_digest_storage.m_digest_hash.m_md5, digest_storage->m_digest_hash.m_md5, 16);
 
     /* Set digest hash/LF Hash search key. */
     memcpy(pfs->m_md5_hash.m_md5, hash_key, 16);
@@ -348,10 +346,6 @@ void reset_esms_by_digest()
   */
   for (index= 0; index < statements_digest_size; index++)
   {
-    statements_digest_stat_array[index].m_digest[0]= '\0';
-    statements_digest_stat_array[index].m_digest_length= 0;
-    statements_digest_stat_array[index].m_digest_text[0]= '\0';;
-    statements_digest_stat_array[index].m_digest_text_length= 0;
     statements_digest_stat_array[index].m_md5_hash.m_md5[0]= '\0';
     statements_digest_stat_array[index].m_stat.reset();
   }
@@ -366,7 +360,7 @@ void reset_esms_by_digest()
 /*
   This function, iterates token array and updates digest_text.
 */
-static void get_digest_text(char* digest_text,
+void get_digest_text(char* digest_text,
                             char* token_array,
                             int byte_count)
 {

=== modified file 'storage/perfschema/pfs_digest.h'
--- a/storage/perfschema/pfs_digest.h	2012-01-09 07:25:42 +0000
+++ b/storage/perfschema/pfs_digest.h	2012-02-02 08:15:42 +0000
@@ -54,11 +54,10 @@ struct {
 /** A statement digest stat record. */
 struct PFS_statements_digest_stat
 {
-  char m_digest[COL_DIGEST_SIZE];
-  unsigned int m_digest_length;
-  char m_digest_text[COL_DIGEST_TEXT_SIZE];
-  unsigned int m_digest_text_length;
-  
+  /**
+    Digest Storage.
+  */
+  PFS_digest_storage m_digest_storage;
   /**
     Digest hash/LF Hash search key.
   */
@@ -80,6 +79,10 @@ void cleanup_digest_hash(void);
 PFS_statements_digest_stat* find_or_create_digest(PFS_thread*,
                                                   PFS_digest_storage*);
 
+void get_digest_text(char* digest_text,
+                            char* token_array,
+                            int byte_count);
+
 void reset_esms_by_digest();
 
 /* Exposing the data directly, for iterators. */

=== modified file 'storage/perfschema/table_esms_by_digest.cc'
--- a/storage/perfschema/table_esms_by_digest.cc	2012-01-17 10:15:06 +0000
+++ b/storage/perfschema/table_esms_by_digest.cc	2012-02-02 08:15:42 +0000
@@ -34,7 +34,6 @@ THR_LOCK table_esms_by_digest::m_table_l
 
 static const TABLE_FIELD_TYPE field_types[]=
 {
-  /* TBD */
   {
     { C_STRING_WITH_LEN("DIGEST") },
     { C_STRING_WITH_LEN("varchar(64)") },
@@ -222,11 +221,11 @@ int table_esms_by_digest::rnd_next(void)
   digest_stat= &statements_digest_stat_array[m_pos.m_index];
 
   /* 
-    If digest information exist for this record or
+    If MD5 HASH information exist for this record or
     If it is a record at index 0 of statements_digest_stat_array,
     make a new row.
   */
-  if(digest_stat->m_digest_text[0] != '\0' ||
+  if(digest_stat->m_md5_hash.m_md5[0] != '\0' ||
      m_pos.m_index == 0)
   {
     make_row(digest_stat);
@@ -246,11 +245,11 @@ table_esms_by_digest::rnd_pos(const void
   digest_stat= &statements_digest_stat_array[m_pos.m_index];
 
   /* 
-    If digest information exist for this record or
+    If MD5 HASH information exist for this record or
     If it is a record at index 0 of statements_digest_stat_array,
     make a new row.
   */
-  if(digest_stat->m_digest_text[0] != '\0' ||
+  if(digest_stat->m_md5_hash.m_md5[0] != '\0' ||
      m_pos.m_index == 0)
   {
     make_row(digest_stat);
@@ -267,7 +266,7 @@ void table_esms_by_digest::make_row(PFS_
   m_row.m_digest.make_row(digest_stat);
 
   /*
-   Get statements stats.
+    Get statements stats.
   */
   time_normalizer *normalizer= time_normalizer::get(statement_timer);
   m_row.m_stat.set(normalizer, & digest_stat->m_stat);
@@ -285,8 +284,8 @@ int table_esms_by_digest
     return HA_ERR_RECORD_DELETED;
 
   /* 
-     Set the null bits. It indicates how many fields could be null
-     in the table.
+    Set the null bits. It indicates how many fields could be null
+    in the table.
   */
   DBUG_ASSERT(table->s->null_bytes == 1);
   buf[0]= 0;

=== modified file 'storage/perfschema/table_events_statements.cc'
--- a/storage/perfschema/table_events_statements.cc	2012-01-31 06:34:29 +0000
+++ b/storage/perfschema/table_events_statements.cc	2012-02-02 08:15:42 +0000
@@ -368,23 +368,25 @@ void table_events_statements_common::mak
   /* 
     Filling up statement digest information.
   */
-  if(statement->statement_digest_stat_ptr)
+  PFS_statements_digest_stat *pfs= statement->statement_digest_stat_ptr;
+  if(pfs && pfs->m_md5_hash.m_md5[0] != '\0')
   {
-    MD5_HASH_TO_STRING(statement->statement_digest_stat_ptr->m_md5_hash.m_md5,
-                       statement->statement_digest_stat_ptr->m_digest);
-    statement->statement_digest_stat_ptr->m_digest_length= 16;
+    /*
+      Calculate digest from MD5 HASH collected to be shown as
+      DIGEST in this row.
+    */
+    MD5_HASH_TO_STRING(pfs->m_md5_hash.m_md5,
+                       m_row.m_digest.m_digest);
+    m_row.m_digest.m_digest_length= 16;
 
-    memcpy(m_row.m_digest.m_digest,
-           statement->statement_digest_stat_ptr->m_digest,
-           statement->statement_digest_stat_ptr->m_digest_length);
-    m_row.m_digest.m_digest_length=
-           statement->statement_digest_stat_ptr->m_digest_length;
-
-    memcpy(m_row.m_digest.m_digest_text,
-           statement->statement_digest_stat_ptr->m_digest_text,
-           statement->statement_digest_stat_ptr->m_digest_text_length);
-    m_row.m_digest.m_digest_text_length=
-           statement->statement_digest_stat_ptr->m_digest_text_length;
+    /* 
+      Caclulate digest_text information from the token array collected
+      to be shown as DIGEST_TEXT column.
+    */ 
+    get_digest_text(m_row.m_digest.m_digest_text,
+                    pfs->m_digest_storage.m_token_array,
+                    pfs->m_digest_storage.m_byte_count);
+    m_row.m_digest.m_digest_text_length= strlen(m_row.m_digest.m_digest_text);
   }
   else
   {

=== modified file 'storage/perfschema/table_helper.cc'
--- a/storage/perfschema/table_helper.cc	2012-01-17 10:15:06 +0000
+++ b/storage/perfschema/table_helper.cc	2012-02-02 08:15:42 +0000
@@ -104,35 +104,33 @@ void PFS_account_row::set_field(uint ind
 int PFS_digest_row::make_row(PFS_statements_digest_stat* pfs)
 {
   /*
-    Copy digest text from statements_digest_stat_array to be shown as
-    DIGEST_TEXT in this row.
-  */
-  m_digest_text_length= pfs->m_digest_text_length;
-  if (m_digest_text_length > sizeof(m_digest_text))
-    return 1;
-  if (m_digest_text_length > 0)
-    memcpy(m_digest_text, pfs->m_digest_text, sizeof(m_digest_text));
- 
-  /*
-    "NULL" value for digest text indicates special entry i.e. aggregated
+    "NULL" value for MD5_HASH indicates special entry i.e. aggregated
     stats at index 0 of statements_digest_stat_array. So do not calculate
-    digest as it should always be "NULL".
+    digest/digest_text as it should always be "NULL".
   */
-  if(m_digest_text_length != 0 &&
-     pfs->m_digest_text[0] != '\0') 
+  if(pfs->m_md5_hash.m_md5[0] != '\0')
   {
-    MD5_HASH_TO_STRING(pfs->m_md5_hash.m_md5, pfs->m_digest);
-    pfs->m_digest_length= 16;
     /*
-      Copy digest from statements_digest_stat_array to be shown as
+      Calculate digest from MD5 HASH collected to be shown as
       DIGEST in this row.
     */
-    m_digest_length= pfs->m_digest_length;
-    memcpy(m_digest, pfs->m_digest, sizeof(m_digest));
+    MD5_HASH_TO_STRING(pfs->m_md5_hash.m_md5, m_digest);
+    m_digest_length= 16;
+
+    /* 
+      Caclulate digest_text information from the token array collected
+      to be shown as DIGEST_TEXT column.
+    */ 
+    get_digest_text(m_digest_text,
+                    pfs->m_digest_storage.m_token_array,
+                    pfs->m_digest_storage.m_byte_count);
+    m_digest_text_length= strlen(m_digest_text);
+
   }
   else
   {
     m_digest_length= 0;
+    m_digest_text_length= 0;
   }
   
   return 0;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3421 to 3422) WL#5767Mayank Prasad2 Feb