List:Commits« Previous MessageNext Message »
From:Marc Alff Date:July 7 2011 5:59pm
Subject:bzr push into mysql-trunk branch (marc.alff:3245)
View as plain text  
 3245 Marc Alff	2011-07-07 [merge]
      Local merge

    removed:
      storage/ndb/test/sql/
      storage/ndb/test/sql/BANK.sql
      storage/ndb/test/sql/T1.sql
      storage/ndb/test/sql/test_create_drop.pl
      storage/ndb/test/sql/test_range_bounds.pl
    added:
      mysql-test/include/explain_non_select.inc
      mysql-test/include/explain_utils.inc
      mysql-test/r/grant_explain_non_select.result
      mysql-test/r/innodb_explain_non_select_all.result
      mysql-test/r/innodb_explain_non_select_none.result
      mysql-test/r/myisam_explain_non_select_all.result
      mysql-test/r/myisam_explain_non_select_none.result
      mysql-test/r/secure_file_priv_win.result
      mysql-test/t/grant_explain_non_select.test
      mysql-test/t/innodb_explain_non_select_all.test
      mysql-test/t/innodb_explain_non_select_none.test
      mysql-test/t/myisam_explain_non_select_all.test
      mysql-test/t/myisam_explain_non_select_none.test
      mysql-test/t/secure_file_priv_win-master.opt
      mysql-test/t/secure_file_priv_win.test
      sql/opt_explain.cc
      sql/opt_explain.h
    modified:
      client/mysqltest.cc
      dbug/dbug.c
      include/mysql/plugin_audit.h
      libmysqld/lib_sql.cc
      mysql-test/include/subquery.inc
      mysql-test/r/alter_table.result
      mysql-test/r/ctype_utf16.result
      mysql-test/r/explain.result
      mysql-test/r/greedy_optimizer.result
      mysql-test/r/join_outer.result
      mysql-test/r/join_outer_jcl6.result
      mysql-test/r/partition_pruning.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/sp-security.result
      mysql-test/r/sp.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_jcl6.result
      mysql-test/r/xml.result
      mysql-test/suite/federated/federated.result
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/t/innodb-index.test
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/suite/sys_vars/t/all_vars.test
      mysql-test/t/alter_table.test
      mysql-test/t/ctype_utf16.test
      mysql-test/t/explain.test
      mysql-test/t/greedy_optimizer.test
      mysql-test/t/partition_pruning.test
      mysql-test/t/plugin_auth.test
      mysql-test/t/sp-security.test
      mysql-test/t/sp.test
      mysql-test/t/xml.test
      mysys/my_symlink.c
      plugin/audit_null/audit_null.c
      sql/CMakeLists.txt
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_subselect.cc
      sql/item_sum.cc
      sql/item_timefunc.cc
      sql/item_xmlfunc.cc
      sql/my_decimal.h
      sql/mysqld.cc
      sql/opt_range.cc
      sql/opt_range.h
      sql/protocol.cc
      sql/sp_head.cc
      sql/sql_acl.cc
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_parse.h
      sql/sql_partition.cc
      sql/sql_priv.h
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_string.h
      sql/sql_table.cc
      sql/sql_update.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      storage/innobase/btr/btr0cur.c
      storage/perfschema/pfs.cc
      support-files/mysql.spec.sh
      tests/mysql_client_test.c
      unittest/gunit/my_decimal-t.cc
      unittest/mysys/lf-t.c
