~percona-dev/percona-server/5.1.57-partially-ported

« back to all changes in this revision

Viewing changes to userstat.patch

  • Committer: Oleg Tsarev
  • Date: 2011-05-10 00:07:01 UTC
  • Revision ID: oleg.tsarev@percona.com-20110510000701-l08jx5er0g8ogi6w
Patches ported to 5.1.57
ATTENTION, ATTENTION, ATTENTION
!!!
Some parts of innodb_split_buf_pool_mutex.patch was removed (for apply another patches)
You should revert changes in this commit from patch and do their right

!!! 
innodb_lru_dump_restore.patch has some changes, what should be reviewed

!!!
mysql-test.diff - I removed part for "mysql-test/include/mtr_warnings.sql", should be restored and fixed

All other looks fine.

UNFORTUNATELY, MYSQL DOESN'T BUILD (Compilation error in InnoDB).

ATTENTION, ATTENTION, ATTENTION

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
diff -ruN a/sql/handler.h b/sql/handler.h
295
295
--- a/sql/handler.h     2010-10-12 00:34:25.000000000 +0400
296
296
+++ b/sql/handler.h     2010-11-24 17:28:49.000000000 +0300
297
 
@@ -30,6 +30,10 @@
 
297
@@ -29,6 +29,10 @@
298
298
 
299
299
 #define USING_TRANSACTIONS
300
300
 
305
305
 // the following is for checking tables
306
306
 
307
307
 #define HA_ADMIN_ALREADY_DONE    1
308
 
@@ -1121,6 +1125,9 @@
 
308
@@ -1120,6 +1124,9 @@
309
309
   bool locked;
310
310
   bool implicit_emptied;                /* Can be !=0 only if HEAP */
311
311
   const COND *pushed_cond;
315
315
   /**
316
316
     next_insert_id is the next value which should be inserted into the
317
317
     auto_increment column: in a inserting-multi-row statement (like INSERT
318
 
@@ -1158,9 +1165,11 @@
 
318
@@ -1157,9 +1164,11 @@
319
319
     ref_length(sizeof(my_off_t)),
320
320
     ft_handler(0), inited(NONE),
321
321
     locked(FALSE), implicit_emptied(0),
329
329
   virtual ~handler(void)
330
330
   {
331
331
     DBUG_ASSERT(locked == FALSE);
332
 
@@ -1284,6 +1293,8 @@
 
332
@@ -1283,6 +1292,8 @@
333
333
   {
334
334
     table= table_arg;
335
335
     table_share= share;
338
338
   }
339
339
   virtual double scan_time()
340
340
   { return ulonglong2double(stats.data_file_length) / IO_SIZE + 2; }
341
 
@@ -1628,6 +1639,8 @@
 
341
@@ -1627,6 +1638,8 @@
342
342
   virtual bool is_crashed() const  { return 0; }
343
343
   virtual bool auto_repair() const { return 0; }
344
344
 
563
563
diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
564
564
--- a/sql/mysql_priv.h  2010-11-24 17:24:51.000000000 +0300
565
565
+++ b/sql/mysql_priv.h  2010-11-24 17:31:34.000000000 +0300
566
 
@@ -1164,7 +1164,17 @@
 
566
@@ -1168,7 +1168,17 @@
567
567
 bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
568
568
 void init_max_user_conn(void);
569
569
 void init_update_queries(void);
581
581
 pthread_handler_t handle_bootstrap(void *arg);
582
582
 int mysql_execute_command(THD *thd);
583
583
 bool do_command(THD *thd);
584
 
@@ -2040,6 +2050,7 @@
 
584
@@ -2044,6 +2054,7 @@
585
585
 extern ulong max_connect_errors, connect_timeout;
586
586
 extern ulong slave_net_timeout, slave_trans_retries;
587
587
 extern uint max_user_connections;
589
589
 extern ulong what_to_log,flush_time;
590
590
 extern ulong query_buff_size;
591
591
 extern ulong max_prepared_stmt_count, prepared_stmt_count;
592
 
@@ -2093,6 +2104,7 @@
 
592
@@ -2098,6 +2109,7 @@
593
593
 extern my_bool opt_slave_compressed_protocol, use_temp_pool;
594
594
 extern ulong slave_exec_mode_options;
595
595
 extern my_bool opt_readonly, lower_case_file_system;
597
597
 extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
598
598
 extern my_bool opt_secure_auth;
599
599
 extern char* opt_secure_file_priv;
600
 
@@ -2157,6 +2169,15 @@
 
600
@@ -2162,6 +2174,15 @@
601
601
 extern struct system_variables max_system_variables;
602
602
 extern struct system_status_var global_status_var;
603
603
 extern struct rand_struct sql_rand;
616
616
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
617
617
--- a/sql/mysqld.cc     2010-11-24 17:24:51.000000000 +0300
618
618
+++ b/sql/mysqld.cc     2010-11-24 17:31:34.000000000 +0300
619
 
@@ -531,6 +531,7 @@
 
619
@@ -532,6 +532,7 @@
620
620
 uint    opt_debug_sync_timeout= 0;
621
621
 #endif /* defined(ENABLED_DEBUG_SYNC) */
