~percona-dev/percona-server/release-5.1.57-12.8-commit108486

« back to all changes in this revision

Viewing changes to userstat.patch

  • Committer: kinoyasu
  • Date: 2010-06-18 10:43:10 UTC
  • Revision ID: kinoyasu@gauntlet4-20100618104310-16tw73nfzl8rvkay
port for mysql-5.1.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
diff -ruN a/configure.in b/configure.in
2
2
--- a/configure.in      2010-04-06 23:03:56.000000000 +0900
3
3
+++ b/configure.in      2010-05-04 13:46:51.000000000 +0900
4
 
@@ -2106,7 +2106,7 @@
 
4
@@ -2117,7 +2117,7 @@
5
5
   realpath rename rint rwlock_init setupterm \
6
6
   shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
7
7
   sighold sigset sigthreadmask port_create sleep \
23
23
diff -ruN a/configure b/configure
24
24
--- a/configure 2010-04-30 18:38:49.000000000 +0900
25
25
+++ b/configure 2010-04-30 18:42:27.000000000 +0900
26
 
@@ -37957,7 +37957,7 @@
 
26
@@ -38123,7 +38123,7 @@
27
27
   realpath rename rint rwlock_init setupterm \
28
28
   shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
29
29
   sighold sigset sigthreadmask port_create sleep \
402
402
 
403
403
 /*
404
404
   Log slow query with all enabled log event handlers
405
 
@@ -4427,6 +4449,8 @@
 
405
@@ -4394,6 +4416,8 @@
406
406
                              thd->first_successful_insert_id_in_prev_stmt_for_binlog);
407
407
           if (e.write(file))
408
408
             goto err;
411
411
         }
412
412
         if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
413
413
         {
414
 
@@ -4438,12 +4462,16 @@
 
414
@@ -4405,12 +4429,16 @@
415
415
                              minimum());
416
416
           if (e.write(file))
417
417
             goto err;
428
428
         }
429
429
         if (thd->user_var_events.elements)
430
430
         {
431
 
@@ -4459,6 +4487,8 @@
 
431
@@ -4426,6 +4454,8 @@
432
432
                                  user_var_event->charset_number);
433
433
             if (e.write(file))
434
434
               goto err;
437
437
           }
438
438
         }
439
439
       }
440
 
@@ -4471,6 +4501,8 @@
 
440
@@ -4438,6 +4468,8 @@
441
441
     if (event_info->write(file) || 
442
442
         DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
443
443
       goto err;
446
446
 
447
447
     if (file == &log_file) // we are writing to the real log (disk)
448
448
     {
449
 
@@ -4619,7 +4651,7 @@
 
449
@@ -4583,7 +4615,7 @@
450
450
     be reset as a READ_CACHE to be able to read the contents from it.
451
451
  */
452
452
 
455
455
 {
456
456
   Mutex_sentry sentry(lock_log ? &LOCK_log : NULL);
457
457
 
458
 
@@ -4667,6 +4699,7 @@
 
458
@@ -4631,6 +4663,7 @@
459
459
       /* write the first half of the split header */
460
460
       if (my_b_write(&log_file, header, carry))
461
461
         return ER_ERROR_ON_WRITE;
463
463
 
464
464
       /*
465
465
         copy fixed second half of header to cache so the correct
466
 
@@ -4735,6 +4768,7 @@
 
466
@@ -4699,6 +4732,7 @@
467
467
     /* Write data to the binary log file */
468
468
     if (my_b_write(&log_file, cache->read_pos, length))
469
469
       return ER_ERROR_ON_WRITE;
471
471
     cache->read_pos=cache->read_end;           // Mark buffer used up
472
472
   } while ((length= my_b_fill(cache)));
473
473
 
474
 
@@ -4857,21 +4891,24 @@
 
474
@@ -4821,21 +4855,24 @@
475
475
       */
476
476
       if (qinfo.write(&log_file))
477
477
         goto err;
501
501
diff -ruN a/sql/log.h b/sql/log.h
502
502
--- a/sql/log.h 2010-04-06 23:07:02.000000000 +0900
503
503
+++ b/sql/log.h 2010-04-30 18:39:05.000000000 +0900
504
 
@@ -365,7 +365,7 @@
 
504
@@ -355,7 +355,7 @@
505
505
   bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
