~percona-dev/percona-server/release-5.5.11-20.2-fix-bug-764138

« back to all changes in this revision

Viewing changes to userstat.patch

  • Committer: Ignacio Nin
  • Date: 2011-03-27 18:30:06 UTC
  • mfrom: (88.2.3 5.5.10)
  • Revision ID: ignacio.nin@percona.com-20110327183006-ij0o2pdyhzaerish
Merge 5.5.10 changes

Merge 5.5.10 changes to release-5.5.9-20.1 in order to create release-5.5.10-20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
 // the following is for checking tables
243
243
 
244
244
 #define HA_ADMIN_ALREADY_DONE    1
245
 
@@ -561,10 +565,12 @@
 
245
@@ -553,10 +557,12 @@
246
246
 enum enum_schema_tables
247
247
 {
248
248
   SCH_CHARSETS= 0,
255
255
   SCH_ENGINES,
256
256
   SCH_EVENTS,
257
257
   SCH_FILES,
258
 
@@ -592,9 +598,12 @@
 
258
@@ -584,9 +590,12 @@
259
259
   SCH_TABLE_CONSTRAINTS,
260
260
   SCH_TABLE_NAMES,
261
261
   SCH_TABLE_PRIVILEGES,
268
268
   SCH_VARIABLES,
269
269
   SCH_VIEWS
270
270
 };
271
 
@@ -1209,6 +1218,9 @@
 
271
@@ -1201,6 +1210,9 @@
272
272
   bool locked;
273
273
   bool implicit_emptied;                /* Can be !=0 only if HEAP */
274
274
   const COND *pushed_cond;
278
278
   /**
279
279
     next_insert_id is the next value which should be inserted into the
280
280
     auto_increment column: in a inserting-multi-row statement (like INSERT
281
 
@@ -1260,10 +1272,12 @@
 
281
@@ -1252,10 +1264,12 @@
282
282
     ref_length(sizeof(my_off_t)),
283
283
     ft_handler(0), inited(NONE),
284
284
     locked(FALSE), implicit_emptied(0),
293
293
   virtual ~handler(void)
294
294
   {
295
295
     DBUG_ASSERT(locked == FALSE);
296
 
@@ -1386,6 +1400,8 @@
 
296
@@ -1378,6 +1392,8 @@
297
297
   {
298
298
     table= table_arg;
299
299
     table_share= share;
302
302
   }
303
303
   virtual double scan_time()
304
304
   { return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; }
305
 
@@ -1753,6 +1769,8 @@
 
305
@@ -1745,6 +1761,8 @@
306
306
   virtual bool is_crashed() const  { return 0; }
307
307
   virtual bool auto_repair() const { return 0; }
308
308
 
370
370
 /*
371
371
   Log error with all enabled log event handlers
372
372
 
373
 
@@ -5042,6 +5049,8 @@
 
373
@@ -5041,6 +5048,8 @@
374
374
                              thd->first_successful_insert_id_in_prev_stmt_for_binlog);
375
375
           if (e.write(file))
376
376
             goto err;
379
379
         }
380
380
         if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
381
381
         {
382
 
@@ -5053,12 +5062,16 @@
 
382
@@ -5052,12 +5061,16 @@
383
383
                              minimum());
384
384
           if (e.write(file))
385
385
             goto err;
396
396
         }
397
397
         if (thd->user_var_events.elements)
398
398
         {
399
 
@@ -5081,6 +5094,8 @@
 
399
@@ -5080,6 +5093,8 @@
400
400
                                  flags);
401
401
             if (e.write(file))
402
402
               goto err;
405
405
           }
406
406
         }
407
407
       }
408
 
@@ -5092,6 +5107,8 @@
 
408
@@ -5091,6 +5106,8 @@
409
409
     if (event_info->write(file) ||
410
410
         DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
411
411
       goto err;
414
414
 
415
415
     error= 0;
416
416
 err:
417
 
@@ -5277,7 +5294,8 @@
 
417
@@ -5276,7 +5293,8 @@
418
418
     be reset as a READ_CACHE to be able to read the contents from it.
419
419
  */