622
622
 my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
624
624
 /*
625
625
   True if there is at least one per-hour limit for some user, so we should
626
626
   check them before each query (and possibly reset counters when hour is
627
 
@@ -579,6 +580,7 @@
628
 
 ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
629
 
 ulong max_connections, max_connect_errors;
 
627
@@ -585,6 +586,7 @@
 
628
 */
 
629
 ulong max_long_data_size;
630
630
 uint  max_user_connections= 0;
631
631
+ulonglong denied_connections = 0;
632
632
 /**
633
633
   Limit of the total number of prepared statements in the server.
634
634
   Is necessary to protect the server against out-of-memory attacks.
635
 
@@ -680,6 +682,10 @@
 
635
@@ -686,6 +688,10 @@
636
636
                LOCK_global_system_variables,
637
637
                LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
638
638
                 LOCK_connection_count;
643
643
 /**
644
644
   The below lock protects access to two global server variables:
645
645
   max_prepared_stmt_count and prepared_stmt_count. These variables
646
 
@@ -1365,6 +1371,11 @@
 
646
@@ -1371,6 +1377,11 @@
647
647
   x_free(opt_secure_file_priv);
648
648
   bitmap_free(&temp_pool);
649
649
   free_max_user_conn();
655
655
 #ifdef HAVE_REPLICATION
656
656
   end_slave_list();
657
657
 #endif
658
 
@@ -1481,6 +1492,10 @@
 
658
@@ -1487,6 +1498,10 @@
659
659
   (void) pthread_cond_destroy(&COND_thread_cache);
660
660
   (void) pthread_cond_destroy(&COND_flush_thread_cache);
661
661
   (void) pthread_cond_destroy(&COND_manager);
666
666
 }
667
667
 
668
668
 #endif /*EMBEDDED_LIBRARY*/
669
 
@@ -3177,6 +3192,7 @@
 