506
506
   bool write_incident(THD *thd, bool lock);
507
507
 
510
510
   void set_write_error(THD *thd);
511
511
   bool check_write_error(THD *thd);
512
512
 
513
 
@@ -503,6 +503,7 @@
 
513
@@ -493,6 +493,7 @@
514
514
                            const char *sql_text, uint sql_text_len,
515
515
                            CHARSET_INFO *client_cs);
516
516
   void flush();
518
518
   void init_pthread_objects();
519
519
   MYSQL_QUERY_LOG *get_mysql_slow_log() { return &mysql_slow_log; }
520
520
   MYSQL_QUERY_LOG *get_mysql_log() { return &mysql_log; }
521
 
@@ -547,6 +548,7 @@
 
521
@@ -537,6 +538,7 @@
522
522
   void init_base();
523
523
   void init_log_tables();
524
524
   bool flush_logs(THD *thd);
547
547
 pthread_handler_t handle_bootstrap(void *arg);
548
548
 int mysql_execute_command(THD *thd);
549
549
 bool do_command(THD *thd);
550
 
@@ -2028,6 +2038,7 @@
 
550
@@ -2029,6 +2039,7 @@
551
551
 extern ulong max_connect_errors, connect_timeout;
552
552
 extern ulong slave_net_timeout, slave_trans_retries;
553
553
 extern uint max_user_connections;
555
555
 extern ulong what_to_log,flush_time;
556
556
 extern ulong query_buff_size;
557
557
 extern ulong max_prepared_stmt_count, prepared_stmt_count;
558
 
@@ -2081,6 +2092,7 @@
 
558
@@ -2082,6 +2093,7 @@
559
559
 extern my_bool opt_slave_compressed_protocol, use_temp_pool;
560
560
 extern ulong slave_exec_mode_options;
561
561
 extern my_bool opt_readonly, lower_case_file_system;
563
563
 extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
564
564
 extern my_bool opt_secure_auth;
565
565
 extern char* opt_secure_file_priv;
566
 
@@ -2144,6 +2156,15 @@
 
566
@@ -2145,6 +2157,15 @@
567
567
 extern struct system_variables max_system_variables;
568
568
 extern struct system_status_var global_status_var;
569
569
 extern struct rand_struct sql_rand;
741
741
diff -ruN a/sql/sql_base.cc b/sql/sql_base.cc
742
742
--- a/sql/sql_base.cc   2010-04-06 23:07:04.000000000 +0900
743
743
+++ b/sql/sql_base.cc   2010-04-30 18:39:05.000000000 +0900
744
 
@@ -1376,6 +1376,12 @@
 
744
@@ -1382,6 +1382,12 @@
745
745
   DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
746
746
                         table->s->table_name.str, (long) table));
747
747
 
754
754
   *table_ptr=table->next;
755
755
   /*
756
756
     When closing a MERGE parent or child table, detach the children first.
757
 
@@ -1916,6 +1922,8 @@
 
757
@@ -1922,6 +1928,8 @@
758
758
   DBUG_PRINT("tmptable", ("closing table: '%s'.'%s'",
759
759
                           table->s->db.str, table->s->table_name.str));
760
760
 
922
922
 }
923
923
 
924
924
 
925
 
@@ -2837,6 +2951,7 @@
 
925
@@ -2858,6 +2972,7 @@
926
926
   if (likely(thd != 0))
927
927
   { /* current_thd==0 when close_connection() calls net_send_error() */
928
928
     thd->status_var.bytes_sent+= length;
930
930
   }
931
931
 }
932
932
 
933
 
@@ -2844,6 +2959,7 @@
 
933
@@ -2865,6 +2980,7 @@
934
934
 void thd_increment_bytes_received(ulong length)
