List:Commits« Previous MessageNext Message »
From:Marc Alff Date:November 8 2011 4:28am
Subject:bzr push into mysql-trunk branch (marc.alff:3569 to 3570)
View as plain text  
 3570 Marc Alff	2011-11-07
      Fixed several issues affecting the embedded build.
      
      1) in psi.h, do not compile with the performance schema instrumentation,
      for the embedded build.
      
      2) in mysql_socket.h, cleanup compiler warnings when building
      without the socket instrumentation
      
      3) in mysqld.cc, remove un needed code for embedded builds
      
      4) in sql_class.h, remove un needed instrumentation state,
      when compiling for embedded

    modified:
      include/mysql/psi/mysql_socket.h
      include/mysql/psi/psi.h
      sql/mysqld.cc
      sql/sql_class.h
      sql/sql_parse.cc
 3569 Tor Didriksen	2011-11-07
      Bug#11748783 37359: FILESORT CAN BE MORE EFFICIENT
      
      filesort() initializes space for
      MIN(Estimate rows in table, max rows that can fit in sort buffer) rows
      before doing the sort. For queries that have a "where" clause, the
      number of rows estimated by estimate_rows_upper_bound can be much
      higher than rows that match the where clause.
      
      The initialization is done via make_char_array() in filesort.cc and is
      very expensive when the estimate is off.
      
      Solution: lazy-init of the pointers in the sort buffer.
     @ mysql-test/r/filesort_debug.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/filesort_pq.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/general2_no_prot.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/general2_ps_prot.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/general_no_prot_none.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/general_ps_prot_none.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/subquery_no_prot.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/suite/opt_trace/r/subquery_ps_prot.result
        Add sort_buffer_size to opt_trace.
     @ mysql-test/t/filesort_debug.test
        Add sort_buffer_size to opt_trace.
     @ sql/filesort.cc
        Use Filesort_buffer* rather than uchar **
     @ sql/filesort_utils.cc
        New class Filesort_buffer, which wraps the uchar** buffer.
     @ sql/filesort_utils.h
        New class Filesort_buffer, which wraps the uchar** buffer.
     @ sql/table.h
        New class Filesort_buffer, which wraps the uchar** buffer.
        Rename FILESORT_INFO => Filesort_info.
     @ unittest/gunit/CMakeLists.txt
        New unit test.
     @ unittest/gunit/filesort_buffer-t.cc
        New unit test.

    added:
      unittest/gunit/filesort_buffer-t.cc
    modified:
      mysql-test/r/filesort_debug.result
      mysql-test/suite/opt_trace/r/filesort_pq.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/subquery_no_prot.result
      mysql-test/suite/opt_trace/r/subquery_ps_prot.result
      mysql-test/t/filesort_debug.test
      sql/filesort.cc
      sql/filesort_utils.cc
      sql/filesort_utils.h
      sql/table.h
      unittest/gunit/CMakeLists.txt
=== modified file 'include/mysql/psi/mysql_socket.h'
--- a/include/mysql/psi/mysql_socket.h	2011-09-20 15:42:23 +0000
+++ b/include/mysql/psi/mysql_socket.h	2011-11-08 04:28:05 +0000
@@ -97,7 +97,7 @@ mysql_socket_invalid()
   MYSQL_SOCKET mysql_socket= {INVALID_SOCKET, NULL};
   return mysql_socket;
 }
-
+
 /**
   Set socket descriptor and address.
   @param socket nstrumented socket
@@ -105,10 +105,19 @@ mysql_socket_invalid()
   @param addr unformatted socket address
   @param adr_len length of socket addres
 */
+
 static inline void
