~vlad-lesin/percona-server/pintables

« back to all changes in this revision

Viewing changes to innodb_stats.patch

  • Committer: Laurynas Biveinis
  • Date: 2011-06-21 02:36:36 UTC
  • mfrom: (123 merge)
  • mto: This revision was merged to the branch mainline in revision 124.
  • Revision ID: laurynas.biveinis@percona.com-20110621023636-ccp1iyyrncj181zt
MergeĀ fromĀ lp:percona-server

Show diffs side-by-side

added added

removed removed

Lines of Context:
350
350
diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
351
351
--- a/storage/innobase/dict/dict0dict.c 2010-12-03 15:48:03.040222428 +0900
352
352
+++ b/storage/innobase/dict/dict0dict.c 2010-12-03 17:19:24.841947690 +0900
353
 
@@ -756,7 +756,7 @@
 
353
@@ -755,7 +755,7 @@
354
354
                print an error message and return without doing
355
355
                anything. */
356
356
                dict_update_statistics(table, TRUE /* only update stats
359
359
        }
360
360
 
361
361
        return(table);
362
 
@@ -4310,6 +4310,289 @@
 
362
@@ -4309,6 +4309,295 @@
363
363
 }
364
364
 
365
365
 /*********************************************************************//**
592
592
+                       break;
593
593
+               }
594
594
+
 
595
+               btr_pcur_store_position(&pcur, &mtr);
 
596
+
595
597
+               if (rec_get_deleted_flag(rec, 0)) {
596
598
+                       /* don't count */
597
599
+                       i--;
626
628
+               rests--;
627
629
+
628
630
+next_rec:
 
631
+               mtr_commit(&mtr);
 
632
+               mtr_start(&mtr);
 
633
+               btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr);
 
634
+
629
635
+               btr_pcur_move_to_next_user_rec(&pcur, &mtr);
630
636
+       }
631
637
+       btr_pcur_close(&pcur);
649
655
 Calculates new estimates for table and index statistics. The statistics
650
656
 are used in query optimization. */
651
657
 UNIV_INTERN
652
 
@@ -4317,10 +4600,11 @@
 
658
@@ -4316,10 +4605,11 @@
653
659
 dict_update_statistics(
654
660
 /*===================*/
655
661
        dict_table_t*   table,          /*!< in/out: table */
662
668
 {
663
669
        dict_index_t*   index;
664
670
        ulint           sum_of_index_sizes      = 0;
665
 
@@ -4337,6 +4621,27 @@
 
671
@@ -4336,6 +4626,27 @@
666
672
                return;
667
673
        }
668
674
 
690
696
        /* Find out the sizes of the indexes and how many different values
691
697
        for the key they approximately have */
692
698
 
693
 
@@ -4401,6 +4706,11 @@
 
699
@@ -4400,6 +4711,11 @@
694
700
                index = dict_table_get_next_index(index);
695
701
        } while (index);
696
702
 
702
708
        index = dict_table_get_first_index(table);
703
709
 
704
710
        table->stat_n_rows = index->stat_n_diff_key_vals[
705
 
@@ -4418,6 +4728,78 @@
 
711
@@ -4417,6 +4733,78 @@
706
712
        dict_table_stats_unlock(table, RW_X_LATCH);
707
713
 }
708
714
 
781
787
 /**********************************************************************//**
782
788
 Prints info of a foreign key constraint. */
783
789
 static
784
 
@@ -4495,7 +4877,8 @@
 
790
@@ -4494,7 +4882,8 @@
785
791
 
786
792
        ut_ad(mutex_own(&(dict_sys->mutex)));
787
793
 
906
912
 
907
913
 
908
914
 static char*   internal_innobase_data_file_path        = NULL;
909
 
@@ -2420,6 +2421,8 @@
 
915
@@ -2434,6 +2435,8 @@
910
916
                goto error;
911
917
        }
912
918
 
915
921
        /* -------------- Log files ---------------------------*/
916
922
 
917
923
        /* The default dir for log files is the datadir of MySQL */
918
 
@@ -5223,6 +5226,10 @@
 
924
@@ -5236,6 +5239,10 @@
919
925
 
920
926
        error = row_insert_for_mysql((byte*) record, prebuilt);
921
927
 
926
932
        /* Handle duplicate key errors */
927
933
        if (auto_inc_used) {
928
934
                ulint           err;
929
 
@@ -5559,6 +5566,10 @@
 
935
@@ -5572,6 +5579,10 @@
930
936
                }
931
937
        }
932
938
 
937
943
        innodb_srv_conc_exit_innodb(trx);
938
944
 