935
935
 {
936
936
   current_thd->status_var.bytes_received+= length;
950
950
   uint32     server_id;
951
951
   uint32     file_id;                  // for LOAD DATA INFILE
952
952
   /* remote (peer) port */
953
 
@@ -1816,6 +1818,8 @@
 
953
@@ -1823,6 +1825,8 @@
954
954
   /* variables.transaction_isolation is reset to this after each commit */
955
955
   enum_tx_isolation session_tx_isolation;
956
956
   enum_check_fields count_cuted_fields;
959
959
 
960
960
   DYNAMIC_ARRAY user_var_events;        /* For user variables replication */
961
961
   MEM_ROOT      *user_var_events_alloc; /* Allocate above array elements here */
962
 
@@ -1904,6 +1908,49 @@
 
962
@@ -1911,6 +1915,49 @@
963
963
   */
964
964
   LOG_INFO*  current_linfo;
965
965
   NET*       slave_net;                        // network connection from slave -> m.
1009
1009
   /* Used by the sys_var class to store temporary values */
1010
1010
   union
1011
1011
   {
1012
 
@@ -1969,6 +2016,11 @@
 
1012
@@ -1976,6 +2023,11 @@
1013
1013
     alloc_root. 
1014
1014
   */
1015
1015
   void init_for_queries();
1021
1021
   void change_user(void);
1022
1022
   void cleanup(void);
1023
1023
   void cleanup_after_query();
1024
 
@@ -2334,9 +2386,15 @@
 
1024
@@ -2341,9 +2393,15 @@
1025
1025
     *p_db= strmake(db, db_length);
1026
1026
     *p_db_length= db_length;
1027
1027
     return FALSE;
1037
1037
 public:
1038
1038
   inline Internal_error_handler *get_internal_handler()
1039
1039
   { return m_internal_handler; }
1040
 
@@ -2390,6 +2448,9 @@
 
1040
@@ -2397,6 +2455,9 @@
1041
1041
   MEM_ROOT main_mem_root;
1042
1042
 };
1043
1043
 
1714
1714
diff -ruN a/sql/sql_delete.cc b/sql/sql_delete.cc
1715
1715
--- a/sql/sql_delete.cc 2010-04-06 23:07:04.000000000 +0900
1716
1716
+++ b/sql/sql_delete.cc 2010-04-30 18:39:05.000000000 +0900
1717
 
@@ -449,6 +449,7 @@
 
1717
@@ -451,6 +451,7 @@
1718
1718
     my_ok(thd, (ha_rows) thd->row_count_func);
1719
1719
     DBUG_PRINT("info",("%ld records deleted",(long) deleted));
1720
1720
   }
1722
1722
   DBUG_RETURN(error >= 0 || thd->is_error());
1723
1723
 }
1724
1724
 
1725
 
@@ -1056,6 +1057,7 @@
 
1725
@@ -1058,6 +1059,7 @@
1726
1726
     thd->row_count_func= deleted;
1727
1727
     ::my_ok(thd, (ha_rows) thd->row_count_func);
1728
1728
   }
1775
1775
 const char *any_db="*any*";    // Special symbol for check_access
1776
1776
 
1777
1777
 const LEX_STRING command_name[]={
1778
 
@@ -810,6 +813,12 @@
 
1778
@@ -818,6 +821,12 @@
1779
1779
   */
1780
1780
   thd->clear_error();                          // Clear error message
1781
1781
   thd->main_da.reset_diagnostics_area();
1788
1788
 
1789
1789
   net_new_transaction(net);
1790
1790
 
1791
 
@@ -979,6 +988,9 @@
 
1791
@@ -987,6 +996,9 @@
1792
1792
   DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command));
1793
1793
 
1794
1794
   thd->command=command;
1798
1798
   /*
1799
1799
     Commands which always take a long time are logged into
1800
1800
     the slow log only if opt_log_slow_admin_statements is set.
1801
 
@@ -1823,6 +1835,13 @@
 
1801
@@ -1831,6 +1843,13 @@
1802
1802
     thd->profiling.discard_current_query();
1803
1803
 #endif
1804
1804
     break;
1812
1812
   case SCH_OPEN_TABLES:
1813
1813
   case SCH_VARIABLES:
1814
1814
   case SCH_STATUS:
1815
 
@@ -1979,6 +1998,7 @@
 
1815
@@ -1987,6 +2006,7 @@
1816
1816
                        thd->security_ctx->priv_host)) &&
1817
1817
         check_global_access(thd, SUPER_ACL))
1818
1818
     {
1820
1820
       my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
1821
1821
       DBUG_RETURN(TRUE);
1822
1822
     }
1823
 
@@ -5259,6 +5279,7 @@
 
1823
@@ -5267,6 +5287,7 @@
1824
1824
       if (!no_errors)
1825
1825
       {
1826
1826
         const char *db_name= db ? db : thd->db;
1828
1828
         my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
1829
1829
                  sctx->priv_user, sctx->priv_host, db_name);
1830
1830
       }
1831
 
@@ -5291,12 +5312,15 @@
 
1831
@@ -5299,12 +5320,15 @@
1832
1832
   {                                            // We can never grant this
1833
1833
     DBUG_PRINT("error",("No possible access"));
1834
1834
     if (!no_errors)
1844
1844
     DBUG_RETURN(TRUE);                         /* purecov: tested */