-mysql_socket_set_address(MYSQL_SOCKET socket,
-                         const struct sockaddr *addr,
-                         socklen_t addr_len)
+mysql_socket_set_address(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+  MYSQL_SOCKET socket,
+  const struct sockaddr *addr,
+  socklen_t addr_len
+#else
+  MYSQL_SOCKET socket __attribute__ ((unused)),
+  const struct sockaddr *addr __attribute__ ((unused)),
+  socklen_t addr_len __attribute__ ((unused))
+#endif
+)
 {
 #ifdef HAVE_PSI_SOCKET_INTERFACE
   PSI_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
@@ -121,7 +130,13 @@ mysql_socket_set_address(MYSQL_SOCKET so
   @param thread instrumented owning thread
 */
 static inline void
-mysql_socket_set_thread_owner(MYSQL_SOCKET socket)
+mysql_socket_set_thread_owner(
+#ifdef HAVE_PSI_SOCKET_INTERFACE
+MYSQL_SOCKET socket
+#else
+MYSQL_SOCKET socket __attribute__ ((unused))
+#endif
+)
 {
 #ifdef HAVE_PSI_SOCKET_INTERFACE
   PSI_CALL(set_socket_thread_owner)(socket.m_psi);

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2011-11-03 16:03:34 +0000
+++ b/include/mysql/psi/psi.h	2011-11-08 04:28:05 +0000
@@ -16,6 +16,18 @@
 #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 
+#ifdef EMBEDDED_LIBRARY
+#define DISABLE_PSI_MUTEX
+#define DISABLE_PSI_RWLOCK
+#define DISABLE_PSI_COND
+#define DISABLE_PSI_FILE
+#define DISABLE_PSI_TABLE
+#define DISABLE_PSI_SOCKET
+#define DISABLE_PSI_STAGE
+#define DISABLE_PSI_STATEMENT
+#define DISABLE_PSI_IDLE
+#endif /* EMBEDDED_LIBRARY */
+
 #ifndef MY_GLOBAL_INCLUDED
 /*
   Make sure a .c or .cc file contains an include to my_global.h first.

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-11-03 16:03:34 +0000
+++ b/sql/mysqld.cc	2011-11-08 04:28:05 +0000
@@ -708,6 +708,7 @@ void set_remaining_args(int argc, char *
 PSI_statement_info stmt_info_new_packet;
 #endif
 
+#ifndef EMBEDDED_LIBRARY
 void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused: count */)
 {
   THD *thd;
@@ -783,6 +784,7 @@ void init_net_server_extension(THD *thd)
   thd->net.extension= NULL;
 #endif
 }
+#endif /* EMBEDDED_LIBRARY */
 
 /*
   Since buffered_option_error_reporter is only used currently

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-11-02 23:29:01 +0000
+++ b/sql/sql_class.h	2011-11-08 04:28:05 +0000
@@ -2362,20 +2362,19 @@ public:
 
   /** Current statement instrumentation. */
   PSI_statement_locker *m_statement_psi;
-#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#ifndef EMBEDDED_LIBRARY
   /** Current statement instrumentation state. */
   PSI_statement_locker_state m_statement_state;
-#endif
+#endif /* EMBEDDED_LIBRARY */
   /** Idle instrumentation. */
   PSI_idle_locker *m_idle_psi;
-#ifdef HAVE_PSI_IDLE_INTERFACE
+#ifndef EMBEDDED_LIBRARY
   /** Idle instrumentation state. */
   PSI_idle_locker_state m_idle_state;
-#endif
+#endif /* EMBEDDED_LIBRARY */
   /** True if the server code is IDLE for this connection. */
   bool m_server_idle;
 
-
   /*
     Id of current query. Statement can be reused to execute several queries
     query_id is global in context of the whole MySQL server.

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-11-03 16:03:34 +0000
+++ b/sql/sql_parse.cc	2011-11-08 04:28:05 +0000
@@ -1597,14 +1597,15 @@ bool dispatch_command(enum enum_server_c
 
   thd->reset_query();
   thd->set_command(COM_SLEEP);
-  dec_thread_running();
-  thd->packet.shrink(thd->variables.net_buffer_length);	// Reclaim some memory
-  free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
 
   /* Performance Schema Interface instrumentation, end */
   MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
   thd->m_statement_psi= NULL;
 
+  dec_thread_running();
+  thd->packet.shrink(thd->variables.net_buffer_length);	// Reclaim some memory
+  free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
+
   /* DTRACE instrumentation, end */
   if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
   {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marc.alff:3569 to 3570) Marc Alff11 Nov