List:Commits« Previous MessageNext Message »
From:Mayank Prasad Date:January 4 2012 10:32am
Subject:bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3412 to 3413) WL#5767
View as plain text  
 3413 Mayank Prasad	2012-01-04
      WL#5767 : Statements Digest, Performance Schema
      
      Details:
       - Added code to avoid Identifier to be considered
         in reducing tokens for normalisation.

    modified:
      storage/perfschema/gen_pfs_lex_token.cc
      storage/perfschema/pfs_digest.cc
      storage/perfschema/pfs_digest.h
 3412 Mayank Prasad	2012-01-04
      WL#5767 : Statement Digest, Performance Schema
      
      Details:
       - Modified token array from int array to byte (char) array.
       - Stored identifiers as token array.
       - Modified test case statements_digest result accordingly.

    modified:
      mysql-test/suite/perfschema/r/statements_digest.result
      storage/perfschema/pfs_digest.cc
      storage/perfschema/pfs_digest.h
=== modified file 'storage/perfschema/gen_pfs_lex_token.cc'
--- a/storage/perfschema/gen_pfs_lex_token.cc	2011-12-28 12:40:43 +0000
+++ b/storage/perfschema/gen_pfs_lex_token.cc	2012-01-04 10:31:04 +0000
@@ -55,6 +55,7 @@ int tok_pfs_row_single_value_list= 0;
 int tok_pfs_row_possible_multiple_value= 0;
 int tok_pfs_row_multiple_value= 0;
 int tok_pfs_row_multiple_value_list= 0;
+int tok_pfs_unused= 0;
 
 void set_token(int tok, const char *str)
 {
@@ -207,6 +208,10 @@ void compute_tokens()
   max_token_seen++;
   tok_pfs_row_multiple_value_list= max_token_seen;
   set_token(tok_pfs_row_multiple_value_list, "(#,#),(#,#)");
+
+  max_token_seen++;
+  tok_pfs_unused= max_token_seen;
+  set_token(tok_pfs_unused, "UNUSED");
 }
 
 void print_tokens()
@@ -244,6 +249,7 @@ void print_tokens()
   printf("#define TOK_PFS_ROW_POSSIBLE_MULTIPLE_VALUE %d\n", tok_pfs_row_possible_multiple_value);
   printf("#define TOK_PFS_ROW_MULTIPLE_VALUE %d\n", tok_pfs_row_multiple_value);
   printf("#define TOK_PFS_ROW_MULTIPLE_VALUE_LIST %d\n", tok_pfs_row_multiple_value_list);
+  printf("#define TOK_PFS_UNUSED %d\n", tok_pfs_unused);
 }
 
 int main(int argc,char **argv)

=== modified file 'storage/perfschema/pfs_digest.cc'
--- a/storage/perfschema/pfs_digest.cc	2012-01-04 08:15:36 +0000
+++ b/storage/perfschema/pfs_digest.cc	2012-01-04 10:31:04 +0000
@@ -400,6 +400,7 @@ struct PSI_digest_locker* pfs_digest_sta
   */
   digest_storage->m_token_count= PFS_MAX_TOKEN_COUNT;
   digest_storage->m_byte_count= 0;
+  digest_storage->m_last_id_index= 0;
   while(digest_storage->m_token_count)
     digest_storage->m_token_array[--digest_storage->m_token_count]= 0;
 
@@ -439,15 +440,34 @@ void pfs_digest_add_token_v1(PSI_digest_
 
   /* 
      Take last_token 3 tokens collected till now. These tokens will be used
-     for normalisation.
+     in reduce for normalisation. Make sure not to consider ID tokens in reduce.
   */
-  int index, last_token, last_token2, last_token3;
-  index= digest_storage->m_byte_count-2;
-  READ_TOKEN(digest_storage->m_token_array, index, last_token);
-  index= digest_storage->m_byte_count-4;
-  READ_TOKEN(digest_storage->m_token_array, index ,last_token2);
-  index= digest_storage->m_byte_count-6;
-  READ_TOKEN(digest_storage->m_token_array, index ,last_token3);
+  uint last_token_index; 
+  uint last_token = TOK_PFS_UNUSED;
+  uint last_token2= TOK_PFS_UNUSED;
+  uint last_token3= TOK_PFS_UNUSED;
+  
+  if((digest_storage->m_last_id_index <= digest_storage->m_byte_count-2) &&
+     (digest_storage->m_token_count >= 1))
+  {
+    /* Take last token. */
+    last_token_index= digest_storage->m_byte_count-2;
+    READ_TOKEN(digest_storage->m_token_array, last_token_index, last_token);
+  }
+  if((digest_storage->m_last_id_index <= digest_storage->m_byte_count-4) &&
+     (digest_storage->m_token_count >= 2))
+  {
+    /* Take 2nd token from last. */
+    last_token_index= digest_storage->m_byte_count-4;
+    READ_TOKEN(digest_storage->m_token_array, last_token_index ,last_token2);
+  }
+  if((digest_storage->m_last_id_index <= digest_storage->m_byte_count-6) &&
+     (digest_storage->m_token_count >= 3))
+  {
+    /* Take 3rd token from last. */
+    last_token_index= digest_storage->m_byte_count-6;
+    READ_TOKEN(digest_storage->m_token_array, last_token_index ,last_token3);
+  }
 
   switch (token)
   {
@@ -528,7 +548,7 @@ void pfs_digest_add_token_v1(PSI_digest_
           digest_storage->m_byte_count-= 2;
           token= TOK_PFS_ROW_SINGLE_VALUE;
         
-          if (digest_storage->m_token_count >= 2)
+          if (digest_storage->m_token_count >= 3)
           {
             if((last_token3 == TOK_PFS_ROW_SINGLE_VALUE ||
                 last_token3 == TOK_PFS_ROW_SINGLE_VALUE_LIST) &&
@@ -556,7 +576,7 @@ void pfs_digest_add_token_v1(PSI_digest_
           digest_storage->m_byte_count-= 2;
           token= TOK_PFS_ROW_MULTIPLE_VALUE;
   
-          if (digest_storage->m_token_count >= 2)
+          if (digest_storage->m_token_count >= 3)
           {
             if((last_token3 == TOK_PFS_ROW_MULTIPLE_VALUE ||
                 last_token3 == TOK_PFS_ROW_MULTIPLE_VALUE_LIST) &&
@@ -586,6 +606,7 @@ void pfs_digest_add_token_v1(PSI_digest_
   if(token == IDENT || token == IDENT_QUOTED)
   {
     STORE_IDENTIFIER(digest_storage->m_token_array, digest_storage->m_byte_count, yylen, yytext);
+    digest_storage->m_last_id_index= digest_storage->m_byte_count;
   }
 
   digest_storage->m_token_count++;

=== modified file 'storage/perfschema/pfs_digest.h'
--- a/storage/perfschema/pfs_digest.h	2012-01-04 08:15:36 +0000
+++ b/storage/perfschema/pfs_digest.h	2012-01-04 10:31:04 +0000
@@ -48,6 +48,7 @@ struct {
 struct {
          uint m_token_count;
          uint m_byte_count;
+         uint m_last_id_index;
          char m_token_array[PFS_MAX_TOKEN_COUNT];
          PFS_digest_hash m_digest_hash;
        } typedef PFS_digest_storage;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3412 to 3413) WL#5767Mayank Prasad9 Jan