420
420
 
424
424
 {
425
425
   Mutex_sentry sentry(lock_log ? &LOCK_log : NULL);
426
426
 
427
 
@@ -5324,6 +5342,7 @@
 
427
@@ -5323,6 +5341,7 @@
428
428
       /* write the first half of the split header */
429
429
       if (my_b_write(&log_file, header, carry))
430
430
         return ER_ERROR_ON_WRITE;
432
432
 
433
433
       /*
434
434
         copy fixed second half of header to cache so the correct
435
 
@@ -5392,6 +5411,7 @@
 
435
@@ -5391,6 +5410,7 @@
436
436
     /* Write data to the binary log file */
437
437
     if (my_b_write(&log_file, cache->read_pos, length))
438
438
       return ER_ERROR_ON_WRITE;
440
440
     cache->read_pos=cache->read_end;           // Mark buffer used up
441
441
   } while ((length= my_b_fill(cache)));
442
442
 
443
 
@@ -5506,20 +5526,23 @@
 
443
@@ -5505,20 +5525,23 @@
444
444
       Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0);
445
445
       if (qinfo.write(&log_file))
446
446
         goto err;
490
490
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
491
491
--- a/sql/mysqld.cc     2010-12-03 20:58:26.000000000 +0300
492
492
+++ b/sql/mysqld.cc     2010-12-30 02:04:50.000000000 +0300
493
 
@@ -438,6 +438,7 @@
 
493
@@ -439,6 +439,7 @@
494
494
 uint    opt_debug_sync_timeout= 0;
495
495
 #endif /* defined(ENABLED_DEBUG_SYNC) */
496
496
 my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
498
498
 my_bool opt_optimizer_fix= 0;
499
499
 /*
500
500
   True if there is at least one per-hour limit for some user, so we should
501
 
@@ -489,6 +490,7 @@
 
501
@@ -490,6 +491,7 @@
502
502
 ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
503
503
 ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
504
504
 ulong max_connections, max_connect_errors;
506
506
 
507
507
 /* flashcache */
508
508
 int cachedev_fd;
509
 
@@ -633,7 +635,9 @@
 
509
@@ -634,7 +636,9 @@
510
510
   LOCK_crypt,
511
511
   LOCK_global_system_variables,
512
512
   LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
517
517
 /**
518
518
   The below lock protects access to two global server variables:
519
519
   max_prepared_stmt_count and prepared_stmt_count. These variables
520
 
@@ -1493,6 +1497,11 @@
 
520
@@ -1494,6 +1498,11 @@
521
521
 #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
522
522
   query_response_time_free();
523
523
 #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
529
529
 #ifdef HAVE_REPLICATION
530
530
   end_slave_list();
531
531
 #endif
532
 
@@ -1596,6 +1605,10 @@
 
532
@@ -1597,6 +1606,10 @@
533
533
   mysql_cond_destroy(&COND_thread_cache);
534
534
   mysql_cond_destroy(&COND_flush_thread_cache);
535
535
   mysql_cond_destroy(&COND_manager);
540
540
 }
541
541
 #endif /*EMBEDDED_LIBRARY*/
542
542
 
543
 
@@ -3019,6 +3032,7 @@
 