669
@@ -3183,6 +3198,7 @@
670
670
   {"show_binlog_events",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
671
671
   {"show_binlogs",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
672
672
   {"show_charsets",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
674
674
   {"show_collations",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
675
675
   {"show_column_types",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLUMN_TYPES]), SHOW_LONG_STATUS},
676
676
   {"show_contributors",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS},
677
 
@@ -3198,6 +3214,7 @@
 
677
@@ -3204,6 +3220,7 @@
678
678
 #endif
679
679
   {"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS},
680
680
   {"show_grants",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
682
682
   {"show_keys",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
683
683
   {"show_master_status",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
684
684
   {"show_new_master",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
685
 
@@ -3216,9 +3233,12 @@
 
685
@@ -3222,9 +3239,12 @@
686
686
   {"show_slave_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
687
687
   {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
688
688
   {"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
695
695
   {"show_variables",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
696
696
   {"show_warnings",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
697
697
   {"slave_start",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
698
 
@@ -3662,6 +3682,10 @@
 
698
@@ -3668,6 +3688,10 @@
699
699
 #endif
700
700
   (void) pthread_mutex_init(&LOCK_server_started, MY_MUTEX_INIT_FAST);
701
701
   (void) pthread_cond_init(&COND_server_started,NULL);
706
706
   sp_cache_init();
707
707
 #ifdef HAVE_EVENT_SCHEDULER
708
708
   Events::init_mutexes();
709
 
@@ -4063,6 +4087,9 @@
 
709
@@ -4069,6 +4093,9 @@
710
710
   if (!errmesg[0][0])
711
711
     unireg_abort(1);
712
712
 
716
716
   /* We have to initialize the storage engines before CSV logging */
717
717
   if (ha_init())
718
718
   {
719
 
@@ -4209,6 +4236,9 @@
 
719
@@ -4215,6 +4242,9 @@
720
720
 
721
721
   init_max_user_conn();
722
722
   init_update_queries();
726
726
   DBUG_RETURN(0);
727
727
 }
728
728
 
729
 
@@ -5026,6 +5056,7 @@
 
729
@@ -5032,6 +5062,7 @@
730
730
 
731
731
     DBUG_PRINT("error",("Too many connections"));
732
732
     close_connection(thd, ER_CON_COUNT_ERROR, 1);
734
734
     delete thd;
735
735
     DBUG_VOID_RETURN;
736
736
   }
737
 
@@ -5810,6 +5841,8 @@
 
737
@@ -5816,6 +5847,8 @@
738
738
   OPT_SLAVE_EXEC_MODE,
739
739
   OPT_GENERAL_LOG_FILE,
740
740
   OPT_SLOW_QUERY_LOG_FILE,
743
743
   OPT_USE_GLOBAL_LONG_QUERY_TIME,
744
744
   OPT_USE_GLOBAL_LOG_SLOW_CONTROL,
745
745
   OPT_SLOW_QUERY_LOG_MICROSECONDS_TIMESTAMP,
746
 
@@ -7303,6 +7336,14 @@
 
746
@@ -7317,6 +7350,14 @@
747
747
    &max_system_variables.net_wait_timeout, 0, GET_ULONG,
748
748
    REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
749
749
    0, 1, 0},
761
761
diff -ruN a/sql/set_var.cc b/sql/set_var.cc
762
762
--- a/sql/set_var.cc    2010-11-24 17:24:51.000000000 +0300
763
763
+++ b/sql/set_var.cc    2010-11-24 17:31:34.000000000 +0300
764
 
@@ -557,6 +557,10 @@
 
764
@@ -567,6 +567,10 @@
765
765
 static sys_var_thd_ulong       sys_read_buff_size(&vars, "read_buffer_size",
766
766
                                           &SV::read_buff_size);
767
767
 static sys_var_opt_readonly    sys_readonly(&vars, "read_only", &opt_readonly);
1692
1692
   my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
1693
1693
            thd->main_security_ctx.user,
1694
1694
            thd->main_security_ctx.host_or_ip,
1695
 
@@ -984,11 +1563,20 @@
 
1695
@@ -1131,11 +1710,20 @@
1696
1696
       my_sleep(1000);                          /* must wait after eof() */
1697
1697
 #endif
1698
1698
     statistic_increment(aborted_connects,&LOCK_status);
1713
1713
   DBUG_RETURN(0);
1714
1714
 }
1715
1715
 
1716
 
@@ -1010,6 +1598,7 @@
 
1716
@@ -1157,6 +1745,7 @@
1717
1717
   if (thd->killed || (net->error && net->vio != 0))
1718
1718
   {
1719
1719
     statistic_increment(aborted_threads,&LOCK_status);
1721
1721
   }
1722
1722
 
1723
1723
   if (net->error && net->vio != 0)
1724
 
@@ -1136,10 +1725,14 @@
 
1724
@@ -1283,10 +1872,14 @@
1725
1725
   for (;;)
1726
1726
   {
1727
1727
     NET *net= &thd->net;
1736
1736
 
1737
1737
     prepare_new_connection_state(thd);
1738
1738
 
1739
 
@@ -1162,6 +1755,8 @@
 
1739
@@ -1309,6 +1902,8 @@
1740
1740
    
1741
1741
 end_thread:
1742
1742
     close_connection(thd, 0, 1);
1832
1832
   /*
1833
1833
     Commands which always take a long time are logged into
1834
1834
     the slow log only if opt_log_slow_admin_statements is set.
1835
 
@@ -1865,6 +1877,13 @@
 
1835
@@ -1879,6 +1891,13 @@
1836
1836
     thd->profiling.discard_current_query();
1837
1837
 #endif
1838
1838
     break;
1846
1846
   case SCH_OPEN_TABLES:
1847
1847
   case SCH_VARIABLES:
1848
1848
   case SCH_STATUS:
1849
 
@@ -2021,6 +2040,7 @@
 
1849
@@ -2035,6 +2054,7 @@
1850
1850
                        thd->security_ctx->priv_host)) &&
1851
1851
         check_global_access(thd, SUPER_ACL))
1852
1852
     {
1854
1854
       my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
1855
1855
       DBUG_RETURN(TRUE);
1856
1856
     }
1857
 
@@ -5363,6 +5383,7 @@
 
1857
@@ -5377,6 +5397,7 @@
1858
1858
       if (!no_errors)
1859
1859
       {
1860
1860
         const char *db_name= db ? db : thd->db;
1862
1862
         my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
1863
1863
                  sctx->priv_user, sctx->priv_host, db_name);
1864
1864
       }
1865
 
@@ -5395,12 +5416,15 @@
 
1865
@@ -5409,12 +5430,15 @@
1866
1866
   {                                            // We can never grant this
1867
1867
     DBUG_PRINT("error",("No possible access"));
1868
1868
     if (!no_errors)
1878
1878
     DBUG_RETURN(TRUE);                         /* purecov: tested */
1879
1879
   }
1880
1880
 
1881
 
@@ -5426,11 +5450,15 @@
 
1881
@@ -5440,11 +5464,15 @@
1882
1882
 
1883
1883
   DBUG_PRINT("error",("Access denied"));
1884
1884
   if (!no_errors)
1894
1894
   DBUG_RETURN(TRUE);                           /* purecov: tested */
1895
1895
 }
1896
1896
 
1897
 
@@ -5459,6 +5487,7 @@
 
1897
@@ -5473,6 +5501,7 @@
1898
1898
 
1899
1899
     if (!thd->col_access && check_grant_db(thd, dst_db_name))
1900
1900
     {
1902
1902
       my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
1903
1903
                thd->security_ctx->priv_user,
1904
1904
                thd->security_ctx->priv_host,
1905
 
@@ -5540,9 +5569,12 @@
 
1905
@@ -5554,9 +5583,12 @@
1906
1906
         (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
1907
1907
     {
1908
1908
       if (!no_errors)
1915
1915
       return TRUE;
1916
1916
     }
1917
1917
     /*
1918
 
@@ -5705,6 +5737,7 @@
 
1918
@@ -5719,6 +5751,7 @@
1919
1919
   if ((thd->security_ctx->master_access & want_access))
1920
1920
     return 0;
1921
1921
   get_privilege_desc(command, sizeof(command), want_access);
1923
1923
   my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
1924
1924
   return 1;
1925
1925
 #else
1926
 
@@ -6079,6 +6112,32 @@
 
1926
@@ -6093,6 +6126,32 @@
1927
1927
   lex_start(thd);
1928
1928
   mysql_reset_thd_for_next_command(thd);
1929
1929
 
1956
1956
   if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
1957
1957
   {
1958
1958
     LEX *lex= thd->lex;
1959
 
@@ -6159,6 +6218,43 @@
 
1959
@@ -6173,6 +6232,43 @@
1960
1960
     *found_semicolon= NULL;
1961
1961
   }
1962
1962
 
2000
2000
   DBUG_VOID_RETURN;
2001
2001
 }
2002
2002
 
2003
 
@@ -7031,6 +7127,13 @@
 
2003
@@ -7045,6 +7141,13 @@
2004
2004
     if (flush_error_log())
2005
2005
       result=1;
2006
2006
   }
2014
2014
 #ifdef HAVE_QUERY_CACHE
2015
2015
   if (options & REFRESH_QUERY_CACHE_FREE)
2016
2016
   {
2017
 
@@ -7131,6 +7234,40 @@
 
2017
@@ -7145,6 +7248,40 @@
2018
2018
 #endif
2019
2019
  if (options & REFRESH_USER_RESOURCES)
2020
2020
    reset_mqh((LEX_USER *) NULL, 0);             /* purecov: inspected */
2756
2756
 
2757
2757
 /* collect status for all running threads */
2758
2758
 
2759
 
@@ -6709,6 +7017,104 @@
 
2759
@@ -6711,6 +7019,104 @@
2760
2760
 };
2761
2761
 
2762
2762
 
2861
2861
 ST_FIELD_INFO processlist_fields_info[]=
2862
2862
 {
2863
2863
   {"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
2864
 
@@ -6844,6 +7250,8 @@
 
2864
@@ -6846,6 +7252,8 @@
2865
2865
 {
2866
2866
   {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
2867
2867
    fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
2870
2870
   {"COLLATIONS", collation_fields_info, create_schema_table, 
2871
2871
    fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
2872
2872
   {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
2873
 
@@ -6853,6 +7261,8 @@
 
2873
@@ -6855,6 +7263,8 @@
2874
2874
    OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL},
2875
2875
   {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
2876
2876
    fill_schema_column_privileges, 0, 0, -1, -1, 0, 0},
2879
2879
   {"ENGINES", engines_fields_info, create_schema_table,
2880
2880
    fill_schema_engines, make_old_format, 0, -1, -1, 0, 0},
2881
2881
 #ifdef HAVE_EVENT_SCHEDULER
2882
 
@@ -6909,11 +7319,17 @@
 
2882
@@ -6911,11 +7321,17 @@
2883
2883
    get_all_tables, make_table_names_old_format, 0, 1, 2, 1, 0},
2884
2884
   {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
2885
2885
    fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},