=== modified file 'storage/innobase/include/sync0sync.ic'
--- a/storage/innobase/include/sync0sync.ic	2011-07-01 08:46:20 +0000
+++ b/storage/innobase/include/sync0sync.ic	2011-07-06 18:58:53 +0000
@@ -240,8 +240,8 @@ pfs_mutex_enter_func(
 	PSI_mutex_locker_state		state;
 
 	locker = PSI_CALL(get_thread_mutex_locker)(
-			&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
-	if (locker) {
+		&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
+	if (UNIV_LIKELY(locker != NULL)) {
 		PSI_CALL(start_mutex_wait)(locker, file_name, line);
 		mutex_enter_func(mutex, file_name, line);
 		PSI_CALL(end_mutex_wait)(locker, 0);

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-07-07 11:24:33 +0000
+++ b/storage/perfschema/pfs.cc	2011-07-07 17:57:35 +0000
@@ -1469,13 +1469,8 @@ open_table_v1(PSI_table_share *share, co
   if (unlikely(thread == NULL))
     return NULL;
 
-  if (unlikely(setup_objects_version != pfs_table_share->m_setup_objects_version))
-  {
-    pfs_table_share->refresh_setup_object_flags(thread);
-  }
-
   /* Do not instrument this table is all table instruments are disabled. */
-  if (! pfs_table_share->m_io_enabled && ! pfs_table_share->m_lock_enabled)
+  if (! pfs_table_share->m_enabled)
     return NULL;
 
   PFS_table *pfs_table= create_table(pfs_table_share, thread, identity);
@@ -1915,10 +1910,7 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
 
   DBUG_ASSERT(pfs_mutex->m_class != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-  PFS_mutex_class *klass= pfs_mutex->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_mutex->m_enabled)
     return NULL;
 
   register uint flags;
@@ -1933,7 +1925,7 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_mutex->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -1953,7 +1945,7 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_mutex->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_mutex->m_identity;
@@ -1966,7 +1958,7 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
   }
   else
   {
-    if (klass->m_timed)
+    if (pfs_mutex->m_timed)
     {
       flags= STATE_FLAG_TIMED;
       state->m_thread= NULL;
@@ -1976,7 +1968,6 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
       /*
         Complete shortcut.
       */
-      PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex *> (mutex);
       /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
       pfs_mutex->m_wait_stat.aggregate_counted();
       return NULL;
@@ -2006,10 +1997,7 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
 
   DBUG_ASSERT(pfs_rwlock->m_class != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-  PFS_rwlock_class *klass= pfs_rwlock->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_rwlock->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2024,7 +2012,7 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_rwlock->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2044,7 +2032,7 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_rwlock->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_rwlock->m_identity;
@@ -2057,7 +2045,7 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
   }
   else
   {
-    if (klass->m_timed)
+    if (pfs_rwlock->m_timed)
     {
       flags= STATE_FLAG_TIMED;
       state->m_thread= NULL;
@@ -2067,7 +2055,6 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
       /*
         Complete shortcut.
       */
-      PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock *> (rwlock);
       /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
       pfs_rwlock->m_wait_stat.aggregate_counted();
       return NULL;
@@ -2109,15 +2096,12 @@ get_thread_cond_locker_v1(PSI_cond_locke
 
   DBUG_ASSERT(pfs_cond->m_class != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-  PFS_cond_class *klass= pfs_cond->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_cond->m_enabled)
     return NULL;
 
   register uint flags;
 
-  if (klass->m_timed)
+  if (pfs_cond->m_timed)
     state->m_flags= STATE_FLAG_TIMED;
   else
     state->m_flags= 0;
@@ -2132,7 +2116,7 @@ get_thread_cond_locker_v1(PSI_cond_locke
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_cond->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2152,7 +2136,7 @@ get_thread_cond_locker_v1(PSI_cond_locke
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_cond->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_cond->m_identity;
@@ -2165,14 +2149,13 @@ get_thread_cond_locker_v1(PSI_cond_locke
   }
   else
   {
-    if (klass->m_timed)
+    if (pfs_cond->m_timed)
       flags= STATE_FLAG_TIMED;
     else
     {
       /*
         Complete shortcut.
       */
-      PFS_cond *pfs_cond= reinterpret_cast<PFS_cond *> (cond);
       /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
       pfs_cond->m_wait_stat.aggregate_counted();
       return NULL;
@@ -2247,16 +2230,9 @@ get_thread_table_io_locker_v1(PSI_table_
 
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
-  if (! flag_global_instrumentation)
+  if (! pfs_table->m_io_enabled)
     return NULL;
 
-  PFS_table_share *share= pfs_table->m_share;
-  if (! share->m_io_enabled)
-    return NULL;
-
-  PFS_instr_class *klass;
-  klass= &global_table_io_class;
-
   register uint flags;
 
   if (flag_thread_instrumentation)
@@ -2269,7 +2245,7 @@ get_thread_table_io_locker_v1(PSI_table_
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (share->m_io_timed)
+    if (pfs_table->m_io_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2283,8 +2259,9 @@ get_thread_table_io_locker_v1(PSI_table_
       state->m_wait= wait;
       flags|= STATE_FLAG_EVENT;
 
+      PFS_table_share *share= pfs_table->m_share;
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= &global_table_io_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_table->m_identity;
@@ -2303,7 +2280,7 @@ get_thread_table_io_locker_v1(PSI_table_
   }
   else
   {
-    if (share->m_io_timed)
+    if (pfs_table->m_io_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2330,6 +2307,7 @@ get_thread_table_lock_locker_v1(PSI_tabl
                                 PSI_table *table, PSI_table_lock_operation op, ulong op_flags)
 {
   DBUG_ASSERT(state != NULL);
+  DBUG_ASSERT((op == PSI_TABLE_LOCK) || (op == PSI_TABLE_EXTERNAL_LOCK));
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
 
   if (unlikely(pfs_table == NULL))
@@ -2337,18 +2315,10 @@ get_thread_table_lock_locker_v1(PSI_tabl
 
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
-  DBUG_ASSERT((op == PSI_TABLE_LOCK) || (op == PSI_TABLE_EXTERNAL_LOCK));
-
-  if (! flag_global_instrumentation)
-    return NULL;
-
-  PFS_table_share *share= pfs_table->m_share;
-  if (! share->m_lock_enabled)
+  if (! pfs_table->m_lock_enabled)
     return NULL;
 
-  PFS_instr_class *klass;
   PFS_TL_LOCK_TYPE lock_type;
-  klass= &global_table_lock_class;
 
   switch (op)
   {
@@ -2383,7 +2353,7 @@ get_thread_table_lock_locker_v1(PSI_tabl
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (share->m_lock_timed)
+    if (pfs_table->m_lock_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2397,8 +2367,9 @@ get_thread_table_lock_locker_v1(PSI_tabl
       state->m_wait= wait;
       flags|= STATE_FLAG_EVENT;
 
+      PFS_table_share *share= pfs_table->m_share;
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= &global_table_lock_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_table->m_identity;
@@ -2417,7 +2388,7 @@ get_thread_table_lock_locker_v1(PSI_tabl
   }
   else
   {
-    if (share->m_lock_timed)
+    if (pfs_table->m_lock_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2530,11 +2501,7 @@ get_thread_file_stream_locker_v1(PSI_fil
     return NULL; 
   DBUG_ASSERT(pfs_file->m_class != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
-  PFS_file_class *klass= pfs_file->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_file->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2549,7 +2516,7 @@ get_thread_file_stream_locker_v1(PSI_fil
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2569,7 +2536,7 @@ get_thread_file_stream_locker_v1(PSI_fil
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_file->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_file;
@@ -2585,7 +2552,7 @@ get_thread_file_stream_locker_v1(PSI_fil
   else
   {
     state->m_thread= NULL;
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2615,9 +2582,6 @@ get_thread_file_descriptor_locker_v1(PSI
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   if (unlikely((index < 0) || (index >= file_handle_max)))
     return NULL;
 
@@ -2637,8 +2601,7 @@ get_thread_file_descriptor_locker_v1(PSI
     file_handle_array[index]= NULL;
 
   DBUG_ASSERT(pfs_file->m_class != NULL);
-  PFS_instr_class *klass= pfs_file->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_file->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2653,7 +2616,7 @@ get_thread_file_descriptor_locker_v1(PSI
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2673,7 +2636,7 @@ get_thread_file_descriptor_locker_v1(PSI
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_file->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_file;
@@ -2689,7 +2652,7 @@ get_thread_file_descriptor_locker_v1(PSI
   else
   {
     state->m_thread= NULL;
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
     {
       flags= STATE_FLAG_TIMED;
     }

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_instr.cc	2011-07-06 18:58:53 +0000
@@ -581,6 +581,8 @@ PFS_mutex* create_mutex(PFS_mutex_class 
         {
           pfs->m_identity= identity;
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+          pfs->m_timed= klass->m_timed;
           pfs->m_wait_stat.reset();
           pfs->m_lock_stat.reset();
           pfs->m_owner= NULL;
@@ -640,6 +642,8 @@ PFS_rwlock* create_rwlock(PFS_rwlock_cla
         {
           pfs->m_identity= identity;
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+          pfs->m_timed= klass->m_timed;
           pfs->m_wait_stat.reset();
           pfs->m_lock.dirty_to_allocated();
           pfs->m_read_lock_stat.reset();
@@ -702,6 +706,8 @@ PFS_cond* create_cond(PFS_cond_class *kl
         {
           pfs->m_identity= identity;
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+          pfs->m_timed= klass->m_timed;
           pfs->m_cond_stat.m_signal_count= 0;
           pfs->m_cond_stat.m_broadcast_count= 0;
           pfs->m_wait_stat.reset();
@@ -1098,6 +1104,8 @@ search:
         if (pfs->m_lock.free_to_dirty())
         {
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+          pfs->m_timed= klass->m_timed;
           strncpy(pfs->m_filename, normalized_filename, normalized_length);
           pfs->m_filename[normalized_length]= '\0';
           pfs->m_filename_length= normalized_length;
@@ -1207,6 +1215,12 @@ PFS_table* create_table(PFS_table_share 
         {
           pfs->m_identity= identity;
           pfs->m_share= share;
+          pfs->m_io_enabled= share->m_enabled &&
+            flag_global_instrumentation && global_table_io_class.m_enabled;
+          pfs->m_io_timed= share->m_timed && global_table_io_class.m_timed;
+          pfs->m_lock_enabled= share->m_enabled &&
+            flag_global_instrumentation && global_table_lock_class.m_enabled;
+          pfs->m_lock_timed= share->m_timed && global_table_lock_class.m_timed;
           share->inc_refcount();
           pfs->m_table_stat.reset();
           pfs->m_opening_thread= opening_thread;
@@ -1525,4 +1539,130 @@ void aggregate_thread_statements(PFS_thr
                            global_instr_class_statements_array);
 }
 
+void update_mutex_derived_flags()
+{
+  PFS_mutex *pfs= mutex_array;
+  PFS_mutex *pfs_last= mutex_array + mutex_max;
+  PFS_mutex_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_mutex_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+void update_rwlock_derived_flags()
+{
+  PFS_rwlock *pfs= rwlock_array;
+  PFS_rwlock *pfs_last= rwlock_array + rwlock_max;
+  PFS_rwlock_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_rwlock_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+void update_cond_derived_flags()
+{
+  PFS_cond *pfs= cond_array;
+  PFS_cond *pfs_last= cond_array + cond_max;
+  PFS_cond_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_cond_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+void update_file_derived_flags()
+{
+  PFS_file *pfs= file_array;
+  PFS_file *pfs_last= file_array + file_max;
+  PFS_file_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_file_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+void update_table_derived_flags()
+{
+  PFS_table *pfs= table_array;
+  PFS_table *pfs_last= table_array + table_max;
+  PFS_table_share *share;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    share= sanitize_table_share(pfs->m_share);
+    if (likely(share != NULL))
+    {
+      pfs->m_io_enabled= share->m_enabled &&
+        flag_global_instrumentation && global_table_io_class.m_enabled;
+      pfs->m_io_timed= share->m_timed && global_table_io_class.m_timed;
+      pfs->m_lock_enabled= share->m_enabled &&
+        flag_global_instrumentation && global_table_lock_class.m_enabled;
+      pfs->m_lock_timed= share->m_timed && global_table_lock_class.m_timed;
+    }
+    else
+    {
+      pfs->m_io_enabled= false;
+      pfs->m_io_timed= false;
+      pfs->m_lock_enabled= false;
+      pfs->m_lock_timed= false;
+    }
+  }
+}
+
+void update_instruments_derived_flags()
+{
+  update_mutex_derived_flags();
+  update_rwlock_derived_flags();
+  update_cond_derived_flags();
+  update_file_derived_flags();
+  update_table_derived_flags();
+  /* nothing for stages and statements (no instances) */
+}
+
 /** @} */

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_instr.h	2011-07-06 18:58:53 +0000
@@ -50,6 +50,10 @@ struct PFS_instr
 {
   /** Internal lock. */
   pfs_lock m_lock;
+  /** Enabled flag. */
+  bool m_enabled;
+  /** Timed flag. */
+  bool m_timed;
   /** Instrument wait statistics. */
   PFS_single_stat m_wait_stat;
 };
@@ -138,6 +142,27 @@ struct PFS_file : public PFS_instr
 /** Instrumented table implementation. @see PSI_table. */
 struct PFS_table
 {
+  /**
+    True if table io instrumentation is enabled.
+    This flag is computed.
+  */
+  bool m_io_enabled;
+  /**
+    True if table lock instrumentation is enabled.
+    This flag is computed.
+  */
+  bool m_lock_enabled;
+  /**
+    True if table io instrumentation is timed.
+    This flag is computed.
+  */
+  bool m_io_timed;
+  /**
+    True if table lock instrumentation is timed.
+    This flag is computed.
+  */
+  bool m_lock_timed;
+
 public:
   /**
     Aggregate this table handle statistics to the parents.
@@ -278,6 +303,12 @@ struct PFS_thread : PFS_connection_slice
 {
   static PFS_thread* get_current_thread(void);
 
+  /** Thread instrumentation flag. */
+  bool m_enabled;
+  /** Size of @c m_events_waits_stack. */
+  uint m_events_waits_count;
+  /** Event ID counter */
+  ulonglong m_event_id;
   /** Internal lock. */
   pfs_lock m_lock;
   /** Pins for filename_hash. */
@@ -288,10 +319,6 @@ struct PFS_thread : PFS_connection_slice
   LF_PINS *m_setup_actor_hash_pins;
   /** Pins for setup_object_hash. */
   LF_PINS *m_setup_object_hash_pins;
-  /** Event ID counter */
-  ulonglong m_event_id;
-  /** Thread instrumentation flag. */
-  bool m_enabled;
   /** Internal thread identifier, unique. */
   ulong m_thread_internal_id;
   /** Parent internal thread identifier. */
@@ -300,8 +327,6 @@ struct PFS_thread : PFS_connection_slice
   ulong m_thread_id;
   /** Thread class. */
   PFS_thread_class *m_class;
-  /** Size of @c m_events_waits_stack. */
-  uint m_events_waits_count;
   /**
     Stack of events waits.
     This member holds the data for the table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT.
@@ -485,6 +510,19 @@ void aggregate_thread_waits(PFS_thread *
 void aggregate_thread_stages(PFS_thread *thread);
 void aggregate_thread_statements(PFS_thread *thread);
 
+/** Update derived flags for all mutex instances. */
+void update_mutex_derived_flags();
+/** Update derived flags for all rwlock instances. */
+void update_rwlock_derived_flags();
+/** Update derived flags for all condition instances. */
+void update_cond_derived_flags();
+/** Update derived flags for all file handles. */
+void update_file_derived_flags();
+/** Update derived flags for all table handles. */
+void update_table_derived_flags();
+/** Update derived flags for all instruments. */
+void update_instruments_derived_flags();
+
 /** @} */
 #endif
 

=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_instr_class.cc	2011-07-06 18:58:53 +0000
@@ -118,36 +118,6 @@ PFS_table_share *table_share_array= NULL
 PFS_instr_class global_table_io_class;
 PFS_instr_class global_table_lock_class;
 
-void PFS_instr_class::set_enabled(PFS_instr_class *pfs, bool enabled)
-{
-  pfs->m_enabled= enabled;
-
-  /*
-    When the table instruments are changed,
-    the cache on top of SETUP_OBJECTS is invalidated.
-  */
-  if ((pfs == & global_table_io_class) ||
-      (pfs == & global_table_lock_class))
-  {
-    setup_objects_version++;
-  }
-}
-
-void PFS_instr_class::set_timed(PFS_instr_class *pfs, bool timed)
-{
-  pfs->m_timed= timed;
-
-  /*
-    When the table instruments are changed,
-    the cache on top of SETUP_OBJECTS is invalidated.
-  */
-  if ((pfs == & global_table_io_class) ||
-      (pfs == & global_table_lock_class))
-  {
-    setup_objects_version++;
-  }
-}
-
 /**
   Hash index for instrumented table shares.
   This index is searched by table fully qualified name (@c PFS_table_share_key),
@@ -441,20 +411,11 @@ static void set_table_share_key(PFS_tabl
 
 void PFS_table_share::refresh_setup_object_flags(PFS_thread *thread)
 {
-  bool enabled;
-  bool timed;
-  m_setup_objects_version= setup_objects_version;
   lookup_setup_object(thread,
                       OBJECT_TYPE_TABLE,
                       m_schema_name, m_schema_name_length,
                       m_table_name, m_table_name_length,
-                      &enabled, &timed);
-
-  m_io_enabled= enabled && global_table_io_class.m_enabled;
-  m_io_timed= timed && global_table_io_class.m_timed;
-
-  m_lock_enabled= enabled && global_table_lock_class.m_enabled;
-  m_lock_timed= timed && global_table_lock_class.m_timed;
+                      &m_enabled, &m_timed);
 }
 
 /**
@@ -636,7 +597,6 @@ PFS_sync_key register_mutex_class(const 
     entry= &mutex_class_array[index];
     init_instr_class(entry, name, name_length, flags);
     entry->m_lock_stat.reset();
-    entry->m_index= index;
     entry->m_event_name_index= mutex_class_start + index;
     entry->m_singleton= NULL;
     /*
@@ -698,7 +658,6 @@ PFS_sync_key register_rwlock_class(const
     init_instr_class(entry, name, name_length, flags);
     entry->m_read_lock_stat.reset();
     entry->m_write_lock_stat.reset();
-    entry->m_index= index;
     entry->m_event_name_index= rwlock_class_start + index;
     entry->m_singleton= NULL;
     PFS_atomic::add_u32(&rwlock_class_allocated_count, 1);
@@ -732,7 +691,6 @@ PFS_sync_key register_cond_class(const c
   {
     entry= &cond_class_array[index];
     init_instr_class(entry, name, name_length, flags);
-    entry->m_index= index;
     entry->m_event_name_index= cond_class_start + index;
     entry->m_singleton= NULL;
     PFS_atomic::add_u32(&cond_class_allocated_count, 1);
@@ -871,7 +829,6 @@ PFS_file_key register_file_class(const c
   {
     entry= &file_class_array[index];
     init_instr_class(entry, name, name_length, flags);
-    entry->m_index= index;
     entry->m_event_name_index= file_class_start + index;
     entry->m_singleton= NULL;
     PFS_atomic::add_u32(&file_class_allocated_count, 1);
@@ -905,7 +862,6 @@ PFS_stage_key register_stage_class(const
   {
     entry= &stage_class_array[index];
     init_instr_class(entry, name, name_length, flags);
-    entry->m_index= index;
     entry->m_event_name_index= index;
     PFS_atomic::add_u32(&stage_class_allocated_count, 1);
 
@@ -939,7 +895,6 @@ PFS_statement_key register_statement_cla
   {
     entry= &statement_class_array[index];
     init_instr_class(entry, name, name_length, flags);
-    entry->m_index= index;
     entry->m_event_name_index= index;
     PFS_atomic::add_u32(&statement_class_allocated_count, 1);
 
@@ -1087,12 +1042,9 @@ PFS_table_share* find_or_create_table_sh
 
   PFS_table_share **entry;
   uint retry_count= 0;
-  uint version= 0;
   const uint retry_max= 3;
-  bool io_enabled= true;
-  bool lock_enabled= true;
-  bool io_timed= true;
-  bool lock_timed= true;
+  bool enabled= true;
+  bool timed= true;
 
 search:
   entry= reinterpret_cast<PFS_table_share**>
@@ -1115,21 +1067,11 @@ search:
 
   if (retry_count == 0)
   {
-    bool enabled;
-    bool timed;
-    version= setup_objects_version;
     lookup_setup_object(thread,
                         OBJECT_TYPE_TABLE,
                         schema_name, schema_name_length,
                         table_name, table_name_length,
                         &enabled, &timed);
-
-    io_enabled= enabled && global_table_io_class.m_enabled;
-    io_timed= timed && global_table_io_class.m_timed;
-
-    lock_enabled= enabled && global_table_lock_class.m_enabled;
-    lock_timed= timed && global_table_lock_class.m_timed;
-
     /*
       Even when enabled is false, a record is added in the dictionary:
       - It makes enabling a table already in the table cache possible,
@@ -1153,16 +1095,13 @@ search:
       {
         if (pfs->m_lock.free_to_dirty())
         {
-          pfs->m_setup_objects_version= version;
           pfs->m_key= key;
           pfs->m_schema_name= &pfs->m_key.m_hash_key[1];
           pfs->m_schema_name_length= schema_name_length;
           pfs->m_table_name= &pfs->m_key.m_hash_key[schema_name_length + 2];
           pfs->m_table_name_length= table_name_length;
-          pfs->m_io_enabled= io_enabled;
-          pfs->m_lock_enabled= lock_enabled;
-          pfs->m_io_timed= io_timed;
-          pfs->m_lock_timed= lock_timed;
+          pfs->m_enabled= enabled;
+          pfs->m_timed= timed;
           pfs->init_refcount();
           pfs->m_table_stat.reset();
           set_keys(pfs, share);
@@ -1347,5 +1286,16 @@ void reset_file_class_io(void)
     pfs->m_file_stat.m_io_stat.reset();
 }
 
+void update_table_share_derived_flags(PFS_thread *thread)
+{
+  PFS_table_share *pfs= table_share_array;
+  PFS_table_share *pfs_last= table_share_array + table_share_max;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    pfs->refresh_setup_object_flags(thread);
+  }
+}
+
 /** @} */
 

=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_instr_class.h	2011-07-06 18:58:53 +0000
@@ -76,16 +76,12 @@ extern uint wait_class_max;
 /** Information for all instrumentation. */
 struct PFS_instr_class
 {
-  /** Instrument name. */
-  char m_name[PFS_MAX_INFO_NAME_LENGTH];
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-  /** Instrument flags. */
-  int m_flags;
   /** True if this instrument is enabled. */
   bool m_enabled;
   /** True if this instrument is timed. */
   bool m_timed;
+  /** Instrument flags. */
+  int m_flags;
   /**
     Instrument name index.
     Self index in:
@@ -94,6 +90,10 @@ struct PFS_instr_class
     - EVENTS_STATEMENTS_SUMMARY_*_BY_EVENT_NAME for statements
   */
   uint m_event_name_index;
+  /** Instrument name. */
+  char m_name[PFS_MAX_INFO_NAME_LENGTH];
+  /** Length in bytes of @c m_name. */
+  uint m_name_length;
 
   bool is_singleton() const
   {
@@ -114,8 +114,6 @@ struct PFS_mutex_class : public PFS_inst
     This statistic is not exposed in user visible tables yet.
   */
   PFS_single_stat m_lock_stat;
-  /** Self index in @c mutex_class_array. */
-  uint m_index;
   /** Singleton instance. */
   PFS_mutex *m_singleton;
 };
@@ -135,8 +133,6 @@ struct PFS_rwlock_class : public PFS_ins
     This statistic is not exposed in user visible tables yet.
   */
   PFS_single_stat m_write_lock_stat;
-  /** Self index in @c rwlock_class_array. */
-  uint m_index;
   /** Singleton instance. */
   PFS_rwlock *m_singleton;
 };
@@ -151,8 +147,6 @@ struct PFS_cond_class : public PFS_instr
     This statistic is not exposed in user visible tables yet.
   */
   PFS_cond_stat m_cond_stat;
-  /** Self index in @c cond_class_array. */
-  uint m_index;
   /** Singleton instance. */
   PFS_cond *m_singleton;
 };
@@ -160,14 +154,14 @@ struct PFS_cond_class : public PFS_instr
 /** Instrumentation metadata of a thread. */
 struct PFS_thread_class
 {
-  /** Thread instrument name. */
-  char m_name[PFS_MAX_INFO_NAME_LENGTH];
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
   /** True if this thread instrument is enabled. */
   bool m_enabled;
   /** Singleton instance. */
   PFS_thread *m_singleton;
+  /** Thread instrument name. */
+  char m_name[PFS_MAX_INFO_NAME_LENGTH];
+  /** Length in bytes of @c m_name. */
+  uint m_name_length;
 };
 
 /** Key identifying a table share. */
@@ -236,18 +230,18 @@ public:
 
   void refresh_setup_object_flags(PFS_thread *thread);
 
-  /**
-    Setup object refresh version.
-    Cache version used when computing the enabled / timed flags.
-    @sa setup_objects_version
-    @sa m_io_enabled
-    @sa m_lock_enabled
-    @sa m_io_timed
-    @sa m_lock_timed
-  */
-  uint m_setup_objects_version;
   /** Internal lock. */
   pfs_lock m_lock;
+  /**
+    True if table instrumentation is enabled.
+    This flag is computed from the content of table setup_objects.
+  */
+  bool m_enabled;
+  /**
+    True if table instrumentation is timed.
+    This flag is computed from the content of table setup_objects.
+  */
+  bool m_timed;
   /** Search key. */
   PFS_table_share_key m_key;
   /** Schema name. */
@@ -258,18 +252,10 @@ public:
   const char *m_table_name;
   /** Length in bytes of @c m_table_name. */
   uint m_table_name_length;
-  /** True if table io instrumentation is enabled. */
-  bool m_io_enabled;
-  /** True if table lock instrumentation is enabled. */
-  bool m_lock_enabled;
-  /** True if table io instrumentation is timed. */
-  bool m_io_timed;
-  /** True if table lock instrumentation is timed. */
-  bool m_lock_timed;
-  /** Table statistics. */
-  PFS_table_stat m_table_stat;
   /** Number of indexes. */
   uint m_key_count;
+  /** Table statistics. */
+  PFS_table_stat m_table_stat;
   /** Index names. */
   PFS_table_key m_keys[MAX_KEY];
 
@@ -297,8 +283,6 @@ struct PFS_file_class : public PFS_instr
 {
   /** File usage statistics. */
   PFS_file_stat m_file_stat;
-  /** Self index in @c file_class_array. */
-  uint m_index;
   /** Singleton instance. */
   PFS_file *m_singleton;
 };
@@ -308,15 +292,11 @@ struct PFS_stage_class : public PFS_inst
 {
   /** Stage usage statistics. */
   PFS_stage_stat m_stage_stat;
-  /** Self index in @c stage_class_array. */
-  uint m_index;
 };
 
 /** Instrumentation metadata for a statement. */
 struct PFS_statement_class : public PFS_instr_class
 {
-  /** Self index in @c statement_class_array. */
-  uint m_index;
 };
 
 void init_event_name_sizing(const PFS_global_param *param);
@@ -410,6 +390,9 @@ extern PFS_table_share *table_share_arra
 
 void reset_file_class_io();
 
+/** Update derived flags for all table shares. */
+void update_table_share_derived_flags(PFS_thread *thread);
+
 /** @} */
 #endif
 

=== modified file 'storage/perfschema/pfs_setup_object.h'
--- a/storage/perfschema/pfs_setup_object.h	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_setup_object.h	2011-07-06 18:58:53 +0000
@@ -70,22 +70,6 @@ struct PFS_setup_object
   bool m_timed;
 };
 
-/**
-  Version number of the SETUP_OBJECTS cache.
-  The content of the SETUP_OBJECTS table,
-  and the content of SETUP_INSTRUMENTS table for instruments that apply to objects :
-  - wait/io/table/sql/handler
-  - wait/lock/table/sql/handler
-  is cached once for each object,
-  to avoid evaluating the object ENABLED and TIMED flags too frequently.
-  Incrementing @c setup_objects_version invalidates the cache.
-  @sa global_table_io_class
-  @sa global_table_lock_class
-  @sa PFS_table_share::refresh_setup_objects_flags
-  @sa PFS_table_share::m_setup_objects_version
-*/
-extern uint setup_objects_version;
-
 int init_setup_object(const PFS_global_param *param);
 void cleanup_setup_object(void);
 int init_setup_object_hash(void);

=== modified file 'storage/perfschema/table_setup_consumers.cc'
--- a/storage/perfschema/table_setup_consumers.cc	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/table_setup_consumers.cc	2011-07-06 18:58:53 +0000
@@ -29,47 +29,58 @@ static row_setup_consumers all_setup_con
 {
   {
     { C_STRING_WITH_LEN("events_stages_current") },
-    &flag_events_stages_current
+    &flag_events_stages_current,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_stages_history") },
-    &flag_events_stages_history
+    &flag_events_stages_history,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_stages_history_long") },
-    &flag_events_stages_history_long
+    &flag_events_stages_history_long,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_statements_current") },
-    &flag_events_statements_current
+    &flag_events_statements_current,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_statements_history") },
-    &flag_events_statements_history
+    &flag_events_statements_history,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_statements_history_long") },
-    &flag_events_statements_history_long
+    &flag_events_statements_history_long,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_waits_current") },
-    &flag_events_waits_current
+    &flag_events_waits_current,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_waits_history") },
-    &flag_events_waits_history
+    &flag_events_waits_history,
+    false
   },
   {
     { C_STRING_WITH_LEN("events_waits_history_long") },
-    &flag_events_waits_history_long
+    &flag_events_waits_history_long,
+    false
   },
   {
     { C_STRING_WITH_LEN("global_instrumentation") },
-    &flag_global_instrumentation
+    &flag_global_instrumentation,
+    true
   },
   {
     { C_STRING_WITH_LEN("thread_instrumentation") },
-    &flag_thread_instrumentation
+    &flag_thread_instrumentation,
+    false
   }
 };
 
@@ -218,6 +229,9 @@ int table_setup_consumers::update_row_va
     }
   }
 
+  if (m_row->m_refresh)
+    update_instruments_derived_flags();
+
   return 0;
 }
 

=== modified file 'storage/perfschema/table_setup_consumers.h'
--- a/storage/perfschema/table_setup_consumers.h	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/table_setup_consumers.h	2011-07-06 18:58:53 +0000
@@ -36,6 +36,8 @@ struct row_setup_consumers
   LEX_STRING m_name;
   /** Column ENABLED. */
   bool *m_enabled_ptr;
+  /** Hidden column, refresh. */
+  bool m_refresh;
 };
 
 /** Table PERFORMANCE_SCHEMA.SETUP_CONSUMERS. */

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2011-05-13 13:44:31 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2011-07-06 18:58:53 +0000
@@ -21,6 +21,7 @@
 #include "my_global.h"
 #include "my_pthread.h"
 #include "pfs_instr_class.h"
+#include "pfs_instr.h"
 #include "pfs_column_types.h"
 #include "pfs_column_values.h"
 #include "table_setup_instruments.h"
@@ -233,11 +234,11 @@ int table_setup_instruments::update_row_
         return HA_ERR_WRONG_COMMAND;
       case 1: /* ENABLED */
         value= (enum_yes_no) get_field_enum(f);
-        PFS_instr_class::set_enabled(m_row.m_instr_class, (value == ENUM_YES) ? true : false);
+        m_row.m_instr_class->m_enabled= (value == ENUM_YES) ? true : false;
         break;
       case 2: /* TIMED */
         value= (enum_yes_no) get_field_enum(f);
-        PFS_instr_class::set_timed(m_row.m_instr_class, (value == ENUM_YES) ? true : false);
+        m_row.m_instr_class->m_timed= (value == ENUM_YES) ? true : false;
         break;
       default:
         DBUG_ASSERT(false);
@@ -245,6 +246,35 @@ int table_setup_instruments::update_row_
     }
   }
 
+  switch (m_pos.m_index_1)
+  {
+    case pos_setup_instruments::VIEW_MUTEX:
+      update_mutex_derived_flags();
+      break;
+    case pos_setup_instruments::VIEW_RWLOCK:
+      update_rwlock_derived_flags();
+      break;
+    case pos_setup_instruments::VIEW_COND:
+      update_cond_derived_flags();
+      break;
+    case pos_setup_instruments::VIEW_THREAD:
+      /* Not used yet  */
+      break;
+    case pos_setup_instruments::VIEW_FILE:
+      update_file_derived_flags();
+      break;
+    case pos_setup_instruments::VIEW_TABLE:
+      update_table_derived_flags();
+      break;
+    case pos_setup_instruments::VIEW_STAGE:
+    case pos_setup_instruments::VIEW_STATEMENT:
+      /* No flag to update. */
+      break;
+    default:
+      DBUG_ASSERT(false);
+      break;
+  }
+
   return 0;
 }
 

=== modified file 'storage/perfschema/table_setup_objects.cc'
--- a/storage/perfschema/table_setup_objects.cc	2010-12-02 16:38:55 +0000
+++ b/storage/perfschema/table_setup_objects.cc	2011-07-06 18:58:53 +0000
@@ -81,6 +81,17 @@ table_setup_objects::m_share=
   false /* checked */
 };
 
+int update_derived_flags()
+{
+  PFS_thread *thread= PFS_thread::get_current_thread();
+  if (unlikely(thread == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  update_table_share_derived_flags(thread);
+  update_table_derived_flags();
+  return 0;
+}
+
 PFS_engine_table* table_setup_objects::create(void)
 {
   return new table_setup_objects();
@@ -89,6 +100,7 @@ PFS_engine_table* table_setup_objects::c
 int table_setup_objects::write_row(TABLE *table, unsigned char *buf,
                                    Field **fields)
 {
+  int result;
   Field *f;
   enum_object_type object_type= OBJECT_TYPE_TABLE;
   String object_schema_data("%", 1, &my_charset_utf8_bin);
@@ -134,13 +146,19 @@ int table_setup_objects::write_row(TABLE
   if (object_type != OBJECT_TYPE_TABLE)
     return HA_ERR_NO_REFERENCED_ROW;
 
-  return insert_setup_object(object_type, object_schema, object_name,
-                             enabled, timed);
+  result= insert_setup_object(object_type, object_schema, object_name,
+                              enabled, timed);
+  if (result == 0)
+    result= update_derived_flags();
+  return result;
 }
 
 int table_setup_objects::delete_all_rows(void)
 {
-  return reset_setup_object();
+  int result= reset_setup_object();
+  if (result == 0)
+    result= update_derived_flags();
+  return result;
 }
 
 ha_rows table_setup_objects::get_row_count(void)
@@ -285,6 +303,7 @@ int table_setup_objects::update_row_valu
                                            unsigned char *,
                                            Field **fields)
 {
+  int result;
   Field *f;
   enum_yes_no value;
 
@@ -314,14 +333,15 @@ int table_setup_objects::update_row_valu
     }
   }
 
-  setup_objects_version++;
-  return 0;
+  result= update_derived_flags();
+  return result;
 }
 
 int table_setup_objects::delete_row_values(TABLE *table,
                                            const unsigned char *buf,
                                            Field **fields)
 {
+  int result;
   Field *f;
   enum_object_type object_type= OBJECT_TYPE_TABLE;
   String object_schema_data("", 0, &my_charset_utf8_bin);
@@ -356,6 +376,9 @@ int table_setup_objects::delete_row_valu
   DBUG_ASSERT(object_schema != NULL);
   DBUG_ASSERT(object_name != NULL);
 
-  return delete_setup_object(object_type, object_schema, object_name);
+  result= delete_setup_object(object_type, object_schema, object_name);
+  if (result == 0)
+    result= update_derived_flags();
+  return result;
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marc.alff:3245) Marc Alff7 Jul