1845
1845
   }
1846
1846
 
1847
 
@@ -5322,11 +5346,15 @@
 
1847
@@ -5330,11 +5354,15 @@
1848
1848
 
1849
1849
   DBUG_PRINT("error",("Access denied"));
1850
1850
   if (!no_errors)
1860
1860
   DBUG_RETURN(TRUE);                           /* purecov: tested */
1861
1861
 }
1862
1862
 
1863
 
@@ -5355,6 +5383,7 @@
 
1863
@@ -5363,6 +5391,7 @@
1864
1864
 
1865
1865
     if (!thd->col_access && check_grant_db(thd, dst_db_name))
1866
1866
     {
1868
1868
       my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
1869
1869
                thd->security_ctx->priv_user,
1870
1870
                thd->security_ctx->priv_host,
1871
 
@@ -5436,9 +5465,12 @@
 
1871
@@ -5444,9 +5473,12 @@
1872
1872
         (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
1873
1873
     {
1874
1874
       if (!no_errors)
1881
1881
       return TRUE;
1882
1882
     }
1883
1883
     /*
1884
 
@@ -5601,6 +5633,7 @@
 
1884
@@ -5609,6 +5641,7 @@
1885
1885
   if ((thd->security_ctx->master_access & want_access))
1886
1886
     return 0;
1887
1887
   get_privilege_desc(command, sizeof(command), want_access);
1889
1889
   my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
1890
1890
   return 1;
1891
1891
 #else
1892
 
@@ -5982,6 +6015,34 @@
 
1892
@@ -5990,6 +6023,34 @@
1893
1893
   lex_start(thd);
1894
1894
   mysql_reset_thd_for_next_command(thd);
1895
1895
 
1924
1924
   if (query_cache_send_result_to_client(thd, (char*) inBuf, length) <= 0)
1925
1925
   {
1926
1926
     LEX *lex= thd->lex;
1927
 
@@ -6057,6 +6118,43 @@
 
1927
@@ -6065,6 +6126,43 @@
1928
1928
     *found_semicolon= NULL;
1929
1929
   }
1930
1930
 
1968
1968
   DBUG_VOID_RETURN;
1969
1969
 }
1970
1970
 
1971
 
@@ -6919,6 +7017,13 @@
 
1971
@@ -6927,6 +7025,13 @@
1972
1972
     if (flush_error_log())
1973
1973
       result=1;
1974
1974
   }
1982
1982
 #ifdef HAVE_QUERY_CACHE
1983
1983
   if (options & REFRESH_QUERY_CACHE_FREE)
1984
1984
   {
1985
 
@@ -7019,6 +7124,40 @@
 
1985
@@ -7027,6 +7132,40 @@
1986
1986
 #endif
1987
1987
  if (options & REFRESH_USER_RESOURCES)
1988
1988
    reset_mqh((LEX_USER *) NULL, 0);             /* purecov: inspected */
2391
2391
diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
2392
2392
--- a/sql/sql_show.cc   2010-04-30 18:38:49.000000000 +0900
2393
2393
+++ b/sql/sql_show.cc   2010-04-30 18:44:22.000000000 +0900
2394
 
@@ -83,6 +83,40 @@
 
2394
@@ -84,6 +84,40 @@
2395
2395
 
2396
2396
 static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
2397
2397
 
2432
2432
 /***************************************************************************
2433
2433
 ** List all table types supported
2434
2434
 ***************************************************************************/
2435
 
@@ -820,6 +854,7 @@
 
2435
@@ -821,6 +855,7 @@
2436
2436
                sctx->master_access);
2437
2437
   if (!(db_access & DB_ACLS) && check_grant_db(thd,dbname))
2438
2438
   {
2440
2440
     my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
2441
2441
              sctx->priv_user, sctx->host_or_ip, dbname);
2442
2442
     general_log_print(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
2443
 
@@ -2365,6 +2400,360 @@
 
2443
@@ -2366,6 +2401,360 @@
2444
2444
   DBUG_RETURN(res);
2445
2445
 }
2446
2446
 
2801
2801
 
2802
2802
 /* collect status for all running threads */
2803
2803
 
2804
 
@@ -6641,6 +7030,104 @@
 
2804
@@ -6643,6 +7032,104 @@
2805
2805
 };