543
@@ -3033,6 +3046,7 @@
544
544
   {"show_binlog_events",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
545
545
   {"show_binlogs",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
546
546
   {"show_charsets",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
548
548
   {"show_collations",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
549
549
   {"show_contributors",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS},
550
550
   {"show_create_db",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
551
 
@@ -3039,6 +3053,7 @@
 
551
@@ -3053,6 +3067,7 @@
552
552
 #endif
553
553
   {"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS},
554
554
   {"show_grants",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
556
556
   {"show_keys",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
557
557
   {"show_master_status",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
558
558
   {"show_new_master",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
559
 
@@ -3058,10 +3073,13 @@
 
559
@@ -3072,10 +3087,13 @@
560
560
   {"show_slave_status_nolock", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_NOLOCK_STAT]), SHOW_LONG_STATUS},
561
561
   {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
562
562
   {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
570
570
   {"show_variables",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
571
571
   {"show_warnings",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
572
572
   {"slave_start",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
573
 
@@ -3582,6 +3600,13 @@
 
573
@@ -3601,6 +3619,13 @@
574
574
   mysql_mutex_init(key_LOCK_server_started,
575
575
                    &LOCK_server_started, MY_MUTEX_INIT_FAST);
576
576
   mysql_cond_init(key_COND_server_started, &COND_server_started, NULL);
584
584
   sp_cache_init();
585
585
 #ifdef HAVE_EVENT_SCHEDULER
586
586
   Events::init_mutexes();
587
 
@@ -3951,6 +3976,9 @@
 
587
@@ -3970,6 +3995,9 @@
588
588
   query_response_time_init();
589
589
 #endif // HAVE_RESPONSE_TIME_DISTRIBUTION
590
590
   /* We have to initialize the storage engines before CSV logging */
594
594
   if (ha_init())
595
595
   {
596
596
     sql_print_error("Can't init databases");
597
 
@@ -4087,6 +4115,9 @@
 
597
@@ -4106,6 +4134,9 @@
598
598
 
599
599
   init_max_user_conn();
600
600
   init_update_queries();
604
604
   DBUG_RETURN(0);
605
605
 }
606
606
 
607
 
@@ -5118,6 +5149,7 @@
 
607
@@ -5139,6 +5170,7 @@
608
608
     {
609
609
       sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
610
610
     }
612
612
     delete thd;
613
613
     DBUG_VOID_RETURN;
614
614
   }
615
 
@@ -7817,6 +7849,8 @@
 
615
@@ -7834,6 +7866,8 @@
616
616
   key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
617
617
   key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
618
618
   key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
621
621
   key_LOCK_gdl, key_LOCK_global_system_variables,
622
622
   key_LOCK_manager,
623
623
   key_LOCK_prepared_stmt_count,
624
 
@@ -7854,6 +7888,13 @@
 
624
@@ -7871,6 +7905,13 @@
625
625
   { &key_LOCK_delayed_insert, "LOCK_delayed_insert", PSI_FLAG_GLOBAL},
626
626
   { &key_LOCK_delayed_status, "LOCK_delayed_status", PSI_FLAG_GLOBAL},
627
627
   { &key_LOCK_error_log, "LOCK_error_log", PSI_FLAG_GLOBAL},
694
694
 extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
695
695
 #ifdef HAVE_OPENSSL
696
696
 extern mysql_mutex_t LOCK_des_key_file;
697
 
@@ -452,6 +464,16 @@
 
697
@@ -451,6 +463,16 @@
698
698
   return id;
699
699
 }
700
700
 
738
738
diff -ruN a/sql/sql_class.cc b/sql/sql_class.cc
739
739
--- a/sql/sql_class.cc  2010-12-03 20:58:26.000000000 +0300
740
740
+++ b/sql/sql_class.cc  2010-12-30 02:41:40.000000000 +0300
741
 
@@ -601,6 +601,13 @@
 
741
@@ -602,6 +602,13 @@
742
742
   mysys_var=0;
743
743
   binlog_evt_union.do_union= FALSE;
744
744
   enable_slow_log= 0;
752
752
 #ifndef DBUG_OFF
753
753
   dbug_sentry=THD_SENTRY_MAGIC;
754
754
 #endif
755
 
@@ -981,6 +988,7 @@
 
755
@@ -982,6 +989,7 @@
756
756
     variables.option_bits|= OPTION_BIN_LOG;
757
757
   else
758
758
     variables.option_bits&= ~OPTION_BIN_LOG;
760
760
 
761
761
 #if defined(ENABLED_DEBUG_SYNC)
762
762
   /* Initialize the Debug Sync Facility. See debug_sync.cc. */
763
 
@@ -988,6 +996,94 @@
 
763
@@ -989,6 +997,94 @@
764
764
 #endif /* defined(ENABLED_DEBUG_SYNC) */
765
765
 }
766
766
 
855
855
 
856
856
 /*
857
857
   Init THD for query processing.
858
 
@@ -1722,6 +1818,32 @@
 
858
@@ -1723,6 +1819,32 @@
859
859
 }
860
860
 #endif
861
861
 
888
888
 
889
889
 struct Item_change_record: public ilink
890
890
 {
891
 
@@ -1898,6 +2020,7 @@
 
891
@@ -1899,6 +2021,7 @@
892
892
   }
893
893
 
894
894
   thd->sent_row_count++;
896
896
 
897
897
   if (thd->vio_ok())
898
898
     DBUG_RETURN(protocol->write());
899
 
@@ -1990,6 +2113,7 @@
 
899
@@ -1991,6 +2114,7 @@
900
900
 select_export::~select_export()
901
901
 {
902
902
   thd->sent_row_count=row_count;
904
904
 }
905
905
 
906
906
 
907
 
@@ -3013,6 +3137,7 @@
 
907
@@ -3014,6 +3138,7 @@
908
908
   if (likely(thd != 0))
909
909
   { /* current_thd==0 when close_connection() calls net_send_error() */
910
910
     thd->status_var.bytes_sent+= length;
912
912
   }
913
913
 }
914
914
 
915
 
@@ -3020,6 +3145,7 @@
 
915
@@ -3021,6 +3146,7 @@
916
916
 void thd_increment_bytes_received(ulong length)
917
917
 {
918
918
   current_thd->status_var.bytes_received+= length;
2461
2461
 /***************************************************************************
2462
2462
 ** List all table types supported
2463
2463
 ***************************************************************************/
2464
 
@@ -799,6 +836,7 @@
 
2464
@@ -800,6 +837,7 @@
2465
2465
                sctx->master_access);
2466
2466
   if (!(db_access & DB_ACLS) && check_grant_db(thd,dbname))
2467
2467
   {
2469
2469
     my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
2470
2470
              sctx->priv_user, sctx->host_or_ip, dbname);
2471
2471
     general_log_print(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
2472
 
@@ -2351,6 +2389,284 @@
 
2472
@@ -2352,6 +2390,284 @@
2473
2473
   DBUG_RETURN(res);
2474
2474
 }
2475
2475
 
2754
2754
 
2755
2755
 /* collect status for all running threads */
2756
2756
 
2757
 
@@ -7512,6 +7828,104 @@
 
2757
@@ -7513,6 +7829,104 @@
2758
2758
 };
2759
2759
 
2760
2760
 
2859
2859
 ST_FIELD_INFO processlist_fields_info[]=
2860
2860
 {
2861
2861
   {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
2862
 
@@ -7701,6 +8115,8 @@
 
2862
@@ -7702,6 +8116,8 @@
2863
2863
 {
2864
2864
   {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
2865
2865
    fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
2868
2868
   {"COLLATIONS", collation_fields_info, create_schema_table, 
2869
2869
    fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
2870
2870
   {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
2871
 
@@ -7710,6 +8126,8 @@
 
2871
@@ -7711,6 +8127,8 @@
2872
2872
    OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
2873
2873
   {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
2874
2874
    fill_schema_column_privileges, 0, 0, -1, -1, 0, 0},
2877
2877
   {"ENGINES", engines_fields_info, create_schema_table,
2878
2878
    fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
2879
2879
 #ifdef HAVE_EVENT_SCHEDULER
2880
 
@@ -7782,14 +8200,20 @@
 
2880
@@ -7783,14 +8201,20 @@
2881
2881
    get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
2882
2882
   {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
2883
2883
    fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},