939
945
        error = convert_error_code_to_mysql(error,
940
 
@@ -5612,6 +5623,10 @@
 
946
@@ -5625,6 +5636,10 @@
941
947
 
942
948
        error = row_update_for_mysql((byte*) record, prebuilt);
943
949
 
948
954
        innodb_srv_conc_exit_innodb(trx);
949
955
 
950
956
        error = convert_error_code_to_mysql(
951
 
@@ -5930,6 +5945,11 @@
 
957
@@ -5943,6 +5958,11 @@
952
958
        case DB_SUCCESS:
953
959
                error = 0;
954
960
                table->status = 0;
960
966
                break;
961
967
        case DB_RECORD_NOT_FOUND:
962
968
                error = HA_ERR_KEY_NOT_FOUND;
963
 
@@ -6139,6 +6159,11 @@
 
969
@@ -6152,6 +6172,11 @@
964
970
        case DB_SUCCESS:
965
971
                error = 0;
966
972
                table->status = 0;
972
978
                break;
973
979
        case DB_RECORD_NOT_FOUND:
974
980
                error = HA_ERR_END_OF_FILE;
975
 
@@ -8089,11 +8114,35 @@
 
981
@@ -8094,11 +8119,35 @@
976
982
                        /* In sql_show we call with this flag: update
977
983
                        then statistics so that they are up-to-date */
978
984
 
1009
1015
 
1010
1016
                        prebuilt->trx->op_info = "returning various info to MySQL";
1011
1017
                }
1012
 
@@ -8171,7 +8220,7 @@
 
1018
@@ -8176,7 +8225,7 @@
1013
1019
                are asked by MySQL to avoid locking. Another reason to
1014
1020
                avoid the call is that it uses quite a lot of CPU.
1015
1021
                See Bug#38185. */
1018
1024
                    || !(flag & HA_STATUS_VARIABLE_EXTRA)) {
1019
1025
                        /* We do not update delete_length if no
1020
1026
                        locking is requested so the "old" value can
1021
 
@@ -11378,6 +11427,26 @@
 
1027
@@ -11385,6 +11434,26 @@
1022
1028
   "The number of index pages to sample when calculating statistics (default 8)",
1023
1029
   NULL, NULL, 8, 1, ~0ULL, 0);
1024
1030
 
1045
1051
 static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
1046
1052
   PLUGIN_VAR_OPCMDARG,
1047
1053
   "Enable InnoDB adaptive hash index (enabled by default).  "
1048
 
@@ -11703,6 +11772,9 @@
 
1054
@@ -11710,6 +11779,9 @@
1049
1055
   MYSQL_SYSVAR(recovery_update_relay_log),
1050
1056
   MYSQL_SYSVAR(rollback_on_timeout),
1051
1057
   MYSQL_SYSVAR(stats_on_metadata),
1055
1061
   MYSQL_SYSVAR(stats_sample_pages),
1056
1062
   MYSQL_SYSVAR(adaptive_hash_index),
1057
1063
   MYSQL_SYSVAR(stats_method),
1058
 
@@ -11772,7 +11844,10 @@
 
1064
@@ -11779,7 +11851,10 @@
1059
1065
 i_s_innodb_sys_columns,
1060
1066
 i_s_innodb_sys_fields,
1061
1067
 i_s_innodb_sys_foreign,
1862
1868
diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
1863
1869
--- a/storage/innobase/include/srv0srv.h        2010-12-03 15:53:54.622036720 +0900
1864
1870
+++ b/storage/innobase/include/srv0srv.h        2010-12-03 17:19:24.906953188 +0900
1865
 
@@ -214,6 +214,9 @@
 
1871
@@ -211,6 +211,9 @@
1866
1872
 extern ibool   srv_innodb_status;
1867
1873
 
1868
1874
 extern unsigned long long      srv_stats_sample_pages;
1930
1936
diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
1931
1937
--- a/storage/innobase/row/row0merge.c  2010-11-03 07:01:13.000000000 +0900
1932
1938
+++ b/storage/innobase/row/row0merge.c  2010-12-03 17:19:24.914955391 +0900
1933
 
@@ -2020,6 +2020,8 @@
 
1939
@@ -2019,6 +2019,8 @@
1934
1940
                "UPDATE SYS_INDEXES SET NAME=CONCAT('"
1935
1941
                TEMP_INDEX_PREFIX_STR "', NAME) WHERE ID = :indexid;\n"
1936
1942
                "COMMIT WORK;\n"
1961
1967
        }
1962
1968
 }
1963
1969
 
1964
 
@@ -2105,6 +2108,71 @@
 
1970
@@ -2098,6 +2101,71 @@
1965
1971
 }
1966
1972
 
1967
1973
 /*********************************************************************//**
1978
1984
+       que_thr_t*      thr;
1979
1985
+       ulint           err;
1980
1986
+
1981
 
+       ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
 
1987
+       //ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
1982
1988
+
1983
1989
+       trx->op_info = "try to insert rows to SYS_STATS";
1984
1990
+
2033
2039
 Scans a table create SQL string and adds to the data dictionary
2034
2040
 the foreign key constraints declared in the string. This function
2035
2041
 should be called after the indexes for a table have been created.
2036
 
@@ -3024,7 +3092,7 @@
 
2042
@@ -3022,7 +3090,7 @@
2037
2043
        dict_table_autoinc_initialize(table, 1);
2038
2044
        dict_table_autoinc_unlock(table);
2039
2045
        dict_update_statistics(table, FALSE /* update even if stats are
2042
2048
 
2043
2049
        trx_commit_for_mysql(trx);
2044
2050
 
2045
 
@@ -3326,6 +3394,8 @@
 
2051
@@ -3324,6 +3392,8 @@
2046
2052
                           "       IF (SQL % NOTFOUND) THEN\n"
2047
2053
                           "               found := 0;\n"
2048
2054
                           "       ELSE\n"
2122
2128
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
2123
2129
--- a/storage/innobase/srv/srv0srv.c    2010-12-03 15:53:54.625288512 +0900
2124
2130
+++ b/storage/innobase/srv/srv0srv.c    2010-12-03 17:19:24.922953561 +0900
2125
 
@@ -404,6 +404,9 @@
 
2131
@@ -398,6 +398,9 @@
2126
2132
 /* When estimating number of different key values in an index, sample
2127
2133
 this many index pages */
2128
2134
 UNIV_INTERN unsigned long long srv_stats_sample_pages = 8;