2806
2806
 
2807
2807
 
2906
2906
 ST_FIELD_INFO processlist_fields_info[]=
2907
2907
 {
2908
2908
   {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
2909
 
@@ -6776,6 +7263,8 @@
 
2909
@@ -6778,6 +7265,8 @@
2910
2910
 {
2911
2911
   {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
2912
2912
    fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
2915
2915
   {"COLLATIONS", collation_fields_info, create_schema_table, 
2916
2916
    fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
2917
2917
   {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
2918
 
@@ -6785,6 +7274,8 @@
 
2918
@@ -6787,6 +7276,8 @@
2919
2919
    OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
2920
2920
   {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
2921
2921
    fill_schema_column_privileges, 0, 0, -1, -1, 0, 0},
2924
2924
   {"ENGINES", engines_fields_info, create_schema_table,
2925
2925
    fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
2926
2926
 #ifdef HAVE_EVENT_SCHEDULER
2927
 
@@ -6841,11 +7332,17 @@
 
2927
@@ -6843,11 +7334,17 @@
2928
2928
    get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
2929
2929
   {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
2930
2930
    fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
2945
2945
diff -ruN a/sql/sql_update.cc b/sql/sql_update.cc
2946
2946
--- a/sql/sql_update.cc 2010-04-06 23:07:06.000000000 +0900
2947
2947
+++ b/sql/sql_update.cc 2010-04-30 18:39:05.000000000 +0900
2948
 
@@ -832,6 +832,7 @@
 
2948
@@ -835,6 +835,7 @@
2949
2949
     thd->row_count_func=
2950
2950
       (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
2951
2951
     my_ok(thd, (ulong) thd->row_count_func, id, buff);
2953
2953
     DBUG_PRINT("info",("%ld records updated", (long) updated));
2954
2954
   }
2955
2955
   thd->count_cuted_fields= CHECK_FIELD_IGNORE;         /* calc cuted fields */
2956
 
@@ -2201,5 +2202,6 @@
 
2956
@@ -2204,5 +2205,6 @@
2957
2957
   thd->row_count_func=
2958
2958
     (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
2959
2959
   ::my_ok(thd, (ulong) thd->row_count_func, id, buff);
3326
3326
diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
3327
3327
--- a/storage/innobase/handler/ha_innodb.cc     2010-04-06 23:07:08.000000000 +0900
3328
3328
+++ b/storage/innobase/handler/ha_innodb.cc     2010-04-30 18:39:05.000000000 +0900
3329
 
@@ -4012,6 +4012,8 @@
 
3329
@@ -4025,6 +4025,8 @@
3330
3330
 
3331
3331
        error = row_insert_for_mysql((byte*) record, prebuilt);
3332
3332
 
3335
3335
        /* Handle duplicate key errors */
3336
3336
        if (auto_inc_used) {
3337
3337
                ulint           err;
3338
 
@@ -4349,6 +4351,8 @@
 
3338
@@ -4362,6 +4364,8 @@
3339
3339
                }
3340
3340
        }
3341
3341
 
3344
3344
        innodb_srv_conc_exit_innodb(trx);
3345
3345
 
3346
3346
        error = convert_error_code_to_mysql(error, user_thd);
3347
 
@@ -4401,6 +4405,8 @@
 
3347
@@ -4414,6 +4418,8 @@
3348
3348
 
3349
3349
        error = row_update_for_mysql((byte*) record, prebuilt);
3350
3350
 
3353
3353
        innodb_srv_conc_exit_innodb(trx);
3354
3354
 
3355
3355
        error = convert_error_code_to_mysql(error, user_thd);
3356
 
@@ -4880,6 +4886,9 @@
 
3356
@@ -4893,6 +4899,9 @@
3357
3357
        if (ret == DB_SUCCESS) {
3358
3358
                error = 0;
3359
3359
                table->status = 0;