diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-02-04 20:34:15 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-02-04 20:34:15 +0300 |
commit | a9e22b589677df9035c73e61b80be0fc54d175a5 (patch) | |
tree | bf6e8bd7de75f7f9ec6dbf8903d150ed3511a6da | |
parent | 1edca1d7ef6a77d406ea2c1bcaf5d9aff2f4c04c (diff) | |
parent | 8dfc3fbbab0dc7b3be98a47423ae74a6b4933864 (diff) | |
download | mariadb-git-a9e22b589677df9035c73e61b80be0fc54d175a5.tar.gz |
Merge next-mr -> next-4284-merge.
311 files changed, 39387 insertions, 657 deletions
diff --git a/BUILD/compile-dist b/BUILD/compile-dist index cf6cefc0969..9fe3aaf8bb5 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -1,4 +1,20 @@ #!/bin/sh + +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # # This script's purpose is to update the automake/autoconf helper scripts and # to run a plain "configure" without any special compile flags. Only features @@ -61,6 +77,7 @@ fi # Remember that configure restricts the man pages to the configured features ! ./configure \ --with-embedded-server \ + --with-perfschema \ --with-ndbcluster $gmake diff --git a/include/m_ctype.h b/include/m_ctype.h index 700f373d677..35d40e8bfa4 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -40,9 +40,9 @@ extern "C" { typedef struct unicase_info_st { - uint16 toupper; - uint16 tolower; - uint16 sort; + uint32 toupper; + uint32 tolower; + uint32 sort; } MY_UNICASE_INFO; @@ -439,6 +439,14 @@ extern size_t my_caseup_mb(CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); extern size_t my_casedn_mb(CHARSET_INFO *, char *src, size_t srclen, char *dst, size_t dstlen); +extern size_t my_caseup_mb_varlen(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); +extern size_t my_casedn_mb_varlen(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); +extern size_t my_caseup_ujis(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); +extern size_t my_casedn_ujis(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *); int my_wildcmp_mb(CHARSET_INFO *, diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 2686cd36355..6d870f4bcdf 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB +# Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -75,6 +75,8 @@ EXTRA_DIST = README \ # List of directories containing test + result files and the # related test data files that should be copied +# If you want to add a new suite, please check DEFAULT_SUITES in +# mysql-test-run.pl. TEST_DIRS = t r include std_data std_data/parts collections \ std_data/ndb_backup50 std_data/ndb_backup51 \ std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \ @@ -100,7 +102,9 @@ TEST_DIRS = t r include std_data std_data/parts collections \ suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \ suite/parts suite/parts/t suite/parts/r suite/parts/inc \ suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \ - suite/sys_vars suite/sys_vars/t suite/sys_vars/inc suite/sys_vars/r + suite/sys_vars suite/sys_vars/t suite/sys_vars/inc suite/sys_vars/r \ + suite/perfschema suite/perfschema/t suite/perfschema/r \ + suite/perfschema/include # Used by dist-hook and install-data-local to copy all # test files into either dist or install directory diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf index 428c2166947..6888a69b0a4 100644 --- a/mysql-test/include/default_my.cnf +++ b/mysql-test/include/default_my.cnf @@ -1,3 +1,18 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # Use default setting for mysqld processes !include default_mysqld.cnf !include default_client.cnf @@ -9,6 +24,8 @@ log-bin= master-bin +# Run tests with the performance schema instrumentation +loose-enable-performance-schema [mysqlbinlog] disable-force-if-open diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 6116b20d8bb..def14abf55a 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -1,3 +1,18 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # Default values that applies to all MySQL Servers [mysqld] open-files-limit= 1024 @@ -26,3 +41,6 @@ slave-net-timeout=120 log-bin=mysqld-bin +# Run tests with the performance schema instrumentation +loose-enable-performance-schema + diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 27f4891c39e..02404af5eea 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1,6 +1,21 @@ #!/usr/bin/perl # -*- cperl -*- +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # ############################################################################## # @@ -128,7 +143,9 @@ my $path_config_file; # The generated config file, var/my.cnf # executables will be used by the test suite. our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; -my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,rpl_ndb,ndb,innodb"; +# If you add a new suite, please check TEST_DIRS in Makefile.am. +# +my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,rpl_ndb,ndb,innodb,perfschema"; my $opt_suites; our $opt_verbose= 0; # Verbose output, enable with --verbose diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result index 4a82f8c66e9..ae9989ce563 100644 --- a/mysql-test/r/1st.result +++ b/mysql-test/r/1st.result @@ -3,6 +3,7 @@ Database information_schema mtr mysql +performance_schema test show tables in mysql; Tables_in_mysql diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 2efcf549608..d81534ac84e 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -277,3 +277,281 @@ hex(a) EE00 drop table t1; End of 5.0 tests +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=big5_chinese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(8) DEFAULT NULL, + `a` varchar(1) CHARACTER SET big5 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT COUNT(*) FROM t1; +COUNT(*) +28672 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1 WHERE a<>''; +COUNT(*) +13973 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +A2CF A2CF A2E9 A A ï½ +A2D0 A2D0 A2EA ï¼¢ ï¼¢ b +A2D1 A2D1 A2EB ï¼£ ï¼£ c +A2D2 A2D2 A2EC D D d +A2D3 A2D3 A2ED ï¼¥ ï¼¥ ï½… +A2D4 A2D4 A2EE F F f +A2D5 A2D5 A2EF G G g +A2D6 A2D6 A2F0 H H h +A2D7 A2D7 A2F1 I I i +A2D8 A2D8 A2F2 J J j +A2D9 A2D9 A2F3 K K k +A2DA A2DA A2F4 L L l +A2DB A2DB A2F5 ï¼ ï¼ ï½ +A2DC A2DC A2F6 ï¼® ï¼® n +A2DD A2DD A2F7 O O ï½ +A2DE A2DE A2F8 ï¼° ï¼° ï½ +A2DF A2DF A2F9 ï¼± ï¼± q +A2E0 A2E0 A2FA ï¼² ï¼² ï½’ +A2E1 A2E1 A2FB ï¼³ ï¼³ s +A2E2 A2E2 A2FC ï¼´ ï¼´ ï½” +A2E3 A2E3 A2FD ï¼µ ï¼µ u +A2E4 A2E4 A2FE V V ï½– +A2E5 A2E5 A340 ï¼· ï¼· ï½— +A2E6 A2E6 A341 X X x +A2E7 A2E7 A342 ï¼¹ ï¼¹ ï½™ +A2E8 A2E8 A343 Z Z z +A2E9 A2CF A2E9 ï½ ï¼¡ ï½ +A2EA A2D0 A2EA b ï¼¢ b +A2EB A2D1 A2EB c ï¼£ c +A2EC A2D2 A2EC d D d +A2ED A2D3 A2ED ï½… ï¼¥ ï½… +A2EE A2D4 A2EE f F f +A2EF A2D5 A2EF g G g +A2F0 A2D6 A2F0 h H h +A2F1 A2D7 A2F1 i I i +A2F2 A2D8 A2F2 j J j +A2F3 A2D9 A2F3 k K k +A2F4 A2DA A2F4 l L l +A2F5 A2DB A2F5 ï½ ï¼ ï½ +A2F6 A2DC A2F6 n ï¼® n +A2F7 A2DD A2F7 ï½ ï¼¯ ï½ +A2F8 A2DE A2F8 ï½ ï¼° ï½ +A2F9 A2DF A2F9 q ï¼± q +A2FA A2E0 A2FA ï½’ ï¼² ï½’ +A2FB A2E1 A2FB s ï¼³ s +A2FC A2E2 A2FC ï½” ï¼´ ï½” +A2FD A2E3 A2FD u ï¼µ u +A2FE A2E4 A2FE ï½– V ï½– +A340 A2E5 A340 ï½— ï¼· ï½— +A341 A2E6 A341 x X x +A342 A2E7 A342 ï½™ ï¼¹ ï½™ +A343 A2E8 A343 z Z z +A344 A344 A35C Α Α α +A345 A345 A35D Î’ Î’ β +A346 A346 A35E Γ Γ γ +A347 A347 A35F Δ Δ δ +A348 A348 A360 Ε Ε ε +A349 A349 A361 Ζ Ζ ζ +A34A A34A A362 Η Η η +A34B A34B A363 Θ Θ θ +A34C A34C A364 Ι Ι ι +A34D A34D A365 Κ Κ κ +A34E A34E A366 Λ Λ λ +A34F A34F A367 Îœ Îœ μ +A350 A350 A368 ΠΠν +A351 A351 A369 Ξ Ξ ξ +A352 A352 A36A Ο Ο ο +A353 A353 A36B ΠΠπ +A354 A354 A36C Ρ Ρ Ï +A355 A355 A36D Σ Σ σ +A356 A356 A36E Τ Τ Ï„ +A357 A357 A36F Î¥ Î¥ Ï… +A358 A358 A370 Φ Φ φ +A359 A359 A371 Χ Χ χ +A35A A35A A372 Ψ Ψ ψ +A35B A35B A373 Ω Ω ω +A35C A344 A35C α Α α +A35D A345 A35D β Î’ β +A35E A346 A35E γ Γ γ +A35F A347 A35F δ Δ δ +A360 A348 A360 ε Ε ε +A361 A349 A361 ζ Ζ ζ +A362 A34A A362 η Η η +A363 A34B A363 θ Θ θ +A364 A34C A364 ι Ι ι +A365 A34D A365 κ Κ κ +A366 A34E A366 λ Λ λ +A367 A34F A367 μ Îœ μ +A368 A350 A368 ν Πν +A369 A351 A369 ξ Ξ ξ +A36A A352 A36A ο Ο ο +A36B A353 A36B Ï€ Ππ +A36C A354 A36C Ï Î¡ Ï +A36D A355 A36D σ Σ σ +A36E A356 A36E Ï„ Τ Ï„ +A36F A357 A36F Ï… Î¥ Ï… +A370 A358 A370 φ Φ φ +A371 A359 A371 χ Χ χ +A372 A35A A372 ψ Ψ ψ +A373 A35B A373 ω Ω ω +C7B1 C7B1 C7CC Д Д д +C7B2 C7B2 C7CD Е Е е +C7B3 C7B3 C7CE Ð Ð Ñ‘ +C7B4 C7B4 C7CF Ж Ж ж +C7B5 C7B5 C7D0 З З з +C7B6 C7B6 C7D1 И И и +C7B7 C7B7 C7D2 Й Й й +C7B8 C7B8 C7D3 К К к +C7B9 C7B9 C7D4 Л Л л +C7BA C7BA C7D5 Ðœ Ðœ м +C7BB C7BB C7DC У У у +C7BC C7BC C7DD Ф Ф Ñ„ +C7BD C7BD C7DE Ð¥ Ð¥ Ñ… +C7BE C7BE C7DF Ц Ц ц +C7BF C7BF C7E0 Ч Ч ч +C7C0 C7C0 C7E1 Ш Ш ш +C7C1 C7C1 C7E2 Щ Щ щ +C7C2 C7C2 C7E3 Ъ Ъ ÑŠ +C7C3 C7C3 C7E4 Ы Ы Ñ‹ +C7C4 C7C4 C7E5 Ь Ь ÑŒ +C7C5 C7C5 C7E6 Ð Ð Ñ +C7C6 C7C6 C7E7 Ю Ю ÑŽ +C7C7 C7C7 C7E8 Я Я Ñ +C7CC C7B1 C7CC д Д д +C7CD C7B2 C7CD е Е е +C7CE C7B3 C7CE Ñ‘ Ð Ñ‘ +C7CF C7B4 C7CF ж Ж ж +C7D0 C7B5 C7D0 з З з +C7D1 C7B6 C7D1 и И и +C7D2 C7B7 C7D2 й Й й +C7D3 C7B8 C7D3 к К к +C7D4 C7B9 C7D4 л Л л +C7D5 C7BA C7D5 м Ðœ м +C7DC C7BB C7DC у У у +C7DD C7BC C7DD Ñ„ Ф Ñ„ +C7DE C7BD C7DE Ñ… Ð¥ Ñ… +C7DF C7BE C7DF ц Ц ц +C7E0 C7BF C7E0 ч Ч ч +C7E1 C7C0 C7E1 ш Ш ш +C7E2 C7C1 C7E2 щ Щ щ +C7E3 C7C2 C7E3 ÑŠ Ъ ÑŠ +C7E4 C7C3 C7E4 Ñ‹ Ы Ñ‹ +C7E5 C7C4 C7E5 ÑŒ Ь ÑŒ +C7E6 C7C5 C7E6 Ñ Ð Ñ +C7E7 C7C6 C7E7 ÑŽ Ю ÑŽ +C7E8 C7C7 C7E8 Ñ Ð¯ Ñ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A2B9 â… +A2BA â…¡ +A2BB â…¢ +A2BC â…£ +A2BD â…¤ +A2BE â…¥ +A2BF â…¦ +A2C0 â…§ +A2C1 â…¨ +A2C2 â…© +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +C7C8 а +C7C9 б +C7CA в +C7CB г +C7D6 н +C7D7 о +C7D8 п +C7D9 Ñ€ +C7DA Ñ +C7DB Ñ‚ +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index bb971e5453b..6f859c9abf7 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -55,3 +55,331 @@ hex(a) hex(lower(a)) hex(upper(a)) 8372835E 8372835E 8372835E DROP TABLE t1; End of 5.1 tests +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=cp932_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +INSERT t1 (code) SELECT head FROM head +WHERE (head BETWEEN 'A1' AND 'DF') +ORDER BY head; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(8) DEFAULT NULL, + `a` varchar(1) CHARACTER SET cp932 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1; +COUNT(*) +14623 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=1; +COUNT(*) +63 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +COUNT(*) +11280 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 +WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) +ORDER BY code; +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +8260 8260 8281 A A ï½ +8261 8261 8282 ï¼¢ ï¼¢ b +8262 8262 8283 ï¼£ ï¼£ c +8263 8263 8284 D D d +8264 8264 8285 ï¼¥ ï¼¥ ï½… +8265 8265 8286 F F f +8266 8266 8287 G G g +8267 8267 8288 H H h +8268 8268 8289 I I i +8269 8269 828A J J j +826A 826A 828B K K k +826B 826B 828C L L l +826C 826C 828D ï¼ ï¼ ï½ +826D 826D 828E ï¼® ï¼® n +826E 826E 828F O O ï½ +826F 826F 8290 ï¼° ï¼° ï½ +8270 8270 8291 ï¼± ï¼± q +8271 8271 8292 ï¼² ï¼² ï½’ +8272 8272 8293 ï¼³ ï¼³ s +8273 8273 8294 ï¼´ ï¼´ ï½” +8274 8274 8295 ï¼µ ï¼µ u +8275 8275 8296 V V ï½– +8276 8276 8297 ï¼· ï¼· ï½— +8277 8277 8298 X X x +8278 8278 8299 ï¼¹ ï¼¹ ï½™ +8279 8279 829A Z Z z +8281 8260 8281 ï½ ï¼¡ ï½ +8282 8261 8282 b ï¼¢ b +8283 8262 8283 c ï¼£ c +8284 8263 8284 d D d +8285 8264 8285 ï½… ï¼¥ ï½… +8286 8265 8286 f F f +8287 8266 8287 g G g +8288 8267 8288 h H h +8289 8268 8289 i I i +828A 8269 828A j J j +828B 826A 828B k K k +828C 826B 828C l L l +828D 826C 828D ï½ ï¼ ï½ +828E 826D 828E n ï¼® n +828F 826E 828F ï½ ï¼¯ ï½ +8290 826F 8290 ï½ ï¼° ï½ +8291 8270 8291 q ï¼± q +8292 8271 8292 ï½’ ï¼² ï½’ +8293 8272 8293 s ï¼³ s +8294 8273 8294 ï½” ï¼´ ï½” +8295 8274 8295 u ï¼µ u +8296 8275 8296 ï½– V ï½– +8297 8276 8297 ï½— ï¼· ï½— +8298 8277 8298 x X x +8299 8278 8299 ï½™ ï¼¹ ï½™ +829A 8279 829A z Z z +839F 839F 83BF Α Α α +83A0 83A0 83C0 Î’ Î’ β +83A1 83A1 83C1 Γ Γ γ +83A2 83A2 83C2 Δ Δ δ +83A3 83A3 83C3 Ε Ε ε +83A4 83A4 83C4 Ζ Ζ ζ +83A5 83A5 83C5 Η Η η +83A6 83A6 83C6 Θ Θ θ +83A7 83A7 83C7 Ι Ι ι +83A8 83A8 83C8 Κ Κ κ +83A9 83A9 83C9 Λ Λ λ +83AA 83AA 83CA Îœ Îœ μ +83AB 83AB 83CB ΠΠν +83AC 83AC 83CC Ξ Ξ ξ +83AD 83AD 83CD Ο Ο ο +83AE 83AE 83CE ΠΠπ +83AF 83AF 83CF Ρ Ρ Ï +83B0 83B0 83D0 Σ Σ σ +83B1 83B1 83D1 Τ Τ Ï„ +83B2 83B2 83D2 Î¥ Î¥ Ï… +83B3 83B3 83D3 Φ Φ φ +83B4 83B4 83D4 Χ Χ χ +83B5 83B5 83D5 Ψ Ψ ψ +83B6 83B6 83D6 Ω Ω ω +83BF 839F 83BF α Α α +83C0 83A0 83C0 β Î’ β +83C1 83A1 83C1 γ Γ γ +83C2 83A2 83C2 δ Δ δ +83C3 83A3 83C3 ε Ε ε +83C4 83A4 83C4 ζ Ζ ζ +83C5 83A5 83C5 η Η η +83C6 83A6 83C6 θ Θ θ +83C7 83A7 83C7 ι Ι ι +83C8 83A8 83C8 κ Κ κ +83C9 83A9 83C9 λ Λ λ +83CA 83AA 83CA μ Îœ μ +83CB 83AB 83CB ν Πν +83CC 83AC 83CC ξ Ξ ξ +83CD 83AD 83CD ο Ο ο +83CE 83AE 83CE Ï€ Ππ +83CF 83AF 83CF Ï Î¡ Ï +83D0 83B0 83D0 σ Σ σ +83D1 83B1 83D1 Ï„ Τ Ï„ +83D2 83B2 83D2 Ï… Î¥ Ï… +83D3 83B3 83D3 φ Φ φ +83D4 83B4 83D4 χ Χ χ +83D5 83B5 83D5 ψ Ψ ψ +83D6 83B6 83D6 ω Ω ω +8440 8440 8470 РРа +8441 8441 8471 Б Б б +8442 8442 8472 Ð’ Ð’ в +8443 8443 8473 Г Г г +8444 8444 8474 Д Д д +8445 8445 8475 Е Е е +8446 8446 8476 Ð Ð Ñ‘ +8447 8447 8477 Ж Ж ж +8448 8448 8478 З З з +8449 8449 8479 И И и +844A 844A 847A Й Й й +844B 844B 847B К К к +844C 844C 847C Л Л л +844D 844D 847D Ðœ Ðœ м +844E 844E 847E РРн +844F 844F 8480 О О о +8450 8450 8481 П П п +8451 8451 8482 РРр +8452 8452 8483 С С Ñ +8453 8453 8484 Т Т Ñ‚ +8454 8454 8485 У У у +8455 8455 8486 Ф Ф Ñ„ +8456 8456 8487 Ð¥ Ð¥ Ñ… +8457 8457 8488 Ц Ц ц +8458 8458 8489 Ч Ч ч +8459 8459 848A Ш Ш ш +845A 845A 848B Щ Щ щ +845B 845B 848C Ъ Ъ ÑŠ +845C 845C 848D Ы Ы Ñ‹ +845D 845D 848E Ь Ь ÑŒ +845E 845E 848F Ð Ð Ñ +845F 845F 8490 Ю Ю ÑŽ +8460 8460 8491 Я Я Ñ +8470 8440 8470 а Ра +8471 8441 8471 б Б б +8472 8442 8472 в Ð’ в +8473 8443 8473 г Г г +8474 8444 8474 д Д д +8475 8445 8475 е Е е +8476 8446 8476 Ñ‘ Ð Ñ‘ +8477 8447 8477 ж Ж ж +8478 8448 8478 з З з +8479 8449 8479 и И и +847A 844A 847A й Й й +847B 844B 847B к К к +847C 844C 847C л Л л +847D 844D 847D м Ðœ м +847E 844E 847E н Рн +8480 844F 8480 о О о +8481 8450 8481 п П п +8482 8451 8482 Ñ€ Рр +8483 8452 8483 Ñ Ð¡ Ñ +8484 8453 8484 Ñ‚ Т Ñ‚ +8485 8454 8485 у У у +8486 8455 8486 Ñ„ Ф Ñ„ +8487 8456 8487 Ñ… Ð¥ Ñ… +8488 8457 8488 ц Ц ц +8489 8458 8489 ч Ч ч +848A 8459 848A ш Ш ш +848B 845A 848B щ Щ щ +848C 845B 848C ÑŠ Ъ ÑŠ +848D 845C 848D Ñ‹ Ы Ñ‹ +848E 845D 848E ÑŒ Ь ÑŒ +848F 845E 848F Ñ Ð Ñ +8490 845F 8490 ÑŽ Ю ÑŽ +8491 8460 8491 Ñ Ð¯ Ñ +8754 8754 EEEF â… â… â…° +8755 8755 EEF0 â…¡ â…¡ â…± +8756 8756 EEF1 â…¢ â…¢ â…² +8757 8757 EEF2 â…£ â…£ â…³ +8758 8758 EEF3 â…¤ â…¤ â…´ +8759 8759 EEF4 â…¥ â…¥ â…µ +875A 875A EEF5 â…¦ â…¦ â…¶ +875B 875B EEF6 â…§ â…§ â…· +875C 875C EEF7 â…¨ â…¨ â…¸ +875D 875D EEF8 â…© â…© â…¹ +EEEF 8754 EEEF â…° â… â…° +EEF0 8755 EEF0 â…± â…¡ â…± +EEF1 8756 EEF1 â…² â…¢ â…² +EEF2 8757 EEF2 â…³ â…£ â…³ +EEF3 8758 EEF3 â…´ â…¤ â…´ +EEF4 8759 EEF4 â…µ â…¥ â…µ +EEF5 875A EEF5 â…¶ â…¦ â…¶ +EEF6 875B EEF6 â…· â…§ â…· +EEF7 875C EEF7 â…¸ â…¨ â…¸ +EEF8 875D EEF8 â…¹ â…© â…¹ +FA40 FA4A FA40 â…° â… â…° +FA41 FA4B FA41 â…± â…¡ â…± +FA42 FA4C FA42 â…² â…¢ â…² +FA43 FA4D FA43 â…³ â…£ â…³ +FA44 FA4E FA44 â…´ â…¤ â…´ +FA45 FA4F FA45 â…µ â…¥ â…µ +FA46 FA50 FA46 â…¶ â…¦ â…¶ +FA47 FA51 FA47 â…· â…§ â…· +FA48 FA52 FA48 â…¸ â…¨ â…¸ +FA49 FA53 FA49 â…¹ â…© â…¹ +FA4A FA4A FA40 â… â… â…° +FA4B FA4B FA41 â…¡ â…¡ â…± +FA4C FA4C FA42 â…¢ â…¢ â…² +FA4D FA4D FA43 â…£ â…£ â…³ +FA4E FA4E FA44 â…¤ â…¤ â…´ +FA4F FA4F FA45 â…¥ â…¥ â…µ +FA50 FA50 FA46 â…¦ â…¦ â…¶ +FA51 FA51 FA47 â…§ â…§ â…· +FA52 FA52 FA48 â…¨ â…¨ â…¸ +FA53 FA53 FA49 â…© â…© â…¹ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +81F0 â„« +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result index 21aa38b7fe6..c8ece9a28cd 100755 --- a/mysql-test/r/ctype_eucjpms.result +++ b/mysql-test/r/ctype_eucjpms.result @@ -9859,3 +9859,567 @@ hex(convert(_eucjpms 0xA5FE41 using ucs2)) select hex(convert(_eucjpms 0x8FABF841 using ucs2)); hex(convert(_eucjpms 0x8FABF841 using ucs2)) 003F0041 +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=eucjpms_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0; +INSERT INTO t1 (code) SELECT concat('8E', head) FROM head +WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head; +INSERT INTO t1 (code) SELECT concat(head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +INSERT INTO t1 (code) SELECT concat('8F', head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(6) CHARACTER SET eucjpms NOT NULL DEFAULT '', + `a` varchar(1) CHARACTER SET eucjpms NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1; +COUNT(*) +56959 +SELECT COUNT(*) FROM t1 WHERE a<>''; +COUNT(*) +17735 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +COUNT(*) +8899 +SELECT * FROM t1 WHERE CHAR_LENGTH(a)=2; +code a +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=3; +COUNT(*) +8836 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) ORDER BY code; +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +8FA6E1 8FA6E1 8FA6F1 Ά Ά ά +8FA6E2 8FA6E2 8FA6F2 Έ Έ Î +8FA6E3 8FA6E3 8FA6F3 Ή Ή ή +8FA6E4 8FA6E4 8FA6F4 Ί Ί ί +8FA6E5 8FA6E5 8FA6F5 Ϊ Ϊ ÏŠ +8FA6E7 8FA6E7 8FA6F7 ÎŒ ÎŒ ÏŒ +8FA6E9 8FA6E9 8FA6F9 ÎŽ ÎŽ Ï +8FA6EA 8FA6EA 8FA6FA Ϋ Ϋ Ï‹ +8FA6EC 8FA6EC 8FA6FC Î Î ÏŽ +8FA6F1 8FA6E1 8FA6F1 ά Ά ά +8FA6F2 8FA6E2 8FA6F2 ΠΈ Î +8FA6F3 8FA6E3 8FA6F3 ή Ή ή +8FA6F4 8FA6E4 8FA6F4 ί Ί ί +8FA6F5 8FA6E5 8FA6F5 ÏŠ Ϊ ÏŠ +8FA6F7 8FA6E7 8FA6F7 ÏŒ ÎŒ ÏŒ +8FA6F8 A6B2 8FA6F8 Ï‚ Σ Ï‚ +8FA6F9 8FA6E9 8FA6F9 Ï ÎŽ Ï +8FA6FA 8FA6EA 8FA6FA Ï‹ Ϋ Ï‹ +8FA6FC 8FA6EC 8FA6FC ÏŽ Î ÏŽ +8FA7C2 8FA7C2 8FA7F2 Ђ Ђ Ñ’ +8FA7C3 8FA7C3 8FA7F3 Ѓ Ѓ Ñ“ +8FA7C4 8FA7C4 8FA7F4 Є Є Ñ” +8FA7C5 8FA7C5 8FA7F5 Ð… Ð… Ñ• +8FA7C6 8FA7C6 8FA7F6 І І Ñ– +8FA7C7 8FA7C7 8FA7F7 Ї Ї Ñ— +8FA7C8 8FA7C8 8FA7F8 Ј Ј ј +8FA7C9 8FA7C9 8FA7F9 Љ Љ Ñ™ +8FA7CA 8FA7CA 8FA7FA Њ Њ Ñš +8FA7CB 8FA7CB 8FA7FB Ћ Ћ Ñ› +8FA7CC 8FA7CC 8FA7FC ÐŒ ÐŒ Ñœ +8FA7CD 8FA7CD 8FA7FD ÐŽ ÐŽ Ñž +8FA7CE 8FA7CE 8FA7FE Ð Ð ÑŸ +8FA7F2 8FA7C2 8FA7F2 Ñ’ Ђ Ñ’ +8FA7F3 8FA7C3 8FA7F3 Ñ“ Ѓ Ñ“ +8FA7F4 8FA7C4 8FA7F4 Ñ” Є Ñ” +8FA7F5 8FA7C5 8FA7F5 Ñ• Ð… Ñ• +8FA7F6 8FA7C6 8FA7F6 Ñ– І Ñ– +8FA7F7 8FA7C7 8FA7F7 Ñ— Ї Ñ— +8FA7F8 8FA7C8 8FA7F8 ј Ј ј +8FA7F9 8FA7C9 8FA7F9 Ñ™ Љ Ñ™ +8FA7FA 8FA7CA 8FA7FA Ñš Њ Ñš +8FA7FB 8FA7CB 8FA7FB Ñ› Ћ Ñ› +8FA7FC 8FA7CC 8FA7FC Ñœ ÐŒ Ñœ +8FA7FD 8FA7CD 8FA7FD Ñž ÐŽ Ñž +8FA7FE 8FA7CE 8FA7FE ÑŸ Ð ÑŸ +8FA9A1 8FA9A1 8FA9C1 Æ Æ æ +8FA9A2 8FA9A2 8FA9C2 Ä Ä Ä‘ +8FA9A4 8FA9A4 8FA9C4 Ħ Ħ ħ +8FA9A6 8FA9A6 8FA9C6 IJ IJ ij +8FA9A8 8FA9A8 8FA9C8 Å Å Å‚ +8FA9A9 8FA9A9 8FA9C9 Ä¿ Ä¿ Å€ +8FA9AB 8FA9AB 8FA9CB ÅŠ ÅŠ Å‹ +8FA9AC 8FA9AC 8FA9CC Ø Ø ø +8FA9AD 8FA9AD 8FA9CD Å’ Å’ Å“ +8FA9AF 8FA9AF 8FA9CF Ŧ Ŧ ŧ +8FA9B0 8FA9B0 8FA9D0 Þ Þ þ +8FA9C1 8FA9A1 8FA9C1 æ Æ æ +8FA9C2 8FA9A2 8FA9C2 Ä‘ Ä Ä‘ +8FA9C4 8FA9A4 8FA9C4 ħ Ħ ħ +8FA9C5 49 8FA9C5 ı I ı +8FA9C6 8FA9A6 8FA9C6 ij IJ ij +8FA9C8 8FA9A8 8FA9C8 Å‚ Å Å‚ +8FA9C9 8FA9A9 8FA9C9 Å€ Ä¿ Å€ +8FA9CB 8FA9AB 8FA9CB Å‹ ÅŠ Å‹ +8FA9CC 8FA9AC 8FA9CC ø Ø ø +8FA9CD 8FA9AD 8FA9CD Å“ Å’ Å“ +8FA9CF 8FA9AF 8FA9CF ŧ Ŧ ŧ +8FA9D0 8FA9B0 8FA9D0 þ Þ þ +8FAAA1 8FAAA1 8FABA1 à à á +8FAAA2 8FAAA2 8FABA2 À À à +8FAAA3 8FAAA3 8FABA3 Ä Ä ä +8FAAA4 8FAAA4 8FABA4   â +8FAAA5 8FAAA5 8FABA5 Ä‚ Ä‚ ă +8FAAA6 8FAAA6 8FABA6 Ç Ç ÇŽ +8FAAA7 8FAAA7 8FABA7 Ä€ Ä€ Ä +8FAAA8 8FAAA8 8FABA8 Ä„ Ä„ Ä… +8FAAA9 8FAAA9 8FABA9 Ã… Ã… Ã¥ +8FAAAA 8FAAAA 8FABAA à à ã +8FAAAB 8FAAAB 8FABAB Ć Ć ć +8FAAAC 8FAAAC 8FABAC Ĉ Ĉ ĉ +8FAAAD 8FAAAD 8FABAD ÄŒ ÄŒ Ä +8FAAAE 8FAAAE 8FABAE Ç Ç ç +8FAAAF 8FAAAF 8FABAF ÄŠ ÄŠ Ä‹ +8FAAB0 8FAAB0 8FABB0 ÄŽ ÄŽ Ä +8FAAB1 8FAAB1 8FABB1 É É é +8FAAB2 8FAAB2 8FABB2 È È è +8FAAB3 8FAAB3 8FABB3 Ë Ë ë +8FAAB4 8FAAB4 8FABB4 Ê Ê ê +8FAAB5 8FAAB5 8FABB5 Äš Äš Ä› +8FAAB6 8FAAB6 8FABB6 Ä– Ä– Ä— +8FAAB7 8FAAB7 8FABB7 Ä’ Ä’ Ä“ +8FAAB8 8FAAB8 8FABB8 Ę Ę Ä™ +8FAABA 8FAABA 8FABBA Äœ Äœ Ä +8FAABB 8FAABB 8FABBB Äž Äž ÄŸ +8FAABD 8FAABD 8FABBD Ä Ä Ä¡ +8FAABE 8FAABE 8FABBE Ĥ Ĥ Ä¥ +8FAABF 8FAABF 8FABBF à à à +8FAAC0 8FAAC0 8FABC0 ÃŒ ÃŒ ì +8FAAC1 8FAAC1 8FABC1 à à ï +8FAAC2 8FAAC2 8FABC2 ÃŽ ÃŽ î +8FAAC3 8FAAC3 8FABC3 Ç Ç Ç +8FAAC4 8FAAC4 69 Ä° Ä° i +8FAAC5 8FAAC5 8FABC5 Ī Ī Ä« +8FAAC6 8FAAC6 8FABC6 Ä® Ä® į +8FAAC7 8FAAC7 8FABC7 Ĩ Ĩ Ä© +8FAAC8 8FAAC8 8FABC8 Ä´ Ä´ ĵ +8FAAC9 8FAAC9 8FABC9 Ķ Ķ Ä· +8FAACA 8FAACA 8FABCA Ĺ Ĺ ĺ +8FAACB 8FAACB 8FABCB Ľ Ľ ľ +8FAACC 8FAACC 8FABCC Ä» Ä» ļ +8FAACD 8FAACD 8FABCD Ń Ń Å„ +8FAACE 8FAACE 8FABCE Ň Ň ň +8FAACF 8FAACF 8FABCF Å… Å… ņ +8FAAD0 8FAAD0 8FABD0 Ñ Ñ ñ +8FAAD1 8FAAD1 8FABD1 Ó Ó ó +8FAAD2 8FAAD2 8FABD2 Ã’ Ã’ ò +8FAAD3 8FAAD3 8FABD3 Ö Ö ö +8FAAD4 8FAAD4 8FABD4 Ô Ô ô +8FAAD5 8FAAD5 8FABD5 Ç‘ Ç‘ Ç’ +8FAAD6 8FAAD6 8FABD6 Å Å Å‘ +8FAAD7 8FAAD7 8FABD7 ÅŒ ÅŒ Å +8FAAD8 8FAAD8 8FABD8 Õ Õ õ +8FAAD9 8FAAD9 8FABD9 Å” Å” Å• +8FAADA 8FAADA 8FABDA Ř Ř Å™ +8FAADB 8FAADB 8FABDB Å– Å– Å— +8FAADC 8FAADC 8FABDC Åš Åš Å› +8FAADD 8FAADD 8FABDD Åœ Åœ Å +8FAADE 8FAADE 8FABDE Å Å Å¡ +8FAADF 8FAADF 8FABDF Åž Åž ÅŸ +8FAAE0 8FAAE0 8FABE0 Ť Ť Å¥ +8FAAE1 8FAAE1 8FABE1 Å¢ Å¢ Å£ +8FAAE2 8FAAE2 8FABE2 Ú Ú ú +8FAAE3 8FAAE3 8FABE3 Ù Ù ù +8FAAE4 8FAAE4 8FABE4 Ãœ Ãœ ü +8FAAE5 8FAAE5 8FABE5 Û Û û +8FAAE6 8FAAE6 8FABE6 Ŭ Ŭ Å +8FAAE7 8FAAE7 8FABE7 Ç“ Ç“ Ç” +8FAAE8 8FAAE8 8FABE8 Å° Å° ű +8FAAE9 8FAAE9 8FABE9 Ū Ū Å« +8FAAEA 8FAAEA 8FABEA Ų Ų ų +8FAAEB 8FAAEB 8FABEB Å® Å® ů +8FAAEC 8FAAEC 8FABEC Ũ Ũ Å© +8FAAED 8FAAED 8FABED Ç— Ç— ǘ +8FAAEE 8FAAEE 8FABEE Ç› Ç› Çœ +8FAAEF 8FAAEF 8FABEF Ç™ Ç™ Çš +8FAAF0 8FAAF0 8FABF0 Ç• Ç• Ç– +8FAAF1 8FAAF1 8FABF1 Å´ Å´ ŵ +8FAAF2 8FAAF2 8FABF2 à à ý +8FAAF3 8FAAF3 8FABF3 Ÿ Ÿ ÿ +8FAAF4 8FAAF4 8FABF4 Ŷ Ŷ Å· +8FAAF5 8FAAF5 8FABF5 Ź Ź ź +8FAAF6 8FAAF6 8FABF6 Ž Ž ž +8FAAF7 8FAAF7 8FABF7 Å» Å» ż +8FABA1 8FAAA1 8FABA1 á à á +8FABA2 8FAAA2 8FABA2 à À à +8FABA3 8FAAA3 8FABA3 ä Ä ä +8FABA4 8FAAA4 8FABA4 â  â +8FABA5 8FAAA5 8FABA5 ă Ä‚ ă +8FABA6 8FAAA6 8FABA6 ÇŽ Ç ÇŽ +8FABA7 8FAAA7 8FABA7 Ä Ä€ Ä +8FABA8 8FAAA8 8FABA8 Ä… Ä„ Ä… +8FABA9 8FAAA9 8FABA9 Ã¥ Ã… Ã¥ +8FABAA 8FAAAA 8FABAA ã à ã +8FABAB 8FAAAB 8FABAB ć Ć ć +8FABAC 8FAAAC 8FABAC ĉ Ĉ ĉ +8FABAD 8FAAAD 8FABAD Ä ÄŒ Ä +8FABAE 8FAAAE 8FABAE ç Ç ç +8FABAF 8FAAAF 8FABAF Ä‹ ÄŠ Ä‹ +8FABB0 8FAAB0 8FABB0 Ä ÄŽ Ä +8FABB1 8FAAB1 8FABB1 é É é +8FABB2 8FAAB2 8FABB2 è È è +8FABB3 8FAAB3 8FABB3 ë Ë ë +8FABB4 8FAAB4 8FABB4 ê Ê ê +8FABB5 8FAAB5 8FABB5 Ä› Äš Ä› +8FABB6 8FAAB6 8FABB6 Ä— Ä– Ä— +8FABB7 8FAAB7 8FABB7 Ä“ Ä’ Ä“ +8FABB8 8FAAB8 8FABB8 Ä™ Ę Ä™ +8FABBA 8FAABA 8FABBA Ä Äœ Ä +8FABBB 8FAABB 8FABBB ÄŸ Äž ÄŸ +8FABBD 8FAABD 8FABBD Ä¡ Ä Ä¡ +8FABBE 8FAABE 8FABBE Ä¥ Ĥ Ä¥ +8FABBF 8FAABF 8FABBF à à à +8FABC0 8FAAC0 8FABC0 ì ÃŒ ì +8FABC1 8FAAC1 8FABC1 ï à ï +8FABC2 8FAAC2 8FABC2 î ÃŽ î +8FABC3 8FAAC3 8FABC3 Ç Ç Ç +8FABC5 8FAAC5 8FABC5 Ä« Ī Ä« +8FABC6 8FAAC6 8FABC6 į Ä® į +8FABC7 8FAAC7 8FABC7 Ä© Ĩ Ä© +8FABC8 8FAAC8 8FABC8 ĵ Ä´ ĵ +8FABC9 8FAAC9 8FABC9 Ä· Ķ Ä· +8FABCA 8FAACA 8FABCA ĺ Ĺ ĺ +8FABCB 8FAACB 8FABCB ľ Ľ ľ +8FABCC 8FAACC 8FABCC ļ Ä» ļ +8FABCD 8FAACD 8FABCD Å„ Ń Å„ +8FABCE 8FAACE 8FABCE ň Ň ň +8FABCF 8FAACF 8FABCF ņ Å… ņ +8FABD0 8FAAD0 8FABD0 ñ Ñ ñ +8FABD1 8FAAD1 8FABD1 ó Ó ó +8FABD2 8FAAD2 8FABD2 ò Ã’ ò +8FABD3 8FAAD3 8FABD3 ö Ö ö +8FABD4 8FAAD4 8FABD4 ô Ô ô +8FABD5 8FAAD5 8FABD5 Ç’ Ç‘ Ç’ +8FABD6 8FAAD6 8FABD6 Å‘ Å Å‘ +8FABD7 8FAAD7 8FABD7 Å ÅŒ Å +8FABD8 8FAAD8 8FABD8 õ Õ õ +8FABD9 8FAAD9 8FABD9 Å• Å” Å• +8FABDA 8FAADA 8FABDA Å™ Ř Å™ +8FABDB 8FAADB 8FABDB Å— Å– Å— +8FABDC 8FAADC 8FABDC Å› Åš Å› +8FABDD 8FAADD 8FABDD Å Åœ Å +8FABDE 8FAADE 8FABDE Å¡ Å Å¡ +8FABDF 8FAADF 8FABDF ÅŸ Åž ÅŸ +8FABE0 8FAAE0 8FABE0 Å¥ Ť Å¥ +8FABE1 8FAAE1 8FABE1 Å£ Å¢ Å£ +8FABE2 8FAAE2 8FABE2 ú Ú ú +8FABE3 8FAAE3 8FABE3 ù Ù ù +8FABE4 8FAAE4 8FABE4 ü Ãœ ü +8FABE5 8FAAE5 8FABE5 û Û û +8FABE6 8FAAE6 8FABE6 ŠŬ Å +8FABE7 8FAAE7 8FABE7 Ç” Ç“ Ç” +8FABE8 8FAAE8 8FABE8 ű Å° ű +8FABE9 8FAAE9 8FABE9 Å« Ū Å« +8FABEA 8FAAEA 8FABEA ų Ų ų +8FABEB 8FAAEB 8FABEB ů Å® ů +8FABEC 8FAAEC 8FABEC Å© Ũ Å© +8FABED 8FAAED 8FABED ǘ Ç— ǘ +8FABEE 8FAAEE 8FABEE Çœ Ç› Çœ +8FABEF 8FAAEF 8FABEF Çš Ç™ Çš +8FABF0 8FAAF0 8FABF0 Ç– Ç• Ç– +8FABF1 8FAAF1 8FABF1 ŵ Å´ ŵ +8FABF2 8FAAF2 8FABF2 ý à ý +8FABF3 8FAAF3 8FABF3 ÿ Ÿ ÿ +8FABF4 8FAAF4 8FABF4 Å· Ŷ Å· +8FABF5 8FAAF5 8FABF5 ź Ź ź +8FABF6 8FAAF6 8FABF6 ž Ž ž +8FABF7 8FAAF7 8FABF7 ż Å» ż +8FF3F3 8FF3FD 8FF3F3 â…° â… â…° +8FF3F4 8FF3FE 8FF3F4 â…± â…¡ â…± +8FF3F5 8FF4A1 8FF3F5 â…² â…¢ â…² +8FF3F6 8FF4A2 8FF3F6 â…³ â…£ â…³ +8FF3F7 8FF4A3 8FF3F7 â…´ â…¤ â…´ +8FF3F8 8FF4A4 8FF3F8 â…µ â…¥ â…µ +8FF3F9 8FF4A5 8FF3F9 â…¶ â…¦ â…¶ +8FF3FA 8FF4A6 8FF3FA â…· â…§ â…· +8FF3FB 8FF4A7 8FF3FB â…¸ â…¨ â…¸ +8FF3FC 8FF4A8 8FF3FC â…¹ â…© â…¹ +8FF3FD 8FF3FD 8FF3F3 â… â… â…° +8FF3FE 8FF3FE 8FF3F4 â…¡ â…¡ â…± +8FF4A1 8FF4A1 8FF3F5 â…¢ â…¢ â…² +8FF4A2 8FF4A2 8FF3F6 â…£ â…£ â…³ +8FF4A3 8FF4A3 8FF3F7 â…¤ â…¤ â…´ +8FF4A4 8FF4A4 8FF3F8 â…¥ â…¥ â…µ +8FF4A5 8FF4A5 8FF3F9 â…¦ â…¦ â…¶ +8FF4A6 8FF4A6 8FF3FA â…§ â…§ â…· +8FF4A7 8FF4A7 8FF3FB â…¨ â…¨ â…¸ +8FF4A8 8FF4A8 8FF3FC â…© â…© â…¹ +A2F2 A2F2 8FABA9 â„« â„« Ã¥ +A3C1 A3C1 A3E1 A A ï½ +A3C2 A3C2 A3E2 ï¼¢ ï¼¢ b +A3C3 A3C3 A3E3 ï¼£ ï¼£ c +A3C4 A3C4 A3E4 D D d +A3C5 A3C5 A3E5 ï¼¥ ï¼¥ ï½… +A3C6 A3C6 A3E6 F F f +A3C7 A3C7 A3E7 G G g +A3C8 A3C8 A3E8 H H h +A3C9 A3C9 A3E9 I I i +A3CA A3CA A3EA J J j +A3CB A3CB A3EB K K k +A3CC A3CC A3EC L L l +A3CD A3CD A3ED ï¼ ï¼ ï½ +A3CE A3CE A3EE ï¼® ï¼® n +A3CF A3CF A3EF O O ï½ +A3D0 A3D0 A3F0 ï¼° ï¼° ï½ +A3D1 A3D1 A3F1 ï¼± ï¼± q +A3D2 A3D2 A3F2 ï¼² ï¼² ï½’ +A3D3 A3D3 A3F3 ï¼³ ï¼³ s +A3D4 A3D4 A3F4 ï¼´ ï¼´ ï½” +A3D5 A3D5 A3F5 ï¼µ ï¼µ u +A3D6 A3D6 A3F6 V V ï½– +A3D7 A3D7 A3F7 ï¼· ï¼· ï½— +A3D8 A3D8 A3F8 X X x +A3D9 A3D9 A3F9 ï¼¹ ï¼¹ ï½™ +A3DA A3DA A3FA Z Z z +A3E1 A3C1 A3E1 ï½ ï¼¡ ï½ +A3E2 A3C2 A3E2 b ï¼¢ b +A3E3 A3C3 A3E3 c ï¼£ c +A3E4 A3C4 A3E4 d D d +A3E5 A3C5 A3E5 ï½… ï¼¥ ï½… +A3E6 A3C6 A3E6 f F f +A3E7 A3C7 A3E7 g G g +A3E8 A3C8 A3E8 h H h +A3E9 A3C9 A3E9 i I i +A3EA A3CA A3EA j J j +A3EB A3CB A3EB k K k +A3EC A3CC A3EC l L l +A3ED A3CD A3ED ï½ ï¼ ï½ +A3EE A3CE A3EE n ï¼® n +A3EF A3CF A3EF ï½ ï¼¯ ï½ +A3F0 A3D0 A3F0 ï½ ï¼° ï½ +A3F1 A3D1 A3F1 q ï¼± q +A3F2 A3D2 A3F2 ï½’ ï¼² ï½’ +A3F3 A3D3 A3F3 s ï¼³ s +A3F4 A3D4 A3F4 ï½” ï¼´ ï½” +A3F5 A3D5 A3F5 u ï¼µ u +A3F6 A3D6 A3F6 ï½– V ï½– +A3F7 A3D7 A3F7 ï½— ï¼· ï½— +A3F8 A3D8 A3F8 x X x +A3F9 A3D9 A3F9 ï½™ ï¼¹ ï½™ +A3FA A3DA A3FA z Z z +A6A1 A6A1 A6C1 Α Α α +A6A2 A6A2 A6C2 Î’ Î’ β +A6A3 A6A3 A6C3 Γ Γ γ +A6A4 A6A4 A6C4 Δ Δ δ +A6A5 A6A5 A6C5 Ε Ε ε +A6A6 A6A6 A6C6 Ζ Ζ ζ +A6A7 A6A7 A6C7 Η Η η +A6A8 A6A8 A6C8 Θ Θ θ +A6A9 A6A9 A6C9 Ι Ι ι +A6AA A6AA A6CA Κ Κ κ +A6AB A6AB A6CB Λ Λ λ +A6AC A6AC A6CC Îœ Îœ μ +A6AD A6AD A6CD ΠΠν +A6AE A6AE A6CE Ξ Ξ ξ +A6AF A6AF A6CF Ο Ο ο +A6B0 A6B0 A6D0 ΠΠπ +A6B1 A6B1 A6D1 Ρ Ρ Ï +A6B2 A6B2 A6D2 Σ Σ σ +A6B3 A6B3 A6D3 Τ Τ Ï„ +A6B4 A6B4 A6D4 Î¥ Î¥ Ï… +A6B5 A6B5 A6D5 Φ Φ φ +A6B6 A6B6 A6D6 Χ Χ χ +A6B7 A6B7 A6D7 Ψ Ψ ψ +A6B8 A6B8 A6D8 Ω Ω ω +A6C1 A6A1 A6C1 α Α α +A6C2 A6A2 A6C2 β Î’ β +A6C3 A6A3 A6C3 γ Γ γ +A6C4 A6A4 A6C4 δ Δ δ +A6C5 A6A5 A6C5 ε Ε ε +A6C6 A6A6 A6C6 ζ Ζ ζ +A6C7 A6A7 A6C7 η Η η +A6C8 A6A8 A6C8 θ Θ θ +A6C9 A6A9 A6C9 ι Ι ι +A6CA A6AA A6CA κ Κ κ +A6CB A6AB A6CB λ Λ λ +A6CC A6AC A6CC μ Îœ μ +A6CD A6AD A6CD ν Πν +A6CE A6AE A6CE ξ Ξ ξ +A6CF A6AF A6CF ο Ο ο +A6D0 A6B0 A6D0 Ï€ Ππ +A6D1 A6B1 A6D1 Ï Î¡ Ï +A6D2 A6B2 A6D2 σ Σ σ +A6D3 A6B3 A6D3 Ï„ Τ Ï„ +A6D4 A6B4 A6D4 Ï… Î¥ Ï… +A6D5 A6B5 A6D5 φ Φ φ +A6D6 A6B6 A6D6 χ Χ χ +A6D7 A6B7 A6D7 ψ Ψ ψ +A6D8 A6B8 A6D8 ω Ω ω +A7A1 A7A1 A7D1 РРа +A7A2 A7A2 A7D2 Б Б б +A7A3 A7A3 A7D3 Ð’ Ð’ в +A7A4 A7A4 A7D4 Г Г г +A7A5 A7A5 A7D5 Д Д д +A7A6 A7A6 A7D6 Е Е е +A7A7 A7A7 A7D7 Ð Ð Ñ‘ +A7A8 A7A8 A7D8 Ж Ж ж +A7A9 A7A9 A7D9 З З з +A7AA A7AA A7DA И И и +A7AB A7AB A7DB Й Й й +A7AC A7AC A7DC К К к +A7AD A7AD A7DD Л Л л +A7AE A7AE A7DE Ðœ Ðœ м +A7AF A7AF A7DF РРн +A7B0 A7B0 A7E0 О О о +A7B1 A7B1 A7E1 П П п +A7B2 A7B2 A7E2 РРр +A7B3 A7B3 A7E3 С С Ñ +A7B4 A7B4 A7E4 Т Т Ñ‚ +A7B5 A7B5 A7E5 У У у +A7B6 A7B6 A7E6 Ф Ф Ñ„ +A7B7 A7B7 A7E7 Ð¥ Ð¥ Ñ… +A7B8 A7B8 A7E8 Ц Ц ц +A7B9 A7B9 A7E9 Ч Ч ч +A7BA A7BA A7EA Ш Ш ш +A7BB A7BB A7EB Щ Щ щ +A7BC A7BC A7EC Ъ Ъ ÑŠ +A7BD A7BD A7ED Ы Ы Ñ‹ +A7BE A7BE A7EE Ь Ь ÑŒ +A7BF A7BF A7EF Ð Ð Ñ +A7C0 A7C0 A7F0 Ю Ю ÑŽ +A7C1 A7C1 A7F1 Я Я Ñ +A7D1 A7A1 A7D1 а Ра +A7D2 A7A2 A7D2 б Б б +A7D3 A7A3 A7D3 в Ð’ в +A7D4 A7A4 A7D4 г Г г +A7D5 A7A5 A7D5 д Д д +A7D6 A7A6 A7D6 е Е е +A7D7 A7A7 A7D7 Ñ‘ Ð Ñ‘ +A7D8 A7A8 A7D8 ж Ж ж +A7D9 A7A9 A7D9 з З з +A7DA A7AA A7DA и И и +A7DB A7AB A7DB й Й й +A7DC A7AC A7DC к К к +A7DD A7AD A7DD л Л л +A7DE A7AE A7DE м Ðœ м +A7DF A7AF A7DF н Рн +A7E0 A7B0 A7E0 о О о +A7E1 A7B1 A7E1 п П п +A7E2 A7B2 A7E2 Ñ€ Рр +A7E3 A7B3 A7E3 Ñ Ð¡ Ñ +A7E4 A7B4 A7E4 Ñ‚ Т Ñ‚ +A7E5 A7B5 A7E5 у У у +A7E6 A7B6 A7E6 Ñ„ Ф Ñ„ +A7E7 A7B7 A7E7 Ñ… Ð¥ Ñ… +A7E8 A7B8 A7E8 ц Ц ц +A7E9 A7B9 A7E9 ч Ч ч +A7EA A7BA A7EA ш Ш ш +A7EB A7BB A7EB щ Щ щ +A7EC A7BC A7EC ÑŠ Ъ ÑŠ +A7ED A7BD A7ED Ñ‹ Ы Ñ‹ +A7EE A7BE A7EE ÑŒ Ь ÑŒ +A7EF A7BF A7EF Ñ Ð Ñ +A7F0 A7C0 A7F0 ÑŽ Ю ÑŽ +A7F1 A7C1 A7F1 Ñ Ð¯ Ñ +ADB5 ADB5 8FF3F3 â… â… â…° +ADB6 ADB6 8FF3F4 â…¡ â…¡ â…± +ADB7 ADB7 8FF3F5 â…¢ â…¢ â…² +ADB8 ADB8 8FF3F6 â…£ â…£ â…³ +ADB9 ADB9 8FF3F7 â…¤ â…¤ â…´ +ADBA ADBA 8FF3F8 â…¥ â…¥ â…µ +ADBB ADBB 8FF3F9 â…¦ â…¦ â…¶ +ADBC ADBC 8FF3FA â…§ â…§ â…· +ADBD ADBD 8FF3FB â…¨ â…¨ â…¸ +ADBE ADBE 8FF3FC â…© â…© â…¹ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +8FAABC Ä¢ +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +8FA9C3 ð +8FABB9 ǵ +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result index 3cc74864400..c20504e9ed7 100644 --- a/mysql-test/r/ctype_euckr.result +++ b/mysql-test/r/ctype_euckr.result @@ -24255,3 +24255,350 @@ FDFD FDFD E7BEB2 FDFD FDFE FDFE E8A9B0 FDFE DROP TABLE t1, t2; End of 5.4 tests +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=euckr_korean_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(8) DEFAULT NULL, + `a` varchar(1) CHARACTER SET euckr NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1 WHERE a<>''; +COUNT(*) +22428 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +A3C1 A3C1 A3E1 A A ï½ +A3C2 A3C2 A3E2 ï¼¢ ï¼¢ b +A3C3 A3C3 A3E3 ï¼£ ï¼£ c +A3C4 A3C4 A3E4 D D d +A3C5 A3C5 A3E5 ï¼¥ ï¼¥ ï½… +A3C6 A3C6 A3E6 F F f +A3C7 A3C7 A3E7 G G g +A3C8 A3C8 A3E8 H H h +A3C9 A3C9 A3E9 I I i +A3CA A3CA A3EA J J j +A3CB A3CB A3EB K K k +A3CC A3CC A3EC L L l +A3CD A3CD A3ED ï¼ ï¼ ï½ +A3CE A3CE A3EE ï¼® ï¼® n +A3CF A3CF A3EF O O ï½ +A3D0 A3D0 A3F0 ï¼° ï¼° ï½ +A3D1 A3D1 A3F1 ï¼± ï¼± q +A3D2 A3D2 A3F2 ï¼² ï¼² ï½’ +A3D3 A3D3 A3F3 ï¼³ ï¼³ s +A3D4 A3D4 A3F4 ï¼´ ï¼´ ï½” +A3D5 A3D5 A3F5 ï¼µ ï¼µ u +A3D6 A3D6 A3F6 V V ï½– +A3D7 A3D7 A3F7 ï¼· ï¼· ï½— +A3D8 A3D8 A3F8 X X x +A3D9 A3D9 A3F9 ï¼¹ ï¼¹ ï½™ +A3DA A3DA A3FA Z Z z +A3E1 A3C1 A3E1 ï½ ï¼¡ ï½ +A3E2 A3C2 A3E2 b ï¼¢ b +A3E3 A3C3 A3E3 c ï¼£ c +A3E4 A3C4 A3E4 d D d +A3E5 A3C5 A3E5 ï½… ï¼¥ ï½… +A3E6 A3C6 A3E6 f F f +A3E7 A3C7 A3E7 g G g +A3E8 A3C8 A3E8 h H h +A3E9 A3C9 A3E9 i I i +A3EA A3CA A3EA j J j +A3EB A3CB A3EB k K k +A3EC A3CC A3EC l L l +A3ED A3CD A3ED ï½ ï¼ ï½ +A3EE A3CE A3EE n ï¼® n +A3EF A3CF A3EF ï½ ï¼¯ ï½ +A3F0 A3D0 A3F0 ï½ ï¼° ï½ +A3F1 A3D1 A3F1 q ï¼± q +A3F2 A3D2 A3F2 ï½’ ï¼² ï½’ +A3F3 A3D3 A3F3 s ï¼³ s +A3F4 A3D4 A3F4 ï½” ï¼´ ï½” +A3F5 A3D5 A3F5 u ï¼µ u +A3F6 A3D6 A3F6 ï½– V ï½– +A3F7 A3D7 A3F7 ï½— ï¼· ï½— +A3F8 A3D8 A3F8 x X x +A3F9 A3D9 A3F9 ï½™ ï¼¹ ï½™ +A3FA A3DA A3FA z Z z +A5A1 A5B0 A5A1 â…° â… â…° +A5A2 A5B1 A5A2 â…± â…¡ â…± +A5A3 A5B2 A5A3 â…² â…¢ â…² +A5A4 A5B3 A5A4 â…³ â…£ â…³ +A5A5 A5B4 A5A5 â…´ â…¤ â…´ +A5A6 A5B5 A5A6 â…µ â…¥ â…µ +A5A7 A5B6 A5A7 â…¶ â…¦ â…¶ +A5A8 A5B7 A5A8 â…· â…§ â…· +A5A9 A5B8 A5A9 â…¸ â…¨ â…¸ +A5AA A5B9 A5AA â…¹ â…© â…¹ +A5B0 A5B0 A5A1 â… â… â…° +A5B1 A5B1 A5A2 â…¡ â…¡ â…± +A5B2 A5B2 A5A3 â…¢ â…¢ â…² +A5B3 A5B3 A5A4 â…£ â…£ â…³ +A5B4 A5B4 A5A5 â…¤ â…¤ â…´ +A5B5 A5B5 A5A6 â…¥ â…¥ â…µ +A5B6 A5B6 A5A7 â…¦ â…¦ â…¶ +A5B7 A5B7 A5A8 â…§ â…§ â…· +A5B8 A5B8 A5A9 â…¨ â…¨ â…¸ +A5B9 A5B9 A5AA â…© â…© â…¹ +A5C1 A5C1 A5E1 Α Α α +A5C2 A5C2 A5E2 Î’ Î’ β +A5C3 A5C3 A5E3 Γ Γ γ +A5C4 A5C4 A5E4 Δ Δ δ +A5C5 A5C5 A5E5 Ε Ε ε +A5C6 A5C6 A5E6 Ζ Ζ ζ +A5C7 A5C7 A5E7 Η Η η +A5C8 A5C8 A5E8 Θ Θ θ +A5C9 A5C9 A5E9 Ι Ι ι +A5CA A5CA A5EA Κ Κ κ +A5CB A5CB A5EB Λ Λ λ +A5CC A5CC A5EC Îœ Îœ μ +A5CD A5CD A5ED ΠΠν +A5CE A5CE A5EE Ξ Ξ ξ +A5CF A5CF A5EF Ο Ο ο +A5D0 A5D0 A5F0 ΠΠπ +A5D1 A5D1 A5F1 Ρ Ρ Ï +A5D2 A5D2 A5F2 Σ Σ σ +A5D3 A5D3 A5F3 Τ Τ Ï„ +A5D4 A5D4 A5F4 Î¥ Î¥ Ï… +A5D5 A5D5 A5F5 Φ Φ φ +A5D6 A5D6 A5F6 Χ Χ χ +A5D7 A5D7 A5F7 Ψ Ψ ψ +A5D8 A5D8 A5F8 Ω Ω ω +A5E1 A5C1 A5E1 α Α α +A5E2 A5C2 A5E2 β Î’ β +A5E3 A5C3 A5E3 γ Γ γ +A5E4 A5C4 A5E4 δ Δ δ +A5E5 A5C5 A5E5 ε Ε ε +A5E6 A5C6 A5E6 ζ Ζ ζ +A5E7 A5C7 A5E7 η Η η +A5E8 A5C8 A5E8 θ Θ θ +A5E9 A5C9 A5E9 ι Ι ι +A5EA A5CA A5EA κ Κ κ +A5EB A5CB A5EB λ Λ λ +A5EC A5CC A5EC μ Îœ μ +A5ED A5CD A5ED ν Πν +A5EE A5CE A5EE ξ Ξ ξ +A5EF A5CF A5EF ο Ο ο +A5F0 A5D0 A5F0 Ï€ Ππ +A5F1 A5D1 A5F1 Ï Î¡ Ï +A5F2 A5D2 A5F2 σ Σ σ +A5F3 A5D3 A5F3 Ï„ Τ Ï„ +A5F4 A5D4 A5F4 Ï… Î¥ Ï… +A5F5 A5D5 A5F5 φ Φ φ +A5F6 A5D6 A5F6 χ Χ χ +A5F7 A5D7 A5F7 ψ Ψ ψ +A5F8 A5D8 A5F8 ω Ω ω +A7D9 A7D9 A5F8 Ω Ω ω +A8A1 A8A1 A9A1 Æ Æ æ +A8A2 A8A2 A9A3 à à ð +A8A4 A8A4 A9A4 Ħ Ħ ħ +A8A6 A8A6 A9A6 IJ IJ ij +A8A8 A8A8 A9A8 Ä¿ Ä¿ Å€ +A8A9 A8A9 A9A9 Å Å Å‚ +A8AA A8AA A9AA Ø Ø ø +A8AB A8AB A9AB Å’ Å’ Å“ +A8AD A8AD A9AD Þ Þ þ +A8AE A8AE A9AE Ŧ Ŧ ŧ +A8AF A8AF A9AF ÅŠ ÅŠ Å‹ +A9A1 A8A1 A9A1 æ Æ æ +A9A3 A8A2 A9A3 ð à ð +A9A4 A8A4 A9A4 ħ Ħ ħ +A9A5 49 A9A5 ı I ı +A9A6 A8A6 A9A6 ij IJ ij +A9A8 A8A8 A9A8 Å€ Ä¿ Å€ +A9A9 A8A9 A9A9 Å‚ Å Å‚ +A9AA A8AA A9AA ø Ø ø +A9AB A8AB A9AB Å“ Å’ Å“ +A9AD A8AD A9AD þ Þ þ +A9AE A8AE A9AE ŧ Ŧ ŧ +A9AF A8AF A9AF Å‹ ÅŠ Å‹ +ACA1 ACA1 ACD1 РРа +ACA2 ACA2 ACD2 Б Б б +ACA3 ACA3 ACD3 Ð’ Ð’ в +ACA4 ACA4 ACD4 Г Г г +ACA5 ACA5 ACD5 Д Д д +ACA6 ACA6 ACD6 Е Е е +ACA7 ACA7 ACD7 Ð Ð Ñ‘ +ACA8 ACA8 ACD8 Ж Ж ж +ACA9 ACA9 ACD9 З З з +ACAA ACAA ACDA И И и +ACAB ACAB ACDB Й Й й +ACAC ACAC ACDC К К к +ACAD ACAD ACDD Л Л л +ACAE ACAE ACDE Ðœ Ðœ м +ACAF ACAF ACDF РРн +ACB0 ACB0 ACE0 О О о +ACB1 ACB1 ACE1 П П п +ACB2 ACB2 ACE2 РРр +ACB3 ACB3 ACE3 С С Ñ +ACB4 ACB4 ACE4 Т Т Ñ‚ +ACB5 ACB5 ACE5 У У у +ACB6 ACB6 ACE6 Ф Ф Ñ„ +ACB7 ACB7 ACE7 Ð¥ Ð¥ Ñ… +ACB8 ACB8 ACE8 Ц Ц ц +ACB9 ACB9 ACE9 Ч Ч ч +ACBA ACBA ACEA Ш Ш ш +ACBB ACBB ACEB Щ Щ щ +ACBC ACBC ACEC Ъ Ъ ÑŠ +ACBD ACBD ACED Ы Ы Ñ‹ +ACBE ACBE ACEE Ь Ь ÑŒ +ACBF ACBF ACEF Ð Ð Ñ +ACC0 ACC0 ACF0 Ю Ю ÑŽ +ACC1 ACC1 ACF1 Я Я Ñ +ACD1 ACA1 ACD1 а Ра +ACD2 ACA2 ACD2 б Б б +ACD3 ACA3 ACD3 в Ð’ в +ACD4 ACA4 ACD4 г Г г +ACD5 ACA5 ACD5 д Д д +ACD6 ACA6 ACD6 е Е е +ACD7 ACA7 ACD7 Ñ‘ Ð Ñ‘ +ACD8 ACA8 ACD8 ж Ж ж +ACD9 ACA9 ACD9 з З з +ACDA ACAA ACDA и И и +ACDB ACAB ACDB й Й й +ACDC ACAC ACDC к К к +ACDD ACAD ACDD л Л л +ACDE ACAE ACDE м Ðœ м +ACDF ACAF ACDF н Рн +ACE0 ACB0 ACE0 о О о +ACE1 ACB1 ACE1 п П п +ACE2 ACB2 ACE2 Ñ€ Рр +ACE3 ACB3 ACE3 Ñ Ð¡ Ñ +ACE4 ACB4 ACE4 Ñ‚ Т Ñ‚ +ACE5 ACB5 ACE5 у У у +ACE6 ACB6 ACE6 Ñ„ Ф Ñ„ +ACE7 ACB7 ACE7 Ñ… Ð¥ Ñ… +ACE8 ACB8 ACE8 ц Ц ц +ACE9 ACB9 ACE9 ч Ч ч +ACEA ACBA ACEA ш Ш ш +ACEB ACBB ACEB щ Щ щ +ACEC ACBC ACEC ÑŠ Ъ ÑŠ +ACED ACBD ACED Ñ‹ Ы Ñ‹ +ACEE ACBE ACEE ÑŒ Ь ÑŒ +ACEF ACBF ACEF Ñ Ð Ñ +ACF0 ACC0 ACF0 ÑŽ Ю ÑŽ +ACF1 ACC1 ACF1 Ñ Ð¯ Ñ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A1CA â„« +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A8CD â“ +A8CE â“‘ +A8CF â“’ +A8D0 â““ +A8D1 â“” +A8D2 â“• +A8D3 â“– +A8D4 â“— +A8D5 ⓘ +A8D6 â“™ +A8D7 â“š +A8D8 â“› +A8D9 â“œ +A8DA â“ +A8DB â“ž +A8DC â“Ÿ +A8DD â“ +A8DE â“¡ +A8DF â“¢ +A8E0 â“£ +A8E1 ⓤ +A8E2 â“¥ +A8E3 ⓦ +A8E4 ⓧ +A8E5 ⓨ +A8E6 â“© +A9A2 Ä‘ +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result index 2f789ab5b13..9e9888aecd8 100644 --- a/mysql-test/r/ctype_gb2312.result +++ b/mysql-test/r/ctype_gb2312.result @@ -235,3 +235,316 @@ hex(a) A2A1 D7FE DROP TABLE t1; +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=gb2312_chinese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(8) DEFAULT NULL, + `a` varchar(1) CHARACTER SET gb2312 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1 WHERE a<>''; +COUNT(*) +8178 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +A3C1 A3C1 A3E1 A A ï½ +A3C2 A3C2 A3E2 ï¼¢ ï¼¢ b +A3C3 A3C3 A3E3 ï¼£ ï¼£ c +A3C4 A3C4 A3E4 D D d +A3C5 A3C5 A3E5 ï¼¥ ï¼¥ ï½… +A3C6 A3C6 A3E6 F F f +A3C7 A3C7 A3E7 G G g +A3C8 A3C8 A3E8 H H h +A3C9 A3C9 A3E9 I I i +A3CA A3CA A3EA J J j +A3CB A3CB A3EB K K k +A3CC A3CC A3EC L L l +A3CD A3CD A3ED ï¼ ï¼ ï½ +A3CE A3CE A3EE ï¼® ï¼® n +A3CF A3CF A3EF O O ï½ +A3D0 A3D0 A3F0 ï¼° ï¼° ï½ +A3D1 A3D1 A3F1 ï¼± ï¼± q +A3D2 A3D2 A3F2 ï¼² ï¼² ï½’ +A3D3 A3D3 A3F3 ï¼³ ï¼³ s +A3D4 A3D4 A3F4 ï¼´ ï¼´ ï½” +A3D5 A3D5 A3F5 ï¼µ ï¼µ u +A3D6 A3D6 A3F6 V V ï½– +A3D7 A3D7 A3F7 ï¼· ï¼· ï½— +A3D8 A3D8 A3F8 X X x +A3D9 A3D9 A3F9 ï¼¹ ï¼¹ ï½™ +A3DA A3DA A3FA Z Z z +A3E1 A3C1 A3E1 ï½ ï¼¡ ï½ +A3E2 A3C2 A3E2 b ï¼¢ b +A3E3 A3C3 A3E3 c ï¼£ c +A3E4 A3C4 A3E4 d D d +A3E5 A3C5 A3E5 ï½… ï¼¥ ï½… +A3E6 A3C6 A3E6 f F f +A3E7 A3C7 A3E7 g G g +A3E8 A3C8 A3E8 h H h +A3E9 A3C9 A3E9 i I i +A3EA A3CA A3EA j J j +A3EB A3CB A3EB k K k +A3EC A3CC A3EC l L l +A3ED A3CD A3ED ï½ ï¼ ï½ +A3EE A3CE A3EE n ï¼® n +A3EF A3CF A3EF ï½ ï¼¯ ï½ +A3F0 A3D0 A3F0 ï½ ï¼° ï½ +A3F1 A3D1 A3F1 q ï¼± q +A3F2 A3D2 A3F2 ï½’ ï¼² ï½’ +A3F3 A3D3 A3F3 s ï¼³ s +A3F4 A3D4 A3F4 ï½” ï¼´ ï½” +A3F5 A3D5 A3F5 u ï¼µ u +A3F6 A3D6 A3F6 ï½– V ï½– +A3F7 A3D7 A3F7 ï½— ï¼· ï½— +A3F8 A3D8 A3F8 x X x +A3F9 A3D9 A3F9 ï½™ ï¼¹ ï½™ +A3FA A3DA A3FA z Z z +A6A1 A6A1 A6C1 Α Α α +A6A2 A6A2 A6C2 Î’ Î’ β +A6A3 A6A3 A6C3 Γ Γ γ +A6A4 A6A4 A6C4 Δ Δ δ +A6A5 A6A5 A6C5 Ε Ε ε +A6A6 A6A6 A6C6 Ζ Ζ ζ +A6A7 A6A7 A6C7 Η Η η +A6A8 A6A8 A6C8 Θ Θ θ +A6A9 A6A9 A6C9 Ι Ι ι +A6AA A6AA A6CA Κ Κ κ +A6AB A6AB A6CB Λ Λ λ +A6AC A6AC A6CC Îœ Îœ μ +A6AD A6AD A6CD ΠΠν +A6AE A6AE A6CE Ξ Ξ ξ +A6AF A6AF A6CF Ο Ο ο +A6B0 A6B0 A6D0 ΠΠπ +A6B1 A6B1 A6D1 Ρ Ρ Ï +A6B2 A6B2 A6D2 Σ Σ σ +A6B3 A6B3 A6D3 Τ Τ Ï„ +A6B4 A6B4 A6D4 Î¥ Î¥ Ï… +A6B5 A6B5 A6D5 Φ Φ φ +A6B6 A6B6 A6D6 Χ Χ χ +A6B7 A6B7 A6D7 Ψ Ψ ψ +A6B8 A6B8 A6D8 Ω Ω ω +A6C1 A6A1 A6C1 α Α α +A6C2 A6A2 A6C2 β Î’ β +A6C3 A6A3 A6C3 γ Γ γ +A6C4 A6A4 A6C4 δ Δ δ +A6C5 A6A5 A6C5 ε Ε ε +A6C6 A6A6 A6C6 ζ Ζ ζ +A6C7 A6A7 A6C7 η Η η +A6C8 A6A8 A6C8 θ Θ θ +A6C9 A6A9 A6C9 ι Ι ι +A6CA A6AA A6CA κ Κ κ +A6CB A6AB A6CB λ Λ λ +A6CC A6AC A6CC μ Îœ μ +A6CD A6AD A6CD ν Πν +A6CE A6AE A6CE ξ Ξ ξ +A6CF A6AF A6CF ο Ο ο +A6D0 A6B0 A6D0 Ï€ Ππ +A6D1 A6B1 A6D1 Ï Î¡ Ï +A6D2 A6B2 A6D2 σ Σ σ +A6D3 A6B3 A6D3 Ï„ Τ Ï„ +A6D4 A6B4 A6D4 Ï… Î¥ Ï… +A6D5 A6B5 A6D5 φ Φ φ +A6D6 A6B6 A6D6 χ Χ χ +A6D7 A6B7 A6D7 ψ Ψ ψ +A6D8 A6B8 A6D8 ω Ω ω +A7A1 A7A1 A7D1 РРа +A7A2 A7A2 A7D2 Б Б б +A7A3 A7A3 A7D3 Ð’ Ð’ в +A7A4 A7A4 A7D4 Г Г г +A7A5 A7A5 A7D5 Д Д д +A7A6 A7A6 A7D6 Е Е е +A7A7 A7A7 A7D7 Ð Ð Ñ‘ +A7A8 A7A8 A7D8 Ж Ж ж +A7A9 A7A9 A7D9 З З з +A7AA A7AA A7DA И И и +A7AB A7AB A7DB Й Й й +A7AC A7AC A7DC К К к +A7AD A7AD A7DD Л Л л +A7AE A7AE A7DE Ðœ Ðœ м +A7AF A7AF A7DF РРн +A7B0 A7B0 A7E0 О О о +A7B1 A7B1 A7E1 П П п +A7B2 A7B2 A7E2 РРр +A7B3 A7B3 A7E3 С С Ñ +A7B4 A7B4 A7E4 Т Т Ñ‚ +A7B5 A7B5 A7E5 У У у +A7B6 A7B6 A7E6 Ф Ф Ñ„ +A7B7 A7B7 A7E7 Ð¥ Ð¥ Ñ… +A7B8 A7B8 A7E8 Ц Ц ц +A7B9 A7B9 A7E9 Ч Ч ч +A7BA A7BA A7EA Ш Ш ш +A7BB A7BB A7EB Щ Щ щ +A7BC A7BC A7EC Ъ Ъ ÑŠ +A7BD A7BD A7ED Ы Ы Ñ‹ +A7BE A7BE A7EE Ь Ь ÑŒ +A7BF A7BF A7EF Ð Ð Ñ +A7C0 A7C0 A7F0 Ю Ю ÑŽ +A7C1 A7C1 A7F1 Я Я Ñ +A7D1 A7A1 A7D1 а Ра +A7D2 A7A2 A7D2 б Б б +A7D3 A7A3 A7D3 в Ð’ в +A7D4 A7A4 A7D4 г Г г +A7D5 A7A5 A7D5 д Д д +A7D6 A7A6 A7D6 е Е е +A7D7 A7A7 A7D7 Ñ‘ Ð Ñ‘ +A7D8 A7A8 A7D8 ж Ж ж +A7D9 A7A9 A7D9 з З з +A7DA A7AA A7DA и И и +A7DB A7AB A7DB й Й й +A7DC A7AC A7DC к К к +A7DD A7AD A7DD л Л л +A7DE A7AE A7DE м Ðœ м +A7DF A7AF A7DF н Рн +A7E0 A7B0 A7E0 о О о +A7E1 A7B1 A7E1 п П п +A7E2 A7B2 A7E2 Ñ€ Рр +A7E3 A7B3 A7E3 Ñ Ð¡ Ñ +A7E4 A7B4 A7E4 Ñ‚ Т Ñ‚ +A7E5 A7B5 A7E5 у У у +A7E6 A7B6 A7E6 Ñ„ Ф Ñ„ +A7E7 A7B7 A7E7 Ñ… Ð¥ Ñ… +A7E8 A7B8 A7E8 ц Ц ц +A7E9 A7B9 A7E9 ч Ч ч +A7EA A7BA A7EA ш Ш ш +A7EB A7BB A7EB щ Щ щ +A7EC A7BC A7EC ÑŠ Ъ ÑŠ +A7ED A7BD A7ED Ñ‹ Ы Ñ‹ +A7EE A7BE A7EE ÑŒ Ь ÑŒ +A7EF A7BF A7EF Ñ Ð Ñ +A7F0 A7C0 A7F0 ÑŽ Ю ÑŽ +A7F1 A7C1 A7F1 Ñ Ð¯ Ñ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A2F1 â… +A2F2 â…¡ +A2F3 â…¢ +A2F4 â…£ +A2F5 â…¤ +A2F6 â…¥ +A2F7 â…¦ +A2F8 â…§ +A2F9 â…¨ +A2FA â…© +A2FB â…ª +A2FC â…« +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A8A1 Ä +A8A2 á +A8A3 ÇŽ +A8A4 à +A8A5 Ä“ +A8A6 é +A8A7 Ä› +A8A8 è +A8A9 Ä« +A8AA à +A8AB Ç +A8AC ì +A8AD Å +A8AE ó +A8AF Ç’ +A8B0 ò +A8B1 Å« +A8B2 ú +A8B3 Ç” +A8B4 ù +A8B5 Ç– +A8B6 ǘ +A8B7 Çš +A8B8 Çœ +A8B9 ü +A8BA ê +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index c144ed6881d..0abbbec1d7b 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -255,3 +255,328 @@ SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; DROP TABLES t1; End of 5.0 tests +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=gbk_chinese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(8) DEFAULT NULL, + `a` varchar(1) CHARACTER SET gbk NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1 WHERE a<>''; +COUNT(*) +23940 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +A2A1 A2F1 A2A1 â…° â… â…° +A2A2 A2F2 A2A2 â…± â…¡ â…± +A2A3 A2F3 A2A3 â…² â…¢ â…² +A2A4 A2F4 A2A4 â…³ â…£ â…³ +A2A5 A2F5 A2A5 â…´ â…¤ â…´ +A2A6 A2F6 A2A6 â…µ â…¥ â…µ +A2A7 A2F7 A2A7 â…¶ â…¦ â…¶ +A2A8 A2F8 A2A8 â…· â…§ â…· +A2A9 A2F9 A2A9 â…¸ â…¨ â…¸ +A2AA A2FA A2AA â…¹ â…© â…¹ +A2F1 A2F1 A2A1 â… â… â…° +A2F2 A2F2 A2A2 â…¡ â…¡ â…± +A2F3 A2F3 A2A3 â…¢ â…¢ â…² +A2F4 A2F4 A2A4 â…£ â…£ â…³ +A2F5 A2F5 A2A5 â…¤ â…¤ â…´ +A2F6 A2F6 A2A6 â…¥ â…¥ â…µ +A2F7 A2F7 A2A7 â…¦ â…¦ â…¶ +A2F8 A2F8 A2A8 â…§ â…§ â…· +A2F9 A2F9 A2A9 â…¨ â…¨ â…¸ +A2FA A2FA A2AA â…© â…© â…¹ +A3C1 A3C1 A3E1 A A ï½ +A3C2 A3C2 A3E2 ï¼¢ ï¼¢ b +A3C3 A3C3 A3E3 ï¼£ ï¼£ c +A3C4 A3C4 A3E4 D D d +A3C5 A3C5 A3E5 ï¼¥ ï¼¥ ï½… +A3C6 A3C6 A3E6 F F f +A3C7 A3C7 A3E7 G G g +A3C8 A3C8 A3E8 H H h +A3C9 A3C9 A3E9 I I i +A3CA A3CA A3EA J J j +A3CB A3CB A3EB K K k +A3CC A3CC A3EC L L l +A3CD A3CD A3ED ï¼ ï¼ ï½ +A3CE A3CE A3EE ï¼® ï¼® n +A3CF A3CF A3EF O O ï½ +A3D0 A3D0 A3F0 ï¼° ï¼° ï½ +A3D1 A3D1 A3F1 ï¼± ï¼± q +A3D2 A3D2 A3F2 ï¼² ï¼² ï½’ +A3D3 A3D3 A3F3 ï¼³ ï¼³ s +A3D4 A3D4 A3F4 ï¼´ ï¼´ ï½” +A3D5 A3D5 A3F5 ï¼µ ï¼µ u +A3D6 A3D6 A3F6 V V ï½– +A3D7 A3D7 A3F7 ï¼· ï¼· ï½— +A3D8 A3D8 A3F8 X X x +A3D9 A3D9 A3F9 ï¼¹ ï¼¹ ï½™ +A3DA A3DA A3FA Z Z z +A3E1 A3C1 A3E1 ï½ ï¼¡ ï½ +A3E2 A3C2 A3E2 b ï¼¢ b +A3E3 A3C3 A3E3 c ï¼£ c +A3E4 A3C4 A3E4 d D d +A3E5 A3C5 A3E5 ï½… ï¼¥ ï½… +A3E6 A3C6 A3E6 f F f +A3E7 A3C7 A3E7 g G g +A3E8 A3C8 A3E8 h H h +A3E9 A3C9 A3E9 i I i +A3EA A3CA A3EA j J j +A3EB A3CB A3EB k K k +A3EC A3CC A3EC l L l +A3ED A3CD A3ED ï½ ï¼ ï½ +A3EE A3CE A3EE n ï¼® n +A3EF A3CF A3EF ï½ ï¼¯ ï½ +A3F0 A3D0 A3F0 ï½ ï¼° ï½ +A3F1 A3D1 A3F1 q ï¼± q +A3F2 A3D2 A3F2 ï½’ ï¼² ï½’ +A3F3 A3D3 A3F3 s ï¼³ s +A3F4 A3D4 A3F4 ï½” ï¼´ ï½” +A3F5 A3D5 A3F5 u ï¼µ u +A3F6 A3D6 A3F6 ï½– V ï½– +A3F7 A3D7 A3F7 ï½— ï¼· ï½— +A3F8 A3D8 A3F8 x X x +A3F9 A3D9 A3F9 ï½™ ï¼¹ ï½™ +A3FA A3DA A3FA z Z z +A6A1 A6A1 A6C1 Α Α α +A6A2 A6A2 A6C2 Î’ Î’ β +A6A3 A6A3 A6C3 Γ Γ γ +A6A4 A6A4 A6C4 Δ Δ δ +A6A5 A6A5 A6C5 Ε Ε ε +A6A6 A6A6 A6C6 Ζ Ζ ζ +A6A7 A6A7 A6C7 Η Η η +A6A8 A6A8 A6C8 Θ Θ θ +A6A9 A6A9 A6C9 Ι Ι ι +A6AA A6AA A6CA Κ Κ κ +A6AB A6AB A6CB Λ Λ λ +A6AC A6AC A6CC Îœ Îœ μ +A6AD A6AD A6CD ΠΠν +A6AE A6AE A6CE Ξ Ξ ξ +A6AF A6AF A6CF Ο Ο ο +A6B0 A6B0 A6D0 ΠΠπ +A6B1 A6B1 A6D1 Ρ Ρ Ï +A6B2 A6B2 A6D2 Σ Σ σ +A6B3 A6B3 A6D3 Τ Τ Ï„ +A6B4 A6B4 A6D4 Î¥ Î¥ Ï… +A6B5 A6B5 A6D5 Φ Φ φ +A6B6 A6B6 A6D6 Χ Χ χ +A6B7 A6B7 A6D7 Ψ Ψ ψ +A6B8 A6B8 A6D8 Ω Ω ω +A6C1 A6A1 A6C1 α Α α +A6C2 A6A2 A6C2 β Î’ β +A6C3 A6A3 A6C3 γ Γ γ +A6C4 A6A4 A6C4 δ Δ δ +A6C5 A6A5 A6C5 ε Ε ε +A6C6 A6A6 A6C6 ζ Ζ ζ +A6C7 A6A7 A6C7 η Η η +A6C8 A6A8 A6C8 θ Θ θ +A6C9 A6A9 A6C9 ι Ι ι +A6CA A6AA A6CA κ Κ κ +A6CB A6AB A6CB λ Λ λ +A6CC A6AC A6CC μ Îœ μ +A6CD A6AD A6CD ν Πν +A6CE A6AE A6CE ξ Ξ ξ +A6CF A6AF A6CF ο Ο ο +A6D0 A6B0 A6D0 Ï€ Ππ +A6D1 A6B1 A6D1 Ï Î¡ Ï +A6D2 A6B2 A6D2 σ Σ σ +A6D3 A6B3 A6D3 Ï„ Τ Ï„ +A6D4 A6B4 A6D4 Ï… Î¥ Ï… +A6D5 A6B5 A6D5 φ Φ φ +A6D6 A6B6 A6D6 χ Χ χ +A6D7 A6B7 A6D7 ψ Ψ ψ +A6D8 A6B8 A6D8 ω Ω ω +A7A1 A7A1 A7D1 РРа +A7A2 A7A2 A7D2 Б Б б +A7A3 A7A3 A7D3 Ð’ Ð’ в +A7A4 A7A4 A7D4 Г Г г +A7A5 A7A5 A7D5 Д Д д +A7A6 A7A6 A7D6 Е Е е +A7A7 A7A7 A7D7 Ð Ð Ñ‘ +A7A8 A7A8 A7D8 Ж Ж ж +A7A9 A7A9 A7D9 З З з +A7AA A7AA A7DA И И и +A7AB A7AB A7DB Й Й й +A7AC A7AC A7DC К К к +A7AD A7AD A7DD Л Л л +A7AE A7AE A7DE Ðœ Ðœ м +A7AF A7AF A7DF РРн +A7B0 A7B0 A7E0 О О о +A7B1 A7B1 A7E1 П П п +A7B2 A7B2 A7E2 РРр +A7B3 A7B3 A7E3 С С Ñ +A7B4 A7B4 A7E4 Т Т Ñ‚ +A7B5 A7B5 A7E5 У У у +A7B6 A7B6 A7E6 Ф Ф Ñ„ +A7B7 A7B7 A7E7 Ð¥ Ð¥ Ñ… +A7B8 A7B8 A7E8 Ц Ц ц +A7B9 A7B9 A7E9 Ч Ч ч +A7BA A7BA A7EA Ш Ш ш +A7BB A7BB A7EB Щ Щ щ +A7BC A7BC A7EC Ъ Ъ ÑŠ +A7BD A7BD A7ED Ы Ы Ñ‹ +A7BE A7BE A7EE Ь Ь ÑŒ +A7BF A7BF A7EF Ð Ð Ñ +A7C0 A7C0 A7F0 Ю Ю ÑŽ +A7C1 A7C1 A7F1 Я Я Ñ +A7D1 A7A1 A7D1 а Ра +A7D2 A7A2 A7D2 б Б б +A7D3 A7A3 A7D3 в Ð’ в +A7D4 A7A4 A7D4 г Г г +A7D5 A7A5 A7D5 д Д д +A7D6 A7A6 A7D6 е Е е +A7D7 A7A7 A7D7 Ñ‘ Ð Ñ‘ +A7D8 A7A8 A7D8 ж Ж ж +A7D9 A7A9 A7D9 з З з +A7DA A7AA A7DA и И и +A7DB A7AB A7DB й Й й +A7DC A7AC A7DC к К к +A7DD A7AD A7DD л Л л +A7DE A7AE A7DE м Ðœ м +A7DF A7AF A7DF н Рн +A7E0 A7B0 A7E0 о О о +A7E1 A7B1 A7E1 п П п +A7E2 A7B2 A7E2 Ñ€ Рр +A7E3 A7B3 A7E3 Ñ Ð¡ Ñ +A7E4 A7B4 A7E4 Ñ‚ Т Ñ‚ +A7E5 A7B5 A7E5 у У у +A7E6 A7B6 A7E6 Ñ„ Ф Ñ„ +A7E7 A7B7 A7E7 Ñ… Ð¥ Ñ… +A7E8 A7B8 A7E8 ц Ц ц +A7E9 A7B9 A7E9 ч Ч ч +A7EA A7BA A7EA ш Ш ш +A7EB A7BB A7EB щ Щ щ +A7EC A7BC A7EC ÑŠ Ъ ÑŠ +A7ED A7BD A7ED Ñ‹ Ы Ñ‹ +A7EE A7BE A7EE ÑŒ Ь ÑŒ +A7EF A7BF A7EF Ñ Ð Ñ +A7F0 A7C0 A7F0 ÑŽ Ю ÑŽ +A7F1 A7C1 A7F1 Ñ Ð¯ Ñ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A2FB â…ª +A2FC â…« +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +A8A1 Ä +A8A2 á +A8A3 ÇŽ +A8A4 à +A8A5 Ä“ +A8A6 é +A8A7 Ä› +A8A8 è +A8A9 Ä« +A8AA à +A8AB Ç +A8AC ì +A8AD Å +A8AE ó +A8AF Ç’ +A8B0 ò +A8B1 Å« +A8B2 ú +A8B3 Ç” +A8B4 ù +A8B5 Ç– +A8B6 ǘ +A8B7 Çš +A8B8 Çœ +A8B9 ü +A8BA ê +A8BD Å„ +A8BE ň +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 1469e335f23..f450dd0488d 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -219,3 +219,290 @@ hex(a) hex(lower(a)) hex(upper(a)) 8372835E 8372835E 8372835E DROP TABLE t1; # End of 5.1 tests +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=sjis_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +INSERT t1 (code) SELECT head FROM head WHERE (head BETWEEN 'A1' AND 'DF'); +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(8) DEFAULT NULL, + `a` varchar(1) CHARACTER SET sjis NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1; +COUNT(*) +14623 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=1; +COUNT(*) +63 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +COUNT(*) +11280 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) +FROM t1 +WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) +ORDER BY code; +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +8260 8260 8281 A A ï½ +8261 8261 8282 ï¼¢ ï¼¢ b +8262 8262 8283 ï¼£ ï¼£ c +8263 8263 8284 D D d +8264 8264 8285 ï¼¥ ï¼¥ ï½… +8265 8265 8286 F F f +8266 8266 8287 G G g +8267 8267 8288 H H h +8268 8268 8289 I I i +8269 8269 828A J J j +826A 826A 828B K K k +826B 826B 828C L L l +826C 826C 828D ï¼ ï¼ ï½ +826D 826D 828E ï¼® ï¼® n +826E 826E 828F O O ï½ +826F 826F 8290 ï¼° ï¼° ï½ +8270 8270 8291 ï¼± ï¼± q +8271 8271 8292 ï¼² ï¼² ï½’ +8272 8272 8293 ï¼³ ï¼³ s +8273 8273 8294 ï¼´ ï¼´ ï½” +8274 8274 8295 ï¼µ ï¼µ u +8275 8275 8296 V V ï½– +8276 8276 8297 ï¼· ï¼· ï½— +8277 8277 8298 X X x +8278 8278 8299 ï¼¹ ï¼¹ ï½™ +8279 8279 829A Z Z z +8281 8260 8281 ï½ ï¼¡ ï½ +8282 8261 8282 b ï¼¢ b +8283 8262 8283 c ï¼£ c +8284 8263 8284 d D d +8285 8264 8285 ï½… ï¼¥ ï½… +8286 8265 8286 f F f +8287 8266 8287 g G g +8288 8267 8288 h H h +8289 8268 8289 i I i +828A 8269 828A j J j +828B 826A 828B k K k +828C 826B 828C l L l +828D 826C 828D ï½ ï¼ ï½ +828E 826D 828E n ï¼® n +828F 826E 828F ï½ ï¼¯ ï½ +8290 826F 8290 ï½ ï¼° ï½ +8291 8270 8291 q ï¼± q +8292 8271 8292 ï½’ ï¼² ï½’ +8293 8272 8293 s ï¼³ s +8294 8273 8294 ï½” ï¼´ ï½” +8295 8274 8295 u ï¼µ u +8296 8275 8296 ï½– V ï½– +8297 8276 8297 ï½— ï¼· ï½— +8298 8277 8298 x X x +8299 8278 8299 ï½™ ï¼¹ ï½™ +829A 8279 829A z Z z +839F 839F 83BF Α Α α +83A0 83A0 83C0 Î’ Î’ β +83A1 83A1 83C1 Γ Γ γ +83A2 83A2 83C2 Δ Δ δ +83A3 83A3 83C3 Ε Ε ε +83A4 83A4 83C4 Ζ Ζ ζ +83A5 83A5 83C5 Η Η η +83A6 83A6 83C6 Θ Θ θ +83A7 83A7 83C7 Ι Ι ι +83A8 83A8 83C8 Κ Κ κ +83A9 83A9 83C9 Λ Λ λ +83AA 83AA 83CA Îœ Îœ μ +83AB 83AB 83CB ΠΠν +83AC 83AC 83CC Ξ Ξ ξ +83AD 83AD 83CD Ο Ο ο +83AE 83AE 83CE ΠΠπ +83AF 83AF 83CF Ρ Ρ Ï +83B0 83B0 83D0 Σ Σ σ +83B1 83B1 83D1 Τ Τ Ï„ +83B2 83B2 83D2 Î¥ Î¥ Ï… +83B3 83B3 83D3 Φ Φ φ +83B4 83B4 83D4 Χ Χ χ +83B5 83B5 83D5 Ψ Ψ ψ +83B6 83B6 83D6 Ω Ω ω +83BF 839F 83BF α Α α +83C0 83A0 83C0 β Î’ β +83C1 83A1 83C1 γ Γ γ +83C2 83A2 83C2 δ Δ δ +83C3 83A3 83C3 ε Ε ε +83C4 83A4 83C4 ζ Ζ ζ +83C5 83A5 83C5 η Η η +83C6 83A6 83C6 θ Θ θ +83C7 83A7 83C7 ι Ι ι +83C8 83A8 83C8 κ Κ κ +83C9 83A9 83C9 λ Λ λ +83CA 83AA 83CA μ Îœ μ +83CB 83AB 83CB ν Πν +83CC 83AC 83CC ξ Ξ ξ +83CD 83AD 83CD ο Ο ο +83CE 83AE 83CE Ï€ Ππ +83CF 83AF 83CF Ï Î¡ Ï +83D0 83B0 83D0 σ Σ σ +83D1 83B1 83D1 Ï„ Τ Ï„ +83D2 83B2 83D2 Ï… Î¥ Ï… +83D3 83B3 83D3 φ Φ φ +83D4 83B4 83D4 χ Χ χ +83D5 83B5 83D5 ψ Ψ ψ +83D6 83B6 83D6 ω Ω ω +8440 8440 8470 РРа +8441 8441 8471 Б Б б +8442 8442 8472 Ð’ Ð’ в +8443 8443 8473 Г Г г +8444 8444 8474 Д Д д +8445 8445 8475 Е Е е +8446 8446 8476 Ð Ð Ñ‘ +8447 8447 8477 Ж Ж ж +8448 8448 8478 З З з +8449 8449 8479 И И и +844A 844A 847A Й Й й +844B 844B 847B К К к +844C 844C 847C Л Л л +844D 844D 847D Ðœ Ðœ м +844E 844E 847E РРн +844F 844F 8480 О О о +8450 8450 8481 П П п +8451 8451 8482 РРр +8452 8452 8483 С С Ñ +8453 8453 8484 Т Т Ñ‚ +8454 8454 8485 У У у +8455 8455 8486 Ф Ф Ñ„ +8456 8456 8487 Ð¥ Ð¥ Ñ… +8457 8457 8488 Ц Ц ц +8458 8458 8489 Ч Ч ч +8459 8459 848A Ш Ш ш +845A 845A 848B Щ Щ щ +845B 845B 848C Ъ Ъ ÑŠ +845C 845C 848D Ы Ы Ñ‹ +845D 845D 848E Ь Ь ÑŒ +845E 845E 848F Ð Ð Ñ +845F 845F 8490 Ю Ю ÑŽ +8460 8460 8491 Я Я Ñ +8470 8440 8470 а Ра +8471 8441 8471 б Б б +8472 8442 8472 в Ð’ в +8473 8443 8473 г Г г +8474 8444 8474 д Д д +8475 8445 8475 е Е е +8476 8446 8476 Ñ‘ Ð Ñ‘ +8477 8447 8477 ж Ж ж +8478 8448 8478 з З з +8479 8449 8479 и И и +847A 844A 847A й Й й +847B 844B 847B к К к +847C 844C 847C л Л л +847D 844D 847D м Ðœ м +847E 844E 847E н Рн +8480 844F 8480 о О о +8481 8450 8481 п П п +8482 8451 8482 Ñ€ Рр +8483 8452 8483 Ñ Ð¡ Ñ +8484 8453 8484 Ñ‚ Т Ñ‚ +8485 8454 8485 у У у +8486 8455 8486 Ñ„ Ф Ñ„ +8487 8456 8487 Ñ… Ð¥ Ñ… +8488 8457 8488 ц Ц ц +8489 8458 8489 ч Ч ч +848A 8459 848A ш Ш ш +848B 845A 848B щ Щ щ +848C 845B 848C ÑŠ Ъ ÑŠ +848D 845C 848D Ñ‹ Ы Ñ‹ +848E 845D 848E ÑŒ Ь ÑŒ +848F 845E 848F Ñ Ð Ñ +8490 845F 8490 ÑŽ Ю ÑŽ +8491 8460 8491 Ñ Ð¯ Ñ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +81F0 â„« +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index 540ba178756..1c4cfcd6ec5 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -2377,3 +2377,535 @@ DROP TABLE t2; set names default; set character_set_database=default; set character_set_server=default; +# +# Start of 5.5 tests +# +# +# Testing WL#4583 Case conversion in Asian character sets +# +SET NAMES utf8; +SET collation_connection=ujis_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0; +INSERT INTO t1 (code) SELECT concat('8E', head) FROM head +WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head; +INSERT INTO t1 (code) SELECT concat(head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +INSERT INTO t1 (code) SELECT concat('8F', head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '80' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `code` varchar(6) CHARACTER SET ujis NOT NULL DEFAULT '', + `a` varchar(1) CHARACTER SET ujis NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +UPDATE t1 SET a=unhex(code) ORDER BY code; +Warnings: +Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 +Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 +Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 +Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 +Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 +Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 +Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 +Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 +Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 +Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 +Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 +Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 +Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 +Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 +Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 +Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 +Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 +Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 +Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 +Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 +Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 +Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 +Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 +Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 +Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 +Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 +Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 +Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 +Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 +Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 +Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 +Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 +Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 +Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 +Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 +Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 +Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 +Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 +Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 +Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 +Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 +Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 +Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 +Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 +Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 +Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 +Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 +Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 +Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 +Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 +Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 +Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 +Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 +Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 +Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 +Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 +Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 +Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +SELECT COUNT(*) FROM t1; +COUNT(*) +44671 +SELECT COUNT(*) FROM t1 WHERE a<>''; +COUNT(*) +17735 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +COUNT(*) +8899 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=3; +COUNT(*) +8836 +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) ORDER BY code; +code hex(upper(a)) hex(lower(a)) a upper(a) lower(a) +8FA6E1 8FA6E1 8FA6F1 Ά Ά ά +8FA6E2 8FA6E2 8FA6F2 Έ Έ Î +8FA6E3 8FA6E3 8FA6F3 Ή Ή ή +8FA6E4 8FA6E4 8FA6F4 Ί Ί ί +8FA6E5 8FA6E5 8FA6F5 Ϊ Ϊ ÏŠ +8FA6E7 8FA6E7 8FA6F7 ÎŒ ÎŒ ÏŒ +8FA6E9 8FA6E9 8FA6F9 ÎŽ ÎŽ Ï +8FA6EA 8FA6EA 8FA6FA Ϋ Ϋ Ï‹ +8FA6EC 8FA6EC 8FA6FC Î Î ÏŽ +8FA6F1 8FA6E1 8FA6F1 ά Ά ά +8FA6F2 8FA6E2 8FA6F2 ΠΈ Î +8FA6F3 8FA6E3 8FA6F3 ή Ή ή +8FA6F4 8FA6E4 8FA6F4 ί Ί ί +8FA6F5 8FA6E5 8FA6F5 ÏŠ Ϊ ÏŠ +8FA6F7 8FA6E7 8FA6F7 ÏŒ ÎŒ ÏŒ +8FA6F8 A6B2 8FA6F8 Ï‚ Σ Ï‚ +8FA6F9 8FA6E9 8FA6F9 Ï ÎŽ Ï +8FA6FA 8FA6EA 8FA6FA Ï‹ Ϋ Ï‹ +8FA6FC 8FA6EC 8FA6FC ÏŽ Î ÏŽ +8FA7C2 8FA7C2 8FA7F2 Ђ Ђ Ñ’ +8FA7C3 8FA7C3 8FA7F3 Ѓ Ѓ Ñ“ +8FA7C4 8FA7C4 8FA7F4 Є Є Ñ” +8FA7C5 8FA7C5 8FA7F5 Ð… Ð… Ñ• +8FA7C6 8FA7C6 8FA7F6 І І Ñ– +8FA7C7 8FA7C7 8FA7F7 Ї Ї Ñ— +8FA7C8 8FA7C8 8FA7F8 Ј Ј ј +8FA7C9 8FA7C9 8FA7F9 Љ Љ Ñ™ +8FA7CA 8FA7CA 8FA7FA Њ Њ Ñš +8FA7CB 8FA7CB 8FA7FB Ћ Ћ Ñ› +8FA7CC 8FA7CC 8FA7FC ÐŒ ÐŒ Ñœ +8FA7CD 8FA7CD 8FA7FD ÐŽ ÐŽ Ñž +8FA7CE 8FA7CE 8FA7FE Ð Ð ÑŸ +8FA7F2 8FA7C2 8FA7F2 Ñ’ Ђ Ñ’ +8FA7F3 8FA7C3 8FA7F3 Ñ“ Ѓ Ñ“ +8FA7F4 8FA7C4 8FA7F4 Ñ” Є Ñ” +8FA7F5 8FA7C5 8FA7F5 Ñ• Ð… Ñ• +8FA7F6 8FA7C6 8FA7F6 Ñ– І Ñ– +8FA7F7 8FA7C7 8FA7F7 Ñ— Ї Ñ— +8FA7F8 8FA7C8 8FA7F8 ј Ј ј +8FA7F9 8FA7C9 8FA7F9 Ñ™ Љ Ñ™ +8FA7FA 8FA7CA 8FA7FA Ñš Њ Ñš +8FA7FB 8FA7CB 8FA7FB Ñ› Ћ Ñ› +8FA7FC 8FA7CC 8FA7FC Ñœ ÐŒ Ñœ +8FA7FD 8FA7CD 8FA7FD Ñž ÐŽ Ñž +8FA7FE 8FA7CE 8FA7FE ÑŸ Ð ÑŸ +8FA9A1 8FA9A1 8FA9C1 Æ Æ æ +8FA9A2 8FA9A2 8FA9C2 Ä Ä Ä‘ +8FA9A4 8FA9A4 8FA9C4 Ħ Ħ ħ +8FA9A6 8FA9A6 8FA9C6 IJ IJ ij +8FA9A8 8FA9A8 8FA9C8 Å Å Å‚ +8FA9A9 8FA9A9 8FA9C9 Ä¿ Ä¿ Å€ +8FA9AB 8FA9AB 8FA9CB ÅŠ ÅŠ Å‹ +8FA9AC 8FA9AC 8FA9CC Ø Ø ø +8FA9AD 8FA9AD 8FA9CD Å’ Å’ Å“ +8FA9AF 8FA9AF 8FA9CF Ŧ Ŧ ŧ +8FA9B0 8FA9B0 8FA9D0 Þ Þ þ +8FA9C1 8FA9A1 8FA9C1 æ Æ æ +8FA9C2 8FA9A2 8FA9C2 Ä‘ Ä Ä‘ +8FA9C4 8FA9A4 8FA9C4 ħ Ħ ħ +8FA9C5 49 8FA9C5 ı I ı +8FA9C6 8FA9A6 8FA9C6 ij IJ ij +8FA9C8 8FA9A8 8FA9C8 Å‚ Å Å‚ +8FA9C9 8FA9A9 8FA9C9 Å€ Ä¿ Å€ +8FA9CB 8FA9AB 8FA9CB Å‹ ÅŠ Å‹ +8FA9CC 8FA9AC 8FA9CC ø Ø ø +8FA9CD 8FA9AD 8FA9CD Å“ Å’ Å“ +8FA9CF 8FA9AF 8FA9CF ŧ Ŧ ŧ +8FA9D0 8FA9B0 8FA9D0 þ Þ þ +8FAAA1 8FAAA1 8FABA1 à à á +8FAAA2 8FAAA2 8FABA2 À À à +8FAAA3 8FAAA3 8FABA3 Ä Ä ä +8FAAA4 8FAAA4 8FABA4   â +8FAAA5 8FAAA5 8FABA5 Ä‚ Ä‚ ă +8FAAA6 8FAAA6 8FABA6 Ç Ç ÇŽ +8FAAA7 8FAAA7 8FABA7 Ä€ Ä€ Ä +8FAAA8 8FAAA8 8FABA8 Ä„ Ä„ Ä… +8FAAA9 8FAAA9 8FABA9 Ã… Ã… Ã¥ +8FAAAA 8FAAAA 8FABAA à à ã +8FAAAB 8FAAAB 8FABAB Ć Ć ć +8FAAAC 8FAAAC 8FABAC Ĉ Ĉ ĉ +8FAAAD 8FAAAD 8FABAD ÄŒ ÄŒ Ä +8FAAAE 8FAAAE 8FABAE Ç Ç ç +8FAAAF 8FAAAF 8FABAF ÄŠ ÄŠ Ä‹ +8FAAB0 8FAAB0 8FABB0 ÄŽ ÄŽ Ä +8FAAB1 8FAAB1 8FABB1 É É é +8FAAB2 8FAAB2 8FABB2 È È è +8FAAB3 8FAAB3 8FABB3 Ë Ë ë +8FAAB4 8FAAB4 8FABB4 Ê Ê ê +8FAAB5 8FAAB5 8FABB5 Äš Äš Ä› +8FAAB6 8FAAB6 8FABB6 Ä– Ä– Ä— +8FAAB7 8FAAB7 8FABB7 Ä’ Ä’ Ä“ +8FAAB8 8FAAB8 8FABB8 Ę Ę Ä™ +8FAABA 8FAABA 8FABBA Äœ Äœ Ä +8FAABB 8FAABB 8FABBB Äž Äž ÄŸ +8FAABD 8FAABD 8FABBD Ä Ä Ä¡ +8FAABE 8FAABE 8FABBE Ĥ Ĥ Ä¥ +8FAABF 8FAABF 8FABBF à à à +8FAAC0 8FAAC0 8FABC0 ÃŒ ÃŒ ì +8FAAC1 8FAAC1 8FABC1 à à ï +8FAAC2 8FAAC2 8FABC2 ÃŽ ÃŽ î +8FAAC3 8FAAC3 8FABC3 Ç Ç Ç +8FAAC4 8FAAC4 69 Ä° Ä° i +8FAAC5 8FAAC5 8FABC5 Ī Ī Ä« +8FAAC6 8FAAC6 8FABC6 Ä® Ä® į +8FAAC7 8FAAC7 8FABC7 Ĩ Ĩ Ä© +8FAAC8 8FAAC8 8FABC8 Ä´ Ä´ ĵ +8FAAC9 8FAAC9 8FABC9 Ķ Ķ Ä· +8FAACA 8FAACA 8FABCA Ĺ Ĺ ĺ +8FAACB 8FAACB 8FABCB Ľ Ľ ľ +8FAACC 8FAACC 8FABCC Ä» Ä» ļ +8FAACD 8FAACD 8FABCD Ń Ń Å„ +8FAACE 8FAACE 8FABCE Ň Ň ň +8FAACF 8FAACF 8FABCF Å… Å… ņ +8FAAD0 8FAAD0 8FABD0 Ñ Ñ ñ +8FAAD1 8FAAD1 8FABD1 Ó Ó ó +8FAAD2 8FAAD2 8FABD2 Ã’ Ã’ ò +8FAAD3 8FAAD3 8FABD3 Ö Ö ö +8FAAD4 8FAAD4 8FABD4 Ô Ô ô +8FAAD5 8FAAD5 8FABD5 Ç‘ Ç‘ Ç’ +8FAAD6 8FAAD6 8FABD6 Å Å Å‘ +8FAAD7 8FAAD7 8FABD7 ÅŒ ÅŒ Å +8FAAD8 8FAAD8 8FABD8 Õ Õ õ +8FAAD9 8FAAD9 8FABD9 Å” Å” Å• +8FAADA 8FAADA 8FABDA Ř Ř Å™ +8FAADB 8FAADB 8FABDB Å– Å– Å— +8FAADC 8FAADC 8FABDC Åš Åš Å› +8FAADD 8FAADD 8FABDD Åœ Åœ Å +8FAADE 8FAADE 8FABDE Å Å Å¡ +8FAADF 8FAADF 8FABDF Åž Åž ÅŸ +8FAAE0 8FAAE0 8FABE0 Ť Ť Å¥ +8FAAE1 8FAAE1 8FABE1 Å¢ Å¢ Å£ +8FAAE2 8FAAE2 8FABE2 Ú Ú ú +8FAAE3 8FAAE3 8FABE3 Ù Ù ù +8FAAE4 8FAAE4 8FABE4 Ãœ Ãœ ü +8FAAE5 8FAAE5 8FABE5 Û Û û +8FAAE6 8FAAE6 8FABE6 Ŭ Ŭ Å +8FAAE7 8FAAE7 8FABE7 Ç“ Ç“ Ç” +8FAAE8 8FAAE8 8FABE8 Å° Å° ű +8FAAE9 8FAAE9 8FABE9 Ū Ū Å« +8FAAEA 8FAAEA 8FABEA Ų Ų ų +8FAAEB 8FAAEB 8FABEB Å® Å® ů +8FAAEC 8FAAEC 8FABEC Ũ Ũ Å© +8FAAED 8FAAED 8FABED Ç— Ç— ǘ +8FAAEE 8FAAEE 8FABEE Ç› Ç› Çœ +8FAAEF 8FAAEF 8FABEF Ç™ Ç™ Çš +8FAAF0 8FAAF0 8FABF0 Ç• Ç• Ç– +8FAAF1 8FAAF1 8FABF1 Å´ Å´ ŵ +8FAAF2 8FAAF2 8FABF2 à à ý +8FAAF3 8FAAF3 8FABF3 Ÿ Ÿ ÿ +8FAAF4 8FAAF4 8FABF4 Ŷ Ŷ Å· +8FAAF5 8FAAF5 8FABF5 Ź Ź ź +8FAAF6 8FAAF6 8FABF6 Ž Ž ž +8FAAF7 8FAAF7 8FABF7 Å» Å» ż +8FABA1 8FAAA1 8FABA1 á à á +8FABA2 8FAAA2 8FABA2 à À à +8FABA3 8FAAA3 8FABA3 ä Ä ä +8FABA4 8FAAA4 8FABA4 â  â +8FABA5 8FAAA5 8FABA5 ă Ä‚ ă +8FABA6 8FAAA6 8FABA6 ÇŽ Ç ÇŽ +8FABA7 8FAAA7 8FABA7 Ä Ä€ Ä +8FABA8 8FAAA8 8FABA8 Ä… Ä„ Ä… +8FABA9 8FAAA9 8FABA9 Ã¥ Ã… Ã¥ +8FABAA 8FAAAA 8FABAA ã à ã +8FABAB 8FAAAB 8FABAB ć Ć ć +8FABAC 8FAAAC 8FABAC ĉ Ĉ ĉ +8FABAD 8FAAAD 8FABAD Ä ÄŒ Ä +8FABAE 8FAAAE 8FABAE ç Ç ç +8FABAF 8FAAAF 8FABAF Ä‹ ÄŠ Ä‹ +8FABB0 8FAAB0 8FABB0 Ä ÄŽ Ä +8FABB1 8FAAB1 8FABB1 é É é +8FABB2 8FAAB2 8FABB2 è È è +8FABB3 8FAAB3 8FABB3 ë Ë ë +8FABB4 8FAAB4 8FABB4 ê Ê ê +8FABB5 8FAAB5 8FABB5 Ä› Äš Ä› +8FABB6 8FAAB6 8FABB6 Ä— Ä– Ä— +8FABB7 8FAAB7 8FABB7 Ä“ Ä’ Ä“ +8FABB8 8FAAB8 8FABB8 Ä™ Ę Ä™ +8FABBA 8FAABA 8FABBA Ä Äœ Ä +8FABBB 8FAABB 8FABBB ÄŸ Äž ÄŸ +8FABBD 8FAABD 8FABBD Ä¡ Ä Ä¡ +8FABBE 8FAABE 8FABBE Ä¥ Ĥ Ä¥ +8FABBF 8FAABF 8FABBF à à à +8FABC0 8FAAC0 8FABC0 ì ÃŒ ì +8FABC1 8FAAC1 8FABC1 ï à ï +8FABC2 8FAAC2 8FABC2 î ÃŽ î +8FABC3 8FAAC3 8FABC3 Ç Ç Ç +8FABC5 8FAAC5 8FABC5 Ä« Ī Ä« +8FABC6 8FAAC6 8FABC6 į Ä® į +8FABC7 8FAAC7 8FABC7 Ä© Ĩ Ä© +8FABC8 8FAAC8 8FABC8 ĵ Ä´ ĵ +8FABC9 8FAAC9 8FABC9 Ä· Ķ Ä· +8FABCA 8FAACA 8FABCA ĺ Ĺ ĺ +8FABCB 8FAACB 8FABCB ľ Ľ ľ +8FABCC 8FAACC 8FABCC ļ Ä» ļ +8FABCD 8FAACD 8FABCD Å„ Ń Å„ +8FABCE 8FAACE 8FABCE ň Ň ň +8FABCF 8FAACF 8FABCF ņ Å… ņ +8FABD0 8FAAD0 8FABD0 ñ Ñ ñ +8FABD1 8FAAD1 8FABD1 ó Ó ó +8FABD2 8FAAD2 8FABD2 ò Ã’ ò +8FABD3 8FAAD3 8FABD3 ö Ö ö +8FABD4 8FAAD4 8FABD4 ô Ô ô +8FABD5 8FAAD5 8FABD5 Ç’ Ç‘ Ç’ +8FABD6 8FAAD6 8FABD6 Å‘ Å Å‘ +8FABD7 8FAAD7 8FABD7 Å ÅŒ Å +8FABD8 8FAAD8 8FABD8 õ Õ õ +8FABD9 8FAAD9 8FABD9 Å• Å” Å• +8FABDA 8FAADA 8FABDA Å™ Ř Å™ +8FABDB 8FAADB 8FABDB Å— Å– Å— +8FABDC 8FAADC 8FABDC Å› Åš Å› +8FABDD 8FAADD 8FABDD Å Åœ Å +8FABDE 8FAADE 8FABDE Å¡ Å Å¡ +8FABDF 8FAADF 8FABDF ÅŸ Åž ÅŸ +8FABE0 8FAAE0 8FABE0 Å¥ Ť Å¥ +8FABE1 8FAAE1 8FABE1 Å£ Å¢ Å£ +8FABE2 8FAAE2 8FABE2 ú Ú ú +8FABE3 8FAAE3 8FABE3 ù Ù ù +8FABE4 8FAAE4 8FABE4 ü Ãœ ü +8FABE5 8FAAE5 8FABE5 û Û û +8FABE6 8FAAE6 8FABE6 ŠŬ Å +8FABE7 8FAAE7 8FABE7 Ç” Ç“ Ç” +8FABE8 8FAAE8 8FABE8 ű Å° ű +8FABE9 8FAAE9 8FABE9 Å« Ū Å« +8FABEA 8FAAEA 8FABEA ų Ų ų +8FABEB 8FAAEB 8FABEB ů Å® ů +8FABEC 8FAAEC 8FABEC Å© Ũ Å© +8FABED 8FAAED 8FABED ǘ Ç— ǘ +8FABEE 8FAAEE 8FABEE Çœ Ç› Çœ +8FABEF 8FAAEF 8FABEF Çš Ç™ Çš +8FABF0 8FAAF0 8FABF0 Ç– Ç• Ç– +8FABF1 8FAAF1 8FABF1 ŵ Å´ ŵ +8FABF2 8FAAF2 8FABF2 ý à ý +8FABF3 8FAAF3 8FABF3 ÿ Ÿ ÿ +8FABF4 8FAAF4 8FABF4 Å· Ŷ Å· +8FABF5 8FAAF5 8FABF5 ź Ź ź +8FABF6 8FAAF6 8FABF6 ž Ž ž +8FABF7 8FAAF7 8FABF7 ż Å» ż +A2F2 A2F2 8FABA9 â„« â„« Ã¥ +A3C1 A3C1 A3E1 A A ï½ +A3C2 A3C2 A3E2 ï¼¢ ï¼¢ b +A3C3 A3C3 A3E3 ï¼£ ï¼£ c +A3C4 A3C4 A3E4 D D d +A3C5 A3C5 A3E5 ï¼¥ ï¼¥ ï½… +A3C6 A3C6 A3E6 F F f +A3C7 A3C7 A3E7 G G g +A3C8 A3C8 A3E8 H H h +A3C9 A3C9 A3E9 I I i +A3CA A3CA A3EA J J j +A3CB A3CB A3EB K K k +A3CC A3CC A3EC L L l +A3CD A3CD A3ED ï¼ ï¼ ï½ +A3CE A3CE A3EE ï¼® ï¼® n +A3CF A3CF A3EF O O ï½ +A3D0 A3D0 A3F0 ï¼° ï¼° ï½ +A3D1 A3D1 A3F1 ï¼± ï¼± q +A3D2 A3D2 A3F2 ï¼² ï¼² ï½’ +A3D3 A3D3 A3F3 ï¼³ ï¼³ s +A3D4 A3D4 A3F4 ï¼´ ï¼´ ï½” +A3D5 A3D5 A3F5 ï¼µ ï¼µ u +A3D6 A3D6 A3F6 V V ï½– +A3D7 A3D7 A3F7 ï¼· ï¼· ï½— +A3D8 A3D8 A3F8 X X x +A3D9 A3D9 A3F9 ï¼¹ ï¼¹ ï½™ +A3DA A3DA A3FA Z Z z +A3E1 A3C1 A3E1 ï½ ï¼¡ ï½ +A3E2 A3C2 A3E2 b ï¼¢ b +A3E3 A3C3 A3E3 c ï¼£ c +A3E4 A3C4 A3E4 d D d +A3E5 A3C5 A3E5 ï½… ï¼¥ ï½… +A3E6 A3C6 A3E6 f F f +A3E7 A3C7 A3E7 g G g +A3E8 A3C8 A3E8 h H h +A3E9 A3C9 A3E9 i I i +A3EA A3CA A3EA j J j +A3EB A3CB A3EB k K k +A3EC A3CC A3EC l L l +A3ED A3CD A3ED ï½ ï¼ ï½ +A3EE A3CE A3EE n ï¼® n +A3EF A3CF A3EF ï½ ï¼¯ ï½ +A3F0 A3D0 A3F0 ï½ ï¼° ï½ +A3F1 A3D1 A3F1 q ï¼± q +A3F2 A3D2 A3F2 ï½’ ï¼² ï½’ +A3F3 A3D3 A3F3 s ï¼³ s +A3F4 A3D4 A3F4 ï½” ï¼´ ï½” +A3F5 A3D5 A3F5 u ï¼µ u +A3F6 A3D6 A3F6 ï½– V ï½– +A3F7 A3D7 A3F7 ï½— ï¼· ï½— +A3F8 A3D8 A3F8 x X x +A3F9 A3D9 A3F9 ï½™ ï¼¹ ï½™ +A3FA A3DA A3FA z Z z +A6A1 A6A1 A6C1 Α Α α +A6A2 A6A2 A6C2 Î’ Î’ β +A6A3 A6A3 A6C3 Γ Γ γ +A6A4 A6A4 A6C4 Δ Δ δ +A6A5 A6A5 A6C5 Ε Ε ε +A6A6 A6A6 A6C6 Ζ Ζ ζ +A6A7 A6A7 A6C7 Η Η η +A6A8 A6A8 A6C8 Θ Θ θ +A6A9 A6A9 A6C9 Ι Ι ι +A6AA A6AA A6CA Κ Κ κ +A6AB A6AB A6CB Λ Λ λ +A6AC A6AC A6CC Îœ Îœ μ +A6AD A6AD A6CD ΠΠν +A6AE A6AE A6CE Ξ Ξ ξ +A6AF A6AF A6CF Ο Ο ο +A6B0 A6B0 A6D0 ΠΠπ +A6B1 A6B1 A6D1 Ρ Ρ Ï +A6B2 A6B2 A6D2 Σ Σ σ +A6B3 A6B3 A6D3 Τ Τ Ï„ +A6B4 A6B4 A6D4 Î¥ Î¥ Ï… +A6B5 A6B5 A6D5 Φ Φ φ +A6B6 A6B6 A6D6 Χ Χ χ +A6B7 A6B7 A6D7 Ψ Ψ ψ +A6B8 A6B8 A6D8 Ω Ω ω +A6C1 A6A1 A6C1 α Α α +A6C2 A6A2 A6C2 β Î’ β +A6C3 A6A3 A6C3 γ Γ γ +A6C4 A6A4 A6C4 δ Δ δ +A6C5 A6A5 A6C5 ε Ε ε +A6C6 A6A6 A6C6 ζ Ζ ζ +A6C7 A6A7 A6C7 η Η η +A6C8 A6A8 A6C8 θ Θ θ +A6C9 A6A9 A6C9 ι Ι ι +A6CA A6AA A6CA κ Κ κ +A6CB A6AB A6CB λ Λ λ +A6CC A6AC A6CC μ Îœ μ +A6CD A6AD A6CD ν Πν +A6CE A6AE A6CE ξ Ξ ξ +A6CF A6AF A6CF ο Ο ο +A6D0 A6B0 A6D0 Ï€ Ππ +A6D1 A6B1 A6D1 Ï Î¡ Ï +A6D2 A6B2 A6D2 σ Σ σ +A6D3 A6B3 A6D3 Ï„ Τ Ï„ +A6D4 A6B4 A6D4 Ï… Î¥ Ï… +A6D5 A6B5 A6D5 φ Φ φ +A6D6 A6B6 A6D6 χ Χ χ +A6D7 A6B7 A6D7 ψ Ψ ψ +A6D8 A6B8 A6D8 ω Ω ω +A7A1 A7A1 A7D1 РРа +A7A2 A7A2 A7D2 Б Б б +A7A3 A7A3 A7D3 Ð’ Ð’ в +A7A4 A7A4 A7D4 Г Г г +A7A5 A7A5 A7D5 Д Д д +A7A6 A7A6 A7D6 Е Е е +A7A7 A7A7 A7D7 Ð Ð Ñ‘ +A7A8 A7A8 A7D8 Ж Ж ж +A7A9 A7A9 A7D9 З З з +A7AA A7AA A7DA И И и +A7AB A7AB A7DB Й Й й +A7AC A7AC A7DC К К к +A7AD A7AD A7DD Л Л л +A7AE A7AE A7DE Ðœ Ðœ м +A7AF A7AF A7DF РРн +A7B0 A7B0 A7E0 О О о +A7B1 A7B1 A7E1 П П п +A7B2 A7B2 A7E2 РРр +A7B3 A7B3 A7E3 С С Ñ +A7B4 A7B4 A7E4 Т Т Ñ‚ +A7B5 A7B5 A7E5 У У у +A7B6 A7B6 A7E6 Ф Ф Ñ„ +A7B7 A7B7 A7E7 Ð¥ Ð¥ Ñ… +A7B8 A7B8 A7E8 Ц Ц ц +A7B9 A7B9 A7E9 Ч Ч ч +A7BA A7BA A7EA Ш Ш ш +A7BB A7BB A7EB Щ Щ щ +A7BC A7BC A7EC Ъ Ъ ÑŠ +A7BD A7BD A7ED Ы Ы Ñ‹ +A7BE A7BE A7EE Ь Ь ÑŒ +A7BF A7BF A7EF Ð Ð Ñ +A7C0 A7C0 A7F0 Ю Ю ÑŽ +A7C1 A7C1 A7F1 Я Я Ñ +A7D1 A7A1 A7D1 а Ра +A7D2 A7A2 A7D2 б Б б +A7D3 A7A3 A7D3 в Ð’ в +A7D4 A7A4 A7D4 г Г г +A7D5 A7A5 A7D5 д Д д +A7D6 A7A6 A7D6 е Е е +A7D7 A7A7 A7D7 Ñ‘ Ð Ñ‘ +A7D8 A7A8 A7D8 ж Ж ж +A7D9 A7A9 A7D9 з З з +A7DA A7AA A7DA и И и +A7DB A7AB A7DB й Й й +A7DC A7AC A7DC к К к +A7DD A7AD A7DD л Л л +A7DE A7AE A7DE м Ðœ м +A7DF A7AF A7DF н Рн +A7E0 A7B0 A7E0 о О о +A7E1 A7B1 A7E1 п П п +A7E2 A7B2 A7E2 Ñ€ Рр +A7E3 A7B3 A7E3 Ñ Ð¡ Ñ +A7E4 A7B4 A7E4 Ñ‚ Т Ñ‚ +A7E5 A7B5 A7E5 у У у +A7E6 A7B6 A7E6 Ñ„ Ф Ñ„ +A7E7 A7B7 A7E7 Ñ… Ð¥ Ñ… +A7E8 A7B8 A7E8 ц Ц ц +A7E9 A7B9 A7E9 ч Ч ч +A7EA A7BA A7EA ш Ш ш +A7EB A7BB A7EB щ Щ щ +A7EC A7BC A7EC ÑŠ Ъ ÑŠ +A7ED A7BD A7ED Ñ‹ Ы Ñ‹ +A7EE A7BE A7EE ÑŒ Ь ÑŒ +A7EF A7BF A7EF Ñ Ð Ñ +A7F0 A7C0 A7F0 ÑŽ Ю ÑŽ +A7F1 A7C1 A7F1 Ñ Ð¯ Ñ +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +8FAABC Ä¢ +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> +HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +code a +8FA9C3 ð +8FABB9 ǵ +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 8c6bd582232..17ec2b09a0a 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -50,6 +50,7 @@ information_schema mtr mysql mysqltest +performance_schema test flush tables with read lock; drop database mysqltest; @@ -61,6 +62,7 @@ Database information_schema mtr mysql +performance_schema test drop database mysqltest; ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index da5bbba18fe..0b76e568b4d 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -11,12 +11,14 @@ select * from information_schema.SCHEMATA where schema_name > 'm'; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH def mtr latin1 latin1_swedish_ci NULL def mysql latin1 latin1_swedish_ci NULL +def performance_schema utf8 utf8_general_ci NULL def test latin1 latin1_swedish_ci NULL select schema_name from information_schema.schemata; schema_name information_schema mtr mysql +performance_schema test show databases like 't%'; Database (t%) @@ -26,6 +28,7 @@ Database information_schema mtr mysql +performance_schema test show databases where `database` = 't%'; Database @@ -364,6 +367,7 @@ c information_schema mtr mysql +performance_schema test explain select * from v0; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index 3975f085468..76440e535d6 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -419,6 +419,38 @@ The following options may be given as the first argument: default} --partition[=name] Enable or disable partition plugin. Possible values are ON, OFF, FORCE (don't start if the plugin fails to load). + --performance-schema + Enable the performance schema. + --performance-schema-events-waits-history-long-size=# + Number of rows in EVENTS_WAITS_HISTORY_LONG. + --performance-schema-events-waits-history-size=# + Number of rows per thread in EVENTS_WAITS_HISTORY. + --performance-schema-max-cond-classes=# + Maximum number of condition instruments. + --performance-schema-max-cond-instances=# + Maximum number of instrumented condition objects. + --performance-schema-max-file-classes=# + Maximum number of file instruments. + --performance-schema-max-file-handles=# + Maximum number of opened instrumented files. + --performance-schema-max-file-instances=# + Maximum number of instrumented files. + --performance-schema-max-mutex-classes=# + Maximum number of mutex instruments. + --performance-schema-max-mutex-instances=# + Maximum number of instrumented MUTEX objects. + --performance-schema-max-rwlock-classes=# + Maximum number of rwlock instruments. + --performance-schema-max-rwlock-instances=# + Maximum number of instrumented RWLOCK objects. + --performance-schema-max-table-handles=# + Maximum number of opened instrumented tables. + --performance-schema-max-table-instances=# + Maximum number of instrumented tables. + --performance-schema-max-thread-classes=# + Maximum number of thread instruments. + --performance-schema-max-thread-instances=# + Maximum number of instrumented threads. --pid-file=name Pid file used by safe_mysqld --plugin-dir=name Directory for plugins --plugin-load=name Optional semicolon-separated list of plugins to load, @@ -718,220 +750,236 @@ The following options may be given as the first argument: -W, --warnings[=#] Deprecated; use --log-warnings instead. Variables (--variable-name=value) -and boolean options {FALSE|TRUE} Value (after reading options) ------------------------------------ -------------------------------------- -abort-slave-event-count 0 -allow-suspicious-udfs FALSE -archive ON -auto-increment-increment 1 -auto-increment-offset 1 -automatic-sp-privileges TRUE -back-log 50 -big-tables FALSE -bind-address (No default value) -binlog-cache-size 32768 -binlog-format STATEMENT -binlog-row-event-max-size 1024 -blackhole ON -bulk-insert-buffer-size 8388608 -character-set-client-handshake TRUE -character-set-filesystem binary -character-set-server latin1 -character-sets-dir MYSQL_SHAREDIR/charsets/ -chroot (No default value) -collation-server latin1_swedish_ci -completion-type NO_CHAIN -concurrent-insert AUTO -connect-timeout 10 -console FALSE -date-format %Y-%m-%d -datetime-format %Y-%m-%d %H:%i:%s -default-character-set latin1 -default-collation latin1_swedish_ci -default-storage-engine MyISAM -default-time-zone (No default value) -default-week-format 0 -delay-key-write ON -delayed-insert-limit 100 -delayed-insert-timeout 300 -delayed-queue-size 1000 -disconnect-slave-event-count 0 -div-precision-increment 4 -enable-locking FALSE -engine-condition-pushdown TRUE -event-scheduler OFF -expire-logs-days 0 -external-locking FALSE -federated ON -flush FALSE -flush-time 0 -ft-boolean-syntax + -><()~*:""&| -ft-max-word-len 84 -ft-min-word-len 4 -ft-query-expansion-limit 20 -ft-stopword-file (No default value) -gdb FALSE -general-log FALSE -group-concat-max-len 1024 -help TRUE -ignore-builtin-innodb FALSE -init-connect -init-file (No default value) -init-rpl-role MASTER -init-slave -interactive-timeout 28800 -join-buffer-size 131072 -keep-files-on-create FALSE -key-buffer-size 8388608 -key-cache-age-threshold 300 -key-cache-block-size 1024 -key-cache-division-limit 100 -language MYSQL_SHAREDIR/ -large-pages FALSE -lc-messages en_US -lc-messages-dir MYSQL_SHAREDIR/ -lc-time-names en_US -local-infile TRUE -log-bin (No default value) -log-bin-index (No default value) -log-bin-trust-function-creators FALSE -log-error -log-isam myisam.log -log-output FILE -log-queries-not-using-indexes FALSE -log-short-format FALSE -log-slave-updates FALSE -log-slow-admin-statements FALSE -log-slow-slave-statements FALSE -log-tc tc.log -log-tc-size 24576 -log-update (No default value) -log-warnings 1 -long-query-time 10 -low-priority-updates FALSE -lower-case-table-names 1 -master-info-file master.info -master-retry-count 86400 -max-allowed-packet 1048576 -max-binlog-cache-size 18446744073709547520 -max-binlog-dump-events 0 -max-binlog-size 1073741824 -max-connect-errors 10 -max-connections 151 -max-delayed-threads 20 -max-error-count 64 -max-heap-table-size 16777216 -max-join-size 18446744073709551615 -max-length-for-sort-data 1024 -max-prepared-stmt-count 16382 -max-relay-log-size 0 -max-seeks-for-key 18446744073709551615 -max-sort-length 1024 -max-sp-recursion-depth 0 -max-tmp-tables 32 -max-user-connections 0 -max-write-lock-count 18446744073709551615 -memlock FALSE -min-examined-row-limit 0 -multi-range-count 256 -myisam-block-size 1024 -myisam-data-pointer-size 6 -myisam-max-sort-file-size 9223372036853727232 -myisam-mmap-size 18446744073709551615 -myisam-recover-options OFF -myisam-repair-threads 1 -myisam-sort-buffer-size 8388608 -myisam-stats-method nulls_unequal -myisam-use-mmap FALSE -net-buffer-length 16384 -net-read-timeout 30 -net-retry-count 10 -net-write-timeout 60 -new FALSE -old FALSE -old-alter-table FALSE -old-passwords FALSE -old-style-user-limits FALSE -optimizer-prune-level 1 -optimizer-search-depth 62 -optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on -partition ON -plugin-dir MYSQL_LIBDIR/mysql/plugin -plugin-load (No default value) -port 3306 -port-open-timeout 0 -preload-buffer-size 32768 -profiling-history-size 15 -query-alloc-block-size 8192 -query-cache-limit 1048576 -query-cache-min-res-unit 4096 -query-cache-size 0 -query-cache-type ON -query-cache-wlock-invalidate FALSE -query-prealloc-size 8192 -range-alloc-block-size 4096 -read-buffer-size 131072 -read-only FALSE -read-rnd-buffer-size 262144 -record-buffer 131072 -relay-log (No default value) -relay-log-index (No default value) -relay-log-info-file relay-log.info -relay-log-purge TRUE -relay-log-recovery FALSE -relay-log-space-limit 0 -replicate-same-server-id FALSE -report-host (No default value) -report-password (No default value) -report-port 3306 -report-user (No default value) -rpl-recovery-rank 0 -safe-user-create FALSE -secure-auth FALSE -secure-file-priv (No default value) -server-id 0 -show-slave-auth-info FALSE -skip-grant-tables TRUE -skip-networking FALSE -skip-show-database FALSE -skip-slave-start FALSE -slave-compressed-protocol FALSE -slave-exec-mode STRICT -slave-net-timeout 3600 -slave-skip-errors (No default value) -slave-transaction-retries 10 -slow-launch-time 2 -slow-query-log FALSE -socket /tmp/mysql.sock -sort-buffer-size 2097152 -sporadic-binlog-dump-fail FALSE -sql-mode -symbolic-links FALSE -sync-binlog 0 -sync-frm TRUE -sync-master-info 0 -sync-relay-log 0 -sync-relay-log-info 0 -sysdate-is-now FALSE -table-cache 400 -table-definition-cache 400 -table-lock-wait-timeout 50 -table-open-cache 400 -tc-heuristic-recover COMMIT -thread-cache-size 0 -thread-handling one-thread-per-connection -thread-stack 262144 -time-format %H:%i:%s -timed-mutexes FALSE -tmp-table-size 16777216 -transaction-alloc-block-size 8192 -transaction-isolation REPEATABLE-READ -transaction-prealloc-size 4096 -updatable-views-with-limit YES -use-symbolic-links FALSE -verbose TRUE -wait-timeout 28800 -warnings 1 +and boolean options {FALSE|TRUE} Value (after reading options) +------------------------------------------------- ------------------------ +abort-slave-event-count 0 +allow-suspicious-udfs FALSE +archive ON +auto-increment-increment 1 +auto-increment-offset 1 +automatic-sp-privileges TRUE +back-log 50 +big-tables FALSE +bind-address (No default value) +binlog-cache-size 32768 +binlog-format STATEMENT +binlog-row-event-max-size 1024 +blackhole ON +bulk-insert-buffer-size 8388608 +character-set-client-handshake TRUE +character-set-filesystem binary +character-set-server latin1 +character-sets-dir MYSQL_SHAREDIR/charsets/ +chroot (No default value) +collation-server latin1_swedish_ci +completion-type NO_CHAIN +concurrent-insert AUTO +connect-timeout 10 +console FALSE +date-format %Y-%m-%d +datetime-format %Y-%m-%d %H:%i:%s +default-character-set latin1 +default-collation latin1_swedish_ci +default-storage-engine MyISAM +default-time-zone (No default value) +default-week-format 0 +delay-key-write ON +delayed-insert-limit 100 +delayed-insert-timeout 300 +delayed-queue-size 1000 +disconnect-slave-event-count 0 +div-precision-increment 4 +enable-locking FALSE +engine-condition-pushdown TRUE +event-scheduler OFF +expire-logs-days 0 +external-locking FALSE +federated ON +flush FALSE +flush-time 0 +ft-boolean-syntax + -><()~*:""&| +ft-max-word-len 84 +ft-min-word-len 4 +ft-query-expansion-limit 20 +ft-stopword-file (No default value) +gdb FALSE +general-log FALSE +group-concat-max-len 1024 +help TRUE +ignore-builtin-innodb FALSE +init-connect +init-file (No default value) +init-rpl-role MASTER +init-slave +interactive-timeout 28800 +join-buffer-size 131072 +keep-files-on-create FALSE +key-buffer-size 8388608 +key-cache-age-threshold 300 +key-cache-block-size 1024 +key-cache-division-limit 100 +language MYSQL_SHAREDIR/ +large-pages FALSE +lc-messages en_US +lc-messages-dir MYSQL_SHAREDIR/ +lc-time-names en_US +local-infile TRUE +log-bin (No default value) +log-bin-index (No default value) +log-bin-trust-function-creators FALSE +log-error +log-isam myisam.log +log-output FILE +log-queries-not-using-indexes FALSE +log-short-format FALSE +log-slave-updates FALSE +log-slow-admin-statements FALSE +log-slow-slave-statements FALSE +log-tc tc.log +log-tc-size 24576 +log-update (No default value) +log-warnings 1 +long-query-time 10 +low-priority-updates FALSE +lower-case-table-names 1 +master-info-file master.info +master-retry-count 86400 +max-allowed-packet 1048576 +max-binlog-cache-size 18446744073709547520 +max-binlog-dump-events 0 +max-binlog-size 1073741824 +max-connect-errors 10 +max-connections 151 +max-delayed-threads 20 +max-error-count 64 +max-heap-table-size 16777216 +max-join-size 18446744073709551615 +max-length-for-sort-data 1024 +max-prepared-stmt-count 16382 +max-relay-log-size 0 +max-seeks-for-key 18446744073709551615 +max-sort-length 1024 +max-sp-recursion-depth 0 +max-tmp-tables 32 +max-user-connections 0 +max-write-lock-count 18446744073709551615 +memlock FALSE +min-examined-row-limit 0 +multi-range-count 256 +myisam-block-size 1024 +myisam-data-pointer-size 6 +myisam-max-sort-file-size 9223372036853727232 +myisam-mmap-size 18446744073709551615 +myisam-recover-options OFF +myisam-repair-threads 1 +myisam-sort-buffer-size 8388608 +myisam-stats-method nulls_unequal +myisam-use-mmap FALSE +net-buffer-length 16384 +net-read-timeout 30 +net-retry-count 10 +net-write-timeout 60 +new FALSE +old FALSE +old-alter-table FALSE +old-passwords FALSE +old-style-user-limits FALSE +optimizer-prune-level 1 +optimizer-search-depth 62 +optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on +partition ON +performance-schema FALSE +performance-schema-events-waits-history-long-size 10000 +performance-schema-events-waits-history-size 10 +performance-schema-max-cond-classes 80 +performance-schema-max-cond-instances 1000 +performance-schema-max-file-classes 50 +performance-schema-max-file-handles 32768 +performance-schema-max-file-instances 10000 +performance-schema-max-mutex-classes 200 +performance-schema-max-mutex-instances 1000 +performance-schema-max-rwlock-classes 20 +performance-schema-max-rwlock-instances 1000 +performance-schema-max-table-handles 100000 +performance-schema-max-table-instances 50000 +performance-schema-max-thread-classes 50 +performance-schema-max-thread-instances 1000 +plugin-dir MYSQL_LIBDIR/mysql/plugin +plugin-load (No default value) +port 3306 +port-open-timeout 0 +preload-buffer-size 32768 +profiling-history-size 15 +query-alloc-block-size 8192 +query-cache-limit 1048576 +query-cache-min-res-unit 4096 +query-cache-size 0 +query-cache-type ON +query-cache-wlock-invalidate FALSE +query-prealloc-size 8192 +range-alloc-block-size 4096 +read-buffer-size 131072 +read-only FALSE +read-rnd-buffer-size 262144 +record-buffer 131072 +relay-log (No default value) +relay-log-index (No default value) +relay-log-info-file relay-log.info +relay-log-purge TRUE +relay-log-recovery FALSE +relay-log-space-limit 0 +replicate-same-server-id FALSE +report-host (No default value) +report-password (No default value) +report-port 3306 +report-user (No default value) +rpl-recovery-rank 0 +safe-user-create FALSE +secure-auth FALSE +secure-file-priv (No default value) +server-id 0 +show-slave-auth-info FALSE +skip-grant-tables TRUE +skip-networking FALSE +skip-show-database FALSE +skip-slave-start FALSE +slave-compressed-protocol FALSE +slave-exec-mode STRICT +slave-net-timeout 3600 +slave-skip-errors (No default value) +slave-transaction-retries 10 +slow-launch-time 2 +slow-query-log FALSE +socket /tmp/mysql.sock +sort-buffer-size 2097152 +sporadic-binlog-dump-fail FALSE +sql-mode +symbolic-links FALSE +sync-binlog 0 +sync-frm TRUE +sync-master-info 0 +sync-relay-log 0 +sync-relay-log-info 0 +sysdate-is-now FALSE +table-cache 400 +table-definition-cache 400 +table-lock-wait-timeout 50 +table-open-cache 400 +tc-heuristic-recover COMMIT +thread-cache-size 0 +thread-handling one-thread-per-connection +thread-stack 262144 +time-format %H:%i:%s +timed-mutexes FALSE +tmp-table-size 16777216 +transaction-alloc-block-size 8192 +transaction-isolation REPEATABLE-READ +transaction-prealloc-size 4096 +updatable-views-with-limit YES +use-symbolic-links FALSE +verbose TRUE +wait-timeout 28800 +warnings 1 To see what values a running MySQL server is using, type 'mysqladmin variables' instead of 'mysqld --verbose --help'. diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index c51fbd969ba..88702d61bc4 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -419,6 +419,38 @@ The following options may be given as the first argument: default} --partition[=name] Enable or disable partition plugin. Possible values are ON, OFF, FORCE (don't start if the plugin fails to load). + --performance-schema + Enable the performance schema. + --performance-schema-events-waits-history-long-size=# + Number of rows in EVENTS_WAITS_HISTORY_LONG. + --performance-schema-events-waits-history-size=# + Number of rows per thread in EVENTS_WAITS_HISTORY. + --performance-schema-max-cond-classes=# + Maximum number of condition instruments. + --performance-schema-max-cond-instances=# + Maximum number of instrumented condition objects. + --performance-schema-max-file-classes=# + Maximum number of file instruments. + --performance-schema-max-file-handles=# + Maximum number of opened instrumented files. + --performance-schema-max-file-instances=# + Maximum number of instrumented files. + --performance-schema-max-mutex-classes=# + Maximum number of mutex instruments. + --performance-schema-max-mutex-instances=# + Maximum number of instrumented MUTEX objects. + --performance-schema-max-rwlock-classes=# + Maximum number of rwlock instruments. + --performance-schema-max-rwlock-instances=# + Maximum number of instrumented RWLOCK objects. + --performance-schema-max-table-handles=# + Maximum number of opened instrumented tables. + --performance-schema-max-table-instances=# + Maximum number of instrumented tables. + --performance-schema-max-thread-classes=# + Maximum number of thread instruments. + --performance-schema-max-thread-instances=# + Maximum number of instrumented threads. --pid-file=name Pid file used by safe_mysqld --plugin-dir=name Directory for plugins --plugin-load=name Optional semicolon-separated list of plugins to load, @@ -722,222 +754,238 @@ The following options may be given as the first argument: -W, --warnings[=#] Deprecated; use --log-warnings instead. Variables (--variable-name=value) -and boolean options {FALSE|TRUE} Value (after reading options) ---------------------------------- ---------------------------------------- -abort-slave-event-count 0 -allow-suspicious-udfs FALSE -archive ON -auto-increment-increment 1 -auto-increment-offset 1 -automatic-sp-privileges TRUE -back-log 50 -big-tables FALSE -bind-address (No default value) -binlog-cache-size 32768 -binlog-format STATEMENT -binlog-row-event-max-size 1024 -blackhole ON -bulk-insert-buffer-size 8388608 -character-set-client-handshake TRUE -character-set-filesystem binary -character-set-server latin1 -character-sets-dir MYSQL_SHAREDIR/charsets/ -chroot (No default value) -collation-server latin1_swedish_ci -completion-type NO_CHAIN -concurrent-insert AUTO -connect-timeout 10 -console FALSE -date-format %Y-%m-%d -datetime-format %Y-%m-%d %H:%i:%s -default-character-set latin1 -default-collation latin1_swedish_ci -default-storage-engine MyISAM -default-time-zone (No default value) -default-week-format 0 -delay-key-write ON -delayed-insert-limit 100 -delayed-insert-timeout 300 -delayed-queue-size 1000 -disconnect-slave-event-count 0 -div-precision-increment 4 -enable-locking FALSE -engine-condition-pushdown TRUE -event-scheduler OFF -expire-logs-days 0 -external-locking FALSE -federated ON -flush FALSE -flush-time 1800 -ft-boolean-syntax + -><()~*:""&| -ft-max-word-len 84 -ft-min-word-len 4 -ft-query-expansion-limit 20 -ft-stopword-file (No default value) -gdb FALSE -general-log FALSE -group-concat-max-len 1024 -help TRUE -ignore-builtin-innodb FALSE -init-connect -init-file (No default value) -init-rpl-role MASTER -init-slave -interactive-timeout 28800 -join-buffer-size 131072 -keep-files-on-create FALSE -key-buffer-size 8388608 -key-cache-age-threshold 300 -key-cache-block-size 1024 -key-cache-division-limit 100 -language MYSQL_SHAREDIR/ -lc-messages en_US -lc-messages-dir MYSQL_SHAREDIR/ -lc-time-names en_US -local-infile TRUE -log-bin (No default value) -log-bin-index (No default value) -log-bin-trust-function-creators FALSE -log-error -log-isam myisam.log -log-output FILE -log-queries-not-using-indexes FALSE -log-short-format FALSE -log-slave-updates FALSE -log-slow-admin-statements FALSE -log-slow-slave-statements FALSE -log-tc tc.log -log-tc-size 24576 -log-update (No default value) -log-warnings 1 -long-query-time 10 -low-priority-updates FALSE -lower-case-table-names 1 -master-info-file master.info -master-retry-count 86400 -max-allowed-packet 1048576 -max-binlog-cache-size 18446744073709547520 -max-binlog-dump-events 0 -max-binlog-size 1073741824 -max-connect-errors 10 -max-connections 151 -max-delayed-threads 20 -max-error-count 64 -max-heap-table-size 16777216 -max-join-size 18446744073709551615 -max-length-for-sort-data 1024 -max-prepared-stmt-count 16382 -max-relay-log-size 0 -max-seeks-for-key 18446744073709551615 -max-sort-length 1024 -max-sp-recursion-depth 0 -max-tmp-tables 32 -max-user-connections 0 -max-write-lock-count 18446744073709551615 -memlock FALSE -min-examined-row-limit 0 -multi-range-count 256 -myisam-block-size 1024 -myisam-data-pointer-size 6 -myisam-max-sort-file-size 9223372036853727232 -myisam-mmap-size 18446744073709551615 -myisam-recover-options OFF -myisam-repair-threads 1 -myisam-sort-buffer-size 8388608 -myisam-stats-method nulls_unequal -myisam-use-mmap FALSE -named-pipe FALSE -net-buffer-length 16384 -net-read-timeout 30 -net-retry-count 10 -net-write-timeout 60 -new FALSE -old FALSE -old-alter-table FALSE -old-passwords FALSE -old-style-user-limits FALSE -optimizer-prune-level 1 -optimizer-search-depth 62 -optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on -partition ON -plugin-dir MYSQL_LIBDIR/plugin -plugin-load (No default value) -port 3306 -port-open-timeout 0 -preload-buffer-size 32768 -profiling-history-size 15 -query-alloc-block-size 8192 -query-cache-limit 1048576 -query-cache-min-res-unit 4096 -query-cache-size 0 -query-cache-type ON -query-cache-wlock-invalidate FALSE -query-prealloc-size 8192 -range-alloc-block-size 4096 -read-buffer-size 131072 -read-only FALSE -read-rnd-buffer-size 262144 -record-buffer 131072 -relay-log (No default value) -relay-log-index (No default value) -relay-log-info-file relay-log.info -relay-log-purge TRUE -relay-log-recovery FALSE -relay-log-space-limit 0 -replicate-same-server-id FALSE -report-host (No default value) -report-password (No default value) -report-port 3306 -report-user (No default value) -rpl-recovery-rank 0 -safe-user-create FALSE -secure-auth FALSE -secure-file-priv (No default value) -server-id 0 -shared-memory FALSE -shared-memory-base-name MYSQL -show-slave-auth-info FALSE -skip-grant-tables TRUE -skip-networking FALSE -skip-show-database FALSE -skip-slave-start FALSE -slave-compressed-protocol FALSE -slave-exec-mode STRICT -slave-net-timeout 3600 -slave-skip-errors (No default value) -slave-transaction-retries 10 -slow-launch-time 2 -slow-query-log FALSE -socket MySQL -sort-buffer-size 2097152 -sporadic-binlog-dump-fail FALSE -sql-mode -symbolic-links FALSE -sync-binlog 0 -sync-frm TRUE -sync-master-info 0 -sync-relay-log 0 -sync-relay-log-info 0 -sysdate-is-now FALSE -table-cache 400 -table-definition-cache 400 -table-lock-wait-timeout 50 -table-open-cache 400 -tc-heuristic-recover COMMIT -thread-cache-size 0 -thread-handling one-thread-per-connection -thread-stack 262144 -time-format %H:%i:%s -timed-mutexes FALSE -tmp-table-size 16777216 -transaction-alloc-block-size 8192 -transaction-isolation REPEATABLE-READ -transaction-prealloc-size 4096 -updatable-views-with-limit YES -use-symbolic-links FALSE -verbose TRUE -wait-timeout 28800 -warnings 1 +and boolean options {FALSE|TRUE} Value (after reading options) +------------------------------------------------- ------------------------ +abort-slave-event-count 0 +allow-suspicious-udfs FALSE +archive ON +auto-increment-increment 1 +auto-increment-offset 1 +automatic-sp-privileges TRUE +back-log 50 +big-tables FALSE +bind-address (No default value) +binlog-cache-size 32768 +binlog-format STATEMENT +binlog-row-event-max-size 1024 +blackhole ON +bulk-insert-buffer-size 8388608 +character-set-client-handshake TRUE +character-set-filesystem binary +character-set-server latin1 +character-sets-dir MYSQL_SHAREDIR/charsets/ +chroot (No default value) +collation-server latin1_swedish_ci +completion-type NO_CHAIN +concurrent-insert AUTO +connect-timeout 10 +console FALSE +date-format %Y-%m-%d +datetime-format %Y-%m-%d %H:%i:%s +default-character-set latin1 +default-collation latin1_swedish_ci +default-storage-engine MyISAM +default-time-zone (No default value) +default-week-format 0 +delay-key-write ON +delayed-insert-limit 100 +delayed-insert-timeout 300 +delayed-queue-size 1000 +disconnect-slave-event-count 0 +div-precision-increment 4 +enable-locking FALSE +engine-condition-pushdown TRUE +event-scheduler OFF +expire-logs-days 0 +external-locking FALSE +federated ON +flush FALSE +flush-time 1800 +ft-boolean-syntax + -><()~*:""&| +ft-max-word-len 84 +ft-min-word-len 4 +ft-query-expansion-limit 20 +ft-stopword-file (No default value) +gdb FALSE +general-log FALSE +group-concat-max-len 1024 +help TRUE +ignore-builtin-innodb FALSE +init-connect +init-file (No default value) +init-rpl-role MASTER +init-slave +interactive-timeout 28800 +join-buffer-size 131072 +keep-files-on-create FALSE +key-buffer-size 8388608 +key-cache-age-threshold 300 +key-cache-block-size 1024 +key-cache-division-limit 100 +language MYSQL_SHAREDIR/ +lc-messages en_US +lc-messages-dir MYSQL_SHAREDIR/ +lc-time-names en_US +local-infile TRUE +log-bin (No default value) +log-bin-index (No default value) +log-bin-trust-function-creators FALSE +log-error +log-isam myisam.log +log-output FILE +log-queries-not-using-indexes FALSE +log-short-format FALSE +log-slave-updates FALSE +log-slow-admin-statements FALSE +log-slow-slave-statements FALSE +log-tc tc.log +log-tc-size 24576 +log-update (No default value) +log-warnings 1 +long-query-time 10 +low-priority-updates FALSE +lower-case-table-names 1 +master-info-file master.info +master-retry-count 86400 +max-allowed-packet 1048576 +max-binlog-cache-size 18446744073709547520 +max-binlog-dump-events 0 +max-binlog-size 1073741824 +max-connect-errors 10 +max-connections 151 +max-delayed-threads 20 +max-error-count 64 +max-heap-table-size 16777216 +max-join-size 18446744073709551615 +max-length-for-sort-data 1024 +max-prepared-stmt-count 16382 +max-relay-log-size 0 +max-seeks-for-key 18446744073709551615 +max-sort-length 1024 +max-sp-recursion-depth 0 +max-tmp-tables 32 +max-user-connections 0 +max-write-lock-count 18446744073709551615 +memlock FALSE +min-examined-row-limit 0 +multi-range-count 256 +myisam-block-size 1024 +myisam-data-pointer-size 6 +myisam-max-sort-file-size 9223372036853727232 +myisam-mmap-size 18446744073709551615 +myisam-recover-options OFF +myisam-repair-threads 1 +myisam-sort-buffer-size 8388608 +myisam-stats-method nulls_unequal +myisam-use-mmap FALSE +named-pipe FALSE +net-buffer-length 16384 +net-read-timeout 30 +net-retry-count 10 +net-write-timeout 60 +new FALSE +old FALSE +old-alter-table FALSE +old-passwords FALSE +old-style-user-limits FALSE +optimizer-prune-level 1 +optimizer-search-depth 62 +optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on +partition ON +performance-schema FALSE +performance-schema-events-waits-history-long-size 10000 +performance-schema-events-waits-history-size 10 +performance-schema-max-cond-classes 80 +performance-schema-max-cond-instances 1000 +performance-schema-max-file-classes 50 +performance-schema-max-file-handles 32768 +performance-schema-max-file-instances 10000 +performance-schema-max-mutex-classes 200 +performance-schema-max-mutex-instances 1000 +performance-schema-max-rwlock-classes 20 +performance-schema-max-rwlock-instances 1000 +performance-schema-max-table-handles 100000 +performance-schema-max-table-instances 50000 +performance-schema-max-thread-classes 50 +performance-schema-max-thread-instances 1000 +plugin-dir MYSQL_LIBDIR/plugin +plugin-load (No default value) +port 3306 +port-open-timeout 0 +preload-buffer-size 32768 +profiling-history-size 15 +query-alloc-block-size 8192 +query-cache-limit 1048576 +query-cache-min-res-unit 4096 +query-cache-size 0 +query-cache-type ON +query-cache-wlock-invalidate FALSE +query-prealloc-size 8192 +range-alloc-block-size 4096 +read-buffer-size 131072 +read-only FALSE +read-rnd-buffer-size 262144 +record-buffer 131072 +relay-log (No default value) +relay-log-index (No default value) +relay-log-info-file relay-log.info +relay-log-purge TRUE +relay-log-recovery FALSE +relay-log-space-limit 0 +replicate-same-server-id FALSE +report-host (No default value) +report-password (No default value) +report-port 3306 +report-user (No default value) +rpl-recovery-rank 0 +safe-user-create FALSE +secure-auth FALSE +secure-file-priv (No default value) +server-id 0 +shared-memory FALSE +shared-memory-base-name MYSQL +show-slave-auth-info FALSE +skip-grant-tables TRUE +skip-networking FALSE +skip-show-database FALSE +skip-slave-start FALSE +slave-compressed-protocol FALSE +slave-exec-mode STRICT +slave-net-timeout 3600 +slave-skip-errors (No default value) +slave-transaction-retries 10 +slow-launch-time 2 +slow-query-log FALSE +socket MySQL +sort-buffer-size 2097152 +sporadic-binlog-dump-fail FALSE +sql-mode +symbolic-links FALSE +sync-binlog 0 +sync-frm TRUE +sync-master-info 0 +sync-relay-log 0 +sync-relay-log-info 0 +sysdate-is-now FALSE +table-cache 400 +table-definition-cache 400 +table-lock-wait-timeout 50 +table-open-cache 400 +tc-heuristic-recover COMMIT +thread-cache-size 0 +thread-handling one-thread-per-connection +thread-stack 262144 +time-format %H:%i:%s +timed-mutexes FALSE +tmp-table-size 16777216 +transaction-alloc-block-size 8192 +transaction-isolation REPEATABLE-READ +transaction-prealloc-size 4096 +updatable-views-with-limit YES +use-symbolic-links FALSE +verbose TRUE +wait-timeout 28800 +warnings 1 To see what values a running MySQL server is using, type 'mysqladmin variables' instead of 'mysqld --verbose --help'. diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 1603ecec127..4f6e5238c3f 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -262,6 +262,7 @@ Database information_schema mtr mysql +performance_schema test prepare stmt4 from ' show tables from test like ''t2%'' '; execute stmt4; diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result index b43f601caef..2919606d74a 100644 --- a/mysql-test/r/schema.result +++ b/mysql-test/r/schema.result @@ -9,6 +9,7 @@ information_schema foo mtr mysql +performance_schema test drop schema foo; # diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index a5d2e33399c..22b5b29a0c1 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -142,6 +142,7 @@ Database information_schema mtr mysql +performance_schema test show databases like "test%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result index 1cc9281f3fc..eba93c3ae14 100644 --- a/mysql-test/suite/binlog/r/binlog_database.result +++ b/mysql-test/suite/binlog/r/binlog_database.result @@ -116,4 +116,5 @@ Database information_schema mtr mysql +performance_schema test diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index b525f7324c6..8932ea0445f 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -320,10 +320,10 @@ INSERT INTO t2 SET a = func_modify_t1(); SHOW BINLOG EVENTS FROM 12283; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 12283 Query 1 12351 BEGIN -master-bin.000001 12351 Table_map 1 12393 table_id: 41 (test.t2) -master-bin.000001 12393 Table_map 1 12435 table_id: 42 (test.t1) -master-bin.000001 12435 Write_rows 1 12473 table_id: 42 -master-bin.000001 12473 Write_rows 1 12511 table_id: 41 flags: STMT_END_F +master-bin.000001 12351 Table_map 1 12393 table_id: 59 (test.t2) +master-bin.000001 12393 Table_map 1 12435 table_id: 60 (test.t1) +master-bin.000001 12435 Write_rows 1 12473 table_id: 60 +master-bin.000001 12473 Write_rows 1 12511 table_id: 59 flags: STMT_END_F master-bin.000001 12511 Query 1 12580 COMMIT DROP TABLE t1,t2; DROP FUNCTION func_modify_t1; @@ -347,12 +347,12 @@ INSERT INTO t1 SET a = 2; SHOW BINLOG EVENTS FROM 13426; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 13426 Query 1 13494 BEGIN -master-bin.000001 13494 Table_map 1 13535 table_id: 44 (test.t1) -master-bin.000001 13535 Table_map 1 13577 table_id: 45 (test.t3) -master-bin.000001 13577 Table_map 1 13619 table_id: 46 (test.t2) -master-bin.000001 13619 Write_rows 1 13657 table_id: 46 -master-bin.000001 13657 Write_rows 1 13695 table_id: 45 -master-bin.000001 13695 Write_rows 1 13729 table_id: 44 flags: STMT_END_F +master-bin.000001 13494 Table_map 1 13535 table_id: 62 (test.t1) +master-bin.000001 13535 Table_map 1 13577 table_id: 63 (test.t3) +master-bin.000001 13577 Table_map 1 13619 table_id: 64 (test.t2) +master-bin.000001 13619 Write_rows 1 13657 table_id: 64 +master-bin.000001 13657 Write_rows 1 13695 table_id: 63 +master-bin.000001 13695 Write_rows 1 13729 table_id: 62 flags: STMT_END_F master-bin.000001 13729 Query 1 13798 COMMIT DROP TABLE t1,t2,t3; SET SESSION binlog_format = STATEMENT; diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result index d96ad497da0..92e01814b0e 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata.result +++ b/mysql-test/suite/funcs_1/r/is_schemata.result @@ -56,6 +56,7 @@ catalog_name schema_name sql_path def information_schema NULL def mtr NULL def mysql NULL +def performance_schema NULL def test NULL ############################################################################### # Testcases 3.2.9.2+3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information diff --git a/mysql-test/suite/jp/r/jp_create_db_sjis.result b/mysql-test/suite/jp/r/jp_create_db_sjis.result index fd66609b7bc..b7c09fbfbe9 100644 --- a/mysql-test/suite/jp/r/jp_create_db_sjis.result +++ b/mysql-test/suite/jp/r/jp_create_db_sjis.result @@ -13,6 +13,7 @@ information_schema “ú–{Œê ÆÎÝºÞ mysql +performance_schema test USE `ÆÎݺÞ`; USE `“ú–{Œê`; diff --git a/mysql-test/suite/jp/r/jp_create_db_ucs2.result b/mysql-test/suite/jp/r/jp_create_db_ucs2.result index 3a3316ecbaf..3832ff5a0c7 100644 --- a/mysql-test/suite/jp/r/jp_create_db_ucs2.result +++ b/mysql-test/suite/jp/r/jp_create_db_ucs2.result @@ -14,6 +14,7 @@ information_schema íÜíÝíÞ ŽÆŽÎŽÝŽºŽÞ mysql +performance_schema test USE `ŽÆŽÎŽÝŽºŽÞ`; USE `ÆüËܸì`; diff --git a/mysql-test/suite/jp/r/jp_create_db_ujis.result b/mysql-test/suite/jp/r/jp_create_db_ujis.result index 4d6561b88ce..d6bf31336fd 100644 --- a/mysql-test/suite/jp/r/jp_create_db_ujis.result +++ b/mysql-test/suite/jp/r/jp_create_db_ujis.result @@ -13,6 +13,7 @@ information_schema íÜíÝíÞ ŽÆŽÎŽÝŽºŽÞ mysql +performance_schema test USE `ŽÆŽÎŽÝŽºŽÞ`; USE `ÆüËܸì`; diff --git a/mysql-test/suite/jp/r/jp_create_db_utf8.result b/mysql-test/suite/jp/r/jp_create_db_utf8.result index 2f70903ac71..62202d43df0 100644 --- a/mysql-test/suite/jp/r/jp_create_db_utf8.result +++ b/mysql-test/suite/jp/r/jp_create_db_utf8.result @@ -13,6 +13,7 @@ information_schema 龔龖龗 ニホï¾ï½ºï¾ž mysql +performance_schema test USE `ニホï¾ï½ºï¾ž`; USE `日本語`; diff --git a/mysql-test/suite/perfschema/include/binlog_common.inc b/mysql-test/suite/perfschema/include/binlog_common.inc new file mode 100644 index 00000000000..10afe54ab5b --- /dev/null +++ b/mysql-test/suite/perfschema/include/binlog_common.inc @@ -0,0 +1,49 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +RESET MASTER; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; + +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; + +--disable_warnings +drop table if exists test.t1; +drop table if exists test.t2; +--enable_warnings + +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); + +insert into test.t1 + select thread_id from performance_schema.EVENTS_WAITS_CURRENT; + +insert into test.t2 + select name from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/rwlock/%"; + +drop table test.t1; +drop table test.t2; + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; + +--source include/show_binlog_events.inc + diff --git a/mysql-test/suite/perfschema/include/cleanup_helper.inc b/mysql-test/suite/perfschema/include/cleanup_helper.inc new file mode 100644 index 00000000000..5c2429ddb97 --- /dev/null +++ b/mysql-test/suite/perfschema/include/cleanup_helper.inc @@ -0,0 +1,25 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; + +disconnect con1; +disconnect con2; +disconnect con3; + +connection default; + diff --git a/mysql-test/suite/perfschema/include/privilege.inc b/mysql-test/suite/perfschema/include/privilege.inc new file mode 100644 index 00000000000..ef2acc995d5 --- /dev/null +++ b/mysql-test/suite/perfschema/include/privilege.inc @@ -0,0 +1,194 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--disable_warnings +drop table if exists test.t1; +--enable_warnings + +## The result of show grants is not consistent across platforms ... +## show grants; + +## Not enforced yet: deny CREATE_ACL and DROP_ACL +## Waiting to remove .FRM files first +## +## --error ER_DBACCESS_DENIED_ERROR +## create table performance_schema.t1(a int); +## +## --error ER_DBACCESS_DENIED_ERROR +## drop table performance_schema.t1; +## +## --error ER_DBACCESS_DENIED_ERROR +## create table performance_schema.SETUP_INSTRUMENTS(a int); +## +## --error ER_DBACCESS_DENIED_ERROR +## create table performance_schema.EVENTS_WAITS_CURRENT(a int); +## +## --error ER_DBACCESS_DENIED_ERROR +## create table performance_schema.FILE_INSTANCES(a int); +## +## --error ER_DBACCESS_DENIED_ERROR +## drop table performance_schema.SETUP_INSTRUMENTS; +## +## --error ER_DBACCESS_DENIED_ERROR +## drop table performance_schema.EVENTS_WAITS_CURRENT; +## +## --error ER_DBACCESS_DENIED_ERROR +## drop table performance_schema.FILE_INSTANCES; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.FILE_INSTANCES to test.t1; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.SETUP_INSTRUMENTS + to performance_schema.EVENTS_WAITS_CURRENT; + +--error ER_DBACCESS_DENIED_ERROR +rename table performance_schema.EVENTS_WAITS_CURRENT + to performance_schema.SETUP_INSTRUMENTS; + +--error ER_DBACCESS_DENIED_ERROR +create procedure performance_schema.my_proc() begin end; + +--error ER_DBACCESS_DENIED_ERROR +create function performance_schema.my_func() returns int return 0; + +--error ER_DBACCESS_DENIED_ERROR +create event performance_schema.my_event on schedule every 15 minute +do begin end; + +--error ER_DBACCESS_DENIED_ERROR +create trigger performance_schema.bi_setup_instruments + before insert on performance_schema.SETUP_INSTRUMENTS + for each row begin end; + +--error ER_DBACCESS_DENIED_ERROR +create trigger performance_schema.bi_events_waits_current + before insert on performance_schema.EVENTS_WAITS_CURRENT + for each row begin end; + +--error ER_DBACCESS_DENIED_ERROR +create trigger performance_schema.bi_file_instances + before insert on performance_schema.FILE_INSTANCES + for each row begin end; + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1 like performance_schema.FILE_INSTANCES; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_INSTRUMENTS + set name="foo"; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_CURRENT + set name="foo"; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_INSTANCES + set name="foo"; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_INSTRUMENTS; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_INSTANCES; + +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; + +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +lock table performance_schema.EVENTS_WAITS_CURRENT read; +unlock tables; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +lock table performance_schema.EVENTS_WAITS_CURRENT write; +unlock tables; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +lock table performance_schema.FILE_INSTANCES read; +unlock tables; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +lock table performance_schema.FILE_INSTANCES write; +unlock tables; + +--echo # +--echo # WL#4818, NFS2: Can use grants to give normal user access +--echo # to view data from _CURRENT and _HISTORY tables +--echo # +--echo # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +--echo # (Except for EVENTS_WAITS_CURRENT, which is granted.) + +# Errors here will be caught by the diff afterwards +--disable_abort_on_error + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; + +--enable_abort_on_error + diff --git a/mysql-test/suite/perfschema/include/setup_helper.inc b/mysql-test/suite/perfschema/include/setup_helper.inc new file mode 100644 index 00000000000..8a2dfa86496 --- /dev/null +++ b/mysql-test/suite/perfschema/include/setup_helper.inc @@ -0,0 +1,54 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +let $MYSQLD_DATADIR= `select @@datadir`; +let $MYSQLD_TMPDIR= `select @@tmpdir`; + +--disable_query_log +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_CONSUMERS set enabled='YES'; +--enable_query_log + +connect (con1, localhost, root, , ); + +let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID in (select connection_id())`; + +connect (con2, localhost, root, , ); + +let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID in (select connection_id())`; + +connect (con3, localhost, root, , ); + +let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID in (select connection_id())`; + +connection default; + +--disable_query_log +prepare stmt_dump_events from + "select event_name, + left(source, locate(\":\", source)) as short_source, + operation, number_of_bytes + from performance_schema.EVENTS_WAITS_HISTORY_LONG + where thread_id=? order by event_id;"; + +prepare stmt_dump_thread from + "select name from performance_schema.PROCESSLIST where thread_id=? ;"; +--enable_query_log + diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc new file mode 100644 index 00000000000..fa1cb953f59 --- /dev/null +++ b/mysql-test/suite/perfschema/include/start_server_common.inc @@ -0,0 +1,62 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +show databases; + +select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) from performance_schema.SETUP_TIMERS; + +# Make sure we don't crash, no matter what the starting parameters are + +--disable_result_log +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +--enable_result_log + +# This has a stable output, printing the result: +show variables like "performance_schema%"; + +# This has an unrepeatable output, it does depends too much on +# - the platform hardware (sizeof structures, padding) +# - the compiler used (sizeof(enum)) +# - the platform header files (sizeof(size_t)) +# - the code path in the server (what gets executed and instrumented +# at runtime) + +--disable_result_log +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +--enable_result_log + diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result new file mode 100644 index 00000000000..598f9297cc5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/aggregate.result @@ -0,0 +1,101 @@ +"General cleanup" +drop table if exists t1; +update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO'; +update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS +set enabled = 'YES', timed = 'YES'; +create table t1 ( +id INT PRIMARY KEY, +b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); +update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; +set @dump_all=FALSE; +"Verifying file aggregate consistency" +SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) +OR @dump_all; +EVENT_NAME COUNT_READ SUM(i.COUNT_READ) +SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) +OR @dump_all; +EVENT_NAME COUNT_WRITE SUM(i.COUNT_WRITE) +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) +OR @dump_all; +EVENT_NAME SUM_NUMBER_OF_BYTES_READ SUM(i.SUM_NUMBER_OF_BYTES_READ) +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) +OR @dump_all; +EVENT_NAME SUM_NUMBER_OF_BYTES_WRITE SUM(i.SUM_NUMBER_OF_BYTES_WRITE) +"Verifying waits aggregate consistency (instance)" +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT) +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT)) +AND (MIN(i.MIN_TIMER_WAIT) != 0) +OR @dump_all; +EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT) +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT) +"Verifying waits aggregate consistency (thread)" +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT) +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT)) +AND (MIN(t.MIN_TIMER_WAIT) != 0) +OR @dump_all; +EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT) +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT) +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS +set enabled = 'YES', timed = 'YES'; +drop table test.t1; diff --git a/mysql-test/suite/perfschema/r/bad_option_1.result b/mysql-test/suite/perfschema/r/bad_option_1.result new file mode 100644 index 00000000000..02fd04afd33 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_1.result @@ -0,0 +1,2 @@ +Found: unknown variable 'performance-schema-enabled=maybe' +Found: Aborting diff --git a/mysql-test/suite/perfschema/r/bad_option_2.result b/mysql-test/suite/perfschema/r/bad_option_2.result new file mode 100644 index 00000000000..d8fda2af3b6 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_2.result @@ -0,0 +1 @@ +Found: ambiguous option '--performance-schema-max_=12' diff --git a/mysql-test/suite/perfschema/r/binlog_mix.result b/mysql-test/suite/perfschema/r/binlog_mix.result new file mode 100644 index 00000000000..b437f4eda1f --- /dev/null +++ b/mysql-test/suite/perfschema/r/binlog_mix.result @@ -0,0 +1,49 @@ +set binlog_format=mixed; +RESET MASTER; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +count(*) > 0 +1 +drop table if exists test.t1; +drop table if exists test.t2; +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); +insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +drop table test.t1; +drop table test.t2; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table if exists test.t1 +master-bin.000001 # Query # # use `test`; drop table if exists test.t2 +master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer) +master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table test.t1 +master-bin.000001 # Query # # use `test`; drop table test.t2 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_row.result b/mysql-test/suite/perfschema/r/binlog_row.result new file mode 100644 index 00000000000..50a201a81d9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/binlog_row.result @@ -0,0 +1,49 @@ +set binlog_format=row; +RESET MASTER; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +count(*) > 0 +1 +drop table if exists test.t1; +drop table if exists test.t2; +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); +insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +drop table test.t1; +drop table test.t2; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table if exists test.t1 +master-bin.000001 # Query # # use `test`; drop table if exists test.t2 +master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer) +master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table test.t1 +master-bin.000001 # Query # # use `test`; drop table test.t2 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_stmt.result b/mysql-test/suite/perfschema/r/binlog_stmt.result new file mode 100644 index 00000000000..cec46b20670 --- /dev/null +++ b/mysql-test/suite/perfschema/r/binlog_stmt.result @@ -0,0 +1,48 @@ +set binlog_format=statement; +RESET MASTER; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +count(*) > 0 +1 +drop table if exists test.t1; +drop table if exists test.t2; +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); +insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +drop table test.t1; +drop table test.t2; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%" +master-bin.000001 # Query # # use `test`; drop table if exists test.t1 +master-bin.000001 # Query # # use `test`; drop table if exists test.t2 +master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer) +master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) +master-bin.000001 # Query # # use `test`; insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT +master-bin.000001 # Query # # use `test`; insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%" +master-bin.000001 # Query # # use `test`; drop table test.t1 +master-bin.000001 # Query # # use `test`; drop table test.t2 +master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%" diff --git a/mysql-test/suite/perfschema/r/cnf_option.result b/mysql-test/suite/perfschema/r/cnf_option.result new file mode 100644 index 00000000000..85adfb5113d --- /dev/null +++ b/mysql-test/suite/perfschema/r/cnf_option.result @@ -0,0 +1,6 @@ +show variables like 'performance_schema_max_thread_classes'; +Variable_name Value +performance_schema_max_thread_classes 12 +show variables like 'performance_schema_max_thread_instances'; +Variable_name Value +performance_schema_max_thread_instances 318 diff --git a/mysql-test/suite/perfschema/r/column_privilege.result b/mysql-test/suite/perfschema/r/column_privilege.result new file mode 100644 index 00000000000..7bbc59ac452 --- /dev/null +++ b/mysql-test/suite/perfschema/r/column_privilege.result @@ -0,0 +1,27 @@ +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; +grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT +to 'pfs_user_5'@localhost; +grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS +to 'pfs_user_5'@localhost; +flush privileges; +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select event_name from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT' +select thread_id, event_id, event_name +from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT' +update performance_schema.SETUP_INSTRUMENTS set name='illegal'; +ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'name' in table 'SETUP_INSTRUMENTS' +update performance_schema.SETUP_INSTRUMENTS set timed='NO'; +ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'timed' in table 'SETUP_INSTRUMENTS' +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost; +DROP USER 'pfs_user_5'@localhost; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/r/ddl_cond_instances.result b/mysql-test/suite/perfschema/r/ddl_cond_instances.result new file mode 100644 index 00000000000..33adcebaceb --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_cond_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.COND_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.COND_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_current.result b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result new file mode 100644 index 00000000000..a438c93affe --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_CURRENT; +ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result new file mode 100644 index 00000000000..748dc2f29cd --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_HISTORY; +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result new file mode 100644 index 00000000000..1a047a765f6 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result new file mode 100644 index 00000000000..74fc4e1a640 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result new file mode 100644 index 00000000000..4a35565bae0 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result new file mode 100644 index 00000000000..18d98006220 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result @@ -0,0 +1,9 @@ +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index +ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_file_instances.result b/mysql-test/suite/perfschema/r/ddl_file_instances.result new file mode 100644 index 00000000000..21e65c62405 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_file_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.FILE_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result new file mode 100644 index 00000000000..2f21ef56832 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result @@ -0,0 +1,7 @@ +alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result new file mode 100644 index 00000000000..8e256d1fd8d --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result @@ -0,0 +1,7 @@ +alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_mutex_instances.result b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result new file mode 100644 index 00000000000..35397a5294d --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.MUTEX_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.MUTEX_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_performance_timers.result b/mysql-test/suite/perfschema/r/ddl_performance_timers.result new file mode 100644 index 00000000000..5de8193b205 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_performance_timers.result @@ -0,0 +1,8 @@ +alter table performance_schema.PERFORMANCE_TIMERS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.PERFORMANCE_TIMERS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_processlist.result b/mysql-test/suite/perfschema/r/ddl_processlist.result new file mode 100644 index 00000000000..5a9eb766349 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_processlist.result @@ -0,0 +1,8 @@ +alter table performance_schema.PROCESSLIST add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.PROCESSLIST; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result new file mode 100644 index 00000000000..849d191b17f --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.RWLOCK_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.RWLOCK_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_consumers.result b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result new file mode 100644 index 00000000000..f141725ee1f --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result @@ -0,0 +1,8 @@ +alter table performance_schema.SETUP_CONSUMERS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_CONSUMERS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_instruments.result b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result new file mode 100644 index 00000000000..42e54b587d8 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result @@ -0,0 +1,8 @@ +alter table performance_schema.SETUP_INSTRUMENTS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_objects.result b/mysql-test/suite/perfschema/r/ddl_setup_objects.result new file mode 100644 index 00000000000..c0f00745963 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_objects.result @@ -0,0 +1,7 @@ +alter table performance_schema.SETUP_OBJECTS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_OBJECTS; +ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_timers.result b/mysql-test/suite/perfschema/r/ddl_setup_timers.result new file mode 100644 index 00000000000..fc74730bd50 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_timers.result @@ -0,0 +1,8 @@ +alter table performance_schema.SETUP_TIMERS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_TIMERS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/dml_cond_instances.result b/mysql-test/suite/perfschema/r/dml_cond_instances.result new file mode 100644 index 00000000000..8adc632b91b --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_cond_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.COND_INSTANCES limit 1; +NAME OBJECT_INSTANCE_BEGIN +# # +select * from performance_schema.COND_INSTANCES +where name='FOO'; +NAME OBJECT_INSTANCE_BEGIN +insert into performance_schema.COND_INSTANCES +set name='FOO', object_instance_begin=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +update performance_schema.COND_INSTANCES +set name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +delete from performance_schema.COND_INSTANCES +where name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +delete from performance_schema.COND_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +LOCK TABLES performance_schema.COND_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.COND_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_current.result b/mysql-test/suite/perfschema/r/dml_events_waits_current.result new file mode 100644 index 00000000000..5cd0dba7ad1 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_events_waits_current.result @@ -0,0 +1,28 @@ +select * from performance_schema.EVENTS_WAITS_CURRENT +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_CURRENT +where event_name='FOO'; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +insert into performance_schema.EVENTS_WAITS_CURRENT +set thread_id='1', event_id=1, +event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +update performance_schema.EVENTS_WAITS_CURRENT +set timer_start=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +update performance_schema.EVENTS_WAITS_CURRENT +set timer_start=12 where thread_id=0; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.EVENTS_WAITS_CURRENT +where thread_id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history.result b/mysql-test/suite/perfschema/r/dml_events_waits_history.result new file mode 100644 index 00000000000..953922868fb --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_events_waits_history.result @@ -0,0 +1,36 @@ +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name='FOO'; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name like 'Wait/Synch/%' order by timer_wait limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +insert into performance_schema.EVENTS_WAITS_HISTORY +set thread_id='1', event_id=1, +event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +update performance_schema.EVENTS_WAITS_HISTORY +set timer_start=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +update performance_schema.EVENTS_WAITS_HISTORY +set timer_start=12 where thread_id=0; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +delete from performance_schema.EVENTS_WAITS_HISTORY +where thread_id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +delete from performance_schema.EVENTS_WAITS_HISTORY; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result new file mode 100644 index 00000000000..494469a0db8 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result @@ -0,0 +1,36 @@ +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name='FOO'; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name like 'Wait/Synch/%' order by timer_wait limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +insert into performance_schema.EVENTS_WAITS_HISTORY_LONG +set thread_id='1', event_id=1, +event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +update performance_schema.EVENTS_WAITS_HISTORY_LONG +set timer_start=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +update performance_schema.EVENTS_WAITS_HISTORY_LONG +set timer_start=12 where thread_id=0; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG +where thread_id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result new file mode 100644 index 00000000000..675fba021fe --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result @@ -0,0 +1,28 @@ +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +where event_name like 'Wait/Synch/%' limit 1; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +where event_name='FOO'; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, +avg_timer_wait=4, max_timer_wait=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +set count_star=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +set count_star=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +where count_star=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result new file mode 100644 index 00000000000..dc262982340 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result @@ -0,0 +1,45 @@ +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where event_name like 'Wait/Synch/%' limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where event_name='FOO'; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +order by count_star limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +order by count_star desc limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where min_timer_wait > 0 order by count_star limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where min_timer_wait > 0 order by count_star desc limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +set event_name='FOO', object_instance_begin=0, +count_star=1, sum_timer_wait=2, min_timer_wait=3, +avg_timer_wait=4, max_timer_wait=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +set count_star=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +set count_star=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where count_star=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result new file mode 100644 index 00000000000..2a085659431 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result @@ -0,0 +1,29 @@ +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +where event_name='FOO'; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +set event_name='FOO', thread_id=1, +count_star=1, sum_timer_wait=2, min_timer_wait=3, +avg_timer_wait=4, max_timer_wait=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +set count_star=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +set count_star=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +where count_star=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_instances.result b/mysql-test/suite/perfschema/r/dml_file_instances.result new file mode 100644 index 00000000000..e15d68cbad3 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_file_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.FILE_INSTANCES limit 1; +FILE_NAME EVENT_NAME OPEN_COUNT +# # # +select * from performance_schema.FILE_INSTANCES +where file_name='FOO'; +FILE_NAME EVENT_NAME OPEN_COUNT +insert into performance_schema.FILE_INSTANCES +set file_name='FOO', event_name='BAR', open_count=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +update performance_schema.FILE_INSTANCES +set file_name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.FILE_INSTANCES +where event_name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +LOCK TABLES performance_schema.FILE_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.FILE_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result new file mode 100644 index 00000000000..1ecc82f40a5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result @@ -0,0 +1,28 @@ +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +where event_name like 'Wait/io/%' limit 1; +EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +# # # # # +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +where event_name='FOO'; +EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME +set event_name='FOO', count_read=1, count_write=2, +sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +set count_read=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +set count_write=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +where count_read=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result new file mode 100644 index 00000000000..05b204cc1a9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result @@ -0,0 +1,28 @@ +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +where event_name like 'Wait/io/%' limit 1; +FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +# # # # # # +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +where event_name='FOO'; +FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +insert into performance_schema.FILE_SUMMARY_BY_INSTANCE +set event_name='FOO', count_read=1, count_write=2, +sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +update performance_schema.FILE_SUMMARY_BY_INSTANCE +set count_read=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +update performance_schema.FILE_SUMMARY_BY_INSTANCE +set count_write=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE +where count_read=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_mutex_instances.result b/mysql-test/suite/perfschema/r/dml_mutex_instances.result new file mode 100644 index 00000000000..655ca811c06 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.MUTEX_INSTANCES limit 1; +NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID +# # NULL +select * from performance_schema.MUTEX_INSTANCES +where name='FOO'; +NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID +insert into performance_schema.MUTEX_INSTANCES +set name='FOO', object_instance_begin=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +update performance_schema.MUTEX_INSTANCES +set name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +delete from performance_schema.MUTEX_INSTANCES +where name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +delete from performance_schema.MUTEX_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +LOCK TABLES performance_schema.MUTEX_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_performance_timers.result b/mysql-test/suite/perfschema/r/dml_performance_timers.result new file mode 100644 index 00000000000..99c1c74b797 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_performance_timers.result @@ -0,0 +1,29 @@ +select * from performance_schema.PERFORMANCE_TIMERS; +TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD +CYCLE <frequency> <resolution> <overhead> +NANOSECOND <frequency> <resolution> <overhead> +MICROSECOND <frequency> <resolution> <overhead> +MILLISECOND <frequency> <resolution> <overhead> +TICK <frequency> <resolution> <overhead> +select * from performance_schema.PERFORMANCE_TIMERS +where timer_name='CYCLE'; +TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD +CYCLE <frequency> <resolution> <overhead> +insert into performance_schema.PERFORMANCE_TIMERS +set timer_name='FOO', timer_frequency=1, +timer_resolution=2, timer_overhead=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +update performance_schema.PERFORMANCE_TIMERS +set timer_frequency=12 where timer_name='CYCLE'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +delete from performance_schema.PERFORMANCE_TIMERS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +delete from performance_schema.PERFORMANCE_TIMERS +where timer_name='CYCLE'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +UNLOCK TABLES; +LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_processlist.result b/mysql-test/suite/perfschema/r/dml_processlist.result new file mode 100644 index 00000000000..ee0da5a7f1d --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_processlist.result @@ -0,0 +1,27 @@ +select * from performance_schema.PROCESSLIST +where name like 'Thread/%' limit 1; +THREAD_ID ID NAME +# # # +select * from performance_schema.PROCESSLIST +where name='FOO'; +THREAD_ID ID NAME +insert into performance_schema.PROCESSLIST +set name='FOO', thread_id=1, id=2; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PROCESSLIST' +update performance_schema.PROCESSLIST +set thread_id=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +update performance_schema.PROCESSLIST +set thread_id=12 where name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +delete from performance_schema.PROCESSLIST +where id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +delete from performance_schema.PROCESSLIST; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +LOCK TABLES performance_schema.PROCESSLIST READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST' +UNLOCK TABLES; +LOCK TABLES performance_schema.PROCESSLIST WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result new file mode 100644 index 00000000000..62b5fbeaa8a --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.RWLOCK_INSTANCES limit 1; +NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT +# # NULL 0 +select * from performance_schema.RWLOCK_INSTANCES +where name='FOO'; +NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT +insert into performance_schema.RWLOCK_INSTANCES +set name='FOO', object_instance_begin=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +update performance_schema.RWLOCK_INSTANCES +set name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +delete from performance_schema.RWLOCK_INSTANCES +where name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +delete from performance_schema.RWLOCK_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +LOCK TABLES performance_schema.RWLOCK_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_consumers.result b/mysql-test/suite/perfschema/r/dml_setup_consumers.result new file mode 100644 index 00000000000..44ed751dcd2 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_consumers.result @@ -0,0 +1,45 @@ +select * from performance_schema.SETUP_CONSUMERS; +NAME ENABLED +events_waits_current YES +events_waits_history YES +events_waits_history_long YES +events_waits_summary_by_thread_by_event_name YES +events_waits_summary_by_event_name YES +events_waits_summary_by_instance YES +file_summary_by_event_name YES +file_summary_by_instance YES +select * from performance_schema.SETUP_CONSUMERS +where name='events_waits_current'; +NAME ENABLED +events_waits_current YES +select * from performance_schema.SETUP_CONSUMERS +where enabled='YES'; +NAME ENABLED +events_waits_current YES +events_waits_history YES +events_waits_history_long YES +events_waits_summary_by_thread_by_event_name YES +events_waits_summary_by_event_name YES +events_waits_summary_by_instance YES +file_summary_by_event_name YES +file_summary_by_instance YES +select * from performance_schema.SETUP_CONSUMERS +where enabled='NO'; +NAME ENABLED +insert into performance_schema.SETUP_CONSUMERS +set name='FOO', enabled='YES'; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' +update performance_schema.SETUP_CONSUMERS +set name='FOO'; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.SETUP_CONSUMERS +set enabled='YES'; +delete from performance_schema.SETUP_CONSUMERS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' +delete from performance_schema.SETUP_CONSUMERS +where name='events_waits_current'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' +LOCK TABLES performance_schema.SETUP_CONSUMERS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result new file mode 100644 index 00000000000..3a457578b3d --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -0,0 +1,72 @@ +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/Mutex/sql/%' + and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') +order by name limit 10; +NAME ENABLED TIMED +wait/synch/mutex/sql/Cversion_lock YES YES +wait/synch/mutex/sql/Delayed_insert::mutex YES YES +wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state YES YES +wait/synch/mutex/sql/hash_filo::lock YES YES +wait/synch/mutex/sql/LOCK_active_mi YES YES +wait/synch/mutex/sql/LOCK_connection_count YES YES +wait/synch/mutex/sql/LOCK_crypt YES YES +wait/synch/mutex/sql/LOCK_delayed_create YES YES +wait/synch/mutex/sql/LOCK_delayed_insert YES YES +wait/synch/mutex/sql/LOCK_delayed_status YES YES +select * from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/Rwlock/sql/%' + order by name limit 10; +NAME ENABLED TIMED +wait/synch/rwlock/sql/LOCK_dboptions YES YES +wait/synch/rwlock/sql/LOCK_grant YES YES +wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES +wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES +wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES +wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES +wait/synch/rwlock/sql/Query_cache_query::lock YES YES +wait/synch/rwlock/sql/THR_LOCK_servers YES YES +wait/synch/rwlock/sql/THR_LOCK_udf YES YES +select * from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/Cond/sql/%' + and name not in ( +'wait/synch/cond/sql/COND_handler_count', +'wait/synch/cond/sql/DEBUG_SYNC::cond') +order by name limit 10; +NAME ENABLED TIMED +wait/synch/cond/sql/COND_flush_thread_cache YES YES +wait/synch/cond/sql/COND_global_read_lock YES YES +wait/synch/cond/sql/COND_manager YES YES +wait/synch/cond/sql/COND_queue_state YES YES +wait/synch/cond/sql/COND_refresh YES YES +wait/synch/cond/sql/COND_rpl_status YES YES +wait/synch/cond/sql/COND_server_started YES YES +wait/synch/cond/sql/COND_thread_cache YES YES +wait/synch/cond/sql/COND_thread_count YES YES +wait/synch/cond/sql/Delayed_insert::cond YES YES +select * from performance_schema.SETUP_INSTRUMENTS +where name='Wait'; +select * from performance_schema.SETUP_INSTRUMENTS +where enabled='YES'; +insert into performance_schema.SETUP_INSTRUMENTS +set name='FOO', enabled='YES', timed='YES'; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +update performance_schema.SETUP_INSTRUMENTS +set name='FOO'; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.SETUP_INSTRUMENTS +set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS +set timed='NO'; +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS +set enabled='YES', timed='YES'; +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/%'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_objects.result b/mysql-test/suite/perfschema/r/dml_setup_objects.result new file mode 100644 index 00000000000..a9d97357227 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_objects.result @@ -0,0 +1,35 @@ +select * from performance_schema.SETUP_OBJECTS; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +select * from performance_schema.SETUP_OBJECTS +where object_type = 'TABLE'; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +select * from performance_schema.SETUP_OBJECTS +where enabled='YES'; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +insert into performance_schema.SETUP_OBJECTS +set object_type='TABLE', object_schema='FOO', object_name='BAR', +enabled='YES', timed='YES', aggregated='YES'; +ERROR HY000: Table storage engine for 'SETUP_OBJECTS' doesn't have this option +update performance_schema.SETUP_OBJECTS +set object_type='TABLE'; +update performance_schema.SETUP_OBJECTS +set object_schema='ILLEGAL'; +update performance_schema.SETUP_OBJECTS +set object_name='ILLEGAL'; +update performance_schema.SETUP_OBJECTS +set enabled='NO'; +update performance_schema.SETUP_OBJECTS +set timed='NO'; +update performance_schema.SETUP_OBJECTS +set aggregated='NO'; +select * from performance_schema.SETUP_OBJECTS; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +update performance_schema.SETUP_OBJECTS +set enabled='YES', timed='YES', aggregated='YES'; +delete from performance_schema.SETUP_OBJECTS +where object_type = 'TABLE'; +delete from performance_schema.SETUP_OBJECTS; +LOCK TABLES performance_schema.SETUP_OBJECTS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_OBJECTS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_timers.result b/mysql-test/suite/perfschema/r/dml_setup_timers.result new file mode 100644 index 00000000000..a9bee916cde --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_timers.result @@ -0,0 +1,33 @@ +select * from performance_schema.SETUP_TIMERS; +NAME TIMER_NAME +wait CYCLE +select * from performance_schema.SETUP_TIMERS +where name='Wait'; +NAME TIMER_NAME +wait CYCLE +select * from performance_schema.SETUP_TIMERS +where timer_name='CYCLE'; +NAME TIMER_NAME +wait CYCLE +insert into performance_schema.SETUP_TIMERS +set name='FOO', timer_name='CYCLE'; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' +update performance_schema.SETUP_TIMERS +set name='FOO'; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.SETUP_TIMERS +set timer_name='MILLISECOND'; +select * from performance_schema.SETUP_TIMERS; +NAME TIMER_NAME +wait MILLISECOND +update performance_schema.SETUP_TIMERS +set timer_name='CYCLE'; +delete from performance_schema.SETUP_TIMERS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' +delete from performance_schema.SETUP_TIMERS +where name='Wait'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' +LOCK TABLES performance_schema.SETUP_TIMERS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_TIMERS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result new file mode 100644 index 00000000000..69e6072fc22 --- /dev/null +++ b/mysql-test/suite/perfschema/r/func_file_io.result @@ -0,0 +1,117 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD')); +SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; +has_instrumentation +Success +SELECT * FROM t1 WHERE id < 4; +id b +1 initial value +2 initial value +3 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; +test_ff1_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO'; +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); +SELECT * FROM t1 WHERE id < 6; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; +test_ff2_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id > 4; +id b +5 initial value +6 initial value +7 initial value +8 initial value +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE TIMER_WAIT != NULL +OR TIMER_START != NULL +OR TIMER_END != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE TIMER_WAIT != NULL +OR TIMER_START != NULL +OR TIMER_END != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE TIMER_WAIT != NULL +OR TIMER_START != NULL +OR TIMER_END != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES'; +SELECT * FROM t1 WHERE id < 4; +id b +1 initial value +2 initial value +3 initial value +DROP TABLE t1; +SELECT SUM(COUNT_READ) AS sum_count_read, +SUM(COUNT_WRITE) AS sum_count_write, +SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, +SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; +SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +WHERE COUNT_STAR > 0 +ORDER BY SUM_TIMER_WAIT DESC +LIMIT 10; +SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT +# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user +ORDER BY SUM_WAIT DESC +LIMIT 20; +SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +WHERE p.ID = 1 +GROUP BY h.EVENT_NAME +HAVING TOTAL_WAIT > 0; +SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user, h.operation +HAVING BYTES > 0 +ORDER BY i.user, h.operation; diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result new file mode 100644 index 00000000000..e32d7267bb1 --- /dev/null +++ b/mysql-test/suite/perfschema/r/func_mutex.result @@ -0,0 +1,113 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; +test_fm1_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/mutex/sql/LOCK_open'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; +test_fm2_timed +Success +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; +test_fm1_rw_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; +test_fm2_rw_timed +Success +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/global_read_lock.result b/mysql-test/suite/perfschema/r/global_read_lock.result new file mode 100644 index 00000000000..93d6adfd049 --- /dev/null +++ b/mysql-test/suite/perfschema/r/global_read_lock.result @@ -0,0 +1,33 @@ +use performance_schema; +grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; +flush privileges; +connect (con1, localhost, pfsuser, , test); +lock tables performance_schema.SETUP_INSTRUMENTS read; +select * from performance_schema.SETUP_INSTRUMENTS; +unlock tables; +lock tables performance_schema.SETUP_INSTRUMENTS write; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; +connection default; +flush tables with read lock; +connection con1; +lock tables performance_schema.SETUP_INSTRUMENTS read; +select * from performance_schema.SETUP_INSTRUMENTS; +unlock tables; +lock tables performance_schema.SETUP_INSTRUMENTS write; +connection default; +select event_name, +left(source, locate(":", source)) as short_source, +timer_end, timer_wait, operation +from performance_schema.EVENTS_WAITS_CURRENT +where event_name like "wait/synch/cond/sql/COND_global_read_lock"; +event_name short_source timer_end timer_wait operation +wait/synch/cond/sql/COND_global_read_lock lock.cc: NULL NULL wait +unlock tables; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; +connection default; +drop user pfsuser@localhost; +flush privileges; diff --git a/mysql-test/suite/perfschema/r/information_schema.result b/mysql-test/suite/perfschema/r/information_schema.result new file mode 100644 index 00000000000..86ebe80768c --- /dev/null +++ b/mysql-test/suite/perfschema/r/information_schema.result @@ -0,0 +1,198 @@ +select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +TABLE_SCHEMA upper(TABLE_NAME) TABLE_CATALOG +performance_schema COND_INSTANCES def +performance_schema EVENTS_WAITS_CURRENT def +performance_schema EVENTS_WAITS_HISTORY def +performance_schema EVENTS_WAITS_HISTORY_LONG def +performance_schema EVENTS_WAITS_SUMMARY_BY_EVENT_NAME def +performance_schema EVENTS_WAITS_SUMMARY_BY_INSTANCE def +performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME def +performance_schema FILE_INSTANCES def +performance_schema FILE_SUMMARY_BY_EVENT_NAME def +performance_schema FILE_SUMMARY_BY_INSTANCE def +performance_schema MUTEX_INSTANCES def +performance_schema PERFORMANCE_TIMERS def +performance_schema PROCESSLIST def +performance_schema RWLOCK_INSTANCES def +performance_schema SETUP_CONSUMERS def +performance_schema SETUP_INSTRUMENTS def +performance_schema SETUP_OBJECTS def +performance_schema SETUP_TIMERS def +select upper(TABLE_NAME), TABLE_TYPE, ENGINE +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_TYPE ENGINE +COND_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_CURRENT BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_HISTORY BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_HISTORY_LONG BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA +FILE_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +FILE_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA +FILE_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA +MUTEX_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +PERFORMANCE_TIMERS BASE TABLE PERFORMANCE_SCHEMA +PROCESSLIST BASE TABLE PERFORMANCE_SCHEMA +RWLOCK_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +SETUP_CONSUMERS BASE TABLE PERFORMANCE_SCHEMA +SETUP_INSTRUMENTS BASE TABLE PERFORMANCE_SCHEMA +SETUP_OBJECTS BASE TABLE PERFORMANCE_SCHEMA +SETUP_TIMERS BASE TABLE PERFORMANCE_SCHEMA +select upper(TABLE_NAME), VERSION, ROW_FORMAT +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) VERSION ROW_FORMAT +COND_INSTANCES 10 Dynamic +EVENTS_WAITS_CURRENT 10 Dynamic +EVENTS_WAITS_HISTORY 10 Dynamic +EVENTS_WAITS_HISTORY_LONG 10 Dynamic +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 10 Dynamic +EVENTS_WAITS_SUMMARY_BY_INSTANCE 10 Dynamic +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 10 Dynamic +FILE_INSTANCES 10 Dynamic +FILE_SUMMARY_BY_EVENT_NAME 10 Dynamic +FILE_SUMMARY_BY_INSTANCE 10 Dynamic +MUTEX_INSTANCES 10 Dynamic +PERFORMANCE_TIMERS 10 Fixed +PROCESSLIST 10 Dynamic +RWLOCK_INSTANCES 10 Dynamic +SETUP_CONSUMERS 10 Dynamic +SETUP_INSTRUMENTS 10 Dynamic +SETUP_OBJECTS 10 Dynamic +SETUP_TIMERS 10 Dynamic +select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_ROWS AVG_ROW_LENGTH +COND_INSTANCES 1000 0 +EVENTS_WAITS_CURRENT 1000 0 +EVENTS_WAITS_HISTORY 1000 0 +EVENTS_WAITS_HISTORY_LONG 10000 0 +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 1000 0 +EVENTS_WAITS_SUMMARY_BY_INSTANCE 1000 0 +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 1000 0 +FILE_INSTANCES 1000 0 +FILE_SUMMARY_BY_EVENT_NAME 1000 0 +FILE_SUMMARY_BY_INSTANCE 1000 0 +MUTEX_INSTANCES 1000 0 +PERFORMANCE_TIMERS 5 0 +PROCESSLIST 1000 0 +RWLOCK_INSTANCES 1000 0 +SETUP_CONSUMERS 8 0 +SETUP_INSTRUMENTS 1000 0 +SETUP_OBJECTS 1000 0 +SETUP_TIMERS 1 0 +select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) DATA_LENGTH MAX_DATA_LENGTH +COND_INSTANCES 0 0 +EVENTS_WAITS_CURRENT 0 0 +EVENTS_WAITS_HISTORY 0 0 +EVENTS_WAITS_HISTORY_LONG 0 0 +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 0 0 +EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 +FILE_INSTANCES 0 0 +FILE_SUMMARY_BY_EVENT_NAME 0 0 +FILE_SUMMARY_BY_INSTANCE 0 0 +MUTEX_INSTANCES 0 0 +PERFORMANCE_TIMERS 0 0 +PROCESSLIST 0 0 +RWLOCK_INSTANCES 0 0 +SETUP_CONSUMERS 0 0 +SETUP_INSTRUMENTS 0 0 +SETUP_OBJECTS 0 0 +SETUP_TIMERS 0 0 +select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) INDEX_LENGTH DATA_FREE AUTO_INCREMENT +COND_INSTANCES 0 0 NULL +EVENTS_WAITS_CURRENT 0 0 NULL +EVENTS_WAITS_HISTORY 0 0 NULL +EVENTS_WAITS_HISTORY_LONG 0 0 NULL +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 0 0 NULL +EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 NULL +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 NULL +FILE_INSTANCES 0 0 NULL +FILE_SUMMARY_BY_EVENT_NAME 0 0 NULL +FILE_SUMMARY_BY_INSTANCE 0 0 NULL +MUTEX_INSTANCES 0 0 NULL +PERFORMANCE_TIMERS 0 0 NULL +PROCESSLIST 0 0 NULL +RWLOCK_INSTANCES 0 0 NULL +SETUP_CONSUMERS 0 0 NULL +SETUP_INSTRUMENTS 0 0 NULL +SETUP_OBJECTS 0 0 NULL +SETUP_TIMERS 0 0 NULL +select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) CREATE_TIME UPDATE_TIME CHECK_TIME +COND_INSTANCES NULL NULL NULL +EVENTS_WAITS_CURRENT NULL NULL NULL +EVENTS_WAITS_HISTORY NULL NULL NULL +EVENTS_WAITS_HISTORY_LONG NULL NULL NULL +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME NULL NULL NULL +EVENTS_WAITS_SUMMARY_BY_INSTANCE NULL NULL NULL +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME NULL NULL NULL +FILE_INSTANCES NULL NULL NULL +FILE_SUMMARY_BY_EVENT_NAME NULL NULL NULL +FILE_SUMMARY_BY_INSTANCE NULL NULL NULL +MUTEX_INSTANCES NULL NULL NULL +PERFORMANCE_TIMERS NULL NULL NULL +PROCESSLIST NULL NULL NULL +RWLOCK_INSTANCES NULL NULL NULL +SETUP_CONSUMERS NULL NULL NULL +SETUP_INSTRUMENTS NULL NULL NULL +SETUP_OBJECTS NULL NULL NULL +SETUP_TIMERS NULL NULL NULL +select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_COLLATION CHECKSUM +COND_INSTANCES utf8_general_ci NULL +EVENTS_WAITS_CURRENT utf8_general_ci NULL +EVENTS_WAITS_HISTORY utf8_general_ci NULL +EVENTS_WAITS_HISTORY_LONG utf8_general_ci NULL +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL +EVENTS_WAITS_SUMMARY_BY_INSTANCE utf8_general_ci NULL +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME utf8_general_ci NULL +FILE_INSTANCES utf8_general_ci NULL +FILE_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL +FILE_SUMMARY_BY_INSTANCE utf8_general_ci NULL +MUTEX_INSTANCES utf8_general_ci NULL +PERFORMANCE_TIMERS utf8_general_ci NULL +PROCESSLIST utf8_general_ci NULL +RWLOCK_INSTANCES utf8_general_ci NULL +SETUP_CONSUMERS utf8_general_ci NULL +SETUP_INSTRUMENTS utf8_general_ci NULL +SETUP_OBJECTS utf8_general_ci NULL +SETUP_TIMERS utf8_general_ci NULL +select upper(TABLE_NAME), TABLE_COMMENT +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_COMMENT +COND_INSTANCES +EVENTS_WAITS_CURRENT +EVENTS_WAITS_HISTORY +EVENTS_WAITS_HISTORY_LONG +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +EVENTS_WAITS_SUMMARY_BY_INSTANCE +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +FILE_INSTANCES +FILE_SUMMARY_BY_EVENT_NAME +FILE_SUMMARY_BY_INSTANCE +MUTEX_INSTANCES +PERFORMANCE_TIMERS +PROCESSLIST +RWLOCK_INSTANCES +SETUP_CONSUMERS +SETUP_INSTRUMENTS +SETUP_OBJECTS +SETUP_TIMERS diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result new file mode 100644 index 00000000000..d944b4b1d3d --- /dev/null +++ b/mysql-test/suite/perfschema/r/misc.result @@ -0,0 +1,13 @@ +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN +(SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN +(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS +WHERE NAME LIKE "wait/synch/%") +LIMIT 1; +create table test.t1(a int) engine=performance_schema; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table performance_schema.t1(a int); +ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1' diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result new file mode 100644 index 00000000000..66c37c7d6d8 --- /dev/null +++ b/mysql-test/suite/perfschema/r/myisam_file_io.result @@ -0,0 +1,59 @@ +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/io/file/myisam/%"; +update performance_schema.SETUP_CONSUMERS +set enabled='YES'; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +drop table if exists test.no_index_tab; +create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; +select event_name, +left(source, locate(":", source)) as short_source, +operation, number_of_bytes, +substring(object_name, locate("no_index_tab", object_name)) as short_name +from performance_schema.EVENTS_WAITS_HISTORY_LONG +where operation not like "tell" + order by thread_id, event_id; +event_name short_source operation number_of_bytes short_name +wait/io/file/myisam/kfile mi_create.c: create NULL no_index_tab.MYI +wait/io/file/myisam/dfile mi_create.c: create NULL no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 176 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 100 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI +wait/io/file/myisam/kfile mi_create.c: chsize 1024 no_index_tab.MYI +wait/io/file/myisam/dfile mi_create.c: close NULL no_index_tab.MYD +wait/io/file/myisam/kfile mi_create.c: close NULL no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: open NULL no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: read 24 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: seek NULL no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: read 297 no_index_tab.MYI +wait/io/file/myisam/dfile mi_open.c: open NULL no_index_tab.MYD +wait/io/file/myisam/kfile mi_locking.c: write 3 no_index_tab.MYI +wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI +wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI +wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI +show status like 'performance_schema_%'; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +drop table test.no_index_tab; diff --git a/mysql-test/suite/perfschema/r/no_threads.result b/mysql-test/suite/perfschema/r/no_threads.result new file mode 100644 index 00000000000..b38dc9fd733 --- /dev/null +++ b/mysql-test/suite/perfschema/r/no_threads.result @@ -0,0 +1,43 @@ +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_CONSUMERS set enabled='YES'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; +drop table if exists test.t1; +truncate table performance_schema.EVENTS_WAITS_CURRENT; +truncate table performance_schema.EVENTS_WAITS_HISTORY; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +show variables like "thread_handling"; +Variable_name Value +thread_handling no-threads +create table test.t1(a int) engine=MYISAM; +show variables like "performance_schema"; +Variable_name Value +performance_schema ON +show variables like "performance_schema_max_thread%"; +Variable_name Value +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 10 +select count(*) from performance_schema.PROCESSLIST +where name like "thread/sql/main"; +count(*) +1 +select count(*) from performance_schema.PROCESSLIST +where name like "thread/sql/OneConnection"; +count(*) +0 +select event_name, operation, +left(source, locate(":", source)) as short_source +from performance_schema.EVENTS_WAITS_CURRENT; +event_name operation short_source +wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: +select event_name, operation, +left(source, locate(":", source)) as short_source +from performance_schema.EVENTS_WAITS_HISTORY; +event_name operation short_source +wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: +select event_name, operation, +left(source, locate(":", source)) as short_source +from performance_schema.EVENTS_WAITS_HISTORY_LONG; +event_name operation short_source +wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: +drop table test.t1; diff --git a/mysql-test/suite/perfschema/r/one_thread_per_con.result b/mysql-test/suite/perfschema/r/one_thread_per_con.result new file mode 100644 index 00000000000..9677a09933a --- /dev/null +++ b/mysql-test/suite/perfschema/r/one_thread_per_con.result @@ -0,0 +1,38 @@ +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; +drop table if exists test.t1; +drop table if exists test.t2; +drop table if exists test.t3; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +show variables like "thread_handling"; +Variable_name Value +thread_handling one-thread-per-connection +"----------------- Connection 1" +create table test.t1(a int) engine=MYISAM; +"----------------- Connection 2" +create table test.t2(a int) engine=MYISAM; +"----------------- Connection 3" +create table test.t3(a int) engine=MYISAM; +"----------------- Connection default" +execute stmt_dump_events using @tid; +event_name short_source operation number_of_bytes +wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL +execute stmt_dump_thread using @tid; +name +thread/sql/one_connection +execute stmt_dump_events using @tid; +event_name short_source operation number_of_bytes +wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL +execute stmt_dump_thread using @tid; +name +thread/sql/one_connection +execute stmt_dump_events using @tid; +event_name short_source operation number_of_bytes +wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL +execute stmt_dump_thread using @tid; +name +thread/sql/one_connection +drop table test.t1; +drop table test.t2; +drop table test.t3; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result new file mode 100644 index 00000000000..ddbc150a72a --- /dev/null +++ b/mysql-test/suite/perfschema/r/privilege.result @@ -0,0 +1,577 @@ +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; +grant ALL on performance_schema.* to 'pfs_user_2'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.* to 'pfs_user_2'@localhost; +grant DROP on performance_schema.* to 'pfs_user_2'@localhost; +grant REFERENCES on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE TEMPORARY TABLES on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant EXECUTE on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant EVENT on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SELECT on performance_schema.* to 'pfs_user_2'@localhost; +grant INSERT on performance_schema.* to 'pfs_user_2'@localhost; +grant UPDATE on performance_schema.* to 'pfs_user_2'@localhost; +grant DELETE on performance_schema.* to 'pfs_user_2'@localhost; +grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost; +grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +with GRANT OPTION; +grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +with GRANT OPTION; +grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +with GRANT OPTION; +grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +with GRANT OPTION; +grant LOCK TABLES on performance_schema.* to 'pfs_user_3'@localhost +with GRANT OPTION; +flush privileges; +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +revoke all privileges, grant option from 'pfs_user_1'@localhost; +revoke all privileges, grant option from 'pfs_user_2'@localhost; +revoke all privileges, grant option from 'pfs_user_3'@localhost; +drop user 'pfs_user_1'@localhost; +drop user 'pfs_user_2'@localhost; +drop user 'pfs_user_3'@localhost; +flush privileges; +# Test cases from WL#4818 +# Setup user +CREATE user pfs_user_4; +# +# WL#4818, NFS4: Normal user does not have access to view data +# without grants +# +# Select as pfs_user_4 should fail without grant +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY' +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT' +SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +# +# WL#4818, NFS3: Normal user does not have access to change what is +# instrumented without grants +# +# User pfs_user_4 should not be allowed to tweak instrumentation without +# explicit grant +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS' +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS' +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_CONSUMERS' +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_TIMERS' +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY' +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT' +# +# WL#4814, NFS1: Can use grants to give normal user access +# to turn on and off instrumentation +# +# Grant access to change tables with the root account +GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4; +GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4; +GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4; +# User pfs_user_4 should now be allowed to tweak instrumentation +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +# Clean up +REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; +DROP USER pfs_user_4; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result new file mode 100644 index 00000000000..06862009493 --- /dev/null +++ b/mysql-test/suite/perfschema/r/query_cache.result @@ -0,0 +1,66 @@ +drop table if exists t1; +create table t1 (a int not null); +insert into t1 values (1), (2), (3); +SET GLOBAL query_cache_size=1355776; +flush query cache; +reset query cache; +select * from t1; +a +1 +2 +3 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 0 +select * from t1; +a +1 +2 +3 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +spins +NULL +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +name +wait/io/file/csv/data +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +spins +NULL +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +name +wait/io/file/csv/data +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +SET GLOBAL query_cache_size= default; +drop table t1; diff --git a/mysql-test/suite/perfschema/r/read_only.result b/mysql-test/suite/perfschema/r/read_only.result new file mode 100644 index 00000000000..6a30eb4ab8b --- /dev/null +++ b/mysql-test/suite/perfschema/r/read_only.result @@ -0,0 +1,49 @@ +use performance_schema; +set @start_read_only= @@global.read_only; +grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; +flush privileges; +connect (con1, localhost, pfsuser, , test); +connection default; +set global read_only=0; +connection con1; +select @@global.read_only; +@@global.read_only +0 +show grants; +Grants for pfsuser@localhost +GRANT USAGE ON *.* TO 'pfsuser'@'localhost' +GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +connection default; +set global read_only=1; +connection con1; +select @@global.read_only; +@@global.read_only +1 +show grants; +Grants for pfsuser@localhost +GRANT USAGE ON *.* TO 'pfsuser'@'localhost' +GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +connection default; +grant super on *.* to pfsuser@localhost; +flush privileges; +connect (con1, localhost, pfsuser, , test); +select @@global.read_only; +@@global.read_only +1 +show grants; +Grants for pfsuser@localhost +GRANT SUPER ON *.* TO 'pfsuser'@'localhost' +GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +connection default; +set global read_only= @start_read_only; +drop user pfsuser@localhost; +flush privileges; diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result new file mode 100644 index 00000000000..d402df70ed5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/schema.result @@ -0,0 +1,211 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +use performance_schema; +show tables; +Tables_in_performance_schema +COND_INSTANCES +EVENTS_WAITS_CURRENT +EVENTS_WAITS_HISTORY +EVENTS_WAITS_HISTORY_LONG +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +EVENTS_WAITS_SUMMARY_BY_INSTANCE +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +FILE_INSTANCES +FILE_SUMMARY_BY_EVENT_NAME +FILE_SUMMARY_BY_INSTANCE +MUTEX_INSTANCES +PERFORMANCE_TIMERS +PROCESSLIST +RWLOCK_INSTANCES +SETUP_CONSUMERS +SETUP_INSTRUMENTS +SETUP_OBJECTS +SETUP_TIMERS +show create table COND_INSTANCES; +Table Create Table +COND_INSTANCES CREATE TABLE `COND_INSTANCES` ( + `NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_CURRENT; +Table Create Table +EVENTS_WAITS_CURRENT CREATE TABLE `EVENTS_WAITS_CURRENT` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_ID` bigint(20) unsigned NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `SOURCE` varchar(64) DEFAULT NULL, + `TIMER_START` bigint(20) unsigned DEFAULT NULL, + `TIMER_END` bigint(20) unsigned DEFAULT NULL, + `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, + `SPINS` int(10) unsigned DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(512) DEFAULT NULL, + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, + `OPERATION` varchar(16) NOT NULL, + `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, + `FLAGS` int(10) unsigned DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_HISTORY; +Table Create Table +EVENTS_WAITS_HISTORY CREATE TABLE `EVENTS_WAITS_HISTORY` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_ID` bigint(20) unsigned NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `SOURCE` varchar(64) DEFAULT NULL, + `TIMER_START` bigint(20) unsigned DEFAULT NULL, + `TIMER_END` bigint(20) unsigned DEFAULT NULL, + `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, + `SPINS` int(10) unsigned DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(512) DEFAULT NULL, + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, + `OPERATION` varchar(16) NOT NULL, + `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, + `FLAGS` int(10) unsigned DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_HISTORY_LONG; +Table Create Table +EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_ID` bigint(20) unsigned NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `SOURCE` varchar(64) DEFAULT NULL, + `TIMER_START` bigint(20) unsigned DEFAULT NULL, + `TIMER_END` bigint(20) unsigned DEFAULT NULL, + `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, + `SPINS` int(10) unsigned DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(512) DEFAULT NULL, + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, + `OPERATION` varchar(16) NOT NULL, + `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, + `FLAGS` int(10) unsigned DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +Table Create Table +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_EVENT_NAME` ( + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_STAR` bigint(20) unsigned NOT NULL, + `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE; +Table Create Table +EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` ( + `EVENT_NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `COUNT_STAR` bigint(20) unsigned NOT NULL, + `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +Table Create Table +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_STAR` bigint(20) unsigned NOT NULL, + `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table FILE_INSTANCES; +Table Create Table +FILE_INSTANCES CREATE TABLE `FILE_INSTANCES` ( + `FILE_NAME` varchar(512) NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `OPEN_COUNT` int(10) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table FILE_SUMMARY_BY_EVENT_NAME; +Table Create Table +FILE_SUMMARY_BY_EVENT_NAME CREATE TABLE `FILE_SUMMARY_BY_EVENT_NAME` ( + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_READ` bigint(20) unsigned NOT NULL, + `COUNT_WRITE` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table FILE_SUMMARY_BY_INSTANCE; +Table Create Table +FILE_SUMMARY_BY_INSTANCE CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` ( + `FILE_NAME` varchar(512) NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_READ` bigint(20) unsigned NOT NULL, + `COUNT_WRITE` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table MUTEX_INSTANCES; +Table Create Table +MUTEX_INSTANCES CREATE TABLE `MUTEX_INSTANCES` ( + `NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table PERFORMANCE_TIMERS; +Table Create Table +PERFORMANCE_TIMERS CREATE TABLE `PERFORMANCE_TIMERS` ( + `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL, + `TIMER_FREQUENCY` bigint(20) DEFAULT NULL, + `TIMER_RESOLUTION` bigint(20) DEFAULT NULL, + `TIMER_OVERHEAD` bigint(20) DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table PROCESSLIST; +Table Create Table +PROCESSLIST CREATE TABLE `PROCESSLIST` ( + `THREAD_ID` int(11) NOT NULL, + `ID` int(11) NOT NULL, + `NAME` varchar(64) NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table RWLOCK_INSTANCES; +Table Create Table +RWLOCK_INSTANCES CREATE TABLE `RWLOCK_INSTANCES` ( + `NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL, + `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_CONSUMERS; +Table Create Table +SETUP_CONSUMERS CREATE TABLE `SETUP_CONSUMERS` ( + `NAME` varchar(64) NOT NULL, + `ENABLED` enum('YES','NO') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_INSTRUMENTS; +Table Create Table +SETUP_INSTRUMENTS CREATE TABLE `SETUP_INSTRUMENTS` ( + `NAME` varchar(128) NOT NULL, + `ENABLED` enum('YES','NO') NOT NULL, + `TIMED` enum('YES','NO') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_OBJECTS; +Table Create Table +SETUP_OBJECTS CREATE TABLE `SETUP_OBJECTS` ( + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(64) DEFAULT NULL, + `ENABLED` enum('YES','NO') NOT NULL, + `TIMED` enum('YES','NO') NOT NULL, + `AGGREGATED` enum('YES','NO') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_TIMERS; +Table Create Table +SETUP_TIMERS CREATE TABLE `SETUP_TIMERS` ( + `NAME` varchar(64) NOT NULL, + `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result new file mode 100644 index 00000000000..b5bef207303 --- /dev/null +++ b/mysql-test/suite/perfschema/r/selects.result @@ -0,0 +1,97 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); +SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +GROUP BY OPERATION +HAVING TOTAL IS NOT NULL +ORDER BY OPERATION +LIMIT 1; +OPERATION TOTAL +chsize [NUM_BYTES] +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN +(SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN +(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS +WHERE NAME LIKE "wait/synch/%") +LIMIT 1; +EVENT_ID +[EVENT_ID] +SELECT DISTINCT EVENT_ID +FROM performance_schema.EVENTS_WAITS_CURRENT +JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID) +ORDER BY EVENT_ID +LIMIT 1; +EVENT_ID +[EVENT_ID] +SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY t1 +JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) +ORDER BY t1.EVENT_ID, t2.EVENT_ID +LIMIT 5; +THREAD_ID EVENT_ID EVENT_NAME TIMER_WAIT +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +SELECT THREAD_ID, EVENT_ID FROM ( +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +) t1 ORDER BY THREAD_ID, EVENT_ID +LIMIT 5; +THREAD_ID EVENT_ID +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +CREATE EVENT t_ps_event +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND +DO SELECT DISTINCT EVENT_ID +FROM performance_schema.EVENTS_WAITS_CURRENT +JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +ORDER BY EVENT_ID +LIMIT 1; +ALTER TABLE t1 ADD COLUMN c INT; +CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 +FOR EACH ROW BEGIN +SET NEW.c = (SELECT MAX(EVENT_ID) +FROM performance_schema.EVENTS_WAITS_CURRENT); +END; +| +INSERT INTO t1 (id) VALUES (11), (12), (13); +SELECT id, c FROM t1 WHERE id > 10 ORDER BY c; +id c +11 [EVENT_ID] +12 [EVENT_ID] +13 [EVENT_ID] +DROP TRIGGER t_ps_trigger; +CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) +BEGIN +SELECT id FROM performance_schema.PROCESSLIST +WHERE THREAD_ID = tid INTO pid; +END; +| +CALL t_ps_proc(0, @p_id); +CREATE FUNCTION t_ps_func(tid INT) RETURNS int +BEGIN +return (SELECT id FROM performance_schema.PROCESSLIST +WHERE THREAD_ID = tid); +END; +| +SELECT t_ps_func(0) = @p_id; +t_ps_func(0) = @p_id +1 +DROP PROCEDURE t_ps_proc; +DROP FUNCTION t_ps_func; +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result new file mode 100644 index 00000000000..ac340f8eb67 --- /dev/null +++ b/mysql-test/suite/perfschema/r/server_init.result @@ -0,0 +1,233 @@ +use performance_schema; +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_threads"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_malloc"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_open"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_isam"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_net"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_charset"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_time"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/mysys/THR_COND_threads"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_mysql_create_db"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_open"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_lock_db"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_thread_count"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_mapped_file"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_status"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_error_log"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_delayed_status"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_delayed_create"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_crypt"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_slave_list"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_active_mi"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_manager"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_global_read_lock"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_global_system_variables"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_user_conn"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_connection_count"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_server_started"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_rpl_status"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOG_INFO::lock"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_event_metadata"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_event_queue"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_user_locks"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/Cversion_lock"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_xid_cache"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_plugin"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_gdl"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/tz_LOCK"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_grant"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_server_started"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_refresh"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_thread_count"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_manager"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_global_read_lock"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_thread_cache"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_flush_thread_cache"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_rpl_status"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_queue_state"; +count(name) +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result new file mode 100644 index 00000000000..d6089139d5a --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 0 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_cond_classes"; +Variable_name Value +performance_schema_max_cond_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/cond/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.COND_INSTANCES; +count(*) +0 +show status like "performance_schema_cond_instances_lost"; +Variable_name Value +Performance_schema_cond_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result new file mode 100644 index 00000000000..eaa04c7629d --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 0 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_cond_classes"; +Variable_name Value +performance_schema_max_cond_classes 80 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/cond/%"; +count(*) > 0 +1 +show status like "performance_schema_cond_classes_lost"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +show variables like "performance_schema_max_cond_instances"; +Variable_name Value +performance_schema_max_cond_instances 0 +select count(*) from performance_schema.COND_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_COND_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result new file mode 100644 index 00000000000..d68ec00a456 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 0 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_file_classes"; +Variable_name Value +performance_schema_max_file_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/io/file/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.FILE_INSTANCES; +count(*) +0 +show status like "performance_schema_file_instances_lost"; +Variable_name Value +Performance_schema_file_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result new file mode 100644 index 00000000000..258712ebf68 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 0 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_file_classes"; +Variable_name Value +performance_schema_max_file_classes 50 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/io/file/%"; +count(*) > 0 +1 +show status like "performance_schema_file_classes_lost"; +Variable_name Value +Performance_schema_file_classes_lost 0 +show variables like "performance_schema_max_file_instances"; +Variable_name Value +performance_schema_max_file_instances 0 +select count(*) from performance_schema.FILE_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_FILE_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result new file mode 100644 index 00000000000..d221cb2c22a --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 0 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_mutex_classes"; +Variable_name Value +performance_schema_max_mutex_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/mutex/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.MUTEX_INSTANCES; +count(*) +0 +show status like "performance_schema_mutex_instances_lost"; +Variable_name Value +Performance_schema_mutex_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result new file mode 100644 index 00000000000..adfd4c5ec17 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 0 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_mutex_classes"; +Variable_name Value +performance_schema_max_mutex_classes 200 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/mutex/%"; +count(*) > 0 +1 +show status like "performance_schema_mutex_classes_lost"; +Variable_name Value +Performance_schema_mutex_classes_lost 0 +show variables like "performance_schema_max_mutex_instances"; +Variable_name Value +performance_schema_max_mutex_instances 0 +select count(*) from performance_schema.MUTEX_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result new file mode 100644 index 00000000000..5248becf0e5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 0 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_rwlock_classes"; +Variable_name Value +performance_schema_max_rwlock_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.RWLOCK_INSTANCES; +count(*) +0 +show status like "performance_schema_rwlock_instances_lost"; +Variable_name Value +Performance_schema_rwlock_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result new file mode 100644 index 00000000000..e7a94c4a60d --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 0 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_rwlock_classes"; +Variable_name Value +performance_schema_max_rwlock_classes 20 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +count(*) > 0 +1 +show status like "performance_schema_rwlock_classes_lost"; +Variable_name Value +Performance_schema_rwlock_classes_lost 0 +show variables like "performance_schema_max_rwlock_instances"; +Variable_name Value +performance_schema_max_rwlock_instances 0 +select count(*) from performance_schema.RWLOCK_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result new file mode 100644 index 00000000000..92f1ec29b38 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 0 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_thread_classes"; +Variable_name Value +performance_schema_max_thread_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "thread/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.PROCESSLIST; +count(*) +0 +show status like "performance_schema_thread_instances_lost"; +Variable_name Value +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result new file mode 100644 index 00000000000..3ecf7fe98db --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -0,0 +1,73 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 0 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_thread_classes"; +Variable_name Value +performance_schema_max_thread_classes 50 +show status like "performance_schema_thread_classes_lost"; +Variable_name Value +Performance_schema_thread_classes_lost 0 +show variables like "performance_schema_max_thread_instances"; +Variable_name Value +performance_schema_max_thread_instances 0 +select count(*) from performance_schema.PROCESSLIST; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_THREAD_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result new file mode 100644 index 00000000000..4ce5aa75ce7 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -0,0 +1,73 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +0 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema OFF +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show status like "performance_schema%"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result new file mode 100644 index 00000000000..1d9dc731c7b --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -0,0 +1,73 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show status like "performance_schema%"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result new file mode 100644 index 00000000000..cdf0029eeb9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result @@ -0,0 +1,6 @@ +call mtr.add_suppression( +"Column count of mysql.SETUP_INSTRUMENTS is wrong. " +"Expected 4, found 3. The table is probably corrupted"); +select * from performance_schema.SETUP_INSTRUMENTS limit 1; +ERROR HY000: Native table 'performance_schema'.'SETUP_INSTRUMENTS' has the wrong structure +select * from performance_schema.SETUP_CONSUMERS limit 1; diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test new file mode 100644 index 00000000000..7c01bdd0a4b --- /dev/null +++ b/mysql-test/suite/perfschema/t/aggregate.test @@ -0,0 +1,187 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Verify that statistics aggregated by different criteria are consistent. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--echo "General cleanup" + +--disable_warnings +drop table if exists t1; +--enable_warnings + +update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO'; +update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; + +# Cleanup statistics +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; + +# Start recording data +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS + set enabled = 'YES', timed = 'YES'; + + +create table t1 ( + id INT PRIMARY KEY, + b CHAR(100) DEFAULT 'initial value') + ENGINE=MyISAM; + +insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); + +# Stop recording data, so the select below don't add noise. +update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; + +# Helper to debug +set @dump_all=FALSE; + +# Note that in general: +# - COUNT/SUM/MAX(FILE_SUMMARY_BY_EVENT_NAME) >= +# COUNT/SUM/MAX(FILE_SUMMARY_BY_INSTANCE). +# - MIN(FILE_SUMMARY_BY_EVENT_NAME) <= +# MIN(FILE_SUMMARY_BY_INSTANCE). +# There will be equality only when file instances are not removed, +# aka when a file is not deleted from the file system, +# because doing so removes a row in FILE_SUMMARY_BY_INSTANCE. + +# Likewise: +# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >= +# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE) +# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <= +# MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE) +# There will be equality only when an instrument instance +# is not removed, which is next to impossible to predictably guarantee +# in the server. +# For example, a MyISAM table removed from the table cache +# will cause a mysql_mutex_destroy on myisam/MYISAM_SHARE::intern_lock. +# Another example, a thread terminating will cause a mysql_mutex_destroy +# on sql/LOCK_delete +# Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE. + +# Likewise: +# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >= +# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME) +# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <= +# MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME) +# There will be equality only when no thread is removed, +# that is if no thread disconnects, or no sub thread (for example insert +# delayed) ever completes. +# A thread completing will cause rows in +# EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME to be removed. + +--echo "Verifying file aggregate consistency" + +# Since the code generating the load in this test does: +# - create table +# - insert +# - does not cause temporary tables to be used +# we can test for equality here for file aggregates. + +# If any of these queries returns data, the test failed. + +SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) +OR @dump_all; + +SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) +OR @dump_all; + +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) +OR @dump_all; + +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) +OR @dump_all; + +--echo "Verifying waits aggregate consistency (instance)" + +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT)) +OR @dump_all; + +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT)) +AND (MIN(i.MIN_TIMER_WAIT) != 0) +OR @dump_all; + +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT)) +OR @dump_all; + +--echo "Verifying waits aggregate consistency (thread)" + +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT)) +OR @dump_all; + +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT)) +AND (MIN(t.MIN_TIMER_WAIT) != 0) +OR @dump_all; + +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT)) +OR @dump_all; + + +# Cleanup + +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS + set enabled = 'YES', timed = 'YES'; + +drop table test.t1; diff --git a/mysql-test/suite/perfschema/t/bad_option_1.test b/mysql-test/suite/perfschema/t/bad_option_1.test new file mode 100644 index 00000000000..9962f327093 --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_1.test @@ -0,0 +1,45 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Check error handling for invalid server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--error 7 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-enabled=maybe > $MYSQLTEST_VARDIR/tmp/bad_option_1.txt 2>&1 + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_1.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("unknown variable 'performance-schema-enabled=maybe'", + "Aborting"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF + diff --git a/mysql-test/suite/perfschema/t/bad_option_2.test b/mysql-test/suite/perfschema/t/bad_option_2.test new file mode 100644 index 00000000000..a8d15764864 --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_2.test @@ -0,0 +1,44 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Check error handling for ambiguous server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--error 3 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-max_=12 > $MYSQLTEST_VARDIR/tmp/bad_option_2.txt 2>&1 + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_2.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("ambiguous option '--performance-schema-max_=12'"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF + diff --git a/mysql-test/suite/perfschema/t/binlog_mix.test b/mysql-test/suite/perfschema/t/binlog_mix.test new file mode 100644 index 00000000000..4fe7d68b555 --- /dev/null +++ b/mysql-test/suite/perfschema/t/binlog_mix.test @@ -0,0 +1,28 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/have_log_bin.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# See Bug#46896 binlog: case sensitivity of table names +--source include/have_lowercase0.inc + +set binlog_format=mixed; + +--source ../include/binlog_common.inc + diff --git a/mysql-test/suite/perfschema/t/binlog_row.test b/mysql-test/suite/perfschema/t/binlog_row.test new file mode 100644 index 00000000000..c1c1e06d3f0 --- /dev/null +++ b/mysql-test/suite/perfschema/t/binlog_row.test @@ -0,0 +1,28 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/have_log_bin.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# See Bug#46896 binlog: case sensitivity of table names +--source include/have_lowercase0.inc + +set binlog_format=row; + +--source ../include/binlog_common.inc + diff --git a/mysql-test/suite/perfschema/t/binlog_stmt.test b/mysql-test/suite/perfschema/t/binlog_stmt.test new file mode 100644 index 00000000000..759c34634c8 --- /dev/null +++ b/mysql-test/suite/perfschema/t/binlog_stmt.test @@ -0,0 +1,25 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/have_log_bin.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +set binlog_format=statement; + +--source ../include/binlog_common.inc + diff --git a/mysql-test/suite/perfschema/t/cnf_option.cnf b/mysql-test/suite/perfschema/t/cnf_option.cnf new file mode 100644 index 00000000000..2892908fbb6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/cnf_option.cnf @@ -0,0 +1,25 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Check server start options, read from a .cnf file + +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +loose-performance-schema-max-thread_instances=318 +loose-performance-schema-max-thread_classes=12 + diff --git a/mysql-test/suite/perfschema/t/cnf_option.test b/mysql-test/suite/perfschema/t/cnf_option.test new file mode 100644 index 00000000000..c968307ee00 --- /dev/null +++ b/mysql-test/suite/perfschema/t/cnf_option.test @@ -0,0 +1,24 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Check server start options, read from a .cnf file + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +show variables like 'performance_schema_max_thread_classes'; +show variables like 'performance_schema_max_thread_instances'; + diff --git a/mysql-test/suite/perfschema/t/column_privilege.test b/mysql-test/suite/perfschema/t/column_privilege.test new file mode 100644 index 00000000000..b6bcbdb3396 --- /dev/null +++ b/mysql-test/suite/perfschema/t/column_privilege.test @@ -0,0 +1,82 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Test how columns privileges can be used on performance schema tables, +# for very fine control. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +show grants; + +grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; + +# Test per column privileges on performance_schema + +grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT + to 'pfs_user_5'@localhost; + +grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS + to 'pfs_user_5'@localhost; + +flush privileges; + +connect (con1, localhost, pfs_user_5, , ); + +# Commented because the result is not consistent (uppercase/lowercase) +# show grants; + +# For statements that works, we do not look at the output +--disable_result_log + +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; + +select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT; + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; + +--enable_result_log + +# For statements that are denied, check the error number and error text. + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_COLUMNACCESS_DENIED_ERROR +select event_name from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_COLUMNACCESS_DENIED_ERROR +select thread_id, event_id, event_name + from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_COLUMNACCESS_DENIED_ERROR +update performance_schema.SETUP_INSTRUMENTS set name='illegal'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_COLUMNACCESS_DENIED_ERROR +update performance_schema.SETUP_INSTRUMENTS set timed='NO'; + +# Cleanup + +--connection default +--disconnect con1 +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost; +DROP USER 'pfs_user_5'@localhost; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; + diff --git a/mysql-test/suite/perfschema/t/ddl_cond_instances.test b/mysql-test/suite/perfschema/t/ddl_cond_instances.test new file mode 100644 index 00000000000..e78429cb181 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_cond_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.COND_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.COND_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_current.test b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test new file mode 100644 index 00000000000..34f735c1271 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_CURRENT; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test new file mode 100644 index 00000000000..76ebe3d85c4 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_HISTORY; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test new file mode 100644 index 00000000000..549c5d6880b --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test new file mode 100644 index 00000000000..fbf2d2925a7 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test new file mode 100644 index 00000000000..e6dad07fd63 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test new file mode 100644 index 00000000000..5b65ec26064 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index + ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_file_instances.test b/mysql-test/suite/perfschema/t/ddl_file_instances.test new file mode 100644 index 00000000000..a9c9a2a95b6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_file_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.FILE_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.FILE_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test new file mode 100644 index 00000000000..2581f07c0d2 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer; + +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test new file mode 100644 index 00000000000..e06ad2eb7cd --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer; + +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_mutex_instances.test b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test new file mode 100644 index 00000000000..6489a689620 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.MUTEX_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.MUTEX_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_performance_timers.test b/mysql-test/suite/perfschema/t/ddl_performance_timers.test new file mode 100644 index 00000000000..b692291b8cf --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_performance_timers.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.PERFORMANCE_TIMERS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.PERFORMANCE_TIMERS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_processlist.test b/mysql-test/suite/perfschema/t/ddl_processlist.test new file mode 100644 index 00000000000..fb133b66e26 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_processlist.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.PROCESSLIST add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.PROCESSLIST; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test new file mode 100644 index 00000000000..c07cd1ede48 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.RWLOCK_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.RWLOCK_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_consumers.test b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test new file mode 100644 index 00000000000..c44db822145 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_CONSUMERS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.SETUP_CONSUMERS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_instruments.test b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test new file mode 100644 index 00000000000..c20c386447c --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_INSTRUMENTS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.SETUP_INSTRUMENTS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_objects.test b/mysql-test/suite/perfschema/t/ddl_setup_objects.test new file mode 100644 index 00000000000..6ae6156ef00 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_objects.test @@ -0,0 +1,32 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_objects' '\'SETUP_OBJECTS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_OBJECTS add column foo integer; + +truncate table performance_schema.SETUP_OBJECTS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_timers.test b/mysql-test/suite/perfschema/t/ddl_setup_timers.test new file mode 100644 index 00000000000..b9a5c32ecbe --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_timers.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_TIMERS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.SETUP_TIMERS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME); + diff --git a/mysql-test/suite/perfschema/t/disabled.def b/mysql-test/suite/perfschema/t/disabled.def new file mode 100644 index 00000000000..56bcf811ff6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/disabled.def @@ -0,0 +1,27 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + diff --git a/mysql-test/suite/perfschema/t/dml_cond_instances.test b/mysql-test/suite/perfschema/t/dml_cond_instances.test new file mode 100644 index 00000000000..1d1614db73f --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_cond_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # +select * from performance_schema.COND_INSTANCES limit 1; + +select * from performance_schema.COND_INSTANCES + where name='FOO'; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.COND_INSTANCES + set name='FOO', object_instance_begin=12; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.COND_INSTANCES + set name='FOO'; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.COND_INSTANCES + where name like "wait/%"; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.COND_INSTANCES; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.COND_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.COND_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_current.test b/mysql-test/suite/perfschema/t/dml_events_waits_current.test new file mode 100644 index 00000000000..3a93b98cb57 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_events_waits_current.test @@ -0,0 +1,62 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_CURRENT + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_CURRENT + where event_name='FOO'; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_CURRENT + set thread_id='1', event_id=1, + event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_CURRENT + set timer_start=12; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_CURRENT + set timer_start=12 where thread_id=0; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_CURRENT + where thread_id=1; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history.test b/mysql-test/suite/perfschema/t/dml_events_waits_history.test new file mode 100644 index 00000000000..174ef2147d1 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_events_waits_history.test @@ -0,0 +1,70 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name='FOO'; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name like 'Wait/Synch/%' order by timer_wait limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_HISTORY + set thread_id='1', event_id=1, + event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY + set timer_start=12; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY + set timer_start=12 where thread_id=0; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY + where thread_id=1; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test new file mode 100644 index 00000000000..73dc0aefd06 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test @@ -0,0 +1,70 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name='FOO'; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name like 'Wait/Synch/%' order by timer_wait limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_HISTORY_LONG + set thread_id='1', event_id=1, + event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY_LONG + set timer_start=12; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY_LONG + set timer_start=12 where thread_id=0; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG + where thread_id=1; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test new file mode 100644 index 00000000000..c1fddbe9f87 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test @@ -0,0 +1,62 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + where event_name='FOO'; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, + avg_timer_wait=4, max_timer_wait=5; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + set count_star=12; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + set count_star=12 where event_name like "FOO"; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + where count_star=1; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test new file mode 100644 index 00000000000..4c386313bc5 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test @@ -0,0 +1,79 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where event_name='FOO'; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + order by count_star limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + order by count_star desc limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where min_timer_wait > 0 order by count_star limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where min_timer_wait > 0 order by count_star desc limit 1; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + set event_name='FOO', object_instance_begin=0, + count_star=1, sum_timer_wait=2, min_timer_wait=3, + avg_timer_wait=4, max_timer_wait=5; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + set count_star=12; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + set count_star=12 where event_name like "FOO"; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where count_star=1; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test new file mode 100644 index 00000000000..ce29e59d014 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test @@ -0,0 +1,63 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + where event_name='FOO'; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + set event_name='FOO', thread_id=1, + count_star=1, sum_timer_wait=2, min_timer_wait=3, + avg_timer_wait=4, max_timer_wait=5; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + set count_star=12; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + set count_star=12 where event_name like "FOO"; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + where count_star=1; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_file_instances.test b/mysql-test/suite/perfschema/t/dml_file_instances.test new file mode 100644 index 00000000000..71a053c21be --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_file_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # +select * from performance_schema.FILE_INSTANCES limit 1; + +select * from performance_schema.FILE_INSTANCES + where file_name='FOO'; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_INSTANCES + set file_name='FOO', event_name='BAR', open_count=12; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_INSTANCES + set file_name='FOO'; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_INSTANCES + where event_name like "wait/%"; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_INSTANCES; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test new file mode 100644 index 00000000000..3753f581560 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test @@ -0,0 +1,62 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME + where event_name like 'Wait/io/%' limit 1; + +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME + where event_name='FOO'; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME + set event_name='FOO', count_read=1, count_write=2, + sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME + set count_read=12; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME + set count_write=12 where event_name like "FOO"; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME + where count_read=1; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ; +UNLOCK TABLES; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test new file mode 100644 index 00000000000..07372af5f36 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test @@ -0,0 +1,62 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE + where event_name like 'Wait/io/%' limit 1; + +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE + where event_name='FOO'; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_SUMMARY_BY_INSTANCE + set event_name='FOO', count_read=1, count_write=2, + sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_INSTANCE + set count_read=12; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_INSTANCE + set count_write=12 where event_name like "FOO"; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE + where count_read=1; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ; +UNLOCK TABLES; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_mutex_instances.test b/mysql-test/suite/perfschema/t/dml_mutex_instances.test new file mode 100644 index 00000000000..e3062c7b34c --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # +select * from performance_schema.MUTEX_INSTANCES limit 1; + +select * from performance_schema.MUTEX_INSTANCES + where name='FOO'; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.MUTEX_INSTANCES + set name='FOO', object_instance_begin=12; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.MUTEX_INSTANCES + set name='FOO'; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.MUTEX_INSTANCES + where name like "wait/%"; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.MUTEX_INSTANCES; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.MUTEX_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_performance_timers.test b/mysql-test/suite/perfschema/t/dml_performance_timers.test new file mode 100644 index 00000000000..9c2efb6f709 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_performance_timers.test @@ -0,0 +1,57 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 2 <frequency> 3 <resolution> 4 <overhead> +select * from performance_schema.PERFORMANCE_TIMERS; + +--replace_column 2 <frequency> 3 <resolution> 4 <overhead> +select * from performance_schema.PERFORMANCE_TIMERS + where timer_name='CYCLE'; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.PERFORMANCE_TIMERS + set timer_name='FOO', timer_frequency=1, + timer_resolution=2, timer_overhead=3; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.PERFORMANCE_TIMERS + set timer_frequency=12 where timer_name='CYCLE'; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PERFORMANCE_TIMERS; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PERFORMANCE_TIMERS + where timer_name='CYCLE'; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ; +UNLOCK TABLES; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_processlist.test b/mysql-test/suite/perfschema/t/dml_processlist.test new file mode 100644 index 00000000000..6062b8481f0 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_processlist.test @@ -0,0 +1,61 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # +select * from performance_schema.PROCESSLIST + where name like 'Thread/%' limit 1; + +select * from performance_schema.PROCESSLIST + where name='FOO'; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.PROCESSLIST + set name='FOO', thread_id=1, id=2; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.PROCESSLIST + set thread_id=12; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.PROCESSLIST + set thread_id=12 where name like "FOO"; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PROCESSLIST + where id=1; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PROCESSLIST; + +--replace_result '\'processlist' '\'PROCESSLIST' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PROCESSLIST READ; +UNLOCK TABLES; + +--replace_result '\'processlist' '\'PROCESSLIST' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PROCESSLIST WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test new file mode 100644 index 00000000000..251168237eb --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # +select * from performance_schema.RWLOCK_INSTANCES limit 1; + +select * from performance_schema.RWLOCK_INSTANCES + where name='FOO'; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.RWLOCK_INSTANCES + set name='FOO', object_instance_begin=12; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.RWLOCK_INSTANCES + set name='FOO'; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.RWLOCK_INSTANCES + where name like "wait/%"; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.RWLOCK_INSTANCES; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.RWLOCK_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_consumers.test b/mysql-test/suite/perfschema/t/dml_setup_consumers.test new file mode 100644 index 00000000000..85b65864f91 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_consumers.test @@ -0,0 +1,59 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +select * from performance_schema.SETUP_CONSUMERS; + +select * from performance_schema.SETUP_CONSUMERS + where name='events_waits_current'; + +select * from performance_schema.SETUP_CONSUMERS + where enabled='YES'; + +select * from performance_schema.SETUP_CONSUMERS + where enabled='NO'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_CONSUMERS + set name='FOO', enabled='YES'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.SETUP_CONSUMERS + set name='FOO'; + +update performance_schema.SETUP_CONSUMERS + set enabled='YES'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_CONSUMERS; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_CONSUMERS + where name='events_waits_current'; + +LOCK TABLES performance_schema.SETUP_CONSUMERS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test new file mode 100644 index 00000000000..f737160cebd --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test @@ -0,0 +1,100 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# The query result are not re producible, +# due to variations in platforms and plugins +# We still execute the select statement, for: +# - code coverage +# - make sure it does not crash +# - valgrind coverage + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log + +# DEBUG_SYNC::mutex is dependent on the build (DEBUG only) + +select * from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/Mutex/sql/%' + and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') + order by name limit 10; + +select * from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/Rwlock/sql/%' + order by name limit 10; + +# COND_handler_count is dependent on the build (Windows only) +# DEBUG_SYNC::cond is dependent on the build (DEBUG only) + +select * from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/Cond/sql/%' + and name not in ( + 'wait/synch/cond/sql/COND_handler_count', + 'wait/synch/cond/sql/DEBUG_SYNC::cond') + order by name limit 10; + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS + where name='Wait'; +--enable_result_log + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS + where enabled='YES'; +--enable_result_log + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_INSTRUMENTS + set name='FOO', enabled='YES', timed='YES'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.SETUP_INSTRUMENTS + set name='FOO'; + +update performance_schema.SETUP_INSTRUMENTS + set enabled='NO'; + +update performance_schema.SETUP_INSTRUMENTS + set timed='NO'; + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log + +update performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='YES'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_INSTRUMENTS; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/%'; + +LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_objects.test b/mysql-test/suite/perfschema/t/dml_setup_objects.test new file mode 100644 index 00000000000..21fac64d924 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_objects.test @@ -0,0 +1,75 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +select * from performance_schema.SETUP_OBJECTS; + +select * from performance_schema.SETUP_OBJECTS + where object_type = 'TABLE'; + +select * from performance_schema.SETUP_OBJECTS + where enabled='YES'; + +# Not implemented yet +--replace_result '\'setup_objects' '\'SETUP_OBJECTS' +--error ER_ILLEGAL_HA +insert into performance_schema.SETUP_OBJECTS + set object_type='TABLE', object_schema='FOO', object_name='BAR', + enabled='YES', timed='YES', aggregated='YES'; + +# Not implemented yet +# --error ER_ILLEGAL_HA +update performance_schema.SETUP_OBJECTS + set object_type='TABLE'; + +# Not implemented yet +# --error ER_ILLEGAL_HA +update performance_schema.SETUP_OBJECTS + set object_schema='ILLEGAL'; + +# Not implemented yet +# --error ER_ILLEGAL_HA +update performance_schema.SETUP_OBJECTS + set object_name='ILLEGAL'; + +update performance_schema.SETUP_OBJECTS + set enabled='NO'; + +update performance_schema.SETUP_OBJECTS + set timed='NO'; + +update performance_schema.SETUP_OBJECTS + set aggregated='NO'; + +select * from performance_schema.SETUP_OBJECTS; + +update performance_schema.SETUP_OBJECTS + set enabled='YES', timed='YES', aggregated='YES'; + +delete from performance_schema.SETUP_OBJECTS + where object_type = 'TABLE'; + +delete from performance_schema.SETUP_OBJECTS; + +LOCK TABLES performance_schema.SETUP_OBJECTS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_OBJECTS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_timers.test b/mysql-test/suite/perfschema/t/dml_setup_timers.test new file mode 100644 index 00000000000..5b5850db575 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_timers.test @@ -0,0 +1,61 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +select * from performance_schema.SETUP_TIMERS; + +select * from performance_schema.SETUP_TIMERS + where name='Wait'; + +select * from performance_schema.SETUP_TIMERS + where timer_name='CYCLE'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_TIMERS + set name='FOO', timer_name='CYCLE'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.SETUP_TIMERS + set name='FOO'; + +update performance_schema.SETUP_TIMERS + set timer_name='MILLISECOND'; + +select * from performance_schema.SETUP_TIMERS; + +update performance_schema.SETUP_TIMERS + set timer_name='CYCLE'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_TIMERS; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_TIMERS + where name='Wait'; + +LOCK TABLES performance_schema.SETUP_TIMERS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_TIMERS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test new file mode 100644 index 00000000000..4317f68d13b --- /dev/null +++ b/mysql-test/suite/perfschema/t/func_file_io.test @@ -0,0 +1,192 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## +## WL#4814, 4.1.4 FILE IO +## +## Functional testing of File IO +## + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# TODO: Change to InnoDB when it gets instrumentation +# + +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; + +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +# +# FF1: Count for file should increase with instrumentation enabled and +# FF2: Count for file should not increase with instrumentation disabled +# + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD')); + +SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; + +SELECT * FROM t1 WHERE id < 4; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); + +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO'; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); + +SELECT * FROM t1 WHERE id < 6; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); + +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; + +# +# Check not timed measurements +# + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id > 4; + +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE TIMER_WAIT != NULL + OR TIMER_START != NULL + OR TIMER_END != NULL; + +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE TIMER_WAIT != NULL + OR TIMER_START != NULL + OR TIMER_END != NULL; + +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE TIMER_WAIT != NULL + OR TIMER_START != NULL + OR TIMER_END != NULL; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES'; + +SELECT * FROM t1 WHERE id < 4; + +DROP TABLE t1; + +# +# FF4: Use-case from Enterprise Monitor +# + +--disable_result_log +SELECT SUM(COUNT_READ) AS sum_count_read, + SUM(COUNT_WRITE) AS sum_count_write, + SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, + SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; +--enable_result_log + +# +# FF5: Troubleshooting tasks +# +# These queries will give different results based on timing, +# but at least they should not crash. +# + +# +# Total and average wait time for different events on system level +# +--disable_result_log +SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +WHERE COUNT_STAR > 0 +ORDER BY SUM_TIMER_WAIT DESC +LIMIT 10; +--enable_result_log + +# +# Total and average wait time for different users +# + +--disable_result_log +SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT +# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user +ORDER BY SUM_WAIT DESC +LIMIT 20; +--enable_result_log + +# +# Total and average wait times for different events for a session +# +--disable_result_log +SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +WHERE p.ID = 1 +GROUP BY h.EVENT_NAME +HAVING TOTAL_WAIT > 0; +--enable_result_log + +# +# Which user reads and writes data +# + +--disable_result_log +SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user, h.operation +HAVING BYTES > 0 +ORDER BY i.user, h.operation; +--enable_result_log diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test new file mode 100644 index 00000000000..98cb905c67c --- /dev/null +++ b/mysql-test/suite/perfschema/t/func_mutex.test @@ -0,0 +1,131 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +## +## WL#4818, 4.1.3 MUTEXES, RW-LOCKS, ... +## +## Functional testing of mutexes and RW-locks +## + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# TODO: Change to InnoDB when it gets instrumentation +# + +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; + +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +# +# FM1: Count for mutex should increase with instrumentation enabled and +# FM2: Count for mutex should not increase with instrumentation disabled +# + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/mutex/sql/LOCK_open'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; + +# +# Repeat for RW-lock +# + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; + +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test new file mode 100644 index 00000000000..16971023cbb --- /dev/null +++ b/mysql-test/suite/perfschema/t/global_read_lock.test @@ -0,0 +1,90 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# +# Test the effect of a flush tables with read lock on SETUP_ tables. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +use performance_schema; + +grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; +flush privileges; + +--echo connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, , test); + +lock tables performance_schema.SETUP_INSTRUMENTS read; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log +unlock tables; + +lock tables performance_schema.SETUP_INSTRUMENTS write; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; + +--echo connection default; +connection default; + +flush tables with read lock; + +--echo connection con1; +connection con1; + +lock tables performance_schema.SETUP_INSTRUMENTS read; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log +unlock tables; + +# This will block +--send +lock tables performance_schema.SETUP_INSTRUMENTS write; + +--echo connection default; +connection default; + +let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where event_name like "wait/synch/cond/sql/COND_global_read_lock"; + +--source include/wait_condition.inc + +# Observe the blocked thread in the performance schema :) +select event_name, + left(source, locate(":", source)) as short_source, + timer_end, timer_wait, operation + from performance_schema.EVENTS_WAITS_CURRENT + where event_name like "wait/synch/cond/sql/COND_global_read_lock"; + +unlock tables; + +connection con1; +--reap + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; + +disconnect con1; + +--echo connection default; +connection default; + +drop user pfsuser@localhost; +flush privileges; + diff --git a/mysql-test/suite/perfschema/t/information_schema.test b/mysql-test/suite/perfschema/t/information_schema.test new file mode 100644 index 00000000000..3d2822a1db3 --- /dev/null +++ b/mysql-test/suite/perfschema/t/information_schema.test @@ -0,0 +1,67 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Several selects so the output is readable + +# Note that TABLE_NAME is in uppercase is some platforms, +# and in lowercase in others. +# Using upper(TABLE_NAME) to have consistent results. + +select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_TYPE, ENGINE + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), VERSION, ROW_FORMAT + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +# TABLESPACE_NAME does not exist in 5.4 +# select upper(TABLE_NAME), CREATE_OPTIONS, TABLESPACE_NAME +# from information_schema.tables +# where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_COMMENT + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test new file mode 100644 index 00000000000..d9b97d8441e --- /dev/null +++ b/mysql-test/suite/perfschema/t/misc.test @@ -0,0 +1,57 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# Miscelaneous + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# +# Bug#45496 Performance schema: assertion fails in +# ha_perfschema::rnd_init:223 +# + +--disable_result_log +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN + (SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN + (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS + WHERE NAME LIKE "wait/synch/%") +LIMIT 1; +--enable_result_log + +# +# Bug#45088 Should not be able to create tables of engine PERFORMANCE_SCHEMA +# + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1(a int) engine=performance_schema; + +# +# Bug#44897 Performance Schema: can create a ghost table in another database +# + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; + +# +# Bug#44898 PerformanceSchema: can create a table in db performance_schema, cannot insert +# + +--error ER_TABLEACCESS_DENIED_ERROR +create table performance_schema.t1(a int); + diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.opt b/mysql-test/suite/perfschema/t/myisam_file_io.opt new file mode 100644 index 00000000000..f2e233bd4ab --- /dev/null +++ b/mysql-test/suite/perfschema/t/myisam_file_io.opt @@ -0,0 +1 @@ +--performance_schema_events_waits_history_long_size=5000 diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test new file mode 100644 index 00000000000..53d2ea6dbe6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/myisam_file_io.test @@ -0,0 +1,63 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/io/file/myisam/%"; + +update performance_schema.SETUP_CONSUMERS + set enabled='YES'; + +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +# Code to test + +--disable_warnings +drop table if exists test.no_index_tab; +--enable_warnings + +create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; + +# Verification +# Note that mi_create.c contains mysql_file_tell() calls in debug only, +# so the result are filtered to remove 'tell'. + +select event_name, + left(source, locate(":", source)) as short_source, + operation, number_of_bytes, + substring(object_name, locate("no_index_tab", object_name)) as short_name + from performance_schema.EVENTS_WAITS_HISTORY_LONG + where operation not like "tell" + order by thread_id, event_id; + +# In case of failures, this will tell if file io are lost. +show status like 'performance_schema_%'; + +# Cleanup + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; + +drop table test.no_index_tab; + diff --git a/mysql-test/suite/perfschema/t/no_threads-master.opt b/mysql-test/suite/perfschema/t/no_threads-master.opt new file mode 100644 index 00000000000..b15ab02821d --- /dev/null +++ b/mysql-test/suite/perfschema/t/no_threads-master.opt @@ -0,0 +1 @@ +--one-thread --thread-handling=no-threads --loose-performance-schema-max-thread_instances=10 diff --git a/mysql-test/suite/perfschema/t/no_threads.test b/mysql-test/suite/perfschema/t/no_threads.test new file mode 100644 index 00000000000..3d3f712e364 --- /dev/null +++ b/mysql-test/suite/perfschema/t/no_threads.test @@ -0,0 +1,69 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + + +# Setup : in this main thread + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_CONSUMERS set enabled='YES'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; + +--disable_warnings +drop table if exists test.t1; +--enable_warnings + +truncate table performance_schema.EVENTS_WAITS_CURRENT; +truncate table performance_schema.EVENTS_WAITS_HISTORY; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +show variables like "thread_handling"; + +# Code to test : in this main thread + +create table test.t1(a int) engine=MYISAM; + +show variables like "performance_schema"; +show variables like "performance_schema_max_thread%"; + +# Verification : in this main thread + +select count(*) from performance_schema.PROCESSLIST + where name like "thread/sql/main"; + +select count(*) from performance_schema.PROCESSLIST + where name like "thread/sql/OneConnection"; + +select event_name, operation, + left(source, locate(":", source)) as short_source + from performance_schema.EVENTS_WAITS_CURRENT; + +select event_name, operation, + left(source, locate(":", source)) as short_source + from performance_schema.EVENTS_WAITS_HISTORY; + +select event_name, operation, + left(source, locate(":", source)) as short_source + from performance_schema.EVENTS_WAITS_HISTORY_LONG; + +# Cleanup + +drop table test.t1; + diff --git a/mysql-test/suite/perfschema/t/one_thread_per_con-master.opt b/mysql-test/suite/perfschema/t/one_thread_per_con-master.opt new file mode 100644 index 00000000000..d6685208673 --- /dev/null +++ b/mysql-test/suite/perfschema/t/one_thread_per_con-master.opt @@ -0,0 +1 @@ +--thread_handling=one-thread-per-connection diff --git a/mysql-test/suite/perfschema/t/one_thread_per_con.test b/mysql-test/suite/perfschema/t/one_thread_per_con.test new file mode 100644 index 00000000000..7d0daffe228 --- /dev/null +++ b/mysql-test/suite/perfschema/t/one_thread_per_con.test @@ -0,0 +1,94 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +--source ../include/setup_helper.inc + +# We use a myisam table here because CREATE TABLE has a known, +# stable behavior (it will lock THR_LOCK_myisam once). +# The point is not to test myisam, but to test that each +# connection is properly instrumented, with one-thread-per-connection + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; + +--disable_warnings +drop table if exists test.t1; +drop table if exists test.t2; +drop table if exists test.t3; +--enable_warnings + +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +show variables like "thread_handling"; + +# Code to test + +connection con1; + +-- echo "----------------- Connection 1" +create table test.t1(a int) engine=MYISAM; + +connection con2; + +-- echo "----------------- Connection 2" +create table test.t2(a int) engine=MYISAM; + +connection con3; + +-- echo "----------------- Connection 3" +create table test.t3(a int) engine=MYISAM; + +# Verification + +connection default; + +-- echo "----------------- Connection default" + +--disable_query_log +eval set @tid= $con1_THREAD_ID; +--enable_query_log + +execute stmt_dump_events using @tid; +execute stmt_dump_thread using @tid; + +--disable_query_log +eval set @tid= $con2_THREAD_ID; +--enable_query_log + +execute stmt_dump_events using @tid; +execute stmt_dump_thread using @tid; + +--disable_query_log +eval set @tid= $con3_THREAD_ID; +--enable_query_log + +execute stmt_dump_events using @tid; +execute stmt_dump_thread using @tid; + +# Cleanup + +drop table test.t1; +drop table test.t2; +drop table test.t3; + +--source ../include/cleanup_helper.inc + diff --git a/mysql-test/suite/perfschema/t/pool_of_threads-master.opt b/mysql-test/suite/perfschema/t/pool_of_threads-master.opt new file mode 100644 index 00000000000..75a5cd77203 --- /dev/null +++ b/mysql-test/suite/perfschema/t/pool_of_threads-master.opt @@ -0,0 +1 @@ +--loose-pool-of-threads diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test new file mode 100644 index 00000000000..d2f3c2a9e6b --- /dev/null +++ b/mysql-test/suite/perfschema/t/privilege.test @@ -0,0 +1,362 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +show grants; + +grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; + +# Test denied privileges on performance_schema.* + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.* to 'pfs_user_2'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.* to 'pfs_user_2'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE TEMPORARY TABLES on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant EXECUTE on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant EVENT on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.* to 'pfs_user_2'@localhost; + +# Test allowed privileges on performance_schema.* + +grant SELECT on performance_schema.* to 'pfs_user_2'@localhost; +grant INSERT on performance_schema.* to 'pfs_user_2'@localhost; +grant UPDATE on performance_schema.* to 'pfs_user_2'@localhost; +grant DELETE on performance_schema.* to 'pfs_user_2'@localhost; +grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost; + +# Test denied privileges on specific performance_schema tables. +# SETUP_INSTRUMENT : example of PFS_updatable_acl +# EVENTS_WAITS_CURRENT : example of PFS_truncatable_acl +# FILE_INSTANCES : example of PFS_readonly_acl + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost + with GRANT OPTION; + +grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost + with GRANT OPTION; + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost + with GRANT OPTION; + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost + with GRANT OPTION; + +# See bug#45354 LOCK TABLES is not a TABLE privilege +grant LOCK TABLES on performance_schema.* to 'pfs_user_3'@localhost + with GRANT OPTION; + +flush privileges; + +--source ../include/privilege.inc + +connect (con1, localhost, pfs_user_1, , ); + +--source ../include/privilege.inc + +--disconnect con1 + +connect (con2, localhost, pfs_user_2, , ); + +--source ../include/privilege.inc + +--disconnect con2 + +connect (con3, localhost, pfs_user_3, , ); + +--source ../include/privilege.inc + +--disconnect con3 + +--connection default + +revoke all privileges, grant option from 'pfs_user_1'@localhost; +revoke all privileges, grant option from 'pfs_user_2'@localhost; +revoke all privileges, grant option from 'pfs_user_3'@localhost; +drop user 'pfs_user_1'@localhost; +drop user 'pfs_user_2'@localhost; +drop user 'pfs_user_3'@localhost; +flush privileges; + +--echo # Test cases from WL#4818 +--echo # Setup user + +CREATE user pfs_user_4; +--connect (pfs_user_4, localhost, pfs_user_4, , ) + +--echo # +--echo # WL#4818, NFS4: Normal user does not have access to view data +--echo # without grants +--echo # + +--connection pfs_user_4 +--echo # Select as pfs_user_4 should fail without grant + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; + +--echo # +--echo # WL#4818, NFS3: Normal user does not have access to change what is +--echo # instrumented without grants +--echo # + +--connection pfs_user_4 +--echo # User pfs_user_4 should not be allowed to tweak instrumentation without +--echo # explicit grant + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +--echo # +--echo # WL#4814, NFS1: Can use grants to give normal user access +--echo # to turn on and off instrumentation +--echo # + +--connection default +--echo # Grant access to change tables with the root account + +GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4; +GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4; +GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4; + +--connection pfs_user_4 +--echo # User pfs_user_4 should now be allowed to tweak instrumentation + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; + +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; + +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +--echo # Clean up + +--connection default +--disconnect pfs_user_4 +REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; +DROP USER pfs_user_4; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; + diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test new file mode 100644 index 00000000000..a50b3b99650 --- /dev/null +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -0,0 +1,68 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +# This test verifies that performance schema tables, because they contain +# data that is volatile, are never cached in the query cache. + +--source include/have_query_cache.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (a int not null); +insert into t1 values (1), (2), (3); + +SET GLOBAL query_cache_size=1355776; + +flush query cache; +reset query cache; + +select * from t1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +select * from t1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; + +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; + +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +SET GLOBAL query_cache_size= default; + +drop table t1; + diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test new file mode 100644 index 00000000000..62631fa048f --- /dev/null +++ b/mysql-test/suite/perfschema/t/read_only.test @@ -0,0 +1,96 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA +# +# Check that +# - a regular user can not update SETUP_ tables under --read-only +# - a user with SUPER privileges cam + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +use performance_schema; + +set @start_read_only= @@global.read_only; + +grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; +flush privileges; + +--echo connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, , test); + +--echo connection default; +connection default; + +set global read_only=0; + +--echo connection con1; +connection con1; + +select @@global.read_only; +show grants; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +--enable_result_log + +--echo connection default; +connection default; + +set global read_only=1; + +--echo connection con1; +connection con1; + +select @@global.read_only; +show grants; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--error ER_OPTION_PREVENTS_STATEMENT +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +--error ER_OPTION_PREVENTS_STATEMENT +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +--enable_result_log + +--echo connection default; +connection default; + +grant super on *.* to pfsuser@localhost; +flush privileges; + +disconnect con1; +--echo connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, , test); + +select @@global.read_only; +show grants; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +--enable_result_log + +disconnect con1; + +--echo connection default; +connection default; + +set global read_only= @start_read_only; + +drop user pfsuser@localhost; +flush privileges; + diff --git a/mysql-test/suite/perfschema/t/schema.test b/mysql-test/suite/perfschema/t/schema.test new file mode 100644 index 00000000000..d13c399a97b --- /dev/null +++ b/mysql-test/suite/perfschema/t/schema.test @@ -0,0 +1,46 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source include/have_lowercase0.inc + +show databases; + +use performance_schema; + +show tables; + +show create table COND_INSTANCES; +show create table EVENTS_WAITS_CURRENT; +show create table EVENTS_WAITS_HISTORY; +show create table EVENTS_WAITS_HISTORY_LONG; +show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE; +show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +show create table FILE_INSTANCES; +show create table FILE_SUMMARY_BY_EVENT_NAME; +show create table FILE_SUMMARY_BY_INSTANCE; +show create table MUTEX_INSTANCES; +show create table PERFORMANCE_TIMERS; +show create table PROCESSLIST; +show create table RWLOCK_INSTANCES; +show create table SETUP_CONSUMERS; +show create table SETUP_INSTRUMENTS; +show create table SETUP_OBJECTS; +show create table SETUP_TIMERS; + diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test new file mode 100644 index 00000000000..d5268e8465c --- /dev/null +++ b/mysql-test/suite/perfschema/t/selects.test @@ -0,0 +1,156 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# +# WL#4814, 4.1.2 STORAGE ENGINE, FSE8: Selects +# + +# Make some data that we can work on: + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +# ORDER BY, GROUP BY and HAVING + +--replace_column 2 [NUM_BYTES] +SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +GROUP BY OPERATION +HAVING TOTAL IS NOT NULL +ORDER BY OPERATION +LIMIT 1; + +# Sub SELECT +--replace_column 1 [EVENT_ID] +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN + (SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN + (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS + WHERE NAME LIKE "wait/synch/%") +LIMIT 1; + +# JOIN + +--replace_column 1 [EVENT_ID] +SELECT DISTINCT EVENT_ID +FROM performance_schema.EVENTS_WAITS_CURRENT +JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID) +ORDER BY EVENT_ID +LIMIT 1; + +# Self JOIN + +--replace_column 1 [THREAD_ID] 2 [EVENT_ID] 3 [EVENT_NAME] 4 [TIMER_WAIT] +SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY t1 +JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) +ORDER BY t1.EVENT_ID, t2.EVENT_ID +LIMIT 5; + +# UNION +--replace_column 1 [THREAD_ID] 2 [EVENT_ID] +SELECT THREAD_ID, EVENT_ID FROM ( +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +) t1 ORDER BY THREAD_ID, EVENT_ID +LIMIT 5; + +# EVENT + +CREATE EVENT t_ps_event +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND +DO SELECT DISTINCT EVENT_ID + FROM performance_schema.EVENTS_WAITS_CURRENT + JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) + ORDER BY EVENT_ID + LIMIT 1; + +--sleep 2 + +# TRIGGER + +ALTER TABLE t1 ADD COLUMN c INT; + +delimiter |; + +CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 + FOR EACH ROW BEGIN + SET NEW.c = (SELECT MAX(EVENT_ID) + FROM performance_schema.EVENTS_WAITS_CURRENT); + END; +| + +delimiter ;| + +INSERT INTO t1 (id) VALUES (11), (12), (13); + +--replace_column 2 [EVENT_ID] +SELECT id, c FROM t1 WHERE id > 10 ORDER BY c; + +DROP TRIGGER t_ps_trigger; + +# PROCEDURE + +delimiter |; + +CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) +BEGIN + SELECT id FROM performance_schema.PROCESSLIST + WHERE THREAD_ID = tid INTO pid; +END; + +| + +delimiter ;| + +CALL t_ps_proc(0, @p_id); + +# FUNCTION + +delimiter |; + +CREATE FUNCTION t_ps_func(tid INT) RETURNS int +BEGIN + return (SELECT id FROM performance_schema.PROCESSLIST + WHERE THREAD_ID = tid); +END; + +| + +delimiter ;| + +SELECT t_ps_func(0) = @p_id; + +DROP PROCEDURE t_ps_proc; +DROP FUNCTION t_ps_func; + +# Clean up +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test new file mode 100644 index 00000000000..cd9357cce67 --- /dev/null +++ b/mysql-test/suite/perfschema/t/server_init.test @@ -0,0 +1,263 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# This test verifies that the mysys and server instruments are properly +# initialized and recorded by the performance schema during the bootstrap +# sequence in mysqld main(). +# Note that some globals mutexes/rwlocks/conds that depend on #ifdef options +# or runtime options are not tested here, to have a predictable result. + +use performance_schema; + +# Verify that these global mutexes have been properly initilized in mysys + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_threads"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_malloc"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_open"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_isam"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/mysys/THR_LOCK_myisam_log"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_net"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_charset"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_time"; + +# There are no global rwlock in mysys + +# Verify that these global conditions have been properly initilized in mysys + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/mysys/THR_COND_threads"; + +# Verify that these global mutexes have been properly initilized in sql + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_mysql_create_db"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_open"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_lock_db"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_thread_count"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_mapped_file"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_status"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_error_log"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; + +# Named LOCK_uuid_short in 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_uuid_short"; + +# Named LOCK_uuid_generator in 5.5, LOCK_uuid_short in 6.0 +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_delayed_status"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_delayed_create"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_crypt"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_slave_list"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_active_mi"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_manager"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_global_read_lock"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_global_system_variables"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_user_conn"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_connection_count"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_server_started"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_rpl_status"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOG_INFO::lock"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_event_metadata"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_event_queue"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_user_locks"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_mdl"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/Cversion_lock"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_audit_mask"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_xid_cache"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_plugin"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_gdl"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/tz_LOCK"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/slave_start"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_active"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_get"; + +# Verify that these global rwlocks have been properly initilized in sql + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_grant"; + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect"; + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave"; + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash"; + +# Verify that these global conditions have been properly initilized in sql + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_server_started"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_refresh"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_thread_count"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_manager"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_global_read_lock"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_thread_cache"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_flush_thread_cache"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_rpl_status"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_queue_state"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/COND_mdl"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/BML_class::COND_BML"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/BML_class::COND_BML_registered"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/BML_class::COND_BML_release"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt new file mode 100644 index 00000000000..714888a6de1 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_cond_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_class.test b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test new file mode 100644 index 00000000000..34ff61c358e --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_cond_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/cond/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.COND_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_cond_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt new file mode 100644 index 00000000000..4b33152f89a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_cond_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test new file mode 100644 index 00000000000..fe2177adb82 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_cond_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/cond/%"; + +# Expect no class lost +show status like "performance_schema_cond_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_cond_instances"; + +select count(*) from performance_schema.COND_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_COND_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt new file mode 100644 index 00000000000..f4b6d1ec893 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_file_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_class.test b/mysql-test/suite/perfschema/t/start_server_no_file_class.test new file mode 100644 index 00000000000..ca84fbbdcf2 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_file_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/io/file/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.FILE_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_file_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt new file mode 100644 index 00000000000..7f0d246f97a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_file_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_inst.test b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test new file mode 100644 index 00000000000..dbbba7bbe4a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_file_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/io/file/%"; + +# Expect no class lost +show status like "performance_schema_file_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_file_instances"; + +select count(*) from performance_schema.FILE_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_FILE_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt new file mode 100644 index 00000000000..173851434eb --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_mutex_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test new file mode 100644 index 00000000000..142e150ede6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_mutex_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/mutex/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.MUTEX_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_mutex_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt new file mode 100644 index 00000000000..5bdd7d39b4a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_mutex_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test new file mode 100644 index 00000000000..5a03251d97a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_mutex_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/mutex/%"; + +# Expect no class lost +show status like "performance_schema_mutex_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_mutex_instances"; + +select count(*) from performance_schema.MUTEX_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt new file mode 100644 index 00000000000..f0d15c86ddc --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_rwlock_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test new file mode 100644 index 00000000000..e4dfe121fcf --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_rwlock_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/rwlock/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.RWLOCK_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_rwlock_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt new file mode 100644 index 00000000000..fc1f5f89902 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_rwlock_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test new file mode 100644 index 00000000000..1d79d2d3991 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_rwlock_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/rwlock/%"; + +# Expect no class lost +show status like "performance_schema_rwlock_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_rwlock_instances"; + +select count(*) from performance_schema.RWLOCK_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt new file mode 100644 index 00000000000..91286cef859 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_thread_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test new file mode 100644 index 00000000000..ba214ba9966 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_thread_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "thread/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.PROCESSLIST; + +# Expect no instances lost +show status like "performance_schema_thread_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt new file mode 100644 index 00000000000..6e9d13c2b4c --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_thread_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test new file mode 100644 index 00000000000..7d8a44ebcd5 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test @@ -0,0 +1,42 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_thread_classes"; + +# Not observable yet +# select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +# where name like "thread/%"; + +# Expect no class lost +show status like "performance_schema_thread_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_thread_instances"; + +select count(*) from performance_schema.PROCESSLIST; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_THREAD_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_off-master.opt b/mysql-test/suite/perfschema/t/start_server_off-master.opt new file mode 100644 index 00000000000..600566e870b --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_off-master.opt @@ -0,0 +1 @@ +--loose-disable-performance-schema diff --git a/mysql-test/suite/perfschema/t/start_server_off.test b/mysql-test/suite/perfschema/t/start_server_off.test new file mode 100644 index 00000000000..bd9db97840d --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_off.test @@ -0,0 +1,25 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expecting all off / zero +show status like "performance_schema%"; + diff --git a/mysql-test/suite/perfschema/t/start_server_on-master.opt b/mysql-test/suite/perfschema/t/start_server_on-master.opt new file mode 100644 index 00000000000..542720c44d7 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_on-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema diff --git a/mysql-test/suite/perfschema/t/start_server_on.test b/mysql-test/suite/perfschema/t/start_server_on.test new file mode 100644 index 00000000000..54714616a08 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_on.test @@ -0,0 +1,25 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expecting nothing lost with default parameters + +show status like "performance_schema%"; diff --git a/mysql-test/suite/perfschema/t/tampered_perfschema_table1-master.opt b/mysql-test/suite/perfschema/t/tampered_perfschema_table1-master.opt new file mode 100644 index 00000000000..5f094e68be7 --- /dev/null +++ b/mysql-test/suite/perfschema/t/tampered_perfschema_table1-master.opt @@ -0,0 +1 @@ +--loose-debug=+d,tampered_perfschema_table1 diff --git a/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test new file mode 100644 index 00000000000..be079bacfbf --- /dev/null +++ b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test @@ -0,0 +1,44 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for PERFORMANCE_SCHEMA + +# This test uses error injection, +# see PFS_engine_table_share::check_all_tables() + +# Verify that the server starts even when a performance schema table +# is corrupted, with an incompatible change. +# Verify that using that table nicely fails. +# Verify that other tables are not affected. + +--source include/have_debug.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# The message prints 'mysql.SETUP_INSTRUMENTS' +# instead of 'performance_schema.SETUP_INSTRUMENTS', +# due to Bug#46792 + +call mtr.add_suppression( +"Column count of mysql.SETUP_INSTRUMENTS is wrong. " +"Expected 4, found 3. The table is probably corrupted"); + +--error ER_WRONG_NATIVE_TABLE_STRUCTURE +select * from performance_schema.SETUP_INSTRUMENTS limit 1; + +--disable_result_log +select * from performance_schema.SETUP_CONSUMERS limit 1; +--enable_result_log + diff --git a/mysql-test/suite/perfschema_stress/README b/mysql-test/suite/perfschema_stress/README new file mode 100644 index 00000000000..53f6f1daf35 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/README @@ -0,0 +1,34 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +WL#4818 - Stress testing of PERFORMANCE_SCHEMA + +The performance schema storage engine is backed by data structures, we +want to be sure that these data structures are not fragile under +load. + +NFS1: 20 threads doing read of performance data (both mutex and +disk), 5 threads changing what is being instrumented, 25 threads doing +DML and DDL so that the statistics are updated. Connections should frequently +disconnect or be KILLed, and reconnect. + +The database should not crash under any circumstance. + +How to run: + +MTR_VERSION=1 ./mtr --stress \ + --stress-suite=perfschema_stress \ + --stress-threads=50 \ + --stress-test-duration=3600 diff --git a/mysql-test/suite/perfschema_stress/include/settings.inc b/mysql-test/suite/perfschema_stress/include/settings.inc new file mode 100644 index 00000000000..fb886a86df2 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/include/settings.inc @@ -0,0 +1,17 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +let $num_stress_rows= 5000; +let $default_engine_type= myisam; diff --git a/mysql-test/suite/perfschema_stress/r/modify.result b/mysql-test/suite/perfschema_stress/r/modify.result new file mode 100644 index 00000000000..e1a79c9be2a --- /dev/null +++ b/mysql-test/suite/perfschema_stress/r/modify.result @@ -0,0 +1,17 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'NO'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'NO'; +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'NANOSECOND' WHERE NAME = 'Wait'; +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'CYCLE' WHERE NAME = 'Wait'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'YES' +WHERE NAME IN ('wait/io/file/sql/FRM', +'thread/sql/Connection', +'wait/synch/cond/sql/COND_mdl', +'wait/synch/rwlock/sql/LOCK_sys_init_connect', +'wait/synch/mutex/sql/LOCK_mdl'); +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'NO' +WHERE NAME = 'events_waits_history'; +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'YES' +WHERE NAME = 'events_waits_history'; diff --git a/mysql-test/suite/perfschema_stress/r/read.result b/mysql-test/suite/perfschema_stress/r/read.result new file mode 100644 index 00000000000..eee3067ddb8 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/r/read.result @@ -0,0 +1,29 @@ +SELECT * FROM performance_schema.SETUP_INSTRUMENTS +WHERE ENABLED='NO' AND TIMED='NO'; +NAME ENABLED TIMED +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE (TIMER_END - TIMER_START != TIMER_WAIT); +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE SPINS != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.PROCESSLIST p, +performance_schema.EVENTS_WAITS_CURRENT e +WHERE p.THREAD_ID = e.THREAD_ID +AND TIMER_START = 0 +ORDER BY e.EVENT_ID; +THREAD_ID ID NAME THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN (SELECT THREAD_ID +FROM performance_schema.PROCESSLIST +ORDER BY THREAD_ID) +AND TIMER_END = 0 +AND TIMER_WAIT != NULL +ORDER BY EVENT_ID; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT SUM(COUNT_READ) AS sum_count_read, +SUM(COUNT_WRITE) AS sum_count_write, +SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, +SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; diff --git a/mysql-test/suite/perfschema_stress/r/work.result b/mysql-test/suite/perfschema_stress/r/work.result new file mode 100644 index 00000000000..c782b45fdf9 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/r/work.result @@ -0,0 +1,16 @@ +SET @rowid = ROUND(RAND() * <num_stress_rows>); +START TRANSACTION; +UPDATE t1 SET b = 'changed' WHERE id=@rowid; +SELECT b FROM t1 WHERE id=@rowid; +b +changed +COMMIT; +START TRANSACTION; +DELETE FROM t1 WHERE id=@rowid; +INSERT INTO t1 (id, b) VALUES (@rowid, 'newly_inserted'); +SELECT b FROM t1 WHERE id=@rowid; +b +newly_inserted +COMMIT; +CREATE TABLE tw_<conn_nr> AS SELECT * FROM t1; +DROP TABLE tw_<conn_nr>; diff --git a/mysql-test/suite/perfschema_stress/stress_init.txt b/mysql-test/suite/perfschema_stress/stress_init.txt new file mode 100644 index 00000000000..146f275e098 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/stress_init.txt @@ -0,0 +1 @@ +setup diff --git a/mysql-test/suite/perfschema_stress/stress_tests.txt b/mysql-test/suite/perfschema_stress/stress_tests.txt new file mode 100644 index 00000000000..a17a30cb551 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/stress_tests.txt @@ -0,0 +1,10 @@ +read +read +read +read +modify +work +work +work +work +work diff --git a/mysql-test/suite/perfschema_stress/t/modify.test b/mysql-test/suite/perfschema_stress/t/modify.test new file mode 100644 index 00000000000..08b0699ace6 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/modify.test @@ -0,0 +1,55 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source suite/perfschema_stress/include/settings.inc + +let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`; + +if (`SELECT ($have_table = 0)`) { + --source suite/perfschema_stress/t/setup.test +} + +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'NO'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'NO'; + +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'NANOSECOND' WHERE NAME = 'Wait'; + +# Let it run some time with the new timer name and instruments +--sleep 1 + +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'CYCLE' WHERE NAME = 'Wait'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'YES' +WHERE NAME IN ('wait/io/file/sql/FRM', + 'thread/sql/Connection', + 'wait/synch/cond/sql/COND_mdl', + 'wait/synch/rwlock/sql/LOCK_sys_init_connect', + 'wait/synch/mutex/sql/LOCK_mdl'); + +# Two short lived changes to see that switching does not lead +# to havoc. + +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'NO' +WHERE NAME = 'events_waits_history'; + +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'YES' +WHERE NAME = 'events_waits_history'; diff --git a/mysql-test/suite/perfschema_stress/t/read.test b/mysql-test/suite/perfschema_stress/t/read.test new file mode 100644 index 00000000000..28ba4d8d887 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/read.test @@ -0,0 +1,49 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc + +SELECT * FROM performance_schema.SETUP_INSTRUMENTS +WHERE ENABLED='NO' AND TIMED='NO'; + +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE (TIMER_END - TIMER_START != TIMER_WAIT); + +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE SPINS != NULL; + +SELECT * FROM performance_schema.PROCESSLIST p, + performance_schema.EVENTS_WAITS_CURRENT e +WHERE p.THREAD_ID = e.THREAD_ID + AND TIMER_START = 0 +ORDER BY e.EVENT_ID; + +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN (SELECT THREAD_ID + FROM performance_schema.PROCESSLIST + ORDER BY THREAD_ID) + AND TIMER_END = 0 + AND TIMER_WAIT != NULL +ORDER BY EVENT_ID; + +--disable_result_log +SELECT SUM(COUNT_READ) AS sum_count_read, + SUM(COUNT_WRITE) AS sum_count_write, + SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, + SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; +--enable_result_log + diff --git a/mysql-test/suite/perfschema_stress/t/setup.test b/mysql-test/suite/perfschema_stress/t/setup.test new file mode 100644 index 00000000000..9f643edfebe --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/setup.test @@ -0,0 +1,64 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +if (`SELECT VERSION() LIKE '%embedded%'`) +{ + --skip This test cannot run with the embedded server. +} + +--source suite/perfschema_stress/include/settings.inc + +--disable_query_log +--disable_result_log + +if (`SELECT LENGTH('$engine_type') = 0`) { + let $engine_type= $default_engine_type; +} +if (`SELECT '$engine_type' = 'Falcon'`) { + --source include/have_falcon.inc +} + +--replace_result $engine_type <engine_type> +eval CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') + ENGINE=$engine_type; + +# Need something to start with +INSERT INTO t1(id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +# Bulk load the correct number of rows +while (`SELECT MAX(id) < $num_stress_rows FROM t1`) +{ + SELECT MAX(id) FROM t1 INTO @max; +--replace_result $num_stress_rows <num_stress_rows> + eval INSERT INTO t1(id) SELECT id + @max FROM t1 + WHERE id + @max <= $num_stress_rows; +} + +# Turn on some instruments + +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'NO'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'YES' +WHERE NAME IN ('wait/io/file/sql/FRM', + 'thread/sql/Connection', + 'wait/synch/cond/sql/COND_mdl', + 'wait/synch/rwlock/sql/LOCK_sys_init_connect', + 'wait/synch/mutex/sql/LOCK_mdl'); + +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'YES'; + +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/perfschema_stress/t/work.test b/mysql-test/suite/perfschema_stress/t/work.test new file mode 100644 index 00000000000..8f1bc42c5bc --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/work.test @@ -0,0 +1,47 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source suite/perfschema_stress/include/settings.inc + +let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`; + +if (`SELECT ($have_table = 0)`) { + --source suite/perfschema_stress/t/setup.test +} + +--replace_result $num_stress_rows <num_stress_rows> +eval SET @rowid = ROUND(RAND() * $num_stress_rows); + +let $conn_id= `SELECT CONNECTION_ID()`; +let $conn_nr= conn_$conn_id; + +START TRANSACTION; +UPDATE t1 SET b = 'changed' WHERE id=@rowid; +SELECT b FROM t1 WHERE id=@rowid; +COMMIT; + +START TRANSACTION; +DELETE FROM t1 WHERE id=@rowid; +INSERT INTO t1 (id, b) VALUES (@rowid, 'newly_inserted'); +SELECT b FROM t1 WHERE id=@rowid; +COMMIT; + +--replace_result $conn_nr <conn_nr> +eval CREATE TABLE tw_$conn_nr AS SELECT * FROM t1; + +--replace_result $conn_nr <conn_nr> +eval DROP TABLE tw_$conn_nr; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result index a1294d515fa..4639c717cea 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result @@ -24,6 +24,7 @@ information_schema mtr mysql mysqltest +performance_schema test USE test; SHOW TABLES; diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 27960be8054..13ee20cb3a0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -11,6 +11,7 @@ Database information_schema mtr mysql +performance_schema test test_ignore USE test; @@ -38,6 +39,7 @@ Database information_schema mtr mysql +performance_schema test USE test; SHOW TABLES; diff --git a/mysql-test/t/bug46080-master.opt b/mysql-test/t/bug46080-master.opt index edcc54fa428..71024d39356 100644 --- a/mysql-test/t/bug46080-master.opt +++ b/mysql-test/t/bug46080-master.opt @@ -1 +1 @@ ---skip-grant-tables --skip-name-resolve --loose-safemalloc-mem-limit=4000000 +--loose-performance-schema=0 --skip-grant-tables --skip-name-resolve --loose-safemalloc-mem-limit=4000000 diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index a75fd917052..b024420dee3 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -84,3 +84,64 @@ select hex(a) from t1; drop table t1; --echo End of 5.0 tests + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=big5_chinese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all values [80..FF][20..FF] +# Expected valid big5 codes: [A1..F9][40..7E,A1..FE] (89x157=13973) +# +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +SELECT COUNT(*) FROM t1; +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1 WHERE a<>''; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +# +# Make sure all possible conversion happened +# +# Expect U+2160 to U+2169 ROMAN NUMERAL ONE to ROMAN NUMERAL TEN +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect U+0430 to U+0433 CYRILLIC SMALL LETTER A, BE, VE, GHE +# Expect U+043D to U+0442 CYRILLIC SMALL LETTER EN, O, PE, ER, ES, TE +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +DROP TABLE t1; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test index af6e6baf92a..2a5aa723956 100644 --- a/mysql-test/t/ctype_cp932_binlog_stm.test +++ b/mysql-test/t/ctype_cp932_binlog_stm.test @@ -42,3 +42,79 @@ SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); DROP TABLE t1; --echo End of 5.1 tests + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=cp932_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all codes [80..FF][20..FF] +# excluding Half Width Kana [A1..DF] +# Expected valid cp932 multibyte codes: +# [81..9F,E0..FC][40..7E,80..fC] (60x188=11280 characters) +# +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +# +# Populate t1 with Half Width Kana [A1..DF] +# +INSERT t1 (code) SELECT head FROM head +WHERE (head BETWEEN 'A1' AND 'DF') +ORDER BY head; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=1; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 +WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) +ORDER BY code; +# +# Make sure all possible conversion happened +# +# Expect U+212B ANGSTROM SIGN +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect no results +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test index ec358d94900..799c8c1796f 100644 --- a/mysql-test/t/ctype_eucjpms.test +++ b/mysql-test/t/ctype_eucjpms.test @@ -381,3 +381,89 @@ select hex(convert(_eucjpms 0xA5FE41 using ucs2)); # the next character, which is a single byte character 0x41. select hex(convert(_eucjpms 0x8FABF841 using ucs2)); + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=eucjpms_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all eucjpms codes. +# +CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0; +# +# Pupulate JIS-X-0201 range (Half Width Kana) +# Expected valid code range: [8E][A1..DF] (1x63 characters) +# +INSERT INTO t1 (code) SELECT concat('8E', head) FROM head +WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head; +# +# Populate JIS-X-0208 range +# Expected valid codes: [A1..FE][A1..FE] (94x94=8836 characters) +# +INSERT INTO t1 (code) SELECT concat(head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +# +# Populate JIS-X-0212 range +# Expected valid codes [8F][A1..FE][A1..FE] (1x94x94=8836 characters) +# +INSERT INTO t1 (code) SELECT concat('8F', head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; + +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +SELECT * FROM t1 WHERE CHAR_LENGTH(a)=2; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=3; + + +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) ORDER BY code; +# +# Make sure all possible conversion happened +# +# Expect U+0122 LATIN CAPITAL LETTER G WITH CEDILLA +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect U+00F0 LATIN SMALL LETTER ETH +# Expect U+01F5 LATIN SMALL LETTER G WITH ACUTE +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_euckr.test b/mysql-test/t/ctype_euckr.test index fcb94e7b6d1..644ffbb96d9 100644 --- a/mysql-test/t/ctype_euckr.test +++ b/mysql-test/t/ctype_euckr.test @@ -107,3 +107,68 @@ SELECT s, hex(a), hex(u), hex(a2) FROM t2 ORDER BY s; DROP TABLE t1, t2; --echo End of 5.4 tests + + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=euckr_korean_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all codes [80..FF][20..FF] +# Expected valid euckr codes: [81..FE][41..5A,61..7A,81..FE] +# +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1 WHERE a<>''; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +# +# Make sure all possible conversion happened +# +# Expect U+212B ANGSTROM SIGN +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect U+0111 LATIN SMALL LETTER D WITH STROKE +# Expect U+24D0 to U+24E9 CIRCLED LATIN SMALL LETTER A to Z +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_gb2312.test b/mysql-test/t/ctype_gb2312.test index 86d1c7f72c9..f092a0a501f 100644 --- a/mysql-test/t/ctype_gb2312.test +++ b/mysql-test/t/ctype_gb2312.test @@ -33,3 +33,94 @@ SELECT hex(a) FROM t1 ORDER BY a; DROP TABLE t1; # End of 4.1 tests + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=gb2312_chinese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all codes [80..FF][20..FF] +# Expected valid gb2312 codes [A1..F7][A1..FE] +# +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1 WHERE a<>''; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +# +# Make sure all possible conversion happened +# +# Expect U+2160 to U+216B ROMAN NUMERAL ONE to ROMAN NUMERAL TWELVE +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect +# U+00E0 LATIN SMALL LETTER A WITH GRAVE +# U+00E1 LATIN SMALL LETTER A WITH ACUTE +# U+00E8 LATIN SMALL LETTER E WITH GRAVE +# U+00E9 LATIN SMALL LETTER E WITH ACUTE +# U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX +# U+00EC LATIN SMALL LETTER I WITH GRAVE +# U+00ED LATIN SMALL LETTER I WITH ACUTE +# U+00F2 LATIN SMALL LETTER O WITH GRAVE +# U+00F3 LATIN SMALL LETTER O WITH ACUTE +# U+00F9 LATIN SMALL LETTER U WITH GRAVE +# U+00FA LATIN SMALL LETTER U WITH ACUTE +# U+00FC LATIN SMALL LETTER U WITH DIAERESIS +# U+0101 LATIN SMALL LETTER A WITH MACRON +# U+0113 LATIN SMALL LETTER E WITH MACRON +# U+011B LATIN SMALL LETTER E WITH CARON +# U+012B LATIN SMALL LETTER I WITH MACRON +# U+0144 LATIN SMALL LETTER N WITH ACUTE +# U+0148 LATIN SMALL LETTER N WITH CARON +# U+014D LATIN SMALL LETTER O WITH MACRON +# U+016B LATIN SMALL LETTER U WITH MACRON +# U+01CE LATIN SMALL LETTER A WITH CARON +# U+01D0 LATIN SMALL LETTER I WITH CARON +# U+01D2 LATIN SMALL LETTER O WITH CARON +# U+01D4 LATIN SMALL LETTER U WITH CARON +# U+01D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON +# U+01D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE +# U+01DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON +# U+01DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test index 91fe50d89b9..b9e25e97a3c 100644 --- a/mysql-test/t/ctype_gbk.test +++ b/mysql-test/t/ctype_gbk.test @@ -68,3 +68,94 @@ SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; DROP TABLES t1; --echo End of 5.0 tests + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=gbk_chinese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all codes [80..FF][20..FF] +# Expected valid gbk codes [81..FE][40..7E,80..FE] +# +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1 WHERE a<>''; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); +# +# Make sure all possible conversion happened +# +# Expect U+216A to U+216B ROMAN NUMERAL ELEVEN to ROMAN TWELVE +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect +# U+00E0 LATIN SMALL LETTER A WITH GRAVE +# U+00E1 LATIN SMALL LETTER A WITH ACUTE +# U+00E8 LATIN SMALL LETTER E WITH GRAVE +# U+00E9 LATIN SMALL LETTER E WITH ACUTE +# U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX +# U+00EC LATIN SMALL LETTER I WITH GRAVE +# U+00ED LATIN SMALL LETTER I WITH ACUTE +# U+00F2 LATIN SMALL LETTER O WITH GRAVE +# U+00F3 LATIN SMALL LETTER O WITH ACUTE +# U+00F9 LATIN SMALL LETTER U WITH GRAVE +# U+00FA LATIN SMALL LETTER U WITH ACUTE +# U+00FC LATIN SMALL LETTER U WITH DIAERESIS +# U+0101 LATIN SMALL LETTER A WITH MACRON +# U+0113 LATIN SMALL LETTER E WITH MACRON +# U+011B LATIN SMALL LETTER E WITH CARON +# U+012B LATIN SMALL LETTER I WITH MACRON +# U+0144 LATIN SMALL LETTER N WITH ACUTE +# U+0148 LATIN SMALL LETTER N WITH CARON +# U+014D LATIN SMALL LETTER O WITH MACRON +# U+016B LATIN SMALL LETTER U WITH MACRON +# U+01CE LATIN SMALL LETTER A WITH CARON +# U+01D0 LATIN SMALL LETTER I WITH CARON +# U+01D2 LATIN SMALL LETTER O WITH CARON +# U+01D4 LATIN SMALL LETTER U WITH CARON +# U+01D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON +# U+01D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE +# U+01DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON +# U+01DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 7de94e34dea..5f0a403c933 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -93,3 +93,78 @@ SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); DROP TABLE t1; --echo # End of 5.1 tests + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=sjis_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all codes [80..FF][20..FF] +# excluding Half Width Kana [A1..DF] +# Expected valid sjis codes: +# [81..9F,E0..FC][40..7E,80..fC] (60x188=11280 characters) +# +CREATE TABLE t1 AS +SELECT concat(head, tail) AS code, ' ' AS a +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +# +# Populate Half Width Kana: [A1..DF] +# +INSERT t1 (code) SELECT head FROM head WHERE (head BETWEEN 'A1' AND 'DF'); +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=1; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) +FROM t1 +WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) +ORDER BY code; +# +# Make sure all possible conversion happened +# +# Expect U+212B ANGSTROM SIGN +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# Expect no results +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index 400f1301dd3..68b56118a21 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -1212,3 +1212,88 @@ DROP TABLE t2; set names default; set character_set_database=default; set character_set_server=default; + + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Testing WL#4583 Case conversion in Asian character sets +--echo # +# +# Populate t1 with all hex digits +# +SET NAMES utf8; +SET collation_connection=ujis_japanese_ci; +CREATE TABLE t1 (b VARCHAR(2)); +INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); +INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); +# +# Populate tables head and tail with values '00'-'FF' +# +CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2; +CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2; +DROP TABLE t1; +# +# Populate table t1 with all ujis codes. +# +# +CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0; +# +# Pupulate JIS-X-0201 range (Half Width Kana) +# Valid characters: [8E][A1-DF] +# +INSERT INTO t1 (code) SELECT concat('8E', head) FROM head +WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head; +# +# Populate JIS-X-0208 range +# Expected valid range: [A1..FE][A1..FE] +# +INSERT INTO t1 (code) SELECT concat(head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F') +AND (tail BETWEEN '20' AND 'FF') +ORDER BY head, tail; +# +# Populate JIS-X-0212 range +# Expected valid range: [8F][A1..FE][A1..FE] +# +INSERT INTO t1 (code) SELECT concat('8F', head, tail) +FROM head, tail +WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '80' AND 'FF') +ORDER BY head, tail; +DROP TEMPORARY TABLE head, tail; +SHOW CREATE TABLE t1; + +UPDATE t1 SET a=unhex(code) ORDER BY code; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; +SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=3; +# +# Display all characters that have upper or lower case mapping. +# +SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) ORDER BY code; +# +# Make sure all possible conversion happened +# +# Expect U+0122 LATIN CAPITAL LETTER G WITH CEDILLA +# +SELECT * FROM t1 +WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; +# +# U+00F0 LATIN SMALL LETTER ETH +# U+01F5 LATIN SMALL LETTER G WITH ACUTE +# +SELECT * FROM t1 +WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> + HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; + +DROP TABLE t1; + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/mysqld--help-notwin.test b/mysql-test/t/mysqld--help-notwin.test index 6db5dd830a6..e3d1ca97128 100644 --- a/mysql-test/t/mysqld--help-notwin.test +++ b/mysql-test/t/mysqld--help-notwin.test @@ -1,8 +1,24 @@ +# Copyright (C) 2009-2010 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # # mysqld --help # --source include/not_embedded.inc --source include/not_windows.inc +--source include/have_perfschema.inc --source include/mysqld--help.inc diff --git a/mysql-test/t/mysqld--help-win.test b/mysql-test/t/mysqld--help-win.test index 416beb1d34c..56cfec8999b 100644 --- a/mysql-test/t/mysqld--help-win.test +++ b/mysql-test/t/mysqld--help-win.test @@ -1,8 +1,24 @@ +# Copyright (C) 2009-2010 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # # mysqld --help # --source include/not_embedded.inc --source include/windows.inc +--source include/have_perfschema.inc --source include/mysqld--help.inc diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 4227498b92c..c2b31ee339d 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008, 2009 Sun Microsystems, Inc +/* Copyright (C) 2008-2010 Sun Microsystems, Inc This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -256,15 +256,15 @@ ulonglong my_timer_nanoseconds(void) read_real_time(&tr, TIMEBASE_SZ); return (ulonglong) tr.tb_high * 1000000000 + (ulonglong) tr.tb_low; } +#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) + /* SunOS 5.10+, Solaris, HP-UX: hrtime_t gethrtime(void) */ + return (ulonglong) gethrtime(); #elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_REALTIME) { struct timespec tp; clock_gettime(CLOCK_REALTIME, &tp); return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec; } -#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) - /* SunOS 5.10+, Solaris, HP-UX: hrtime_t gethrtime(void) */ - return (ulonglong) gethrtime(); #elif defined(__NETWARE__) { NXTime_t tm; @@ -579,10 +579,10 @@ void my_timer_init(MY_TIMER_INFO *mti) mti->nanoseconds.frequency= 1000000000; /* initial assumption */ #if defined(HAVE_READ_REAL_TIME) mti->nanoseconds.routine= MY_TIMER_ROUTINE_READ_REAL_TIME; -#elif defined(HAVE_CLOCK_GETTIME) - mti->nanoseconds.routine= MY_TIMER_ROUTINE_CLOCK_GETTIME; #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) mti->nanoseconds.routine= MY_TIMER_ROUTINE_GETHRTIME; +#elif defined(HAVE_CLOCK_GETTIME) + mti->nanoseconds.routine= MY_TIMER_ROUTINE_CLOCK_GETTIME; #elif defined(__NETWARE__) mti->nanoseconds.routine= MY_TIMER_ROUTINE_NXGETTIME; #elif defined(__APPLE__) && defined(__MACH__) diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index e3ddf7ffc30..bcbedae4d0f 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -1,3 +1,18 @@ +-- Copyright (C) 2008-2009 Sun Microsystems, Inc +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; version 2 of the License. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + -- -- The system tables of MySQL Server -- @@ -85,3 +100,347 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; + +-- +-- The performance schema database. +-- This database is always created, even in --without-perfschema builds, +-- so that the database name is always reserved by the MySQL implementation. +-- + +set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO'); + +DROP DATABASE IF EXISTS performance_schema; + +CREATE DATABASE performance_schema character set utf8; + +-- +-- TABLE COND_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.COND_INSTANCES("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null"; +SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_CURRENT +-- + +SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_CURRENT("; +SET @l2="THREAD_ID INTEGER not null,"; +SET @l3="EVENT_ID BIGINT unsigned not null,"; +SET @l4="EVENT_NAME VARCHAR(128) not null,"; +SET @l5="SOURCE VARCHAR(64),"; +SET @l6="TIMER_START BIGINT unsigned,"; +SET @l7="TIMER_END BIGINT unsigned,"; +SET @l8="TIMER_WAIT BIGINT unsigned,"; +SET @l9="SPINS INTEGER unsigned,"; +SET @l10="OBJECT_SCHEMA VARCHAR(64),"; +SET @l11="OBJECT_NAME VARCHAR(512),"; +SET @l12="OBJECT_TYPE VARCHAR(64),"; +SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l14="NESTING_EVENT_ID BIGINT unsigned,"; +SET @l15="OPERATION VARCHAR(16) not null,"; +SET @l16="NUMBER_OF_BYTES BIGINT unsigned,"; +SET @l17="FLAGS INTEGER unsigned"; +SET @l18=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_HISTORY +-- + +SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY("; +-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_HISTORY_LONG +-- + +SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG("; +-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +-- + +SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME("; +SET @l2="EVENT_NAME VARCHAR(128) not null,"; +SET @l3="COUNT_STAR BIGINT unsigned not null,"; +SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,"; +SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,"; +SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,"; +SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null"; +SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE +-- + +SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE("; +SET @l2="EVENT_NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l4="COUNT_STAR BIGINT unsigned not null,"; +SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,"; +SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,"; +SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,"; +SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null"; +SET @l9=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +-- + +SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME("; +SET @l2="THREAD_ID INTEGER not null,"; +SET @l3="EVENT_NAME VARCHAR(128) not null,"; +SET @l4="COUNT_STAR BIGINT unsigned not null,"; +SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,"; +SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,"; +SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,"; +SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null"; +SET @l9=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.FILE_INSTANCES("; +SET @l2="FILE_NAME VARCHAR(512) not null,"; +SET @l3="EVENT_NAME VARCHAR(128) not null,"; +SET @l4="OPEN_COUNT INTEGER unsigned not null"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_SUMMARY_BY_EVENT_NAME +-- + +SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME("; +SET @l2="EVENT_NAME VARCHAR(128) not null,"; +SET @l3="COUNT_READ BIGINT unsigned not null,"; +SET @l4="COUNT_WRITE BIGINT unsigned not null,"; +SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"; +SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"; +SET @l7=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE FILE_SUMMARY_BY_INSTANCE +-- + +SET @l1="CREATE TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE("; +SET @l2="FILE_NAME VARCHAR(512) not null,"; +SET @l3="EVENT_NAME VARCHAR(128) not null,"; +SET @l4="COUNT_READ BIGINT unsigned not null,"; +SET @l5="COUNT_WRITE BIGINT unsigned not null,"; +SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"; +SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null"; +SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE MUTEX_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.MUTEX_INSTANCES("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l4="LOCKED_BY_THREAD_ID INTEGER"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE PERFORMANCE_TIMERS +-- + +SET @l1="CREATE TABLE performance_schema.PERFORMANCE_TIMERS("; +SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,"; +SET @l3="TIMER_FREQUENCY BIGINT,"; +SET @l4="TIMER_RESOLUTION BIGINT,"; +SET @l5="TIMER_OVERHEAD BIGINT"; +SET @l6=") ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE PROCESSLIST +-- + +SET @l1="CREATE TABLE performance_schema.PROCESSLIST("; +SET @l2="THREAD_ID INTEGER not null,"; +SET @l3="ID INTEGER not null,"; +SET @l4="NAME VARCHAR(64) not null"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE RWLOCK_INSTANCES +-- + +SET @l1="CREATE TABLE performance_schema.RWLOCK_INSTANCES("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,"; +SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,"; +SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null"; +SET @l6=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_CONSUMERS +-- + +SET @l1="CREATE TABLE performance_schema.SETUP_CONSUMERS("; +SET @l2="NAME VARCHAR(64) not null,"; +SET @l3="ENABLED ENUM ('YES', 'NO') not null"; +SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_INSTRUMENTS +-- + +SET @l1="CREATE TABLE performance_schema.SETUP_INSTRUMENTS("; +SET @l2="NAME VARCHAR(128) not null,"; +SET @l3="ENABLED ENUM ('YES', 'NO') not null,"; +SET @l4="TIMED ENUM ('YES', 'NO') not null"; +SET @l5=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_OBJECTS +-- + +SET @l1="CREATE TABLE performance_schema.SETUP_OBJECTS("; +SET @l2="OBJECT_TYPE VARCHAR(64),"; +SET @l3="OBJECT_SCHEMA VARCHAR(64),"; +SET @l4="OBJECT_NAME VARCHAR(64),"; +SET @l5="ENABLED ENUM ('YES', 'NO') not null,"; +SET @l6="TIMED ENUM ('YES', 'NO') not null,"; +SET @l7="AGGREGATED ENUM ('YES', 'NO') not null"; +SET @l8=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + +-- +-- TABLE SETUP_TIMERS +-- + +SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS("; +SET @l2="NAME VARCHAR(64) not null,"; +SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null"; +SET @l4=")ENGINE=PERFORMANCE_SCHEMA;"; + +SET @cmd=concat(@l1,@l2,@l3,@l4); + +SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0'); +PREPARE stmt FROM @str; +EXECUTE stmt; +DROP PREPARE stmt; + diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 7d987db411a..cf63ba937e0 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -343,7 +343,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern, i++; } /* - We don't call pthread_cond_broadcast(&COND_queue_state); + We don't call mysql_cond_broadcast(&COND_queue_state); If we remove the top event: 1. The queue is empty. The scheduler will wake up at some time and realize that the queue is empty. If create_event() comes inbetween @@ -706,13 +706,13 @@ Event_queue::unlock_data(const char *func, uint line) /* - Wrapper for pthread_cond_wait/timedwait + Wrapper for mysql_cond_wait/timedwait SYNOPSIS Event_queue::cond_wait() thd Thread (Could be NULL during shutdown procedure) msg Message for thd->proc_info - abstime If not null then call pthread_cond_timedwait() + abstime If not null then call mysql_cond_timedwait() func Which function is requesting cond_wait line On which line cond_wait is requested */ @@ -729,7 +729,7 @@ Event_queue::cond_wait(THD *thd, struct timespec *abstime, const char* msg, thd->enter_cond(&COND_queue_state, &LOCK_event_queue, msg); - DBUG_PRINT("info", ("pthread_cond_%swait", abstime? "timed":"")); + DBUG_PRINT("info", ("mysql_cond_%swait", abstime? "timed":"")); if (!abstime) mysql_cond_wait(&COND_queue_state, &LOCK_event_queue); else diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index 486b03fc58e..5d8455fa88b 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -129,11 +129,11 @@ post_init_event_thread(THD *thd) return TRUE; } - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); threads.append(thd); thread_count++; inc_thread_running(); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); return FALSE; } @@ -153,12 +153,12 @@ deinit_event_thread(THD *thd) DBUG_ASSERT(thd->net.buff != 0); net_end(&thd->net); DBUG_PRINT("exit", ("Event thread finishing")); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thread_count--; dec_thread_running(); delete thd; - pthread_cond_broadcast(&COND_thread_count); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } @@ -190,9 +190,9 @@ pre_init_event_thread(THD* thd) thd->slave_thread= 0; thd->variables.option_bits|= OPTION_AUTO_IS_NULL; thd->client_capabilities|= CLIENT_MULTI_RESULTS; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); /* Guarantees that we will see the thread in SHOW PROCESSLIST though its @@ -421,12 +421,12 @@ Event_scheduler::start() new_thd->proc_info= "Clearing"; DBUG_ASSERT(new_thd->net.buff != 0); net_end(&new_thd->net); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thread_count--; dec_thread_running(); delete new_thd; - pthread_cond_broadcast(&COND_thread_count); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } end: UNLOCK_DATA(); @@ -555,12 +555,12 @@ error: new_thd->proc_info= "Clearing"; DBUG_ASSERT(new_thd->net.buff != 0); net_end(&new_thd->net); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thread_count--; dec_thread_running(); delete new_thd; - pthread_cond_broadcast(&COND_thread_count); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } delete event_name; DBUG_RETURN(TRUE); @@ -675,12 +675,12 @@ Event_scheduler::workers_count() uint count= 0; DBUG_ENTER("Event_scheduler::workers_count"); - pthread_mutex_lock(&LOCK_thread_count); // For unlink from list + mysql_mutex_lock(&LOCK_thread_count); // For unlink from list I_List_iterator<THD> it(threads); while ((tmp=it++)) if (tmp->system_thread == SYSTEM_THREAD_EVENT_WORKER) ++count; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_PRINT("exit", ("%d", count)); DBUG_RETURN(count); } @@ -733,12 +733,12 @@ Event_scheduler::unlock_data(const char *func, uint line) /* - Wrapper for pthread_cond_wait/timedwait + Wrapper for mysql_cond_wait/timedwait SYNOPSIS Event_scheduler::cond_wait() thd Thread (Could be NULL during shutdown procedure) - abstime If not null then call pthread_cond_timedwait() + abstime If not null then call mysql_cond_timedwait() msg Message for thd->proc_info func Which function is requesting cond_wait line On which line cond_wait is requested @@ -756,7 +756,7 @@ Event_scheduler::cond_wait(THD *thd, struct timespec *abstime, const char* msg, if (thd) thd->enter_cond(&COND_state, &LOCK_scheduler_state, msg); - DBUG_PRINT("info", ("pthread_cond_%swait", abstime? "timed":"")); + DBUG_PRINT("info", ("mysql_cond_%swait", abstime? "timed":"")); if (!abstime) mysql_cond_wait(&COND_state, &LOCK_scheduler_state); else diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index a736dc4536f..1e6d6e26697 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -3643,9 +3643,9 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) /* We need to set thd->thread_id before thd->store_globals, or it will set an invalid value for thd->variables.pseudo_thread_id. */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->thread_id= thread_id++; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mysql_thread_set_psi_id(thd->thread_id); @@ -3681,9 +3681,9 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) pthread_detach_this_thread(); thd->real_id= pthread_self(); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); threads.append(thd); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); thd->lex->start_transaction_opt= 0; if (!(s_ndb= new Ndb(g_ndb_cluster_connection, "")) || diff --git a/sql/item_func.cc b/sql/item_func.cc index d0af0d5f5e9..a7b2609470f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3502,7 +3502,7 @@ void debug_sync_point(const char* lock_name, uint lock_timeout) @param lock the associated mutex @param abstime the amount of time in seconds to wait - @retval return value from pthread_cond_timedwait + @retval return value from mysql_cond_timedwait */ #define INTERRUPT_INTERVAL (5 * ULL(1000000000)) @@ -3822,7 +3822,7 @@ longlong Item_func_sleep::val_int() timeout= args[0]->val_real(); /* - On 64-bit OSX pthread_cond_timedwait() waits forever + On 64-bit OSX mysql_cond_timedwait() waits forever if passed abstime time has already been exceeded by the system time. When given a very short timeout (< 10 mcs) just return diff --git a/sql/lock.cc b/sql/lock.cc index 08d854c4926..f34b6c80872 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1492,7 +1492,7 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) Due to a bug in a threading library it could happen that a signal did not reach its target. A condition for this was that the same condition variable was used with different mutexes in - pthread_cond_wait(). Some time ago we changed LOCK_open to + mysql_cond_wait(). Some time ago we changed LOCK_open to LOCK_global_read_lock in global read lock handling. So COND_refresh was used with LOCK_open and LOCK_global_read_lock. diff --git a/sql/log.cc b/sql/log.cc index a63b4638b95..bd03c861f74 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3062,7 +3062,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) thread. If the transaction involved MyISAM tables, it should go into binlog even on rollback. */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); /* Save variables so that we can reopen the log */ save_name=name; @@ -3155,7 +3155,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) err: if (error == 1) name= const_cast<char*>(save_name); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_index); mysql_mutex_unlock(&LOCK_log); DBUG_RETURN(error); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index fa62ed6b102..efc9f3aa7f3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2055,7 +2055,7 @@ extern mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_lock_db, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock, LOCK_global_system_variables, LOCK_user_conn, LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count; -extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count; +extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count; #ifdef HAVE_OPENSSL extern mysql_mutex_t LOCK_des_key_file; #endif @@ -2064,7 +2064,7 @@ extern mysql_cond_t COND_server_started; extern int mysqld_server_started; extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; extern mysql_rwlock_t LOCK_system_variables_hash; -extern pthread_cond_t COND_thread_count; +extern mysql_cond_t COND_thread_count; extern mysql_cond_t COND_refresh, COND_manager; extern mysql_cond_t COND_global_read_lock; extern pthread_attr_t connection_attrib; @@ -2435,9 +2435,9 @@ inline const char *table_case_name(HA_CREATE_INFO *info, const char *name) inline ulong sql_rnd_with_mutex() { - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all bits random */ - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); return tmp; } @@ -2685,7 +2685,8 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids, key_master_info_data_lock, key_master_info_run_lock, key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock, key_relay_log_info_log_space_lock, key_relay_log_info_run_lock, - key_structure_guard_mutex, key_TABLE_SHARE_mutex, key_LOCK_error_messages; + key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data, key_LOCK_error_messages, + key_LOCK_thread_count; extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave, @@ -2703,7 +2704,8 @@ extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond, key_master_info_start_cond, key_master_info_stop_cond, key_relay_log_info_data_cond, key_relay_log_info_log_space_cond, key_relay_log_info_start_cond, key_relay_log_info_stop_cond, - key_TABLE_SHARE_cond, key_user_level_lock_cond; + key_TABLE_SHARE_cond, key_user_level_lock_cond, + key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache; extern PSI_thread_key key_thread_bootstrap, key_thread_delayed_insert, key_thread_handle_manager, key_thread_kill_server, key_thread_main, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3071e708a2e..64975875da7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -302,6 +302,7 @@ TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"", #ifdef HAVE_PSI_INTERFACE #if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) static PSI_thread_key key_thread_handle_con_namedpipes; +static PSI_cond_key key_COND_handler_count; #endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */ #if defined(HAVE_SMEM) && !defined(EMBEDDED_LIBRARY) @@ -341,8 +342,7 @@ static bool binlog_format_used= false; LEX_STRING opt_init_connect, opt_init_slave; -/* Not instrumented because of LOCK_thread_count */ -static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; +static mysql_cond_t COND_thread_cache, COND_flush_thread_cache; /* Global variables */ @@ -601,8 +601,7 @@ SHOW_COMP_OPTION have_profiling; pthread_key(MEM_ROOT**,THR_MALLOC); pthread_key(THD*, THR_THD); -/* Not instrumented because of Bug#47396 */ -pthread_mutex_t LOCK_thread_count; +mysql_mutex_t LOCK_thread_count; mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_mapped_file, LOCK_status, LOCK_global_read_lock, LOCK_error_log, LOCK_uuid_generator, @@ -624,7 +623,7 @@ mysql_mutex_t LOCK_des_key_file; #endif mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; mysql_rwlock_t LOCK_system_variables_hash; -pthread_cond_t COND_thread_count; +mysql_cond_t COND_thread_count; mysql_cond_t COND_refresh, COND_global_read_lock; pthread_t signal_thread; pthread_attr_t connection_attrib; @@ -839,7 +838,7 @@ static uint thr_kill_signal; #undef getpid #include <process.h> -static pthread_cond_t COND_handler_count; +static mysql_cond_t COND_handler_count; static uint handler_count; static bool start_mode=0, use_opt_args; static int opt_argc; @@ -979,7 +978,7 @@ static void close_connections(void) #if !defined(__WIN__) && !defined(__NETWARE__) DBUG_PRINT("quit", ("waiting for select thread: 0x%lx", (ulong) select_thread)); - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); while (select_thread_in_use) { @@ -995,18 +994,18 @@ static void close_connections(void) set_timespec(abstime, 2); for (uint tmp=0 ; tmp < 10 && select_thread_in_use; tmp++) { - error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count, - &abstime); + error= mysql_cond_timedwait(&COND_thread_count, &LOCK_thread_count, + &abstime); if (error != EINTR) break; } #ifdef EXTRA_DEBUG if (error != 0 && !count++) - sql_print_error("Got error %d from pthread_cond_timedwait",error); + sql_print_error("Got error %d from mysql_cond_timedwait", error); #endif close_server_sock(); } - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); #endif /* __WIN__ */ @@ -1063,7 +1062,7 @@ static void close_connections(void) */ THD *tmp; - (void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list + mysql_mutex_lock(&LOCK_thread_count); // For unlink from list I_List_iterator<THD> it(threads); while ((tmp=it++)) @@ -1089,7 +1088,7 @@ static void close_connections(void) mysql_mutex_unlock(&tmp->mysys_var->mutex); } } - pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list + mysql_mutex_unlock(&LOCK_thread_count); // For unlink from list Events::deinit(); end_slave(); @@ -1106,11 +1105,11 @@ static void close_connections(void) for (;;) { DBUG_PRINT("quit",("Locking LOCK_thread_count")); - (void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list + mysql_mutex_lock(&LOCK_thread_count); // For unlink from list if (!(tmp=threads.get())) { DBUG_PRINT("quit",("Unlocking LOCK_thread_count")); - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); break; } #ifndef __bsdi__ // Bug in BSDI kernel @@ -1125,17 +1124,17 @@ static void close_connections(void) } #endif DBUG_PRINT("quit",("Unlocking LOCK_thread_count")); - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } /* All threads has now been aborted */ DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count)); - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); while (thread_count) { - (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); + mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); DBUG_PRINT("quit",("One thread died (count=%u)",thread_count)); } - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); close_active_mi(); DBUG_PRINT("quit",("close_connections thread")); @@ -1478,12 +1477,12 @@ void clean_up(bool print_message) logger.cleanup_end(); my_atomic_rwlock_destroy(&global_query_id_lock); my_atomic_rwlock_destroy(&thread_running_lock); - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); DBUG_PRINT("quit", ("got thread count lock")); ready_to_exit=1; /* do the broadcast inside the lock to ensure that my_end() is not called */ - (void) pthread_cond_broadcast(&COND_thread_count); - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); sys_var_end(); /* @@ -1524,7 +1523,7 @@ static void clean_up_mutexes() mysql_mutex_destroy(&LOCK_lock_db); mysql_rwlock_destroy(&LOCK_grant); mysql_mutex_destroy(&LOCK_open); - pthread_mutex_destroy(&LOCK_thread_count); + mysql_mutex_destroy(&LOCK_thread_count); mysql_mutex_destroy(&LOCK_mapped_file); mysql_mutex_destroy(&LOCK_status); mysql_mutex_destroy(&LOCK_delayed_insert); @@ -1556,11 +1555,11 @@ static void clean_up_mutexes() mysql_mutex_destroy(&LOCK_uuid_generator); mysql_mutex_destroy(&LOCK_prepared_stmt_count); mysql_mutex_destroy(&LOCK_error_messages); - pthread_cond_destroy(&COND_thread_count); + mysql_cond_destroy(&COND_thread_count); mysql_cond_destroy(&COND_refresh); mysql_cond_destroy(&COND_global_read_lock); - pthread_cond_destroy(&COND_thread_cache); - pthread_cond_destroy(&COND_flush_thread_cache); + mysql_cond_destroy(&COND_thread_cache); + mysql_cond_destroy(&COND_flush_thread_cache); mysql_cond_destroy(&COND_manager); } #endif /*EMBEDDED_LIBRARY*/ @@ -1969,7 +1968,7 @@ void close_connection(THD *thd, uint errcode, bool lock) "(not connected)", errcode ? ER_DEFAULT(errcode) : "")); if (lock) - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->killed= THD::KILL_CONNECTION; if ((vio= thd->net.vio) != 0) { @@ -1979,7 +1978,7 @@ void close_connection(THD *thd, uint errcode, bool lock) vio_close(vio); /* vio is freed in delete thd */ } if (lock) - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); MYSQL_CONNECTION_DONE((int) errcode, thd->thread_id); if (MYSQL_CONNECTION_DONE_ENABLED()) { @@ -2026,7 +2025,7 @@ void unlink_thd(THD *thd) --connection_count; mysql_mutex_unlock(&LOCK_connection_count); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thread_count--; delete thd; DBUG_VOID_RETURN; @@ -2051,7 +2050,7 @@ void unlink_thd(THD *thd) static bool cache_thread() { - safe_mutex_assert_owner(&LOCK_thread_count); + mysql_mutex_assert_owner(&LOCK_thread_count); if (cached_thread_count < thread_cache_size && ! abort_loop && !kill_cached_threads) { @@ -2059,10 +2058,10 @@ static bool cache_thread() DBUG_PRINT("info", ("Adding thread to cache")); cached_thread_count++; while (!abort_loop && ! wake_thread && ! kill_cached_threads) - (void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count); + mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count); cached_thread_count--; if (kill_cached_threads) - pthread_cond_signal(&COND_flush_thread_cache); + mysql_cond_signal(&COND_flush_thread_cache); if (wake_thread) { THD *thd; @@ -2110,14 +2109,14 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache) unlink_thd(thd); if (put_in_cache) put_in_cache= cache_thread(); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if (put_in_cache) DBUG_RETURN(0); // Thread is reused /* It's safe to broadcast outside a lock (COND... is not deleted here) */ DBUG_PRINT("signal", ("Broadcasting COND_thread_count")); my_thread_end(); - (void) pthread_cond_broadcast(&COND_thread_count); + mysql_cond_broadcast(&COND_thread_count); DBUG_LEAVE; // Must match DBUG_ENTER() pthread_exit(0); @@ -2127,15 +2126,15 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache) void flush_thread_cache() { - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); kill_cached_threads++; while (cached_thread_count) { - pthread_cond_broadcast(&COND_thread_cache); - pthread_cond_wait(&COND_flush_thread_cache,&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_cache); + mysql_cond_wait(&COND_flush_thread_cache, &LOCK_thread_count); } kill_cached_threads--; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } @@ -2829,7 +2828,7 @@ static void start_signal_handler(void) #endif #endif - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); if ((error= mysql_thread_create(key_thread_signal_hand, &signal_thread, &thr_attr, signal_hand, 0))) { @@ -2837,8 +2836,8 @@ static void start_signal_handler(void) error,errno); exit(1); } - (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); (void) pthread_attr_destroy(&thr_attr); DBUG_VOID_RETURN; @@ -2896,11 +2895,11 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) This works by waiting for start_signal_handler to free mutex, after which we signal it that we are ready. At this pointer there is no other threads running, so there - should not be any other pthread_cond_signal() calls. + should not be any other mysql_cond_signal() calls. */ - pthread_mutex_lock(&LOCK_thread_count); - pthread_mutex_unlock(&LOCK_thread_count); - pthread_cond_broadcast(&COND_thread_count); + mysql_mutex_lock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); (void) pthread_sigmask(SIG_BLOCK,&set,NULL); for (;;) @@ -3693,7 +3692,7 @@ static int init_thread_environment() &LOCK_mysql_create_db, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_LOCK_lock_db, &LOCK_lock_db, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST); - pthread_mutex_init(&LOCK_thread_count, MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_mapped_file, &LOCK_mapped_file, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_delayed_insert, @@ -3739,11 +3738,11 @@ static int init_thread_environment() mysql_rwlock_init(key_rwlock_LOCK_sys_init_connect, &LOCK_sys_init_connect); mysql_rwlock_init(key_rwlock_LOCK_sys_init_slave, &LOCK_sys_init_slave); mysql_rwlock_init(key_rwlock_LOCK_grant, &LOCK_grant); - pthread_cond_init(&COND_thread_count, NULL); + mysql_cond_init(key_COND_thread_count, &COND_thread_count, NULL); mysql_cond_init(key_COND_refresh, &COND_refresh, NULL); mysql_cond_init(key_COND_global_read_lock, &COND_global_read_lock, NULL); - pthread_cond_init(&COND_thread_cache, NULL); - pthread_cond_init(&COND_flush_thread_cache, NULL); + mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, NULL); + mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, NULL); mysql_cond_init(key_COND_manager, &COND_manager, NULL); #ifdef HAVE_REPLICATION mysql_mutex_init(key_LOCK_rpl_status, &LOCK_rpl_status, MY_MUTEX_INIT_FAST); @@ -4342,8 +4341,8 @@ static void handle_connections_methods() unireg_abort(1); // Will not return } - pthread_mutex_lock(&LOCK_thread_count); - (void) pthread_cond_init(&COND_handler_count,NULL); + mysql_mutex_lock(&LOCK_thread_count); + mysql_cond_init(key_COND_handler_count, &COND_handler_count, NULL); handler_count=0; if (hPipe != INVALID_HANDLE_VALUE) { @@ -4382,17 +4381,17 @@ static void handle_connections_methods() #endif while (handler_count > 0) - pthread_cond_wait(&COND_handler_count,&LOCK_thread_count); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_wait(&COND_handler_count, &LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_VOID_RETURN; } void decrement_handler_count() { - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); handler_count--; - pthread_cond_signal(&COND_handler_count); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_signal(&COND_handler_count); + mysql_mutex_unlock(&LOCK_thread_count); my_thread_end(); } #else @@ -4839,21 +4838,21 @@ int main(int argc, char **argv) #ifdef EXTRA_DEBUG2 sql_print_error("Before Lock_thread_count"); #endif - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); DBUG_PRINT("quit", ("Got thread_count mutex")); select_thread_in_use=0; // For close_connections - (void) pthread_mutex_unlock(&LOCK_thread_count); - (void) pthread_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); #ifdef EXTRA_DEBUG2 sql_print_error("After lock_thread_count"); #endif #endif /* __WIN__ */ /* Wait until cleanup is done */ - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); while (!ready_to_exit) - pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) if (Service.IsNT() && start_mode) @@ -5127,13 +5126,13 @@ static void bootstrap(MYSQL_FILE *file) DBUG_VOID_RETURN; } /* Wait for thread to die */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); while (in_bootstrap) { - pthread_cond_wait(&COND_thread_count, &LOCK_thread_count); + mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); DBUG_PRINT("quit",("One thread died (count=%u)",thread_count)); } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); #else thd->mysql= 0; do_handle_bootstrap(thd); @@ -5171,10 +5170,10 @@ static bool read_init_file(char *file_name) void handle_connection_in_main_thread(THD *thd) { - safe_mutex_assert_owner(&LOCK_thread_count); + mysql_mutex_assert_owner(&LOCK_thread_count); thread_cache_size=0; // Safety threads.append(thd); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); thd->start_utime= my_micro_time(); do_handle_one_connection(thd); } @@ -5191,7 +5190,7 @@ void create_thread_to_handle_connection(THD *thd) /* Get thread from cache */ thread_cache.append(thd); wake_thread++; - pthread_cond_signal(&COND_thread_cache); + mysql_cond_signal(&COND_thread_cache); } else { @@ -5213,7 +5212,7 @@ void create_thread_to_handle_connection(THD *thd) error)); thread_count--; thd->killed= THD::KILL_CONNECTION; // Safety - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_connection_count); --connection_count; @@ -5224,15 +5223,15 @@ void create_thread_to_handle_connection(THD *thd) my_snprintf(error_message_buff, sizeof(error_message_buff), ER(ER_CANT_CREATE_THREAD), error); net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); close_connection(thd,0,0); delete thd; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); return; /* purecov: end */ } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_PRINT("info",("Thread created")); } @@ -5280,7 +5279,7 @@ static void create_new_thread(THD *thd) /* Start a new thread to handle connection. */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); /* The initialization of thread_id is done in create_embedded_thd() for @@ -7856,9 +7855,9 @@ void refresh_status(THD *thd) deadlocks. Status reset becomes not atomic, but status data is not exact anyway. */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); max_used_connections= thread_count-delayed_insert_threads; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } @@ -7903,8 +7902,8 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids, key_master_info_data_lock, key_master_info_run_lock, key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock, key_relay_log_info_log_space_lock, key_relay_log_info_run_lock, - key_structure_guard_mutex, key_TABLE_SHARE_mutex, key_LOCK_error_messages, - key_LOG_INFO_lock; + key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data, key_LOCK_error_messages, + key_LOG_INFO_lock, key_LOCK_thread_count; static PSI_mutex_info all_server_mutexes[]= { @@ -7955,9 +7954,10 @@ static PSI_mutex_info all_server_mutexes[]= { &key_relay_log_info_log_space_lock, "Relay_log_info::log_space_lock", 0}, { &key_relay_log_info_run_lock, "Relay_log_info::run_lock", 0}, { &key_structure_guard_mutex, "Query_cache::structure_guard_mutex", 0}, - { &key_TABLE_SHARE_mutex, "TABLE_SHARE::mutex", 0}, + { &key_TABLE_SHARE_LOCK_ha_data, "TABLE_SHARE::LOCK_ha_data", 0}, { &key_LOCK_error_messages, "LOCK_error_messages", PSI_FLAG_GLOBAL}, - { &key_LOG_INFO_lock, "LOG_INFO::lock", 0} + { &key_LOG_INFO_lock, "LOG_INFO::lock", 0}, + { &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL} }; PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, @@ -7986,10 +7986,14 @@ PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond, key_master_info_start_cond, key_master_info_stop_cond, key_relay_log_info_data_cond, key_relay_log_info_log_space_cond, key_relay_log_info_start_cond, key_relay_log_info_stop_cond, - key_TABLE_SHARE_cond, key_user_level_lock_cond; + key_TABLE_SHARE_cond, key_user_level_lock_cond, + key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache; static PSI_cond_info all_server_conds[]= { +#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) + { &key_COND_handler_count, "COND_handler_count", PSI_FLAG_GLOBAL}, +#endif /* _WIN32 || HAVE_SMEM && !EMBEDDED_LIBRARY */ #ifdef HAVE_MMAP { &key_PAGE_cond, "PAGE::cond", 0}, { &key_COND_active, "TC_LOG_MMAP::COND_active", 0}, @@ -8014,7 +8018,10 @@ static PSI_cond_info all_server_conds[]= { &key_relay_log_info_start_cond, "Relay_log_info::start_cond", 0}, { &key_relay_log_info_stop_cond, "Relay_log_info::stop_cond", 0}, { &key_TABLE_SHARE_cond, "TABLE_SHARE::cond", 0}, - { &key_user_level_lock_cond, "User_level_lock::cond", 0} + { &key_user_level_lock_cond, "User_level_lock::cond", 0}, + { &key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL}, + { &key_COND_thread_cache, "COND_thread_cache", PSI_FLAG_GLOBAL}, + { &key_COND_flush_thread_cache, "COND_flush_thread_cache", PSI_FLAG_GLOBAL} }; PSI_thread_key key_thread_bootstrap, key_thread_delayed_insert, diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 5f206f194e4..e10288552a5 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -83,9 +83,9 @@ static int init_failsafe_rpl_thread(THD* thd) my_net_init(&thd->net, 0); thd->net.read_timeout = slave_net_timeout; thd->max_client_packet_length=thd->net.max_packet; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if (init_thr_lock() || thd->store_globals()) { @@ -413,9 +413,9 @@ mi_inited: err: mysql_mutex_unlock(log_lock); end_io_cache(&log); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if (file >= 0) mysql_file_close(file, MYF(MY_WME)); if (last_file >= 0 && last_file != file) diff --git a/sql/scheduler.cc b/sql/scheduler.cc index b05bdf4756f..b308b84eb19 100644 --- a/sql/scheduler.cc +++ b/sql/scheduler.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 MySQL AB +/* Copyright (C) 2007 MySQL AB, 2008-2010 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ scheduler_functions::scheduler_functions() static bool no_threads_end(THD *thd, bool put_in_cache) { unlink_thd(thd); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); return 1; // Abort handle_one_connection } diff --git a/sql/slave.cc b/sql/slave.cc index cbff1ba3fd2..7dca55f9181 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1970,9 +1970,9 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) thd->enable_slow_log= opt_log_slow_slave_statements; set_slave_thread_options(thd); thd->client_capabilities = CLIENT_LOCAL_FILES; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_EXECUTE_IF("simulate_io_slave_error_on_init", simulate_error|= (1 << SLAVE_THD_IO);); @@ -2672,9 +2672,9 @@ pthread_handler_t handle_slave_io(void *arg) sql_print_error("Failed during slave I/O thread initialization"); goto err; } - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); threads.append(thd); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mi->slave_running = 1; mi->abort_slave = 0; mysql_mutex_unlock(&mi->run_lock); @@ -2971,10 +2971,10 @@ err: DBUG_ASSERT(thd->net.buff != 0); net_end(&thd->net); // destructor will not free it, because net.vio is 0 close_thread_tables(thd); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); THD_CHECK_SENTRY(thd); delete thd; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mi->abort_slave= 0; mi->slave_running= 0; mi->io_thd= 0; @@ -3089,9 +3089,9 @@ pthread_handler_t handle_slave_sql(void *arg) thd->init_for_queries(); thd->temporary_tables = rli->save_temporary_tables; // restore temp tables set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); threads.append(thd); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); /* We are going to set slave_running to 1. Assuming slave I/O thread is alive and connected, this is going to make Seconds_Behind_Master be 0 @@ -3335,10 +3335,10 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ THD_CHECK_SENTRY(thd); rli->sql_thd= 0; set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); THD_CHECK_SENTRY(thd); delete thd; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); /* Note: the order of the broadcast and unlock calls below (first broadcast, then unlock) is important. Otherwise a killer_thread can execute between the calls and diff --git a/sql/slave.h b/sql/slave.h index 421f838f188..f01eccf09f4 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -158,7 +158,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, cond_lock is usually same as start_lock. It is needed for the case when start_lock is 0 which happens if start_slave_thread() is called already inside the start_lock section, but at the same time we want a - pthread_cond_wait() on start_cond,start_lock + mysql_cond_wait() on start_cond, start_lock */ int start_slave_thread( #ifdef HAVE_PSI_INTERFACE diff --git a/sql/sp_head.cc b/sql/sp_head.cc index b1ede0fc6af..aeb1e7c1e36 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1,4 +1,4 @@ -/* Copyright 2002-2008 MySQL AB, 2008 Sun Microsystems, Inc. +/* Copyright 2002-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1751,9 +1751,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, as one select and not resetting THD::user_var_events before each invocation. */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); q= global_query_id; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mysql_bin_log.start_union_events(thd, q + 1); binlog_save_options= thd->variables.option_bits; thd->variables.option_bits&= ~OPTION_BIN_LOG; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2cb873c823d..b1cd530232d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1818,11 +1818,11 @@ public: mysql_mutex_init(key_delayed_insert_mutex, &mutex, MY_MUTEX_INIT_FAST); mysql_cond_init(key_delayed_insert_cond, &cond, NULL); mysql_cond_init(key_delayed_insert_cond_client, &cond_client, NULL); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); delayed_insert_threads++; delayed_lock= global_system_variables.low_priority_updates ? TL_WRITE_LOW_PRIORITY : TL_WRITE; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } ~Delayed_insert() { @@ -1832,7 +1832,7 @@ public: delete row; if (table) close_thread_tables(&thd); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_destroy(&mutex); mysql_cond_destroy(&cond); mysql_cond_destroy(&cond_client); @@ -1841,8 +1841,8 @@ public: thd.security_ctx->user= thd.security_ctx->host=0; thread_count--; delayed_insert_threads--; - pthread_mutex_unlock(&LOCK_thread_count); - pthread_cond_broadcast(&COND_thread_count); /* Tell main we are ready */ + mysql_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); /* Tell main we are ready */ } /* The following is for checking when we can delete ourselves */ @@ -1975,9 +1975,9 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) { if (!(di= new Delayed_insert())) goto end_create; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thread_count++; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); di->thd.set_db(table_list->db, (uint) strlen(table_list->db)); di->thd.set_query(my_strdup(table_list->table_name, MYF(MY_WME | ME_FATALERROR)), 0); @@ -2411,12 +2411,12 @@ pthread_handler_t handle_delayed_insert(void *arg) pthread_detach_this_thread(); /* Add thread to THD list so that's it's visible in 'show processlist' */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; thd->set_current_time(); threads.append(thd); thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); mysql_thread_set_psi_id(thd->thread_id); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 6d7c0013365..18b3b985c8e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -526,11 +526,11 @@ end: delete thd; #ifndef EMBEDDED_LIBRARY - (void) pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thread_count--; in_bootstrap= FALSE; - (void) pthread_cond_broadcast(&COND_thread_count); - (void) pthread_mutex_unlock(&LOCK_thread_count); + mysql_cond_broadcast(&COND_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); my_thread_end(); pthread_exit(0); #endif @@ -6632,7 +6632,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query) uint error=ER_NO_SUCH_THREAD; DBUG_ENTER("kill_one_thread"); DBUG_PRINT("enter", ("id=%lu only_kill=%d", id, only_kill_query)); - pthread_mutex_lock(&LOCK_thread_count); // For unlink from list + mysql_mutex_lock(&LOCK_thread_count); // For unlink from list I_List_iterator<THD> it(threads); while ((tmp=it++)) { @@ -6644,7 +6644,7 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query) break; } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if (tmp) { diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 2b6085f6f04..7996eb5f576 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -214,7 +214,7 @@ void adjust_linfo_offsets(my_off_t purge_offset) { THD *tmp; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); I_List_iterator<THD> it(threads); while ((tmp=it++)) @@ -235,7 +235,7 @@ void adjust_linfo_offsets(my_off_t purge_offset) mysql_mutex_unlock(&linfo->lock); } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); } @@ -245,7 +245,7 @@ bool log_in_use(const char* log_name) THD *tmp; bool result = 0; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); I_List_iterator<THD> it(threads); while ((tmp=it++)) @@ -262,7 +262,7 @@ bool log_in_use(const char* log_name) } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); return result; } @@ -516,9 +516,9 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, goto err; } - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->current_linfo = &linfo; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0) { @@ -967,9 +967,9 @@ end: RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags)); my_eof(thd); thd_proc_info(thd, "Waiting to finalize termination"); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_VOID_RETURN; err: @@ -983,9 +983,9 @@ err: this mutex will make sure that it never tried to update our linfo after we return from this stack frame */ - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if (file >= 0) mysql_file_close(file, MYF(MY_WME)); @@ -1296,7 +1296,7 @@ err: void kill_zombie_dump_threads(uint32 slave_server_id) { - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); I_List_iterator<THD> it(threads); THD *tmp; @@ -1309,7 +1309,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id) break; } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if (tmp) { /* @@ -1724,9 +1724,9 @@ bool mysql_show_binlog_events(THD* thd) goto err; } - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->current_linfo = &linfo; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0) goto err; @@ -1812,9 +1812,9 @@ err: else my_eof(thd); - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_RETURN(ret); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 7e480f797be..85876049455 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1731,7 +1731,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) DBUG_VOID_RETURN; - pthread_mutex_lock(&LOCK_thread_count); // For unlink from list + mysql_mutex_lock(&LOCK_thread_count); // For unlink from list if (!thd->killed) { I_List_iterator<THD> it(threads); @@ -1784,7 +1784,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) } } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); thread_info *thd_info; time_t now= my_time(0); @@ -1823,7 +1823,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) user= thd->security_ctx->master_access & PROCESS_ACL ? NullS : thd->security_ctx->priv_user; - pthread_mutex_lock(&LOCK_thread_count); + mysql_mutex_lock(&LOCK_thread_count); if (!thd->killed) { @@ -1898,13 +1898,13 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) if (schema_table_store_record(thd, table)) { - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_RETURN(1); } } } - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_RETURN(0); } @@ -2271,7 +2271,7 @@ void calc_sum_of_all_status(STATUS_VAR *to) DBUG_ENTER("calc_sum_of_all_status"); /* Ensure that thread id not killed during loop */ - pthread_mutex_lock(&LOCK_thread_count); // For unlink from list + mysql_mutex_lock(&LOCK_thread_count); // For unlink from list I_List_iterator<THD> it(threads); THD *tmp; @@ -2283,7 +2283,7 @@ void calc_sum_of_all_status(STATUS_VAR *to) while ((tmp= it++)) add_to_status(to, &tmp->status_var); - pthread_mutex_unlock(&LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); DBUG_VOID_RETURN; } diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt new file mode 100644 index 00000000000..dbfab3b6749 --- /dev/null +++ b/storage/perfschema/CMakeLists.txt @@ -0,0 +1,79 @@ +# Copyright (C) 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") +INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/sql + ${CMAKE_SOURCE_DIR}/regex + ${CMAKE_SOURCE_DIR}/extra/yassl/include) + +ADD_DEFINITIONS(-DMYSQL_SERVER) + +SET(PERFSCHEMA_SOURCES ha_perfschema.h + pfs_column_types.h + pfs_column_values.h + pfs_events_waits.h + pfs_global.h + pfs.h + pfs_instr.h + pfs_instr_class.h + pfs_lock.h + pfs_atomic.h + pfs_server.h + pfs_stat.h + pfs_engine_table.h + pfs_timer.h + table_all_instr.h + table_events_waits.h + table_events_waits_summary.h + table_file_instances.h + table_file_summary.h + table_performance_timers.h + table_processlist.h + table_setup_consumers.h + table_setup_instruments.h + table_setup_objects.h + table_setup_timers.h + table_sync_instances.h + ha_perfschema.cc + pfs.cc + pfs_column_values.cc + pfs_events_waits.cc + pfs_global.cc + pfs_instr.cc + pfs_instr_class.cc + pfs_server.cc + pfs_engine_table.cc + pfs_timer.cc + table_all_instr.cc + table_events_waits.cc + table_events_waits_summary.cc + table_file_instances.cc + table_file_summary.cc + table_performance_timers.cc + table_processlist.cc + table_setup_consumers.cc + table_setup_instruments.cc + table_setup_objects.cc + table_setup_timers.cc + table_sync_instances.cc + pfs_atomic.cc + pfs_check.cc +) + +MYSQL_STORAGE_ENGINE(PERFSCHEMA) diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am new file mode 100644 index 00000000000..8c30c812bc6 --- /dev/null +++ b/storage/perfschema/Makefile.am @@ -0,0 +1,76 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#called from the top level Makefile + +SUBDIRS = . unittest + +MYSQLDATAdir = $(localstatedir) +MYSQLSHAREdir = $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +pkgplugindir = $(pkglibdir)/plugin +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/sql \ + -I$(srcdir) +WRAPLIBS= + +LDADD = + +DEFS = -DMYSQL_SERVER @DEFS@ + + +noinst_HEADERS = ha_perfschema.h pfs_engine_table.h pfs.h pfs_server.h \ + pfs_global.h pfs_instr_class.h pfs_instr.h \ + pfs_column_types.h pfs_column_values.h \ + table_setup_instruments.h table_performance_timers.h \ + table_setup_timers.h \ + table_setup_consumers.h table_events_waits.h \ + pfs_events_waits.h pfs_timer.h table_processlist.h \ + table_sync_instances.h \ + table_events_waits_summary.h pfs_stat.h \ + table_all_instr.h \ + table_file_instances.h table_file_summary.h \ + table_setup_objects.h pfs_lock.h pfs_atomic.h + +PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \ + pfs_global.cc pfs_instr_class.cc pfs_instr.cc \ + pfs_column_values.cc \ + table_setup_instruments.cc table_performance_timers.cc \ + table_setup_timers.cc \ + table_setup_consumers.cc table_events_waits.cc \ + pfs_events_waits.cc pfs_timer.cc table_processlist.cc \ + table_sync_instances.cc \ + table_events_waits_summary.cc \ + table_all_instr.cc \ + table_file_instances.cc table_file_summary.cc \ + table_setup_objects.cc pfs_atomic.cc pfs_check.cc + +EXTRA_LIBRARIES = libperfschema.a +noinst_LIBRARIES = @plugin_perfschema_static_target@ + +libperfschema_a_SOURCES= $(PSE_SOURCES) + +EXTRA_DIST = plug.in CMakeLists.txt + +unittests = unittest + +test: + perl $(top_srcdir)/unittest/unit.pl run $(unittests) + +test-verbose: + HARNESS_VERBOSE=1 perl $(top_srcdir)/unittest/unit.pl run $(unittests) + diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc new file mode 100644 index 00000000000..68e1f3f3a11 --- /dev/null +++ b/storage/perfschema/ha_perfschema.cc @@ -0,0 +1,382 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/ha_perfschema.cc + Performance schema storage engine (implementation). +*/ + +#include "mysql_priv.h" +#include "ha_perfschema.h" +#include "mysql/plugin.h" +#include "pfs_engine_table.h" +#include "pfs_column_values.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" + +handlerton *pfs_hton= NULL; + +static handler* pfs_create_handler(handlerton *hton, + TABLE_SHARE *table, + MEM_ROOT *mem_root) +{ + return new (mem_root) ha_perfschema(hton, table); +} + +static int compare_database_names(const char *name1, const char *name2) +{ + if (lower_case_table_names) + return strcasecmp(name1, name2); + return strcmp(name1, name2); +} + +static const PFS_engine_table_share* +find_table_share(const char *db, const char *name) +{ + DBUG_ENTER("find_table_share"); + + if (compare_database_names(db, PERFORMANCE_SCHEMA_str.str) != 0) + DBUG_RETURN(NULL); + + const PFS_engine_table_share* result; + result= PFS_engine_table::find_engine_table_share(name); + DBUG_RETURN(result); +} + +static int pfs_init_func(void *p) +{ + DBUG_ENTER("pfs_init_func"); + + pfs_hton= reinterpret_cast<handlerton *> (p); + + pfs_hton->state= SHOW_OPTION_YES; + pfs_hton->create= pfs_create_handler; + pfs_hton->show_status= pfs_show_status; + pfs_hton->flags= HTON_ALTER_NOT_SUPPORTED | + HTON_TEMPORARY_NOT_SUPPORTED | + HTON_NO_PARTITION; + + /* + As long as the server implementation keeps using legacy_db_type, + as for example in mysql_truncate(), + we can not rely on the fact that different mysqld process will assign + consistently the same legacy_db_type for a given storage engine name. + In particular, using different --loose-skip-xxx options between + ./mysqld --bootstrap + ./mysqld + creates bogus .frm forms when bootstrapping the performance schema, + if we rely on ha_initialize_handlerton to assign a really dynamic value. + To fix this, a dedicated DB_TYPE is officially assigned to + the performance schema. See Bug#43039. + */ + pfs_hton->db_type= DB_TYPE_PERFORMANCE_SCHEMA; + + PFS_engine_table_share::init_all_locks(); + + DBUG_RETURN(0); +} + +static int pfs_done_func(void *p) +{ + DBUG_ENTER("pfs_done_func"); + + pfs_hton= NULL; + + PFS_engine_table_share::delete_all_locks(); + + DBUG_RETURN(0); +} + +static struct st_mysql_show_var pfs_status_vars[]= +{ + {"Performance_schema_mutex_classes_lost", + (char*) &mutex_class_lost, SHOW_LONG_NOFLUSH}, + {"Performance_schema_rwlock_classes_lost", + (char*) &rwlock_class_lost, SHOW_LONG_NOFLUSH}, + {"Performance_schema_cond_classes_lost", + (char*) &cond_class_lost, SHOW_LONG_NOFLUSH}, + {"Performance_schema_thread_classes_lost", + (char*) &thread_class_lost, SHOW_LONG_NOFLUSH}, + {"Performance_schema_file_classes_lost", + (char*) &file_class_lost, SHOW_LONG_NOFLUSH}, + {"Performance_schema_mutex_instances_lost", + (char*) &mutex_lost, SHOW_LONG}, + {"Performance_schema_rwlock_instances_lost", + (char*) &rwlock_lost, SHOW_LONG}, + {"Performance_schema_cond_instances_lost", + (char*) &cond_lost, SHOW_LONG}, + {"Performance_schema_thread_instances_lost", + (char*) &thread_lost, SHOW_LONG}, + {"Performance_schema_file_instances_lost", + (char*) &file_lost, SHOW_LONG}, + {"Performance_schema_file_handles_lost", + (char*) &file_handle_lost, SHOW_LONG}, + {"Performance_schema_locker_lost", + (char*) &locker_lost, SHOW_LONG}, + /* table shares, can be flushed */ + {"Performance_schema_table_instances_lost", + (char*) &table_share_lost, SHOW_LONG}, + /* table handles, can be flushed */ + {"Performance_schema_table_handles_lost", + (char*) &table_lost, SHOW_LONG}, + {NullS, NullS, SHOW_LONG} +}; + +struct st_mysql_storage_engine pfs_storage_engine= +{ MYSQL_HANDLERTON_INTERFACE_VERSION }; + +const char* pfs_engine_name= "PERFORMANCE_SCHEMA"; + +mysql_declare_plugin(perfschema) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &pfs_storage_engine, + pfs_engine_name, + "Marc Alff, Sun Microsystems", + "Performance Schema", + PLUGIN_LICENSE_GPL, + pfs_init_func, /* Plugin Init */ + pfs_done_func, /* Plugin Deinit */ + 0x0001 /* 0.1 */, + pfs_status_vars, /* status variables */ + NULL, /* system variables */ + NULL /* config options */ +} +mysql_declare_plugin_end; + +ha_perfschema::ha_perfschema(handlerton *hton, TABLE_SHARE *share) + : handler(hton, share), m_table_share(NULL), m_table(NULL) +{} + +ha_perfschema::~ha_perfschema() +{} + +static const char *ha_pfs_exts[]= { + NullS +}; + +const char **ha_perfschema::bas_ext() const +{ + return ha_pfs_exts; +} + +int ha_perfschema::open(const char *name, int mode, uint test_if_locked) +{ + DBUG_ENTER("ha_perfschema::open"); + + m_table_share= find_table_share(table_share->db.str, + table_share->table_name.str); + if (! m_table_share) + DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); + + thr_lock_data_init(m_table_share->m_thr_lock_ptr, &m_thr_lock, NULL); + ref_length= m_table_share->m_ref_length; + + psi_open(); + + DBUG_RETURN(0); +} + +int ha_perfschema::close(void) +{ + DBUG_ENTER("ha_perfschema::close"); + m_table_share= NULL; + delete m_table; + m_table= NULL; + + psi_close(); + + DBUG_RETURN(0); +} + +int ha_perfschema::write_row(uchar *buf) +{ + int result; + + DBUG_ENTER("ha_perfschema::write_row"); + + ha_statistic_increment(&SSV::ha_write_count); + DBUG_ASSERT(m_table_share); + + if (m_table_share->m_write_row) + result= m_table_share->m_write_row(table, buf, table->field); + else + { + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + result= HA_ERR_WRONG_COMMAND; + } + + DBUG_RETURN(result); +} + +void ha_perfschema::use_hidden_primary_key(void) +{ + /* + This is also called in case of row based replication, + see TABLE::mark_columns_needed_for_update(). + Add all columns to the read set, but do not touch the write set, + as some columns in the SETUP_ tables are not writable. + */ + table->column_bitmaps_set_no_signal(&table->s->all_set, table->write_set); +} + +int ha_perfschema::update_row(const uchar *old_data, uchar *new_data) +{ + DBUG_ENTER("ha_perfschema::update_row"); + + DBUG_ASSERT(m_table); + int result= m_table->update_row(table, old_data, new_data, table->field); + DBUG_RETURN(result); +} + +int ha_perfschema::rnd_init(bool scan) +{ + int result; + DBUG_ENTER("ha_perfschema::rnd_init"); + + DBUG_ASSERT(m_table_share); + DBUG_ASSERT(m_table_share->m_open_table != NULL); + + stats.records= 0; + if (m_table == NULL) + m_table= m_table_share->m_open_table(); + else + m_table->reset_position(); + + result= m_table ? 0 : HA_ERR_OUT_OF_MEM; + DBUG_RETURN(result); +} + +int ha_perfschema::rnd_end(void) +{ + DBUG_ENTER("ha_perfschema::rnd_end"); + DBUG_ASSERT(m_table); + delete m_table; + m_table= NULL; + DBUG_RETURN(0); +} + +int ha_perfschema::rnd_next(uchar *buf) +{ + DBUG_ENTER("ha_perfschema::rnd_next"); + + DBUG_ASSERT(m_table); + int result= m_table->rnd_next(); + if (result == 0) + { + result= m_table->read_row(table, buf, table->field); + if (result == 0) + stats.records++; + } + DBUG_RETURN(result); +} + +void ha_perfschema::position(const uchar *record) +{ + DBUG_ENTER("ha_perfschema::position"); + + DBUG_ASSERT(m_table); + m_table->get_position(ref); + DBUG_VOID_RETURN; +} + +int ha_perfschema::rnd_pos(uchar *buf, uchar *pos) +{ + DBUG_ENTER("ha_perfschema::rnd_pos"); + + DBUG_ASSERT(m_table); + int result= m_table->rnd_pos(pos); + if (result == 0) + result= m_table->read_row(table, buf, table->field); + DBUG_RETURN(result); +} + +int ha_perfschema::info(uint flag) +{ + DBUG_ENTER("ha_perfschema::info"); + DBUG_ASSERT(m_table_share); + if (flag & HA_STATUS_VARIABLE) + stats.records= m_table_share->m_records; + if (flag & HA_STATUS_CONST) + ref_length= m_table_share->m_ref_length; + DBUG_RETURN(0); +} + +int ha_perfschema::delete_all_rows(void) +{ + int result; + + DBUG_ENTER("ha_perfschema::delete_all_rows"); + + DBUG_ASSERT(m_table_share); + if (m_table_share->m_delete_all_rows) + result= m_table_share->m_delete_all_rows(); + else + { + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + result= HA_ERR_WRONG_COMMAND; + } + DBUG_RETURN(result); +} + +THR_LOCK_DATA **ha_perfschema::store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + if (lock_type != TL_IGNORE && m_thr_lock.type == TL_UNLOCK) + m_thr_lock.type= lock_type; + *to++= &m_thr_lock; + m_thr_lock.m_psi= m_psi; + return to; +} + +int ha_perfschema::delete_table(const char *name) +{ + DBUG_ENTER("ha_perfschema::delete_table"); + DBUG_RETURN(0); +} + +int ha_perfschema::rename_table(const char * from, const char * to) +{ + DBUG_ENTER("ha_perfschema::rename_table "); + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); +} + +int ha_perfschema::create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info) +{ + DBUG_ENTER("ha_perfschema::create"); + DBUG_ASSERT(table_arg); + DBUG_ASSERT(table_arg->s); + if (find_table_share(table_arg->s->db.str, + table_arg->s->table_name.str)) + { + /* + Attempting to create a known performance schema table. + Allowing the create, to create .FRM files, + for the initial database install, and mysql_upgrade. + This should fail once .FRM are removed. + */ + DBUG_RETURN(0); + } + /* + This is not a general purpose engine. + Failure to CREATE TABLE is the expected result. + */ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); +} + diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h new file mode 100644 index 00000000000..146b258ff47 --- /dev/null +++ b/storage/perfschema/ha_perfschema.h @@ -0,0 +1,159 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef HA_PERFSCHEMA_H +#define HA_PERFSCHEMA_H + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + +/** + @file storage/perfschema/ha_perfschema.h + Performance schema storage engine (declarations). + + @defgroup Performance_schema_engine Performance Schema Engine + @ingroup Performance_schema_implementation + @{ +*/ +struct PFS_engine_table_share; +class PFS_engine_table; +extern const char *pfs_engine_name; + +/** A handler for a PERFORMANCE_SCHEMA table. */ +class ha_perfschema : public handler +{ +public: + ha_perfschema(handlerton *hton, TABLE_SHARE *share); + + ~ha_perfschema(); + + const char *table_type(void) const { return pfs_engine_name; } + + const char *index_type(uint) { return ""; } + + const char **bas_ext(void) const; + + /** Capabilities of the performance schema tables. */ + ulonglong table_flags(void) const + { + /* + About HA_FAST_KEY_READ: + + The storage engine ::rnd_pos() method is fast to locate records by key, + so HA_FAST_KEY_READ is technically true, but the record content can be + overwritten between ::rnd_next() and ::rnd_pos(), because all the P_S + data is volatile. + The HA_FAST_KEY_READ flag is not advertised, to force the optimizer + to cache records instead, to provide more consistent records. + For example, consider the following statement: + - select * from P_S.EVENTS_WAITS_HISTORY_LONG where THREAD_ID=<n> + order by ... + With HA_FAST_KEY_READ, it can return records where "THREAD_ID=<n>" + is false, because the where clause was evaluated to true after + ::rnd_pos(), then the content changed, then the record was fetched by + key using ::rnd_pos(). + Without HA_FAST_KEY_READ, the optimizer reads all columns and never + calls ::rnd_pos(), so it is guaranteed to return only thread <n> + records. + */ + return HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT | + HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_NO_BLOBS; + } + + /** + Operations supported by indexes. + None, there are no indexes. + */ + ulong index_flags(uint , uint , bool ) const + { return 0; } + + uint max_supported_record_length(void) const + { return HA_MAX_REC_LENGTH; } + + uint max_supported_keys(void) const + { return 0; } + + uint max_supported_key_parts(void) const + { return 0; } + + uint max_supported_key_length(void) const + { return 0; } + + ha_rows estimate_rows_upper_bound(void) + { return HA_POS_ERROR; } + + double scan_time(void) + { return 1.0; } + + double read_time(ha_rows) + { return 1.0; } + + int open(const char *name, int mode, uint test_if_locked); + + int close(void); + + int write_row(uchar *buf); + + void use_hidden_primary_key(); + + int update_row(const uchar *old_data, uchar *new_data); + + int rnd_init(bool scan); + + int rnd_end(void); + + int rnd_next(uchar *buf); + + int rnd_pos(uchar *buf, uchar *pos); + + void position(const uchar *record); + + int info(uint); + + int delete_all_rows(void); + + int delete_table(const char *from); + + int rename_table(const char * from, const char * to); + + int create(const char *name, TABLE *form, + HA_CREATE_INFO *create_info); + + THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + + virtual uint8 table_cache_type(void) + { return HA_CACHE_TBL_NOCACHE; } + + virtual my_bool register_query_cache_table + (THD *, char *, uint , qc_engine_callback *engine_callback, ulonglong *) + { + *engine_callback= 0; + return FALSE; + } + +private: + /** MySQL lock */ + THR_LOCK_DATA m_thr_lock; + /** Performance schema table share for this table handler. */ + const PFS_engine_table_share *m_table_share; + /** Performance schema table cursor. */ + PFS_engine_table *m_table; +}; + +/** @} */ +#endif + diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc new file mode 100644 index 00000000000..01b4b3711c1 --- /dev/null +++ b/storage/perfschema/pfs.cc @@ -0,0 +1,2053 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs.cc + The performance schema implementation of all instruments. +*/ + +#include "my_global.h" +#include "pfs.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" +#include "pfs_global.h" +#include "pfs_column_values.h" +#include "pfs_timer.h" +#include "pfs_events_waits.h" + +/* Pending WL#4895 PERFORMANCE_SCHEMA Instrumenting Table IO */ +#undef HAVE_TABLE_WAIT + +/** + @page PAGE_PERFORMANCE_SCHEMA The Performance Schema main page + MySQL PERFORMANCE_SCHEMA implementation. + + @section INTRO Introduction + The PERFORMANCE_SCHEMA is a way to introspect the internal execution of + the server at runtime. + The performance schema focuses primarily on performance data, + as opposed to the INFORMATION_SCHEMA whose purpose is to inspect metadata. + + From a user point of view, the performance schema consists of: + - a dedicated database schema, named PERFORMANCE_SCHEMA, + - SQL tables, used to query the server internal state or change + configuration settings. + + From an implementation point of view, the performance schema is a dedicated + Storage Engine which exposes data collected by 'Instrumentation Points' + placed in the server code. + + @section INTERFACES Multiple interfaces + + The performance schema exposes many different interfaces, + for different components, and for different purposes. + + @subsection INT_INSTRUMENTING Instrumenting interface + + All the data representing the server internal state exposed + in the performance schema must be first collected: + this is the role of the instrumenting interface. + The instrumenting interface is a coding interface provided + by implementors (of the performance schema) to implementors + (of the server or server components). + + This interface is available to: + - C implementations + - C++ implementations + - the core SQL layer (/sql) + - the mysys library (/mysys) + - MySQL plugins, including storage engines, + - third party plugins, including third party storage engines. + + For details, see the @ref PAGE_INSTRUMENTATION_INTERFACE + "instrumentation interface page". + + @subsection INT_COMPILING Compiling interface + + The implementation of the performance schema can be enabled or disabled at + build time, when building MySQL from the source code. + + When building with the performance schema code, some compilation flags + are available to change the default values used in the code, if required. + + For more details, see: + @verbatim ./configure --help @endverbatim + + To compile with the performance schema: + @verbatim ./configure --with-perfschema @endverbatim + + The implementation of all the compiling options is located in + @verbatim ./storage/perfschema/plug.in @endverbatim + + @subsection INT_STARTUP Server startup interface + + The server startup interface consists of the "./mysqld ..." + command line used to start the server. + When the performance schema is compiled in the server binary, + extra command line options are available. + + These extra start options allow the DBA to: + - enable or disable the performance schema + - specify some sizing parameters. + + To see help for the performance schema startup options, see: + @verbatim ./sql/mysqld --verbose --help @endverbatim + + The implementation of all the startup options is located in + @verbatim ./sql/mysqld.cc, my_long_options[] @endverbatim + + @subsection INT_BOOTSTRAP Server bootstrap interface + + The bootstrap interface is a private interface exposed by + the performance schema, and used by the SQL layer. + Its role is to advertise all the SQL tables natively + supported by the performance schema to the SQL server. + The code consists of creating MySQL tables for the + performance schema itself, and is used in './mysql --bootstrap' + mode when a server is installed. + + The implementation of the database creation script is located in + @verbatim ./scripts/mysql_system_tables.sql @endverbatim + + @subsection INT_CONFIG Runtime configuration interface + + When the performance schema is used at runtime, various configuration + parameters can be used to specify what kind of data is collected, + what kind of aggregations are computed, what kind of timers are used, + what events are timed, etc. + + For all these capabilities, not a single statement or special syntax + was introduced in the parser. + Instead of new SQL statements, the interface consists of DML + (SELECT, INSERT, UPDATE, DELETE) against special "SETUP" tables. + + For example: + @verbatim mysql> update performance_schema.SETUP_INSTRUMENTS + set ENABLED='YES', TIMED='YES'; + Query OK, 234 rows affected (0.00 sec) + Rows matched: 234 Changed: 234 Warnings: 0 @endverbatim + + @subsection INT_STATUS Internal audit interface + + The internal audit interface is provided to the DBA to inspect if the + performance schema code itself is functioning properly. + This interface is necessary because a failure caused while + instrumenting code in the server should not cause failures in the + MySQL server itself, so that the performance schema implementation + never raises errors during runtime execution. + + This auditing interface consists of: + @verbatim SHOW ENGINE PERFORMANCE_SCHEMA STATUS; @endverbatim + It displays data related to the memory usage of the performance schema, + as well as statistics about lost events, if any. + + The SHOW STATUS command is implemented in + @verbatim ./storage/perfschema/pfs_engine_table.cc @endverbatim + + @subsection INT_QUERY Query interface + + The query interface is used to query the internal state of a running server. + It is provided as SQL tables. + + For example: + @verbatim mysql> select * from performance_schema.EVENTS_WAITS_CURRENT; + @endverbatim + + @section DESIGN_PRINCIPLES Design principles + + @subsection PRINCIPLE_BEHAVIOR No behavior changes + + The primary goal of the performance schema is to measure (instrument) the + execution of the server. A good measure should not cause any change + in behavior. + + To achieve this, the overall design of the performance schema complies + with the following very severe design constraints: + + The parser is unchanged. There are no new keywords, no new statements. + This guarantees that existing applications will run the same way with or + without the performance schema. + + All the instrumentation points return "void", there are no error codes. + Even if the performance schema internally fails, execution of the server + code will proceed. + + None of the instrumentation points allocate memory. + All the memory used by the performance schema is pre-allocated at startup, + and is considered "static" during the server life time. + + None of the instrumentation points use any pthread_mutex, pthread_rwlock, + or pthread_cond (or platform equivalents). + Executing the instrumentation point should not cause thread scheduling to + change in the server. + + In other words, the implementation of the instrumentation points, + including all the code called by the instrumentation points, is: + - malloc free + - mutex free + - rwlock free + + TODO: All the code located in storage/perfschema is malloc free, + but unfortunately the usage of LF_HASH introduces some memory allocation. + This should be revised if possible, to use a lock-free, + malloc-free hash code table. + + @subsection PRINCIPLE_PERFORMANCE No performance hit + + The instrumentation of the server should be as fast as possible. + In cases when there are choices between: + - doing some processing when recording the performance data + in the instrumentation, + - doing some processing when retrieving the performance data, + + priority is given in the design to make the instrumentation faster, + pushing some complexity to data retrieval. + + As a result, some parts of the design, related to: + - the setup code path, + - the query code path, + + might appear to be sub-optimal. + + The criterion used here is to optimize primarily the critical path (data + collection), possibly at the expense of non-critical code paths. + + @subsection PRINCIPLE_NOT_INTRUSIVE Unintrusive instrumentation + + For the performance schema in general to be successful, the barrier + of entry for a developer should be low, so it's easy to instrument code. + + In particular, the instrumentation interface: + - is available for C and C++ code (so it's a C interface), + - does not require parameters that the calling code can't easily provide, + - supports partial instrumentation (for example, instrumenting mutexes does + not require that every mutex is instrumented) + + @subsection PRINCIPLE_EXTENDABLE Extendable instrumentation + + As the content of the performance schema improves, + with more tables exposed and more data collected, + the instrumentation interface will also be augmented + to support instrumenting new concepts. + Existing instrumentations should not be affected when additional + instrumentation is made available, and making a new instrumentation + available should not require existing instrumented code to support it. + + @subsection PRINCIPLE_VERSIONED Versioned instrumentation + + Given that the instrumentation offered by the performance schema will + be augmented with time, when more features are implemented, + the interface itself should be versioned, to keep compatibility + with previous instrumented code. + + For example, after both plugin-A and plugin-B have been instrumented for + mutexes, read write locks and conditions, using the instrumentation + interface, we can anticipate that the instrumentation interface + is expanded to support file based operations. + + Plugin-A, a file based storage engine, will most likely use the expanded + interface and instrument its file usage, using the version 2 + interface, while Plugin-B, a network based storage engine, will not change + its code and not release a new binary. + + When later the instrumentation interface is expanded to support network + based operations (which will define interface version 3), the Plugin-B code + can then be changed to make use of it. + + Note, this is just an example to illustrate the design concept here. + Both mutexes and file instrumentation are already available + since version 1 of the instrumentation interface. + + @subsection PRINCIPLE_DEPLOYMENT Easy deployment + + Internally, we might want every plugin implementation to upgrade the + instrumented code to the latest available, but this will cause additional + work and this is not practical if the code change is monolithic. + + Externally, for third party plugin implementors, asking implementors to + always stay aligned to the latest instrumentation and make new releases, + even when the change does not provide new functionality for them, + is a bad idea. + + For example, requiring a network based engine to re-release because the + instrumentation interface changed for file based operations, will create + too many deployment issues. + + So, the performance schema implementation must support concurrently, + in the same deployment, multiple versions of the instrumentation + interface, and ensure binary compatibility with each version. + + In addition to this, the performance schema can be included or excluded + from the server binary, using build time configuration options. + + Regardless, the following types of deployment are valid: + - a server supporting the performance schema + a storage engine + that is not instrumented + - a server not supporting the performance schema + a storage engine + that is instrumented +*/ + +/** + @page PAGE_INSTRUMENTATION_INTERFACE + Performance schema: instrumentation interface page. + MySQL performance schema instrumentation interface. + + @section INTRO Introduction + + The instrumentation interface consist of two layers: + - a raw ABI (Application Binary Interface) layer, that exposes the primitive + instrumentation functions exported by the performance schema instrumentation + - an API (Application Programing Interface) layer, + that provides many helpers for a developer instrumenting some code, + to make the instrumentation as easy as possible. + + The ABI layer consists of: +@code +#include "mysql/psi/psi.h" +@endcode + + The API layer consists of: +@code +#include "mysql/psi/mutex_mutex.h" +#include "mysql/psi/mutex_file.h" +@endcode + + The first helper is for mutexes, rwlocks and conditions, + the second for file io. + + The API layer exposes C macros and typedefs which will expand: + - either to non-instrumented code, when compiled without the performance + schema instrumentation + - or to instrumented code, that will issue the raw calls to the ABI layer + so that the implementation can collect data. + + Note that all the names introduced (for example, @c mysql_mutex_lock) do not + collide with any other namespace. + In particular, the macro @c mysql_mutex_lock is on purpose not named + @c pthread_mutex_lock. + This is to: + - avoid overloading @c pthread_mutex_lock with yet another macro, + which is dangerous as it can affect user code and pollute + the end-user namespace. + - allow the developer instrumenting code to selectively instrument + some code but not all. + + @section PRINCIPLES Design principles + + The ABI part is designed as a facade, that exposes basic primitives. + The expectation is that each primitive will be very stable over time, + but the list will constantly grow when more instruments are supported. + To support binary compatibility with plugins compiled with a different + version of the instrumentation, the ABI itself is versioned + (see @c PSI_v1, @c PSI_v2). + + For a given instrumentation point in the API, the basic coding pattern + used is: + - (a) If the performance schema is not initialized, do nothing + - (b) If the object acted upon is not instrumented, do nothing + - (c) otherwise, notify the performance schema of the operation + about to be performed. + + The implementation of the instrumentation interface can: + - decide that it is not interested by the event, and return NULL. + In this context, 'interested' means whether the instrumentation for + this object + event is turned on in the performance schema configuration + (the SETUP_ tables). + - decide that this event is to be instrumented. + In this case, the instrumentation returns an opaque pointer, + that acts as a listener. + + If a listener is returned, the instrumentation point then: + - (d) invokes the "start" event method + - (e) executes the instrumented code. + - (f) invokes the "end" event method. + + If no listener is returned, only the instrumented code (e) is invoked. + + The following code fragment is annotated to show how in detail this pattern + in implemented, when the instrumentation is compiled in: + +@verbatim +static inline int mysql_mutex_lock( + mysql_mutex_t *that, myf flags, const char *src_file, uint src_line) +{ + int result; + struct PSI_mutex_locker *locker= NULL; + + ...... (a) .......... (b) + if (PSI_server && that->m_psi) + + .......................... (c) + if ((locker= PSI_server->get_thread_mutex_locker(that->m_psi, + PSI_MUTEX_LOCK))) + + ............... (d) + PSI_server->start_mutex_wait(locker, src_file, src_line); + + ........ (e) + result= pthread_mutex_lock(&that->m_mutex); + + if (locker) + + ............. (f) + PSI_server->end_mutex_wait(locker, result); + + return result; +} +@endverbatim + + When the performance schema instrumentation is not compiled in, + the code becomes simply a wrapper, expanded in line by the compiler: + +@verbatim +static inline int mysql_mutex_lock(...) +{ + int result; + + ........ (e) + result= pthread_mutex_lock(&that->m_mutex); + + return result; +} +@endverbatim +*/ + +/** + @page PAGE_AGGREGATES Performance schema: the aggregates page. + Performance schema aggregates. + + @section INTRO Introduction + + Aggregates tables are tables that can be formally defined as + SELECT ... from EVENTS_WAITS_HISTORY_INFINITE ... group by 'group clause'. + + Each group clause defines a different kind of aggregate, and corresponds to + a different table exposed by the performance schema. + + Aggregates can be either: + - computed on the fly, + - computed on demand, based on other available data. + + 'EVENTS_WAITS_HISTORY_INFINITE' is a table that does not exist, + the best approximation is EVENTS_WAITS_HISTORY_LONG. + Aggregates computed on the fly in fact are based on EVENTS_WAITS_CURRENT, + while aggregates computed on demand are based on other + EVENTS_WAITS_SUMMARY_BY_xxx tables. + + To better understand the implementation itself, a bit of math is + required first, to understand the model behind the code: + the code is deceptively simple, the real complexity resides + in the flyweight of pointers between various performance schema buffers. + + @section DIMENSION Concept of dimension + + An event measured by the instrumentation has many attributes. + An event is represented as a data point P(x1, x2, ..., xN), + where each x_i coordinate represents a given attribute value. + + Examples of attributes are: + - the time waited + - the object waited on + - the instrument waited on + - the thread that waited + - the operation performed + - per object or per operation additional attributes, such as spins, + number of bytes, etc. + + Computing an aggregate per thread is fundamentally different from + computing an aggregate by instrument, so the "_BY_THREAD" and + "_BY_EVENT_NAME" aggregates are different dimensions, + operating on different x_i and x_j coordinates. + These aggregates are "orthogonal". + + @section PROJECTION Concept of projection + + A given x_i attribute value can convey either just one basic information, + such as a number of bytes, or can convey implied information, + such as an object fully qualified name. + + For example, from the value "test.t1", the name of the object schema + "test" can be separated from the object name "t1", so that now aggregates + by object schema can be implemented. + + In math terms, that corresponds to defining a function: + F_i (x): x --> y + Applying this function to our point P gives another point P': + + F_i (P): + P(x1, x2, ..., x{i-1}, x_i, x{i+1}, ..., x_N + --> P' (x1, x2, ..., x{i-1}, f_i(x_i), x{i+1}, ..., x_N) + + That function defines in fact an aggregate ! + In SQL terms, this aggregate would look like the following table: + +@verbatim + CREATE VIEW EVENTS_WAITS_SUMMARY_BY_Func_i AS + SELECT col_1, col_2, ..., col_{i-1}, + Func_i(col_i), + COUNT(col_i), + MIN(col_i), AVG(col_i), MAX(col_i), -- if col_i is a numeric value + col_{i+1}, ..., col_N + FROM EVENTS_WAITS_HISTORY_INFINITE + group by col_1, col_2, ..., col_{i-1}, col{i+1}, ..., col_N. +@endverbatim + + Note that not all columns have to be included, + in particular some columns that are dependent on the x_i column should + be removed, so that in practice, MySQL's aggregation method tends to + remove many attributes at each aggregation steps. + + For example, when aggregating wait events by object instances, + - the wait_time and number_of_bytes can be summed, + and sum(wait_time) now becomes an object instance attribute. + - the source, timer_start, timer_end columns are not in the + _BY_INSTANCE table, because these attributes are only + meaningful for a wait. + + @section COMPOSITION Concept of composition + + Now, the "test.t1" --> "test" example was purely theory, + just to explain the concept, and does not lead very far. + Let's look at a more interesting example of data that can be derived + from the row event. + + An event creates a transient object, PFS_wait_locker, per operation. + This object's life cycle is extremely short: it's created just + before the start_wait() instrumentation call, and is destroyed in + the end_wait() call. + + The wait locker itself contains a pointer to the object instance + waited on. + That allows to implement a wait_locker --> object instance projection, + with m_target. + The object instance life cycle depends on _init and _destroy calls + from the code, such as mysql_mutex_init() + and mysql_mutex_destroy() for a mutex. + + The object instance waited on contains a pointer to the object class, + which is represented by the instrument name. + That allows to implement an object instance --> object class projection. + The object class life cycle is permanent, as instruments are loaded in + the server and never removed. + + The object class is named in such a way + (for example, "wait/sync/mutex/sql/LOCK_open", + "wait/io/file/maria/data_file) that the component ("sql", "maria") + that it belongs to can be inferred. + That allows to implement an object class --> server component projection. + + Back to math again, we have, for example for mutexes: + + F1 (l) : PFS_wait_locker l --> PFS_mutex m = l->m_target.m_mutex + + F1_to_2 (m) : PFS_mutex m --> PFS_mutex_class i = m->m_class + + F2_to_3 (i) : PFS_mutex_class i --> const char *component = + substring(i->m_name, ...) + + Per components aggregates are not implemented, this is just an illustration. + + F1 alone defines this aggregate: + + EVENTS_WAITS_HISTORY_INFINITE --> EVENTS_WAITS_SUMMARY_BY_INSTANCE + (or MUTEX_INSTANCE) + + F1_to_2 alone could define this aggregate: + + EVENTS_WAITS_SUMMARY_BY_INSTANCE --> EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + + Alternatively, using function composition, with + F2 = F1_to_2 o F1, F2 defines: + + EVENTS_WAITS_HISTORY_INFINITE --> EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + + Likewise, F_2_to_3 defines: + + EVENTS_WAITS_SUMMARY_BY_EVENT_NAME --> EVENTS_WAITS_SUMMARY_BY_COMPONENT + + and F3 = F_2_to_3 o F_1_to_2 o F1 defines: + + EVENTS_WAITS_HISTORY_INFINITE --> EVENTS_WAITS_SUMMARY_BY_COMPONENT + + What has all this to do with the code ? + + Function composition such as F_2_to_3 o F_1_to_2 o F1 is implemented + as PFS_single_stat_chain, where each link in the chain represents + an individual F_{i}_to_{i+1} aggregation step. + + A single call to aggregate_single_stat_chain() updates all the tables + described in the statistics chain. + + @section STAT_CHAIN Statistics chains + + Statistics chains are only used for on the fly aggregates, + and are therefore all based initially on the '_CURRENT' base table that + contains the data recorded. + The following table aggregates are implemented with a statistics chain: + + EVENTS_WAITS_CURRENT --> EVENTS_WAITS_SUMMARY_BY_INSTANCE + --> EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + + This relationship is between classes. + + In terms of object instances, or records, this chain is implemented + as a flyweight. + + For example, assuming the following scenario: + - A mutex class "M" is instrumented, the instrument name + is "wait/sync/mutex/sql/M" + - This mutex instrument has been instantiated twice, + mutex instances are noted M-1 and M-2 + - Threads T-A and T-B are locking mutex instance M-1 + - Threads T-C and T-D are locking mutex instance M-2 + + The performance schema will record the following data: + - EVENTS_WAITS_CURRENT has 4 rows, one for each mutex locker + - EVENTS_WAITS_SUMMARY_BY_INSTANCE shows 2 rows, for M-1 and M-2 + - EVENTS_WAITS_SUMMARY_BY_EVENT_NAME shows 1 row, for M + + The graph of structures will look like: + +@verbatim + PFS_wait_locker (T-A, M-1) ---------- + | + v + PFS_mutex (M-1) + - m_wait_stat ------------ + ^ | + | | + PFS_wait_locker (T-B, M-1) ---------- | + v + PFS_mutex_class (M) + - m_wait_stat + PFS_wait_locker (T-C, M-2) ---------- ^ + | | + v | + PFS_mutex (M-2) | + - m_wait_stat ------------ + ^ + | + PFS_wait_locker (T-D, M-2) ---------- + + || || || + || || || + vv vv vv + + EVENTS_WAITS_CURRENT ..._SUMMARY_BY_INSTANCE ..._SUMMARY_BY_EVENT_NAME +@endverbatim + + @section ON_THE_FLY On the fly aggregates + + 'On the fly' aggregates are computed during the code execution. + This is necessary because the data the aggregate is based on is volatile, + and can not be kept indefinitely. + + @section HIGHER_LEVEL Higher level aggregates + + Note: no higher level aggregate is implemented yet, + this section is a place holder. +*/ + +/** + @defgroup Performance_schema Performance Schema + The performance schema component. + For details, see the + @ref PAGE_PERFORMANCE_SCHEMA "performance schema main page". + + @defgroup Performance_schema_implementation Performance Schema Implementation + @ingroup Performance_schema + + @defgroup Performance_schema_tables Performance Schema Tables + @ingroup Performance_schema_implementation +*/ + +pthread_key(PFS_thread*, THR_PFS); +bool THR_PFS_initialized= false; + +static enum_operation_type mutex_operation_map[]= +{ + OPERATION_TYPE_LOCK, + OPERATION_TYPE_TRYLOCK +}; + +static enum_operation_type rwlock_operation_map[]= +{ + OPERATION_TYPE_READLOCK, + OPERATION_TYPE_WRITELOCK, + OPERATION_TYPE_TRYREADLOCK, + OPERATION_TYPE_TRYWRITELOCK +}; + +static enum_operation_type cond_operation_map[]= +{ + OPERATION_TYPE_WAIT, + OPERATION_TYPE_TIMEDWAIT +}; + +/** + Conversion map from PSI_file_operation to enum_operation_type. + Indexed by enum PSI_file_operation. +*/ +static enum_operation_type file_operation_map[]= +{ + OPERATION_TYPE_FILECREATE, + OPERATION_TYPE_FILECREATETMP, + OPERATION_TYPE_FILEOPEN, + OPERATION_TYPE_FILESTREAMOPEN, + OPERATION_TYPE_FILECLOSE, + OPERATION_TYPE_FILESTREAMCLOSE, + OPERATION_TYPE_FILEREAD, + OPERATION_TYPE_FILEWRITE, + OPERATION_TYPE_FILESEEK, + OPERATION_TYPE_FILETELL, + OPERATION_TYPE_FILEFLUSH, + OPERATION_TYPE_FILESTAT, + OPERATION_TYPE_FILEFSTAT, + OPERATION_TYPE_FILECHSIZE, + OPERATION_TYPE_FILEDELETE, + OPERATION_TYPE_FILERENAME, + OPERATION_TYPE_FILESYNC +}; + +/** + Build the prefix name of a class of instruments in a category. + For example, this function builds the string 'wait/sync/mutex/sql/' from + a prefix 'wait/sync/mutex' and a category 'sql'. + This prefix is used later to build each instrument name, such as + 'wait/sync/mutex/sql/LOCK_open'. + @param prefix Prefix for this class of instruments + @param category Category name + @param [out] output Buffer of length PFS_MAX_INFO_NAME_LENGTH. + @param [out] output_length Length of the resulting output string. + @return 0 for success, non zero for errors +*/ +static int build_prefix(const LEX_STRING *prefix, const char *category, + char *output, int *output_length) +{ + int len= strlen(category); + char *out_ptr= output; + int prefix_length= prefix->length; + + if (unlikely((prefix_length + len + 1) >= + PFS_MAX_FULL_PREFIX_NAME_LENGTH)) + { + pfs_print_error("build_prefix: prefix+category is too long <%s> <%s>\n", + prefix->str, category); + return 1; + } + + if (unlikely(strchr(category, '/') != NULL)) + { + pfs_print_error("build_prefix: invalid category <%s>\n", + category); + return 1; + } + + /* output = prefix + category + '/' */ + memcpy(out_ptr, prefix->str, prefix_length); + out_ptr+= prefix_length; + memcpy(out_ptr, category, len); + out_ptr+= len; + *out_ptr= '/'; + out_ptr++; + *output_length= out_ptr - output; + + return 0; +} + +#define REGISTER_BODY_V1(KEY_T, PREFIX, REGISTER_FUNC) \ + KEY_T key; \ + char formatted_name[PFS_MAX_INFO_NAME_LENGTH]; \ + int prefix_length; \ + int len; \ + int full_length; \ + \ + DBUG_ASSERT(category != NULL); \ + DBUG_ASSERT(info != NULL); \ + if (unlikely(build_prefix(&PREFIX, category, \ + formatted_name, &prefix_length))) \ + { \ + for (; count>0; count--, info++) \ + *(info->m_key)= 0; \ + return ; \ + } \ + \ + for (; count>0; count--, info++) \ + { \ + DBUG_ASSERT(info->m_key != NULL); \ + DBUG_ASSERT(info->m_name != NULL); \ + len= strlen(info->m_name); \ + full_length= prefix_length + len; \ + if (likely(full_length <= PFS_MAX_INFO_NAME_LENGTH)) \ + { \ + memcpy(formatted_name + prefix_length, info->m_name, len); \ + key= REGISTER_FUNC(formatted_name, full_length, info->m_flags); \ + } \ + else \ + { \ + pfs_print_error("REGISTER_BODY_V1: name too long <%s> <%s>\n", \ + category, info->m_name); \ + key= 0; \ + } \ + \ + *(info->m_key)= key; \ + } \ + return; + +static void register_mutex_v1(const char *category, + PSI_mutex_info_v1 *info, + int count) +{ + REGISTER_BODY_V1(PSI_mutex_key, + mutex_instrument_prefix, + register_mutex_class) +} + +static void register_rwlock_v1(const char *category, + PSI_rwlock_info_v1 *info, + int count) +{ + REGISTER_BODY_V1(PSI_rwlock_key, + rwlock_instrument_prefix, + register_rwlock_class) +} + +static void register_cond_v1(const char *category, + PSI_cond_info_v1 *info, + int count) +{ + REGISTER_BODY_V1(PSI_cond_key, + cond_instrument_prefix, + register_cond_class) +} + +static void register_thread_v1(const char *category, + PSI_thread_info_v1 *info, + int count) +{ + REGISTER_BODY_V1(PSI_thread_key, + thread_instrument_prefix, + register_thread_class) +} + +static void register_file_v1(const char *category, + PSI_file_info_v1 *info, + int count) +{ + REGISTER_BODY_V1(PSI_file_key, + file_instrument_prefix, + register_file_class) +} + +#define INIT_BODY_V1(T, KEY, ID) \ + PFS_##T##_class *klass; \ + PFS_##T *pfs; \ + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); \ + if (unlikely(pfs_thread == NULL)) \ + return NULL; \ + if (! pfs_thread->m_enabled) \ + return NULL; \ + klass= find_##T##_class(KEY); \ + if (unlikely(klass == NULL)) \ + return NULL; \ + if (! klass->m_enabled) \ + return NULL; \ + pfs= create_##T(klass, ID); \ + return reinterpret_cast<PSI_##T *> (pfs) + +static PSI_mutex* +init_mutex_v1(PSI_mutex_key key, const void *identity) +{ + INIT_BODY_V1(mutex, key, identity); +} + +static void destroy_mutex_v1(PSI_mutex* mutex) +{ + PFS_mutex *pfs= reinterpret_cast<PFS_mutex*> (mutex); + destroy_mutex(pfs); +} + +static PSI_rwlock* +init_rwlock_v1(PSI_rwlock_key key, const void *identity) +{ + INIT_BODY_V1(rwlock, key, identity); +} + +static void destroy_rwlock_v1(PSI_rwlock* rwlock) +{ + PFS_rwlock *pfs= reinterpret_cast<PFS_rwlock*> (rwlock); + destroy_rwlock(pfs); +} + +static PSI_cond* +init_cond_v1(PSI_cond_key key, const void *identity) +{ + INIT_BODY_V1(cond, key, identity); +} + +static void destroy_cond_v1(PSI_cond* cond) +{ + PFS_cond *pfs= reinterpret_cast<PFS_cond*> (cond); + destroy_cond(pfs); +} + +static PSI_table_share* +get_table_share_v1(const char *schema_name, int schema_name_length, + const char *table_name, int table_name_length, + const void *identity) +{ +#ifdef HAVE_TABLE_WAIT + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + PFS_table_share* share; + share= find_or_create_table_share(pfs_thread, + schema_name, schema_name_length, + table_name, table_name_length); + return reinterpret_cast<PSI_table_share*> (share); +#else + return NULL; +#endif +} + +static void release_table_share_v1(PSI_table_share* share) +{ + /* + To be implemented by WL#4895 PERFORMANCE_SCHEMA Instrumenting Table IO. + */ +} + +static PSI_table* +open_table_v1(PSI_table_share *share, const void *identity) +{ + PFS_table_share *pfs_table_share= + reinterpret_cast<PFS_table_share*> (share); + PFS_table *pfs_table; + DBUG_ASSERT(pfs_table_share); + pfs_table= create_table(pfs_table_share, identity); + return reinterpret_cast<PSI_table *> (pfs_table); +} + +static void close_table_v1(PSI_table *table) +{ + PFS_table *pfs= reinterpret_cast<PFS_table*> (table); + DBUG_ASSERT(pfs); + destroy_table(pfs); +} + +static void create_file_v1(PSI_file_key key, const char *name, File file) +{ + int index= (int) file; + if (unlikely(index < 0)) + return; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return; + if (! pfs_thread->m_enabled) + return; + PFS_file_class *klass= find_file_class(key); + if (unlikely(klass == NULL)) + return; + if (! klass->m_enabled) + return; + if (likely(index < file_handle_max)) + { + uint len= strlen(name); + PFS_file *pfs= find_or_create_file(pfs_thread, klass, name, len); + file_handle_array[index]= pfs; + } + else + file_handle_lost++; +} + +struct PFS_spawn_thread_arg +{ + PFS_thread *m_parent_thread; + PSI_thread_key m_child_key; + const void *m_child_identity; + void *(*m_user_start_routine)(void*); + void *m_user_arg; +}; + +void* pfs_spawn_thread(void *arg) +{ + PFS_spawn_thread_arg *typed_arg= (PFS_spawn_thread_arg*) arg; + void *user_arg; + void *(*user_start_routine)(void*); + + PFS_thread *pfs; + + /* First, attach instrumentation to this newly created pthread. */ + PFS_thread_class *klass= find_thread_class(typed_arg->m_child_key); + if (likely(klass != NULL)) + pfs= create_thread(klass, typed_arg->m_child_identity, 0); + else + pfs= NULL; + my_pthread_setspecific_ptr(THR_PFS, pfs); + + /* + Secondly, free the memory allocated in spawn_thread_v1(). + It is preferable to do this before invoking the user + routine, to avoid memory leaks at shutdown, in case + the server exits without waiting for this thread. + */ + user_start_routine= typed_arg->m_user_start_routine; + user_arg= typed_arg->m_user_arg; + my_free(typed_arg, MYF(0)); + + /* Then, execute the user code for this thread. */ + (*user_start_routine)(user_arg); + + return NULL; +} + +static int spawn_thread_v1(PSI_thread_key key, + pthread_t *thread, const pthread_attr_t *attr, + void *(*start_routine)(void*), void *arg) +{ + PFS_spawn_thread_arg *psi_arg; + + /* psi_arg can not be global, and can not be a local variable. */ + psi_arg= (PFS_spawn_thread_arg*) my_malloc(sizeof(PFS_spawn_thread_arg), + MYF(MY_WME)); + if (unlikely(psi_arg == NULL)) + return EAGAIN; + + psi_arg->m_parent_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + psi_arg->m_child_key= key; + psi_arg->m_child_identity= (arg ? arg : thread); + psi_arg->m_user_start_routine= start_routine; + psi_arg->m_user_arg= arg; + + int result= pthread_create(thread, attr, pfs_spawn_thread, psi_arg); + if (unlikely(result != 0)) + my_free(psi_arg, MYF(0)); + return result; +} + +static PSI_thread* +new_thread_v1(PSI_thread_key key, const void *identity, ulong thread_id) +{ + PFS_thread *pfs; + + PFS_thread_class *klass= find_thread_class(key); + if (likely(klass != NULL)) + pfs= create_thread(klass, identity, thread_id); + else + pfs= NULL; + + return reinterpret_cast<PSI_thread*> (pfs); +} + +static void set_thread_id_v1(PSI_thread *thread, unsigned long id) +{ + DBUG_ASSERT(thread); + PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread); + pfs->m_thread_id= id; +} + +static PSI_thread* +get_thread_v1(void) +{ + PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + return reinterpret_cast<PSI_thread*> (pfs); +} + +static void set_thread_v1(PSI_thread* thread) +{ + PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread); + my_pthread_setspecific_ptr(THR_PFS, pfs); +} + +static void delete_current_thread_v1(void) +{ + PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (thread != NULL) + { + my_pthread_setspecific_ptr(THR_PFS, NULL); + destroy_thread(thread); + } +} + +static PSI_mutex_locker* +get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) +{ + PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex); + DBUG_ASSERT((int) op >= 0); + DBUG_ASSERT((uint) op < array_elements(mutex_operation_map)); + DBUG_ASSERT(pfs_mutex != NULL); + DBUG_ASSERT(pfs_mutex->m_class != NULL); + if (! flag_events_waits_current) + return NULL; + if (! pfs_mutex->m_class->m_enabled) + return NULL; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_mutex= pfs_mutex; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= pfs_mutex->m_class; + if (pfs_mutex->m_class->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_mutex->m_identity; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_operation= mutex_operation_map[(int) op]; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_MUTEX; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_mutex_locker*> (pfs_locker); +} + +static PSI_rwlock_locker* +get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) +{ + PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock); + DBUG_ASSERT(static_cast<int> (op) >= 0); + DBUG_ASSERT(static_cast<uint> (op) < array_elements(rwlock_operation_map)); + DBUG_ASSERT(pfs_rwlock != NULL); + DBUG_ASSERT(pfs_rwlock->m_class != NULL); + if (! flag_events_waits_current) + return NULL; + if (! pfs_rwlock->m_class->m_enabled) + return NULL; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_rwlock= pfs_rwlock; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= pfs_rwlock->m_class; + if (pfs_rwlock->m_class->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_rwlock->m_identity; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_operation= + rwlock_operation_map[static_cast<int> (op)]; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_RWLOCK; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_rwlock_locker*> (pfs_locker); +} + +static PSI_cond_locker* +get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, + PSI_cond_operation op) +{ + /* + Note about the unused PSI_mutex *mutex parameter: + In the pthread library, a call to pthread_cond_wait() + causes an unlock() + lock() on the mutex associated with the condition. + This mutex operation is not instrumented, so the mutex will still + appear as locked when a thread is waiting on a condition. + This has no impact now, as unlock_mutex() is not recording events. + When unlock_mutex() is implemented by later work logs, + this parameter here will be used to adjust the mutex state, + in start_cond_wait_v1() and end_cond_wait_v1(). + */ + PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); + DBUG_ASSERT(static_cast<int> (op) >= 0); + DBUG_ASSERT(static_cast<uint> (op) < array_elements(cond_operation_map)); + DBUG_ASSERT(pfs_cond != NULL); + DBUG_ASSERT(pfs_cond->m_class != NULL); + if (! flag_events_waits_current) + return NULL; + if (! pfs_cond->m_class->m_enabled) + return NULL; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_cond= pfs_cond; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= pfs_cond->m_class; + if (pfs_cond->m_class->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_cond->m_identity; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_operation= + cond_operation_map[static_cast<int> (op)]; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_COND; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_cond_locker*> (pfs_locker); +} + +static PSI_table_locker* +get_thread_table_locker_v1(PSI_table *table) +{ + PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table); + DBUG_ASSERT(pfs_table != NULL); + DBUG_ASSERT(pfs_table->m_share != NULL); + if (! flag_events_waits_current) + return NULL; + if (! pfs_table->m_share->m_enabled) + return NULL; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_table= pfs_table; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= &global_table_class; + if (pfs_table->m_share->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_table->m_identity; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_TABLE; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_table_locker*> (pfs_locker); +} + +static PSI_file_locker* +get_thread_file_name_locker_v1(PSI_file_key key, + PSI_file_operation op, + const char *name, const void *identity) +{ + DBUG_ASSERT(static_cast<int> (op) >= 0); + DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map)); + + if (! flag_events_waits_current) + return NULL; + PFS_file_class *klass= find_file_class(key); + if (unlikely(klass == NULL)) + return NULL; + if (! klass->m_enabled) + return NULL; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + uint len= strlen(name); + PFS_file *pfs_file= find_or_create_file(pfs_thread, klass, name, len); + if (unlikely(pfs_file == NULL)) + return NULL; + + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_file= pfs_file; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= pfs_file->m_class; + if (pfs_file->m_class->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_file; + pfs_locker->m_waits_current.m_object_name= pfs_file->m_filename; + pfs_locker->m_waits_current.m_object_name_length= + pfs_file->m_filename_length; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_operation= + file_operation_map[static_cast<int> (op)]; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_FILE; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_file_locker*> (pfs_locker); +} + +static PSI_file_locker* +get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) +{ + PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file); + + DBUG_ASSERT(static_cast<int> (op) >= 0); + DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map)); + DBUG_ASSERT(pfs_file != NULL); + DBUG_ASSERT(pfs_file->m_class != NULL); + + if (! flag_events_waits_current) + return NULL; + if (! pfs_file->m_class->m_enabled) + return NULL; + PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_file= pfs_file; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= pfs_file->m_class; + if (pfs_file->m_class->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_file; + pfs_locker->m_waits_current.m_object_name= pfs_file->m_filename; + pfs_locker->m_waits_current.m_object_name_length= + pfs_file->m_filename_length; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_operation= + file_operation_map[static_cast<int> (op)]; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_FILE; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_file_locker*> (pfs_locker); +} + +static PSI_file_locker* +get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) +{ + int index= static_cast<int> (file); + + DBUG_ASSERT(static_cast<int> (op) >= 0); + DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map)); + + if (! flag_events_waits_current) + return NULL; + if (likely((index >= 0) && (index < file_handle_max))) + { + PFS_file *pfs_file= file_handle_array[index]; + if (likely(pfs_file != NULL)) + { + PFS_thread *pfs_thread; + + /* + We are about to close a file by descriptor number, + and the calling code still holds the descriptor. + Cleanup the file descriptor <--> file instrument association. + Remove the instrumentation *before* the close to avoid race + conditions with another thread opening a file + (that could be given the same descriptor). + */ + if (op == PSI_FILE_CLOSE) + file_handle_array[index]= NULL; + + DBUG_ASSERT(pfs_file->m_class != NULL); + if (! pfs_file->m_class->m_enabled) + return NULL; + pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); + if (unlikely(pfs_thread == NULL)) + return NULL; + if (! pfs_thread->m_enabled) + return NULL; + if (unlikely(pfs_thread->m_wait_locker_count >= LOCKER_STACK_SIZE)) + { + locker_lost++; + return NULL; + } + PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack + [pfs_thread->m_wait_locker_count]; + pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + + pfs_locker->m_target.m_file= pfs_file; + pfs_locker->m_waits_current.m_thread= pfs_thread; + pfs_locker->m_waits_current.m_class= pfs_file->m_class; + if (pfs_file->m_class->m_timed) + { + pfs_locker->m_timer_name= wait_timer; + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_STARTING; + } + else + pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED; + pfs_locker->m_waits_current.m_object_instance_addr= pfs_file; + pfs_locker->m_waits_current.m_object_name= pfs_file->m_filename; + pfs_locker->m_waits_current.m_object_name_length= + pfs_file->m_filename_length; + pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++; + pfs_locker->m_waits_current.m_operation= + file_operation_map[static_cast<int> (op)]; + pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_FILE; + + pfs_thread->m_wait_locker_count++; + return reinterpret_cast<PSI_file_locker*> (pfs_locker); + } + } + return NULL; +} + +static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) +{ + PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex); + DBUG_ASSERT(pfs_mutex != NULL); + + /* + Note that this code is still protected by the instrumented mutex, + and therefore is thread safe. See inline_mysql_mutex_unlock(). + */ + + /* Always update the instrumented state */ + pfs_mutex->m_owner= NULL; + pfs_mutex->m_last_locked= 0; + +#ifdef LATER_WL2333 + /* + See WL#2333: SHOW ENGINE ... LOCK STATUS. + PFS_mutex::m_lock_stat is not exposed in user visible tables + currently, so there is no point spending time computing it. + */ + PFS_thread *pfs_thread= reinterpret_cast<PFS_thread*> (thread); + DBUG_ASSERT(pfs_thread != NULL); + + if (unlikely(! flag_events_waits_current)) + return; + if (! pfs_mutex->m_class->m_enabled) + return; + if (! pfs_thread->m_enabled) + return; + + if (pfs_mutex->m_class->m_timed) + { + ulonglong locked_time; + locked_time= get_timer_value(wait_timer) - pfs_mutex->m_last_locked; + aggregate_single_stat_chain(&pfs_mutex->m_lock_stat, locked_time); + } +#endif +} + +static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) +{ + PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock); + DBUG_ASSERT(pfs_rwlock != NULL); + bool last_writer= false; + bool last_reader= false; + + /* + Note that this code is still protected by the instrumented rwlock, + and therefore is: + - thread safe for write locks + - almost thread safe for read locks (pfs_rwlock->m_readers is unsafe). + See inline_mysql_rwlock_unlock() + */ + + /* Always update the instrumented state */ + if (pfs_rwlock->m_writer) + { + /* Nominal case, a writer is unlocking. */ + last_writer= true; + pfs_rwlock->m_writer= NULL; + /* Reset the readers stats, they could be off */ + pfs_rwlock->m_readers= 0; + } + else if (likely(pfs_rwlock->m_readers > 0)) + { + /* Nominal case, a reader is unlocking. */ + if (--(pfs_rwlock->m_readers) == 0) + last_reader= true; + } + else + { + /* + Edge case, we have no writer and no readers, + on an unlock event. + This is possible for: + - partial instrumentation + - instrumentation disabled at runtime, + see when get_thread_rwlock_locker_v1() returns NULL + No further action is taken here, the next + write lock will put the statistics is a valid state. + */ + } + +#ifdef LATER_WL2333 + /* See WL#2333: SHOW ENGINE ... LOCK STATUS. */ + PFS_thread *pfs_thread= reinterpret_cast<PFS_thread*> (thread); + DBUG_ASSERT(pfs_thread != NULL); + + if (unlikely(! flag_events_waits_current)) + return; + if (! pfs_rwlock->m_class->m_enabled) + return; + if (! pfs_thread->m_enabled) + return; + + ulonglong locked_time; + if (last_writer) + { + if (pfs_rwlock->m_class->m_timed) + { + locked_time= get_timer_value(wait_timer) - pfs_rwlock->m_last_written; + aggregate_single_stat_chain(&pfs_rwlock->m_write_lock_stat, locked_time); + } + } + else if (last_reader) + { + if (pfs_rwlock->m_class->m_timed) + { + locked_time= get_timer_value(wait_timer) - pfs_rwlock->m_last_read; + aggregate_single_stat_chain(&pfs_rwlock->m_read_lock_stat, locked_time); + } + } +#endif +} + +static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) +{ + PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); + DBUG_ASSERT(pfs_cond != NULL); + + pfs_cond->m_cond_stat.m_signal_count++; +} + +static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond) +{ + PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); + DBUG_ASSERT(pfs_cond != NULL); + + pfs_cond->m_cond_stat.m_broadcast_count++; +} + +static void start_mutex_wait_v1(PSI_mutex_locker* locker, + const char *src_file, uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + PFS_events_waits *wait= &pfs_locker->m_waits_current; + if (wait->m_timer_state == TIMER_STATE_STARTING) + { + wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_STARTED; + } + wait->m_source_file= src_file; + wait->m_source_line= src_line; +} + +static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + PFS_events_waits *wait= &pfs_locker->m_waits_current; + + if (wait->m_timer_state == TIMER_STATE_STARTED) + { + wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_TIMED; + } + if (flag_events_waits_history) + insert_events_waits_history(wait->m_thread, wait); + if (flag_events_waits_history_long) + insert_events_waits_history_long(wait); + + if (rc == 0) + { + /* Thread safe: we are protected by the instrumented mutex */ + PFS_single_stat_chain *stat; + PFS_mutex *mutex= pfs_locker->m_target.m_mutex; + mutex->m_owner= wait->m_thread; + mutex->m_last_locked= wait->m_timer_end; + + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time); + stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, + mutex->m_class); + aggregate_single_stat_chain(stat, wait_time); + } + wait->m_thread->m_wait_locker_count--; +} + +static void start_rwlock_rdwait_v1(PSI_rwlock_locker* locker, + const char *src_file, uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + PFS_events_waits *wait= &pfs_locker->m_waits_current; + if (wait->m_timer_state == TIMER_STATE_STARTING) + { + wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_STARTED; + } + wait->m_source_file= src_file; + wait->m_source_line= src_line; +} + +static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + PFS_events_waits *wait= &pfs_locker->m_waits_current; + + if (wait->m_timer_state == TIMER_STATE_STARTED) + { + wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_TIMED; + } + if (flag_events_waits_history) + insert_events_waits_history(wait->m_thread, wait); + if (flag_events_waits_history_long) + insert_events_waits_history_long(wait); + + if (rc == 0) + { + /* + Warning: + Multiple threads can execute this section concurrently + (since multiple readers can execute in parallel). + The statistics generated are not safe, which is why they are + just statistics, not facts. + */ + PFS_single_stat_chain *stat; + PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock; + if (rwlock->m_readers == 0) + rwlock->m_last_read= wait->m_timer_end; + rwlock->m_writer= NULL; + rwlock->m_readers++; + + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time); + stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, + rwlock->m_class); + aggregate_single_stat_chain(stat, wait_time); + } + wait->m_thread->m_wait_locker_count--; +} + +static void start_rwlock_wrwait_v1(PSI_rwlock_locker* locker, + const char *src_file, uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + PFS_events_waits *wait= &pfs_locker->m_waits_current; + if (wait->m_timer_state == TIMER_STATE_STARTING) + { + wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_STARTED; + } + wait->m_source_file= src_file; + wait->m_source_line= src_line; +} + +static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + PFS_events_waits *wait= &pfs_locker->m_waits_current; + + if (wait->m_timer_state == TIMER_STATE_STARTED) + { + wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_TIMED; + } + if (flag_events_waits_history) + insert_events_waits_history(wait->m_thread, wait); + if (flag_events_waits_history_long) + insert_events_waits_history_long(wait); + + if (rc == 0) + { + /* Thread safe : we are protected by the instrumented rwlock */ + PFS_single_stat_chain *stat; + PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock; + rwlock->m_writer= wait->m_thread; + rwlock->m_last_written= wait->m_timer_end; + /* Reset the readers stats, they could be off */ + rwlock->m_readers= 0; + rwlock->m_last_read= 0; + + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time); + stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, + rwlock->m_class); + aggregate_single_stat_chain(stat, wait_time); + } + wait->m_thread->m_wait_locker_count--; +} + +static void start_cond_wait_v1(PSI_cond_locker* locker, + const char *src_file, uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + PFS_events_waits *wait= &pfs_locker->m_waits_current; + if (wait->m_timer_state == TIMER_STATE_STARTING) + { + wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_STARTED; + } + wait->m_source_file= src_file; + wait->m_source_line= src_line; +} + +static void end_cond_wait_v1(PSI_cond_locker* locker, int rc) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + PFS_events_waits *wait= &pfs_locker->m_waits_current; + + if (wait->m_timer_state == TIMER_STATE_STARTED) + { + wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_TIMED; + } + if (flag_events_waits_history) + insert_events_waits_history(wait->m_thread, wait); + if (flag_events_waits_history_long) + insert_events_waits_history_long(wait); + + if (rc == 0) + { + /* + Not thread safe, race conditions will occur. + A first race condition is: + - thread 1 waits on cond A + - thread 2 waits on cond B + threads 1 and 2 compete when updating the same cond A + statistics, possibly missing a min / max / sum / count. + A second race condition is: + - thread 1 waits on cond A + - thread 2 destroys cond A + - thread 2 or 3 creates cond B in the same condition slot + thread 1 will then aggregate statistics about defunct A + in condition B. + This is accepted, the data will be slightly inaccurate. + */ + PFS_single_stat_chain *stat; + PFS_cond *cond= pfs_locker->m_target.m_cond; + + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&cond->m_wait_stat, wait_time); + stat= find_per_thread_cond_class_wait_stat(wait->m_thread, + cond->m_class); + aggregate_single_stat_chain(stat, wait_time); + } + wait->m_thread->m_wait_locker_count--; +} + +static void start_table_wait_v1(PSI_table_locker* locker, + const char *src_file, uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + PFS_events_waits *wait= &pfs_locker->m_waits_current; + if (wait->m_timer_state == TIMER_STATE_STARTING) + { + wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_STARTED; + } + wait->m_source_file= src_file; + wait->m_source_line= src_line; + wait->m_operation= OPERATION_TYPE_LOCK; + PFS_table_share *share= pfs_locker->m_target.m_table->m_share; + wait->m_schema_name= share->m_schema_name; + wait->m_schema_name_length= share->m_schema_name_length; + wait->m_object_name= share->m_table_name; + wait->m_object_name_length= share->m_table_name_length; +} + +static void end_table_wait_v1(PSI_table_locker* locker) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + PFS_events_waits *wait= &pfs_locker->m_waits_current; + + if (wait->m_timer_state == TIMER_STATE_STARTED) + { + wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_TIMED; + } + if (flag_events_waits_history) + insert_events_waits_history(wait->m_thread, wait); + if (flag_events_waits_history_long) + insert_events_waits_history_long(wait); + + PFS_table *table= pfs_locker->m_target.m_table; + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&table->m_wait_stat, wait_time); + + /* + There is currently no per table and per thread aggregation. + The number of tables in the application is arbitrary, and may be high. + The number of slots per thread to hold aggregates is fixed, + and is constrained by memory. + Implementing a per thread and per table aggregate has not been + decided yet. + If it's implemented, it's likely that the user will have to specify, + per table name, if the aggregate per thread is to be computed or not. + This will mean a SETUP_ table. + */ + wait->m_thread->m_wait_locker_count--; +} + +static void start_file_wait_v1(PSI_file_locker *locker, + size_t count, + const char *src_file, + uint src_line); + +static void end_file_wait_v1(PSI_file_locker *locker, + size_t count); + +static PSI_file* start_file_open_wait_v1(PSI_file_locker *locker, + const char *src_file, + uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + start_file_wait_v1(locker, 0, src_file, src_line); + + PFS_file *pfs_file= pfs_locker->m_target.m_file; + return reinterpret_cast<PSI_file*> (pfs_file); +} + +static void end_file_open_wait_v1(PSI_file_locker *locker) +{ + end_file_wait_v1(locker, 0); +} + +static void end_file_open_wait_and_bind_to_descriptor_v1 + (PSI_file_locker *locker, File file) +{ + int index= (int) file; + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + end_file_wait_v1(locker, 0); + + PFS_file *pfs_file= pfs_locker->m_target.m_file; + DBUG_ASSERT(pfs_file != NULL); + + if (likely(index >= 0)) + { + if (likely(index < file_handle_max)) + file_handle_array[index]= pfs_file; + else + file_handle_lost++; + } + else + release_file(pfs_file); +} + +static void start_file_wait_v1(PSI_file_locker *locker, + size_t count, + const char *src_file, + uint src_line) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + + PFS_events_waits *wait= &pfs_locker->m_waits_current; + if (wait->m_timer_state == TIMER_STATE_STARTING) + { + wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_STARTED; + } + wait->m_source_file= src_file; + wait->m_source_line= src_line; + wait->m_number_of_bytes= count; +} + +static void end_file_wait_v1(PSI_file_locker *locker, + size_t count) +{ + PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker); + DBUG_ASSERT(pfs_locker != NULL); + PFS_events_waits *wait= &pfs_locker->m_waits_current; + + wait->m_number_of_bytes= count; + if (wait->m_timer_state == TIMER_STATE_STARTED) + { + wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name); + wait->m_timer_state= TIMER_STATE_TIMED; + } + if (flag_events_waits_history) + insert_events_waits_history(wait->m_thread, wait); + if (flag_events_waits_history_long) + insert_events_waits_history_long(wait); + + PFS_single_stat_chain *stat; + PFS_file *file= pfs_locker->m_target.m_file; + + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&file->m_wait_stat, wait_time); + stat= find_per_thread_file_class_wait_stat(wait->m_thread, + file->m_class); + aggregate_single_stat_chain(stat, wait_time); + + PFS_file_class *klass= file->m_class; + + switch(wait->m_operation) + { + case OPERATION_TYPE_FILEREAD: + file->m_file_stat.m_count_read++; + file->m_file_stat.m_read_bytes+= count; + klass->m_file_stat.m_count_read++; + klass->m_file_stat.m_read_bytes+= count; + break; + case OPERATION_TYPE_FILEWRITE: + file->m_file_stat.m_count_write++; + file->m_file_stat.m_write_bytes+= count; + klass->m_file_stat.m_count_write++; + klass->m_file_stat.m_write_bytes+= count; + break; + case OPERATION_TYPE_FILECLOSE: + case OPERATION_TYPE_FILESTREAMCLOSE: + case OPERATION_TYPE_FILESTAT: + release_file(pfs_locker->m_target.m_file); + break; + case OPERATION_TYPE_FILEDELETE: + destroy_file(wait->m_thread, pfs_locker->m_target.m_file); + break; + default: + break; + } + + wait->m_thread->m_wait_locker_count--; +} + +PSI_v1 PFS_v1= +{ + register_mutex_v1, + register_rwlock_v1, + register_cond_v1, + register_thread_v1, + register_file_v1, + init_mutex_v1, + destroy_mutex_v1, + init_rwlock_v1, + destroy_rwlock_v1, + init_cond_v1, + destroy_cond_v1, + get_table_share_v1, + release_table_share_v1, + open_table_v1, + close_table_v1, + create_file_v1, + spawn_thread_v1, + new_thread_v1, + set_thread_id_v1, + get_thread_v1, + set_thread_v1, + delete_current_thread_v1, + get_thread_mutex_locker_v1, + get_thread_rwlock_locker_v1, + get_thread_cond_locker_v1, + get_thread_table_locker_v1, + get_thread_file_name_locker_v1, + get_thread_file_stream_locker_v1, + get_thread_file_descriptor_locker_v1, + unlock_mutex_v1, + unlock_rwlock_v1, + signal_cond_v1, + broadcast_cond_v1, + start_mutex_wait_v1, + end_mutex_wait_v1, + start_rwlock_rdwait_v1, + end_rwlock_rdwait_v1, + start_rwlock_wrwait_v1, + end_rwlock_wrwait_v1, + start_cond_wait_v1, + end_cond_wait_v1, + start_table_wait_v1, + end_table_wait_v1, + start_file_open_wait_v1, + end_file_open_wait_v1, + end_file_open_wait_and_bind_to_descriptor_v1, + start_file_wait_v1, + end_file_wait_v1 +}; + +static void* get_interface(int version) +{ + switch (version) + { + case PSI_VERSION_1: + return &PFS_v1; + default: + return NULL; + } +} + +struct PSI_bootstrap PFS_bootstrap= +{ + get_interface +}; + diff --git a/storage/perfschema/pfs.h b/storage/perfschema/pfs.h new file mode 100644 index 00000000000..7af59ffce57 --- /dev/null +++ b/storage/perfschema/pfs.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_H +#define PFS_H + +/** + @file storage/perfschema/pfs.h + Performance schema instrumentation (declarations). +*/ + +#define HAVE_PSI_1 + +#include <mysql_priv.h> +#include <mysql/psi/psi.h> + +extern struct PSI_bootstrap PFS_bootstrap; +extern pthread_key(PFS_thread*, THR_PFS); +extern bool THR_PFS_initialized; + +#endif + diff --git a/storage/perfschema/pfs_atomic.cc b/storage/perfschema/pfs_atomic.cc new file mode 100644 index 00000000000..c33bb251767 --- /dev/null +++ b/storage/perfschema/pfs_atomic.cc @@ -0,0 +1,78 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_atomic.cc + Atomic operations (implementation). +*/ + +#include <my_global.h> +#include <my_pthread.h> +#include "pfs_atomic.h" + +/* + Using SAFE_MUTEX is impossible, because of recursion. + - code locks mutex X + - P_S records the event + - P_S needs an atomic counter A + - safe mutex called for m_mutex[hash(A)] + - safe mutex allocates/free memory + - safe mutex locks THR_LOCK_malloc + - P_S records the event + - P_S needs an atomic counter B + - safe mutex called for m_mutex[hash(B)] + + When hash(A) == hash(B), safe_mutex complains rightly that + the mutex is already locked. + In some cases, A == B, in particular for events_waits_history_long_index. + + In short, the implementation of PFS_atomic should not cause events + to be recorded in the performance schema. + + Also, because SAFE_MUTEX redefines pthread_mutex_t, etc, + this code is not inlined in pfs_atomic.h, but located here in pfs_atomic.cc. + + What is needed is a plain, unmodified, pthread_mutex_t. + This is provided by my_atomic_rwlock_t. +*/ + +/** + Internal rwlock array. + Using a single rwlock for all atomic operations would be a bottleneck. + Using a rwlock per performance schema structure would be too costly in + memory, and use too many rwlock. + The PFS_atomic implementation computes a hash value from the + atomic variable, to spread the bottleneck across 256 buckets, + while still providing --transparently for the caller-- an atomic + operation. +*/ +my_atomic_rwlock_t PFS_atomic::m_rwlock_array[256]; + +void PFS_atomic::init(void) +{ + uint i; + + for (i=0; i< array_elements(m_rwlock_array); i++) + my_atomic_rwlock_init(&m_rwlock_array[i]); +} + +void PFS_atomic::cleanup(void) +{ + uint i; + + for (i=0; i< array_elements(m_rwlock_array); i++) + my_atomic_rwlock_destroy(&m_rwlock_array[i]); +} + diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h new file mode 100644 index 00000000000..7833c5f1c7a --- /dev/null +++ b/storage/perfschema/pfs_atomic.h @@ -0,0 +1,148 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_ATOMIC_H +#define PFS_ATOMIC_H + +/** + @file storage/perfschema/pfs_atomic.h + Atomic operations (declarations). +*/ + +#include <my_atomic.h> + +/** Helper for atomic operations. */ +class PFS_atomic +{ +public: + static void init(); + static void cleanup(); + + /** Atomic load. */ + static inline int32 load_32(volatile int32 *ptr) + { + int32 result; + rdlock(ptr); + result= my_atomic_load32(ptr); + rdunlock(ptr); + return result; + } + + /** Atomic load. */ + static inline uint32 load_u32(volatile uint32 *ptr) + { + uint32 result; + rdlock(ptr); + result= (uint32) my_atomic_load32((int32*) ptr); + rdunlock(ptr); + return result; + } + + /** Atomic store. */ + static inline void store_32(volatile int32 *ptr, int32 value) + { + wrlock(ptr); + my_atomic_store32(ptr, value); + wrunlock(ptr); + } + + /** Atomic store. */ + static inline void store_u32(volatile uint32 *ptr, uint32 value) + { + wrlock(ptr); + my_atomic_store32((int32*) ptr, (int32) value); + wrunlock(ptr); + } + + /** Atomic add. */ + static inline int32 add_32(volatile int32 *ptr, int32 value) + { + int32 result; + wrlock(ptr); + result= my_atomic_add32(ptr, value); + wrunlock(ptr); + return result; + } + + /** Atomic add. */ + static inline uint32 add_u32(volatile uint32 *ptr, uint32 value) + { + uint32 result; + wrlock(ptr); + result= (uint32) my_atomic_add32((int32*) ptr, (int32) value); + wrunlock(ptr); + return result; + } + + /** Atomic compare and swap. */ + static inline bool cas_32(volatile int32 *ptr, int32 *old_value, + int32 new_value) + { + bool result; + wrlock(ptr); + result= my_atomic_cas32(ptr, old_value, new_value); + wrunlock(ptr); + return result; + } + + /** Atomic compare and swap. */ + static inline bool cas_u32(volatile uint32 *ptr, uint32 *old_value, + uint32 new_value) + { + bool result; + wrlock(ptr); + result= my_atomic_cas32((int32*) ptr, (int32*) old_value, + (uint32) new_value); + wrunlock(ptr); + return result; + } + +private: + static my_atomic_rwlock_t m_rwlock_array[256]; + + static inline my_atomic_rwlock_t *get_rwlock(volatile void *ptr) + { + /* + Divide an address by 8 to remove alignment, + modulo 256 to fall in the array. + */ + uint index= (((intptr) ptr) >> 3) & 0xFF; + my_atomic_rwlock_t *result= &m_rwlock_array[index]; + return result; + } + + static inline void rdlock(volatile void *ptr) + { + my_atomic_rwlock_rdlock(get_rwlock(ptr)); + } + + static inline void wrlock(volatile void *ptr) + { + my_atomic_rwlock_wrlock(get_rwlock(ptr)); + } + + static inline void rdunlock(volatile void *ptr) + { + my_atomic_rwlock_rdunlock(get_rwlock(ptr)); + } + + static inline void wrunlock(volatile void *ptr) + { + my_atomic_rwlock_wrunlock(get_rwlock(ptr)); + } +}; + +#endif + diff --git a/storage/perfschema/pfs_check.cc b/storage/perfschema/pfs_check.cc new file mode 100644 index 00000000000..5d3746d371c --- /dev/null +++ b/storage/perfschema/pfs_check.cc @@ -0,0 +1,62 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_check.cc + Check the performance schema table structure. + The code in this file is implemented in pfs_check.cc + instead of pfs_server.cc, to separate dependencies to server + structures (THD, ...) in a dedicated file. + This code organization helps a lot maintenance of the unit tests. +*/ + +#include "my_global.h" +#include "mysql_priv.h" +#include "pfs_server.h" +#include "pfs_engine_table.h" + +/* +*/ + +/** + Check that the performance schema tables + have the expected structure. + Discrepancies are written in the server log, + but are not considered fatal, so this function does not + return an error code: + - some differences are compatible, and should not cause a failure + - some differences are not compatible, but then the DBA needs an operational + server to be able to DROP+CREATE the tables with the proper structure, + as part of the initial server installation or during an upgrade. + In case of discrepancies, later attempt to perform DML against + the performance schema will be rejected with an error. +*/ +void check_performance_schema() +{ + DBUG_ENTER("check_performance_schema"); + + THD *thd= new THD(); + if (thd == NULL) + DBUG_VOID_RETURN; + + thd->thread_stack= (char*) &thd; + thd->store_globals(); + + PFS_engine_table_share::check_all_tables(thd); + + delete thd; + DBUG_VOID_RETURN; +} + diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h new file mode 100644 index 00000000000..c6f652d57a0 --- /dev/null +++ b/storage/perfschema/pfs_column_types.h @@ -0,0 +1,119 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_COLUMN_TYPES_H +#define PFS_COLUMN_TYPES_H + +/** + @file storage/perfschema/pfs_column_types.h + Data types for columns used in the performance schema tables (declarations) +*/ + +/** Size of the OBJECT_SCHEMA columns. */ +#define COL_OBJECT_SCHEMA_SIZE 64 + +/** + Size of the extended OBJECT_NAME columns. + 'Extended' columns are used when the object name also represents + the name of a non SQL object, such as a file name. + Size in bytes of: + - performance_schema.events_waits_current (OBJECT_NAME) + - performance_schema.events_waits_history (OBJECT_NAME) + - performance_schema.events_waits_history_long (OBJECT_NAME) +*/ +#define COL_OBJECT_NAME_EXTENDED_SIZE 512 + +/** Size of the OBJECT_NAME columns. */ +#define COL_OBJECT_NAME_SIZE 64 + +/** Size of the SOURCE columns. */ +#define COL_SOURCE_SIZE 64 + +/** + Enum values for the TIMER_NAME columns. + This enum is found in the following tables: + - performance_schema.setup_timer (TIMER_NAME) + - performance_schema.performance_timer (TIMER_NAME) +*/ +enum enum_timer_name +{ + TIMER_NAME_CYCLE= 1, + TIMER_NAME_NANOSEC= 2, + TIMER_NAME_MICROSEC= 3, + TIMER_NAME_MILLISEC= 4, + TIMER_NAME_TICK= 5 +}; + +#define FIRST_TIMER_NAME (static_cast<int> (TIMER_NAME_CYCLE)) +#define LAST_TIMER_NAME (static_cast<int> (TIMER_NAME_TICK)) +#define COUNT_TIMER_NAME (LAST_TIMER_NAME - FIRST_TIMER_NAME + 1) + +/** + Enum values for the various YES/NO columns. + This enum is found in the following tables: + - performance_schema.setup_instruments (ENABLED) + - performance_schema.setup_instruments (TIMED) + - performance_schema.setup_consumers (ENABLED) +*/ +enum enum_yes_no +{ + ENUM_YES= 1, + ENUM_NO= 2 +}; + +/** + Enum values for the various OPERATION columns. + This enum is found in the following tables: + - performance_schema.events_waits_current (OPERATION) + - performance_schema.events_waits_history (OPERATION) + - performance_schema.events_waits_history_long (OPERATION) +*/ +enum enum_operation_type +{ + OPERATION_TYPE_LOCK= 1, + OPERATION_TYPE_TRYLOCK= 2, + + OPERATION_TYPE_READLOCK= 3, + OPERATION_TYPE_WRITELOCK= 4, + OPERATION_TYPE_TRYREADLOCK= 5, + OPERATION_TYPE_TRYWRITELOCK= 6, + + OPERATION_TYPE_WAIT= 7, + OPERATION_TYPE_TIMEDWAIT= 8, + + OPERATION_TYPE_FILECREATE= 9, + OPERATION_TYPE_FILECREATETMP= 10, + OPERATION_TYPE_FILEOPEN= 11, + OPERATION_TYPE_FILESTREAMOPEN= 12, + OPERATION_TYPE_FILECLOSE= 13, + OPERATION_TYPE_FILESTREAMCLOSE= 14, + OPERATION_TYPE_FILEREAD= 15, + OPERATION_TYPE_FILEWRITE= 16, + OPERATION_TYPE_FILESEEK= 17, + OPERATION_TYPE_FILETELL= 18, + OPERATION_TYPE_FILEFLUSH= 19, + OPERATION_TYPE_FILESTAT= 20, + OPERATION_TYPE_FILEFSTAT= 21, + OPERATION_TYPE_FILECHSIZE= 22, + OPERATION_TYPE_FILEDELETE= 23, + OPERATION_TYPE_FILERENAME= 24, + OPERATION_TYPE_FILESYNC= 25 +}; +#define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK)) +#define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_FILESYNC)) +#define COUNT_OPERATION_TYPE (LAST_OPERATION_TYPE - FIRST_OPERATION_TYPE + 1) + +#endif + diff --git a/storage/perfschema/pfs_column_values.cc b/storage/perfschema/pfs_column_values.cc new file mode 100644 index 00000000000..3143cd97e5d --- /dev/null +++ b/storage/perfschema/pfs_column_values.cc @@ -0,0 +1,42 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_column_values.cc + Literal values for columns used in the performance + schema tables (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_column_values.h" + +LEX_STRING PERFORMANCE_SCHEMA_str= +{ C_STRING_WITH_LEN("performance_schema") }; + +LEX_STRING mutex_instrument_prefix= +{ C_STRING_WITH_LEN("wait/synch/mutex/") }; + +LEX_STRING rwlock_instrument_prefix= +{ C_STRING_WITH_LEN("wait/synch/rwlock/") }; + +LEX_STRING cond_instrument_prefix= +{ C_STRING_WITH_LEN("wait/synch/cond/") }; + +LEX_STRING thread_instrument_prefix= +{ C_STRING_WITH_LEN("thread/") }; + +LEX_STRING file_instrument_prefix= +{ C_STRING_WITH_LEN("wait/io/file/") }; + diff --git a/storage/perfschema/pfs_column_values.h b/storage/perfschema/pfs_column_values.h new file mode 100644 index 00000000000..6cd2e8687d1 --- /dev/null +++ b/storage/perfschema/pfs_column_values.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_COLUMN_VALUES_H +#define PFS_COLUMN_VALUES_H + +/** + @file storage/perfschema/pfs_column_values.h + Literal values for columns used in the + performance schema tables (declarations). +*/ + +extern LEX_STRING PERFORMANCE_SCHEMA_str; + +extern LEX_STRING mutex_instrument_prefix; +extern LEX_STRING rwlock_instrument_prefix; +extern LEX_STRING cond_instrument_prefix; +extern LEX_STRING thread_instrument_prefix; +extern LEX_STRING file_instrument_prefix; + +#endif + diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc new file mode 100644 index 00000000000..fe6783e10eb --- /dev/null +++ b/storage/perfschema/pfs_engine_table.cc @@ -0,0 +1,719 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_engine_table.cc + Performance schema tables (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_engine_table.h" + +#include "table_events_waits.h" +#include "table_setup_consumers.h" +#include "table_setup_instruments.h" +#include "table_setup_objects.h" +#include "table_setup_timers.h" +#include "table_performance_timers.h" +#include "table_processlist.h" +#include "table_events_waits_summary.h" +#include "table_sync_instances.h" +#include "table_file_instances.h" +#include "table_file_summary.h" + +/* For show status */ +#include "pfs_column_values.h" +#include "pfs_instr.h" + +/** + @addtogroup Performance_schema_engine + @{ +*/ + +static PFS_engine_table_share *all_shares[]= +{ + &table_events_waits_current::m_share, + &table_events_waits_history::m_share, + &table_events_waits_history_long::m_share, + &table_setup_consumers::m_share, + &table_setup_instruments::m_share, + &table_setup_objects::m_share, + &table_setup_timers::m_share, + &table_performance_timers::m_share, + &table_processlist::m_share, + &table_events_waits_summary_by_thread_by_event_name::m_share, + &table_events_waits_summary_by_event_name::m_share, + &table_events_waits_summary_by_instance::m_share, + &table_file_summary_by_event_name::m_share, + &table_file_summary_by_instance::m_share, + &table_mutex_instances::m_share, + &table_rwlock_instances::m_share, + &table_cond_instances::m_share, + &table_file_instances::m_share, + NULL +}; + +/** + Check all the tables structure. + @param thd current thread +*/ +void PFS_engine_table_share::check_all_tables(THD *thd) +{ + PFS_engine_table_share **current; + + DBUG_EXECUTE_IF("tampered_perfschema_table1", + { + /* Hack SETUP_INSTRUMENT, incompatible change. */ + all_shares[4]->m_field_def->count++; + }); + + for (current= &all_shares[0]; (*current) != NULL; current++) + (*current)->check_one_table(thd); +} + +class PFS_check_intact : public Table_check_intact +{ +protected: + virtual void report_error(uint code, const char *fmt, ...); + +public: + PFS_check_intact() + {} + + ~PFS_check_intact() + {} +}; + +void PFS_check_intact::report_error(uint code, const char *fmt, ...) +{ + va_list args; + char buff[MYSQL_ERRMSG_SIZE]; + + va_start(args, fmt); + my_vsnprintf(buff, sizeof(buff), fmt, args); + va_end(args); + + my_message(code, buff, MYF(0)); +} + +/** + Check integrity of the actual table schema. + The actual table schema (.frm) is compared to the expected schema. + @param thd current thread +*/ +void PFS_engine_table_share::check_one_table(THD *thd) +{ + TABLE_LIST tables; + + tables.init_one_table(PERFORMANCE_SCHEMA_str.str, + PERFORMANCE_SCHEMA_str.length, + m_name.str, m_name.length, + m_name.str, TL_READ); + + /* Work around until Bug#32115 is backported. */ + LEX dummy_lex; + LEX *old_lex= thd->lex; + thd->lex= &dummy_lex; + lex_start(thd); + + if (! simple_open_n_lock_tables(thd, &tables)) + { + PFS_check_intact checker; + + if (!checker.check(tables.table, m_field_def)) + m_checked= true; + close_thread_tables(thd); + } + + lex_end(&dummy_lex); + thd->lex= old_lex; +} + +/** Initialize all the table share locks. */ +void PFS_engine_table_share::init_all_locks(void) +{ + PFS_engine_table_share **current; + + for (current= &all_shares[0]; (*current) != NULL; current++) + thr_lock_init((*current)->m_thr_lock_ptr); +} + +/** Delete all the table share locks. */ +void PFS_engine_table_share::delete_all_locks(void) +{ + PFS_engine_table_share **current; + + for (current= &all_shares[0]; (*current) != NULL; current++) + thr_lock_delete((*current)->m_thr_lock_ptr); +} + +static int compare_table_names(const char *name1, const char *name2) +{ + /* + The performance schema is implemented as a storage engine, in memory. + The current storage engine interface exposed by the server, + and in particular handlerton::discover, uses 'FRM' files to describe a + table structure, which are later stored on disk, by the server, + in ha_create_table_from_engine(). + Because the table metadata is stored on disk, the table naming rules + used by the performance schema then have to comply with the constraints + imposed by the disk storage, and in particular with lower_case_table_names. + Once the server is changed to be able to discover a table in a storage engine + and then open the table without storing a FRM file on disk, this constraint + on the performance schema will be lifted, and the naming logic can be relaxed + to be simply my_strcasecmp(system_charset_info, name1, name2). + */ + if (lower_case_table_names) + return strcasecmp(name1, name2); + return strcmp(name1, name2); +} + +/** + Find a table share by name. + @param name The table name + @return table share +*/ +const PFS_engine_table_share* +PFS_engine_table::find_engine_table_share(const char *name) +{ + DBUG_ENTER("PFS_engine_table::find_table_share"); + + PFS_engine_table_share **current; + + for (current= &all_shares[0]; (*current) != NULL; current++) + { + if (compare_table_names(name, (*current)->m_name.str) == 0) + DBUG_RETURN(*current); + } + + DBUG_RETURN(NULL); +} + +/** + Read a table row. + @param table Table handle + @param buf Row buffer + @param fields Table fields + @return 0 on success +*/ +int PFS_engine_table::read_row(TABLE *table, + unsigned char *buf, + Field **fields) +{ + my_bitmap_map *org_bitmap; + + /* + Make sure the table structure is as expected before mapping + hard wired columns in read_row_values. + */ + if (! m_share_ptr->m_checked) + { + my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), + PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name); + return HA_ERR_TABLE_NEEDS_UPGRADE; + } + + /* We must read all columns in case a table is opened for update */ + bool read_all= !bitmap_is_clear_all(table->write_set); + + /* We internally write to Fields to support the read interface */ + org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); + int result= read_row_values(table, buf, fields, read_all); + dbug_tmp_restore_column_map(table->write_set, org_bitmap); + + return result; +} + +/** + Update a table row. + @param table Table handle + @param old_buf old row buffer + @param new_buf new row buffer + @param fields Table fields + @return 0 on success +*/ +int PFS_engine_table::update_row(TABLE *table, + const unsigned char *old_buf, + unsigned char *new_buf, + Field **fields) +{ + my_bitmap_map *org_bitmap; + + /* + Make sure the table structure is as expected before mapping + hard wired columns in update_row_values. + */ + if (! m_share_ptr->m_checked) + { + my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), + PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name); + return HA_ERR_TABLE_NEEDS_UPGRADE; + } + + /* We internally read from Fields to support the write interface */ + org_bitmap= dbug_tmp_use_all_columns(table, table->read_set); + int result= update_row_values(table, old_buf, new_buf, fields); + dbug_tmp_restore_column_map(table->read_set, org_bitmap); + + return result; +} + +/** + Get the position of the current row. + @param [out] ref position +*/ +void PFS_engine_table::get_position(void *ref) +{ + memcpy(ref, m_pos_ptr, m_share_ptr->m_ref_length); +} + +/** + Set the table cursor at a given position. + @param [in] ref position +*/ +void PFS_engine_table::set_position(const void *ref) +{ + memcpy(m_pos_ptr, ref, m_share_ptr->m_ref_length); +} + +void PFS_engine_table::set_field_ulong(Field *f, ulong value) +{ + DBUG_ASSERT(f->real_type() == MYSQL_TYPE_LONG); + Field_long *f2= (Field_long*) f; + f2->store(value, true); +} + +void PFS_engine_table::set_field_ulonglong(Field *f, ulonglong value) +{ + DBUG_ASSERT(f->real_type() == MYSQL_TYPE_LONGLONG); + Field_longlong *f2= (Field_longlong*) f; + f2->store(value, true); +} + +void PFS_engine_table::set_field_varchar_utf8(Field *f, const char* str, + uint len) +{ + DBUG_ASSERT(f->real_type() == MYSQL_TYPE_VARCHAR); + Field_varstring *f2= (Field_varstring*) f; + f2->store(str, len, &my_charset_utf8_bin); +} + +void PFS_engine_table::set_field_enum(Field *f, ulonglong value) +{ + DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM); + Field_enum *f2= (Field_enum*) f; + f2->store_type(value); +} + +ulonglong PFS_engine_table::get_field_enum(Field *f) +{ + DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM); + Field_enum *f2= (Field_enum*) f; + return f2->val_int(); +} + +int PFS_readonly_table::update_row_values(TABLE *, + const unsigned char *, + unsigned char *, + Field **) +{ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + return HA_ERR_WRONG_COMMAND; +} + +class PFS_internal_schema_access : public ACL_internal_schema_access +{ +public: + PFS_internal_schema_access() + {} + + ~PFS_internal_schema_access() + {} + + ACL_internal_access_result check(ulong want_access, + ulong *save_priv) const; + + const ACL_internal_table_access *lookup(const char *name) const; +}; + +ACL_internal_access_result +PFS_internal_schema_access::check(ulong want_access, + ulong *save_priv) const +{ + const ulong always_forbidden= /* CREATE_ACL | */ REFERENCES_ACL + | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | EXECUTE_ACL + | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | ALTER_PROC_ACL + | EVENT_ACL | TRIGGER_ACL ; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + /* + Proceed with regular grant tables, + to give administrative control to the DBA. + */ + return ACL_INTERNAL_ACCESS_CHECK_GRANT; +} + +const ACL_internal_table_access * +PFS_internal_schema_access::lookup(const char *name) const +{ + const PFS_engine_table_share* share; + share= PFS_engine_table::find_engine_table_share(name); + if (share) + return share->m_acl; + /* + Do not return NULL, it would mean we are not interested + in privilege checks for unknown tables. + Instead, return an object that denies every actions, + to prevent users for creating their own tables in the + performance_schema database schema. + */ + return &pfs_unknown_acl; +} + +PFS_internal_schema_access pfs_internal_access; + +void initialize_performance_schema_acl(bool bootstrap) +{ + /* + ACL is always enforced, even if the performance schema + is not enabled (the tables are still visible). + */ + if (! bootstrap) + { + ACL_internal_schema_registry::register_schema(&PERFORMANCE_SCHEMA_str, + &pfs_internal_access); + } +} + +PFS_readonly_acl pfs_readonly_acl; + +ACL_internal_access_result +PFS_readonly_acl::check(ulong want_access, ulong *save_priv) const +{ + const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL + | /* CREATE_ACL | */ REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | SHOW_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + return ACL_INTERNAL_ACCESS_CHECK_GRANT; +} + +PFS_truncatable_acl pfs_truncatable_acl; + +ACL_internal_access_result +PFS_truncatable_acl::check(ulong want_access, ulong *save_priv) const +{ + const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL + | /* CREATE_ACL | */ REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | SHOW_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + return ACL_INTERNAL_ACCESS_CHECK_GRANT; +} + +PFS_updatable_acl pfs_updatable_acl; + +ACL_internal_access_result +PFS_updatable_acl::check(ulong want_access, ulong *save_priv) const +{ + const ulong always_forbidden= INSERT_ACL | DELETE_ACL + | /* CREATE_ACL | */ REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | SHOW_VIEW_ACL | TRIGGER_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + return ACL_INTERNAL_ACCESS_CHECK_GRANT; +} + +PFS_editable_acl pfs_editable_acl; + +ACL_internal_access_result +PFS_editable_acl::check(ulong want_access, ulong *save_priv) const +{ + const ulong always_forbidden= /* CREATE_ACL | */ REFERENCES_ACL + | INDEX_ACL | ALTER_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | TRIGGER_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + return ACL_INTERNAL_ACCESS_CHECK_GRANT; +} + +PFS_unknown_acl pfs_unknown_acl; + +ACL_internal_access_result +PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const +{ + return ACL_INTERNAL_ACCESS_DENIED; +} + +/** + SHOW ENGINE PERFORMANCE_SCHEMA STATUS. + @param hton Storage engine handler + @param thd Current thread + @param print Print function + @param stat status to show +*/ +bool pfs_show_status(handlerton *hton, THD *thd, + stat_print_fn *print, enum ha_stat_type stat) +{ + char buf[1024]; + uint buflen; + const char *name; + int i; + uint size; + + DBUG_ENTER("pfs_show_status"); + + /* + Note about naming conventions: + - Internal buffers exposed as a table in the performance schema are named + after the table, as in 'EVENTS_WAITS_CURRENT' + - Internal buffers not exposed by a table are named with parenthesis, + as in '(PFS_MUTEX_CLASS)'. + */ + if (stat != HA_ENGINE_STATUS) + DBUG_RETURN(false); + + uint total_memory= 0; + + for (i=0; /* empty */; i++) + { + switch (i){ + case 0: + name= "EVENTS_WAITS_CURRENT.ROW_SIZE"; + size= sizeof(PFS_wait_locker); + break; + case 1: + name= "EVENTS_WAITS_CURRENT.ROW_COUNT"; + size= LOCKER_STACK_SIZE * thread_max; + break; + case 2: + name= "EVENTS_WAITS_HISTORY.ROW_SIZE"; + size= sizeof(PFS_events_waits); + break; + case 3: + name= "EVENTS_WAITS_HISTORY.ROW_COUNT"; + size= events_waits_history_per_thread * thread_max; + break; + case 4: + name= "EVENTS_WAITS_HISTORY.MEMORY"; + size= events_waits_history_per_thread * thread_max + * sizeof(PFS_events_waits); + total_memory+= size; + break; + case 5: + name= "EVENTS_WAITS_HISTORY_LONG.ROW_SIZE"; + size= sizeof(PFS_events_waits); + break; + case 6: + name= "EVENTS_WAITS_HISTORY_LONG.ROW_COUNT"; + size= events_waits_history_long_size; + break; + case 7: + name= "EVENTS_WAITS_HISTORY_LONG.MEMORY"; + size= events_waits_history_long_size * sizeof(PFS_events_waits); + total_memory+= size; + break; + case 8: + name= "(PFS_MUTEX_CLASS).ROW_SIZE"; + size= sizeof(PFS_mutex_class); + break; + case 9: + name= "(PFS_MUTEX_CLASS).ROW_COUNT"; + size= mutex_class_max; + break; + case 10: + name= "(PFS_MUTEX_CLASS).MEMORY"; + size= mutex_class_max * sizeof(PFS_mutex_class); + total_memory+= size; + break; + case 11: + name= "(PFS_RWLOCK_CLASS).ROW_SIZE"; + size= sizeof(PFS_rwlock_class); + break; + case 12: + name= "(PFS_RWLOCK_CLASS).ROW_COUNT"; + size= rwlock_class_max; + break; + case 13: + name= "(PFS_RWLOCK_CLASS).MEMORY"; + size= rwlock_class_max * sizeof(PFS_rwlock_class); + total_memory+= size; + break; + case 14: + name= "(PFS_COND_CLASS).ROW_SIZE"; + size= sizeof(PFS_cond_class); + break; + case 15: + name= "(PFS_COND_CLASS).ROW_COUNT"; + size= cond_class_max; + break; + case 16: + name= "(PFS_COND_CLASS).MEMORY"; + size= cond_class_max * sizeof(PFS_cond_class); + total_memory+= size; + break; + case 17: + name= "(PFS_THREAD_CLASS).ROW_SIZE"; + size= sizeof(PFS_thread_class); + break; + case 18: + name= "(PFS_THREAD_CLASS).ROW_COUNT"; + size= thread_class_max; + break; + case 19: + name= "(PFS_THREAD_CLASS).MEMORY"; + size= thread_class_max * sizeof(PFS_thread_class); + total_memory+= size; + break; + case 20: + name= "(PFS_FILE_CLASS).ROW_SIZE"; + size= sizeof(PFS_file_class); + break; + case 21: + name= "(PFS_FILE_CLASS).ROW_COUNT"; + size= file_class_max; + break; + case 22: + name= "(PFS_FILE_CLASS).MEMORY"; + size= file_class_max * sizeof(PFS_file_class); + total_memory+= size; + break; + case 23: + name= "MUTEX_INSTANCES.ROW_SIZE"; + size= sizeof(PFS_mutex); + break; + case 24: + name= "MUTEX_INSTANCES.ROW_COUNT"; + size= mutex_max; + break; + case 25: + name= "MUTEX_INSTANCES.MEMORY"; + size= mutex_max * sizeof(PFS_mutex); + total_memory+= size; + break; + case 26: + name= "RWLOCK_INSTANCES.ROW_SIZE"; + size= sizeof(PFS_rwlock); + break; + case 27: + name= "RWLOCK_INSTANCES.ROW_COUNT"; + size= rwlock_max; + break; + case 28: + name= "RWLOCK_INSTANCES.MEMORY"; + size= rwlock_max * sizeof(PFS_rwlock); + total_memory+= size; + break; + case 29: + name= "COND_INSTANCES.ROW_SIZE"; + size= sizeof(PFS_cond); + break; + case 30: + name= "COND_INSTANCES.ROW_COUNT"; + size= cond_max; + break; + case 31: + name= "COND_INSTANCES.MEMORY"; + size= cond_max * sizeof(PFS_cond); + total_memory+= size; + break; + case 32: + name= "PROCESSLIST.ROW_SIZE"; + size= sizeof(PFS_thread); + break; + case 33: + name= "PROCESSLIST.ROW_COUNT"; + size= thread_max; + break; + case 34: + name= "PROCESSLIST.MEMORY"; + size= thread_max * sizeof(PFS_thread); + total_memory+= size; + break; + case 35: + name= "FILE_INSTANCES.ROW_SIZE"; + size= sizeof(PFS_file); + break; + case 36: + name= "FILE_INSTANCES.ROW_COUNT"; + size= file_max; + break; + case 37: + name= "FILE_INSTANCES.MEMORY"; + size= file_max * sizeof(PFS_file); + total_memory+= size; + break; + case 38: + name= "(PFS_FILE_HANDLE).ROW_SIZE"; + size= sizeof(PFS_file*); + break; + case 39: + name= "(PFS_FILE_HANDLE).ROW_COUNT"; + size= file_handle_max; + break; + case 40: + name= "(PFS_FILE_HANDLE).MEMORY"; + size= file_handle_max * sizeof(PFS_file*); + break; + case 41: + name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_SIZE"; + size= sizeof(PFS_single_stat_chain); + break; + case 42: + name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_COUNT"; + size= thread_max * instr_class_per_thread; + break; + case 43: + name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.MEMORY"; + size= thread_max * instr_class_per_thread * sizeof(PFS_single_stat_chain); + total_memory+= size; + break; + /* + This case must be last, + for aggregation in total_memory. + */ + case 44: + name= "PERFORMANCE_SCHEMA.MEMORY"; + size= total_memory; + break; + default: + goto end; + break; + } + + buflen= int10_to_str(size, buf, 10) - buf; + if (print(thd, + PERFORMANCE_SCHEMA_str.str, PERFORMANCE_SCHEMA_str.length, + name, strlen(name), + buf, buflen)) + DBUG_RETURN(true); + } + +end: + DBUG_RETURN(false); +} + +/** @} */ + + diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h new file mode 100644 index 00000000000..6a826c9da7d --- /dev/null +++ b/storage/perfschema/pfs_engine_table.h @@ -0,0 +1,336 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_ENGINE_TABLE_H +#define PFS_ENGINE_TABLE_H + +/** + @file storage/perfschema/pfs_engine_table.h + Performance schema tables (declarations). +*/ + +class Field; +struct PFS_engine_table_share; + +/** + @addtogroup Performance_schema_engine + @{ +*/ + +/** + An abstract PERFORMANCE_SCHEMA table. + Every table implemented in the performance schema schema and storage engine + derives from this class. +*/ +class PFS_engine_table +{ +public: + static const PFS_engine_table_share* + find_engine_table_share(const char *name); + + int read_row(TABLE *table, unsigned char *buf, Field **fields); + + int update_row(TABLE *table, const unsigned char *old_buf, + unsigned char *new_buf, Field **fields); + + /** Fetch the next row in this cursor. */ + virtual int rnd_next(void)= 0; + /** + Fetch a row by position. + @param pos position to fetch + */ + virtual int rnd_pos(const void *pos)= 0; + + void get_position(void *ref); + void set_position(const void *ref); + virtual void reset_position(void)= 0; + + /** Destructor. */ + virtual ~PFS_engine_table() + {} + +protected: + /** + Read the current row values. + @param table Table handle + @param buf row buffer + @param fields Table fields + @param read_all true if all columns are read. + */ + virtual int read_row_values(TABLE *table, unsigned char *buf, + Field **fields, bool read_all)= 0; + + /** + Update the current row values. + @param table Table handle + @param old_buf old row buffer + @param new_buf new row buffer + @param fields Table fields + */ + virtual int update_row_values(TABLE *table, const unsigned char *old_buf, + unsigned char *new_buf, Field **fields)= 0; + + /** + Constructor. + @param share table share + @param pos address of the m_pos position member + */ + PFS_engine_table(const PFS_engine_table_share *share, void *pos) + : m_share_ptr(share), m_pos_ptr(pos) + {} + + void set_field_ulong(Field *f, ulong value); + void set_field_ulonglong(Field *f, ulonglong value); + void set_field_varchar_utf8(Field *f, const char* str, uint len); + void set_field_enum(Field *f, ulonglong value); + + ulonglong get_field_enum(Field *f); + + /** Table share. */ + const PFS_engine_table_share *m_share_ptr; + /** Opaque pointer to the m_pos position of this cursor. */ + void *m_pos_ptr; +}; + +/** Callback to open a table. */ +typedef PFS_engine_table* (*pfs_open_table_t)(void); +/** Callback to write a row. */ +typedef int (*pfs_write_row_t)(TABLE *table, + unsigned char *buf, Field **fields); +/** Callback to delete all rows. */ +typedef int (*pfs_delete_all_rows_t)(void); + +/** + A PERFORMANCE_SCHEMA table share. + This data is shared by all the table handles opened on the same table. +*/ +struct PFS_engine_table_share +{ + static void check_all_tables(THD *thd); + void check_one_table(THD *thd); + static void init_all_locks(void); + static void delete_all_locks(void); + + /** Table name. */ + LEX_STRING m_name; + /** Table ACL. */ + const ACL_internal_table_access *m_acl; + /** Open table function. */ + pfs_open_table_t m_open_table; + /** Write row function. */ + pfs_write_row_t m_write_row; + /** Delete all rows function. */ + pfs_delete_all_rows_t m_delete_all_rows; + /** + Number or records. + This number does not need to be precise, + it is used by the optimizer to decide if the table + has 0, 1, or many records. + */ + ha_rows m_records; + /** Length of the m_pos position structure. */ + uint m_ref_length; + /** The lock, stored on behalf of the SQL layer. */ + THR_LOCK *m_thr_lock_ptr; + /** Table fields definition. */ + TABLE_FIELD_DEF *m_field_def; + /** Schema integrity flag. */ + bool m_checked; +}; + +/** Adapter for read only PERFORMANCE_SCHEMA tables. */ +class PFS_readonly_table : public PFS_engine_table +{ +protected: + /** + Constructor. + @param share table share + @param pos address of the m_pos position member + */ + PFS_readonly_table(const PFS_engine_table_share *share, void *pos) + : PFS_engine_table(share, pos) + {} + + ~PFS_readonly_table() + {} + + virtual int update_row_values(TABLE *table, const unsigned char *old_buf, + unsigned char *new_buf, Field **fields); + +}; + +class PFS_readonly_acl : public ACL_internal_table_access +{ +public: + PFS_readonly_acl() + {} + + ~PFS_readonly_acl() + {} + + ACL_internal_access_result check(ulong want_access, ulong *save_priv) const; +}; + +extern PFS_readonly_acl pfs_readonly_acl; + +class PFS_truncatable_acl : public ACL_internal_table_access +{ +public: + PFS_truncatable_acl() + {} + + ~PFS_truncatable_acl() + {} + + ACL_internal_access_result check(ulong want_access, ulong *save_priv) const; +}; + +extern PFS_truncatable_acl pfs_truncatable_acl; + +class PFS_updatable_acl : public ACL_internal_table_access +{ +public: + PFS_updatable_acl() + {} + + ~PFS_updatable_acl() + {} + + ACL_internal_access_result check(ulong want_access, ulong *save_priv) const; +}; + +extern PFS_updatable_acl pfs_updatable_acl; + +class PFS_editable_acl : public ACL_internal_table_access +{ +public: + PFS_editable_acl() + {} + + ~PFS_editable_acl() + {} + + ACL_internal_access_result check(ulong want_access, ulong *save_priv) const; +}; + +extern PFS_editable_acl pfs_editable_acl; + +class PFS_unknown_acl : public ACL_internal_table_access +{ +public: + PFS_unknown_acl() + {} + + ~PFS_unknown_acl() + {} + + ACL_internal_access_result check(ulong want_access, ulong *save_priv) const; +}; + +extern PFS_unknown_acl pfs_unknown_acl; + +/** Position of a cursor, for simple iterations. */ +struct PFS_simple_index +{ + /** Current row index. */ + uint m_index; + + PFS_simple_index(uint index) + : m_index(index) + {} + + void set_at(const struct PFS_simple_index *other) + { m_index= other->m_index; } + + void set_after(const struct PFS_simple_index *other) + { m_index= other->m_index + 1; } + + void next(void) + { m_index++; } +}; + +struct PFS_double_index +{ + /** Outer index. */ + uint m_index_1; + /** Current index within index_1. */ + uint m_index_2; + + PFS_double_index(uint index_1, uint index_2) + : m_index_1(index_1), m_index_2(index_2) + {} + + void set_at(const struct PFS_double_index *other) + { + m_index_1= other->m_index_1; + m_index_2= other->m_index_2; + } + + void set_after(const struct PFS_double_index *other) + { + m_index_1= other->m_index_1; + m_index_2= other->m_index_2 + 1; + } +}; + +struct PFS_triple_index +{ + /** Outer index. */ + uint m_index_1; + /** Current index within index_1. */ + uint m_index_2; + /** Current index within index_2. */ + uint m_index_3; + + PFS_triple_index(uint index_1, uint index_2, uint index_3) + : m_index_1(index_1), m_index_2(index_2), m_index_3(index_3) + {} + + void set_at(const struct PFS_triple_index *other) + { + m_index_1= other->m_index_1; + m_index_2= other->m_index_2; + m_index_3= other->m_index_3; + } + + void set_after(const struct PFS_triple_index *other) + { + m_index_1= other->m_index_1; + m_index_2= other->m_index_2; + m_index_3= other->m_index_3 + 1; + } +}; + +struct PFS_instrument_view_constants +{ + static const uint VIEW_MUTEX= 1; + static const uint VIEW_RWLOCK= 2; + static const uint VIEW_COND= 3; + static const uint VIEW_FILE= 4; +}; + +struct PFS_object_view_constants +{ + static const uint VIEW_TABLE= 1; + static const uint VIEW_EVENT= 2; + static const uint VIEW_PROCEDURE= 3; + static const uint VIEW_FUNCTION= 4; +}; + +bool pfs_show_status(handlerton *hton, THD *thd, + stat_print_fn *print, enum ha_stat_type stat); + +/** @} */ +#endif diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc new file mode 100644 index 00000000000..22448af7c5f --- /dev/null +++ b/storage/perfschema/pfs_events_waits.cc @@ -0,0 +1,197 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_events_waits.cc + Events waits data structures (implementation). +*/ + +#include "my_global.h" +#include "my_sys.h" +#include "pfs_global.h" +#include "pfs_instr.h" +#include "pfs_events_waits.h" +#include "pfs_atomic.h" +#include "m_string.h" + +ulong events_waits_history_long_size= 0; +/** Consumer flag for table EVENTS_WAITS_CURRENT. */ +bool flag_events_waits_current= true; +/** Consumer flag for table EVENTS_WAITS_HISTORY. */ +bool flag_events_waits_history= true; +/** Consumer flag for table EVENTS_WAITS_HISTORY_LONG. */ +bool flag_events_waits_history_long= true; +/** Consumer flag for table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. */ +bool flag_events_waits_summary_by_thread_by_event_name= true; +/** Consumer flag for table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */ +bool flag_events_waits_summary_by_event_name= true; +/** Consumer flag for table EVENTS_WAITS_SUMMARY_BY_INSTANCE. */ +bool flag_events_waits_summary_by_instance= true; +bool flag_events_locks_summary_by_thread_by_event_name= true; +bool flag_events_locks_summary_by_event_name= true; +bool flag_events_locks_summary_by_instance= true; +/** Consumer flag for table FILE_SUMMARY_BY_EVENT_NAME. */ +bool flag_file_summary_by_event_name= true; +/** Consumer flag for table FILE_SUMMARY_BY_INSTANCE. */ +bool flag_file_summary_by_instance= true; + +/** True if EVENTS_WAITS_HISTORY_LONG circular buffer is full. */ +bool events_waits_history_long_full= false; +/** Index in EVENTS_WAITS_HISTORY_LONG circular buffer. */ +volatile uint32 events_waits_history_long_index= 0; +/** EVENTS_WAITS_HISTORY_LONG circular buffer. */ +PFS_events_waits *events_waits_history_long_array= NULL; + +/** + Initialize table EVENTS_WAITS_HISTORY_LONG. + @param events_waits_history_long_sizing table sizing +*/ +int init_events_waits_history_long(uint events_waits_history_long_sizing) +{ + events_waits_history_long_size= events_waits_history_long_sizing; + events_waits_history_long_full= false; + PFS_atomic::store_u32(&events_waits_history_long_index, 0); + + if (events_waits_history_long_size == 0) + return 0; + + events_waits_history_long_array= + PFS_MALLOC_ARRAY(events_waits_history_long_size, PFS_events_waits, + MYF(MY_ZEROFILL)); + + return (events_waits_history_long_array ? 0 : 1); +} + +/** Cleanup table EVENTS_WAITS_HISTORY_LONG. */ +void cleanup_events_waits_history_long(void) +{ + pfs_free(events_waits_history_long_array); + events_waits_history_long_array= NULL; +} + +static void copy_events_waits(PFS_events_waits *dest, + const PFS_events_waits *source) +{ + /* m_wait_class must be the first member of PFS_events_waits. */ + compile_time_assert(offsetof(PFS_events_waits, m_wait_class) == 0); + + char* dest_body= (reinterpret_cast<char*> (dest)) + sizeof(events_waits_class); + const char* source_body= (reinterpret_cast<const char*> (source)) + + sizeof(events_waits_class); + + /* See comments in table_events_waits_common::make_row(). */ + + /* Signal readers they are about to read garbage ... */ + dest->m_wait_class= NO_WAIT_CLASS; + /* ... that this can generate. */ + memcpy_fixed(dest_body, + source_body, + sizeof(PFS_events_waits) - sizeof(events_waits_class)); + /* Signal readers the record is now clean again. */ + dest->m_wait_class= source->m_wait_class; +} + +/** + Insert a wait record in table EVENTS_WAITS_HISTORY. + @param thread thread that executed the wait + @param wait record to insert +*/ +void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait) +{ + uint index= thread->m_waits_history_index; + + /* + A concurrent thread executing TRUNCATE TABLE EVENTS_WAITS_CURRENT + could alter the data that this thread is inserting, + causing a potential race condition. + We are not testing for this and insert a possibly empty record, + to make this thread (the writer) faster. + This is ok, the truncated data will have + wait->m_wait_class == NO_WAIT_CLASS, + which readers of m_waits_history will filter out. + */ + copy_events_waits(&thread->m_waits_history[index], wait); + + index++; + if (index >= events_waits_history_per_thread) + { + index= 0; + thread->m_waits_history_full= true; + } + thread->m_waits_history_index= index; +} + +/** + Insert a wait record in table EVENTS_WAITS_HISTORY_LONG. + @param wait record to insert +*/ +void insert_events_waits_history_long(PFS_events_waits *wait) +{ + uint index= PFS_atomic::add_u32(&events_waits_history_long_index, 1); + + index= index % events_waits_history_long_size; + if (index == 0) + events_waits_history_long_full= true; + + /* See related comment in insert_events_waits_history. */ + copy_events_waits(&events_waits_history_long_array[index], wait); +} + +/** Reset table EVENTS_WAITS_CURRENT data. */ +void reset_events_waits_current(void) +{ + PFS_thread *pfs_thread= thread_array; + PFS_thread *pfs_thread_last= thread_array + thread_max; + + for ( ; pfs_thread < pfs_thread_last; pfs_thread++) + { + PFS_wait_locker *locker= pfs_thread->m_wait_locker_stack; + PFS_wait_locker *locker_last= locker + LOCKER_STACK_SIZE; + + for ( ; locker < locker_last; locker++) + locker->m_waits_current.m_wait_class= NO_WAIT_CLASS; + } +} + +/** Reset table EVENTS_WAITS_HISTORY data. */ +void reset_events_waits_history(void) +{ + PFS_thread *pfs_thread= thread_array; + PFS_thread *pfs_thread_last= thread_array + thread_max; + + for ( ; pfs_thread < pfs_thread_last; pfs_thread++) + { + PFS_events_waits *wait= pfs_thread->m_waits_history; + PFS_events_waits *wait_last= wait + events_waits_history_per_thread; + + pfs_thread->m_waits_history_index= 0; + pfs_thread->m_waits_history_full= false; + for ( ; wait < wait_last; wait++) + wait->m_wait_class= NO_WAIT_CLASS; + } +} + +/** Reset table EVENTS_WAITS_HISTORY_LONG data. */ +void reset_events_waits_history_long(void) +{ + PFS_atomic::store_u32(&events_waits_history_long_index, 0); + events_waits_history_long_full= false; + + PFS_events_waits *wait= events_waits_history_long_array; + PFS_events_waits *wait_last= wait + events_waits_history_long_size; + for ( ; wait < wait_last; wait++) + wait->m_wait_class= NO_WAIT_CLASS; +} + diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h new file mode 100644 index 00000000000..c677e83ad34 --- /dev/null +++ b/storage/perfschema/pfs_events_waits.h @@ -0,0 +1,185 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_EVENTS_WAITS_H +#define PFS_EVENTS_WAITS_H + +/** + @file storage/perfschema/pfs_events_waits.h + Events waits data structures (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_lock.h" + +struct PFS_mutex; +struct PFS_rwlock; +struct PFS_cond; +struct PFS_table; +struct PFS_file; +struct PFS_thread; +struct PFS_instr_class; + +/** Class of a wait event. */ +enum events_waits_class +{ + NO_WAIT_CLASS= 0, + WAIT_CLASS_MUTEX, + WAIT_CLASS_RWLOCK, + WAIT_CLASS_COND, + WAIT_CLASS_TABLE, + WAIT_CLASS_FILE +}; + +/** State of a timer. */ +enum timer_state +{ + /** + Not timed. + In this state, TIMER_START, TIMER_END and TIMER_WAIT are NULL. + */ + TIMER_STATE_UNTIMED, + /** + About to start. + In this state, TIMER_START, TIMER_END and TIMER_WAIT are NULL. + */ + TIMER_STATE_STARTING, + /** + Started, but not yet ended. + In this state, TIMER_START has a value, TIMER_END and TIMER_WAIT are NULL. + */ + TIMER_STATE_STARTED, + /** + Ended. + In this state, TIMER_START, TIMER_END and TIMER_WAIT have a value. + */ + TIMER_STATE_TIMED +}; + +/** Target object a wait event is waiting on. */ +union events_waits_target +{ + /** Mutex waited on. */ + PFS_mutex *m_mutex; + /** RWLock waited on. */ + PFS_rwlock *m_rwlock; + /** Condition waited on. */ + PFS_cond *m_cond; + /** Table waited on. */ + PFS_table *m_table; + /** File waited on. */ + PFS_file *m_file; +}; + +/** A wait event record. */ +struct PFS_events_waits +{ + /** + The type of wait. + Readers: + - the consumer threads. + Writers: + - the producer threads, in the instrumentation. + Out of bound Writers: + - TRUNCATE EVENTS_WAITS_CURRENT + - TRUNCATE EVENTS_WAITS_HISTORY + - TRUNCATE EVENTS_WAITS_HISTORY_LONG + */ + volatile events_waits_class m_wait_class; + /** Executing thread. */ + PFS_thread *m_thread; + /** Instrument metadata. */ + PFS_instr_class *m_class; + /** Timer state. */ + enum timer_state m_timer_state; + /** Event id. */ + ulonglong m_event_id; + /** + Timer start. + This member is populated only if m_timed is true. + */ + ulonglong m_timer_start; + /** + Timer end. + This member is populated only if m_timed is true. + */ + ulonglong m_timer_end; + /** Schema name. */ + const char *m_schema_name; + /** Length in bytes of @c m_schema_name. */ + uint m_schema_name_length; + /** Object name. */ + const char *m_object_name; + /** Length in bytes of @c m_object_name. */ + uint m_object_name_length; + /** Address in memory of the object instance waited on. */ + const void *m_object_instance_addr; + /** Location of the instrumentation in the source code (file name). */ + const char *m_source_file; + /** Location of the instrumentation in the source code (line number). */ + uint m_source_line; + /** Operation performed. */ + enum_operation_type m_operation; + /** + Number of bytes read/written. + This member is populated for file READ/WRITE operations only. + */ + size_t m_number_of_bytes; +}; + +/** + A wait locker. + A locker is a transient helper structure used by the instrumentation + during the recording of a wait. +*/ +struct PFS_wait_locker +{ + /** The timer used to measure the wait. */ + enum_timer_name m_timer_name; + /** The object waited on. */ + events_waits_target m_target; + /** The wait data recorded. */ + PFS_events_waits m_waits_current; +}; + +void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait); + +void insert_events_waits_history_long(PFS_events_waits *wait); + +extern bool flag_events_waits_current; +extern bool flag_events_waits_history; +extern bool flag_events_waits_history_long; +extern bool flag_events_waits_summary_by_thread_by_event_name; +extern bool flag_events_waits_summary_by_event_name; +extern bool flag_events_waits_summary_by_instance; +extern bool flag_events_locks_summary_by_thread_by_name; +extern bool flag_events_locks_summary_by_event_name; +extern bool flag_events_locks_summary_by_instance; +extern bool flag_file_summary_by_event_name; +extern bool flag_file_summary_by_instance; +extern bool events_waits_history_long_full; +extern volatile uint32 events_waits_history_long_index; +extern PFS_events_waits *events_waits_history_long_array; +extern ulong events_waits_history_long_size; + +int init_events_waits_history_long(uint events_waits_history_long_sizing); +void cleanup_events_waits_history_long(); + +void reset_events_waits_current(); +void reset_events_waits_history(); +void reset_events_waits_history_long(); + +#endif + diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc new file mode 100644 index 00000000000..cac7d0b06e7 --- /dev/null +++ b/storage/perfschema/pfs_global.cc @@ -0,0 +1,66 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_global.cc + Miscellaneous global dependencies (implementation). +*/ + +#include "my_global.h" +#include "my_sys.h" +#include "pfs_global.h" + +#include <stdlib.h> +#include <string.h> + +bool pfs_initialized= false; + +/** + Memory allocation for the performance schema. + The memory used internally in the performance schema implementation + is allocated once during startup, and considered static thereafter. +*/ +void *pfs_malloc(size_t size, myf flags) +{ + DBUG_ASSERT(! pfs_initialized); + DBUG_ASSERT(size > 0); + + void *ptr= malloc(size); + if (ptr && (flags & MY_ZEROFILL)) + memset(ptr, 0, size); + return ptr; +} + +void pfs_free(void *ptr) +{ + if (ptr != NULL) + free(ptr); +} + +void pfs_print_error(const char *format, ...) +{ + va_list args; + va_start(args, format); + /* + Printing to anything else, like the error log, would generate even more + recursive calls to the performance schema implementation + (file io is instrumented), so that could lead to catastrophic results. + Printing to something safe, and low level: stderr only. + */ + vfprintf(stderr, format, args); + va_end(args); + fflush(stderr); +} + diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h new file mode 100644 index 00000000000..37809f8cc2e --- /dev/null +++ b/storage/perfschema/pfs_global.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_GLOBAL_H +#define PFS_GLOBAL_H + +/** + @file storage/perfschema/pfs_global.h + Miscellaneous global dependencies (declarations). +*/ + +extern bool pfs_initialized; + +void *pfs_malloc(size_t size, myf flags); +#define PFS_MALLOC_ARRAY(n, T, f) \ + reinterpret_cast<T*> (pfs_malloc((n) * sizeof(T), (f))) +void pfs_free(void *ptr); + +inline uint randomized_index(const void *ptr, uint max_size) +{ + if (unlikely(max_size == 0)) + return 0; + + /* + ptr is typically an aligned structure, + so the last bits are not really random, but this has no effect. + Apply a factor A*x to spread + close values of ptr further apart (which helps with arrays), + and to spread values way beyond a typical max_size. + Then, apply a modulo to end within [0, max_size - 1]. + A is big prime numbers, to avoid resonating with max_size, + to have a uniform distribution in [0, max_size - 1]. + The value of A is chosen so that index(ptr) and index(ptr + N) (for arrays) + are likely to be not similar for typical values of max_size + (50, 100, 1000, etc). + In other words, (sizeof(T)*A % max_size) should not be a small number, + to avoid that with 'T array[max_size]', index(array[i]) + and index(array[i + 1]) end up pointing in the same area in [0, max_size - 1]. + */ + return static_cast<uint> + (((reinterpret_cast<intptr> (ptr)) * 2166179) % max_size); +} + +void pfs_print_error(const char *format, ...); + +#endif + diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc new file mode 100644 index 00000000000..2ce3a844290 --- /dev/null +++ b/storage/perfschema/pfs_instr.cc @@ -0,0 +1,962 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_instr.cc + Performance schema instruments (implementation). +*/ + +#include "my_global.h" +#include "mysql_priv.h" +#include "my_sys.h" +#include "pfs_stat.h" +#include "pfs_instr.h" +#include "pfs_global.h" + +/** + @addtogroup Performance_schema_buffers + @{ +*/ + +/** Size of the mutex instances array. @sa mutex_array */ +ulong mutex_max; +/** Number of mutexes instance lost. @sa mutex_array */ +ulong mutex_lost; +/** Size of the rwlock instances array. @sa rwlock_array */ +ulong rwlock_max; +/** Number or rwlock instances lost. @sa rwlock_array */ +ulong rwlock_lost; +/** Size of the conditions instances array. @sa cond_array */ +ulong cond_max; +/** Number of conditions instances lost. @sa cond_array */ +ulong cond_lost; +/** Size of the thread instances array. @sa thread_array */ +ulong thread_max; +/** Number or thread instances lost. @sa thread_array */ +ulong thread_lost; +/** Size of the file instances array. @sa file_array */ +ulong file_max; +/** Number of file instances lost. @sa file_array */ +ulong file_lost; +/** + Size of the file handle array. @sa file_handle_array. + Signed value, for easier comparisons with a file descriptor number. +*/ +long file_handle_max; +/** Number of file handle lost. @sa file_handle_array */ +ulong file_handle_lost; +/** Size of the table instances array. @sa table_array */ +ulong table_max; +/** Number of table instances lost. @sa table_array */ +ulong table_lost; +/** Number of EVENTS_WAITS_HISTORY records per thread. */ +ulong events_waits_history_per_thread; +/** Number of instruments class per thread. */ +ulong instr_class_per_thread; +/** Number of locker lost. @sa LOCKER_STACK_SIZE. */ +ulong locker_lost; + +/** + Mutex instrumentation instances array. + @sa mutex_max + @sa mutex_lost +*/ +PFS_mutex *mutex_array= NULL; + +/** + RWLock instrumentation instances array. + @sa rwlock_max + @sa rwlock_lost +*/ +PFS_rwlock *rwlock_array= NULL; + +/** + Condition instrumentation instances array. + @sa cond_max + @sa cond_lost +*/ +PFS_cond *cond_array= NULL; + +/** + Thread instrumentation instances array. + @sa thread_max + @sa thread_lost +*/ +PFS_thread *thread_array= NULL; + +/** + File instrumentation instances array. + @sa file_max + @sa file_lost + @sa filename_hash +*/ +PFS_file *file_array= NULL; + +/** + File instrumentation handle array. + @sa file_handle_max + @sa file_handle_lost +*/ +PFS_file **file_handle_array= NULL; + +/** + Table instrumentation instances array. + @sa table_max + @sa table_lost +*/ +PFS_table *table_array= NULL; + +static volatile uint32 thread_internal_id_counter= 0; + +static uint per_thread_rwlock_class_start; +static uint per_thread_cond_class_start; +static uint per_thread_file_class_start; +static uint thread_instr_class_waits_sizing; +static PFS_single_stat_chain *thread_instr_class_waits_array= NULL; + +static PFS_events_waits *thread_history_array= NULL; + +/** Hash table for instrumented files. */ +static LF_HASH filename_hash; +/** True if filename_hash is initialized. */ +static bool filename_hash_inited= false; + +/** + Initialize all the instruments instance buffers. + @param param sizing parameters + @return 0 on success +*/ +int init_instruments(const PFS_global_param *param) +{ + uint thread_history_sizing; + uint index; + + mutex_max= param->m_mutex_sizing; + mutex_lost= 0; + rwlock_max= param->m_rwlock_sizing; + rwlock_lost= 0; + cond_max= param->m_cond_sizing; + cond_lost= 0; + file_max= param->m_file_sizing; + file_lost= 0; + file_handle_max= param->m_file_handle_sizing; + file_handle_lost= 0; + table_max= param->m_table_sizing; + table_lost= 0; + thread_max= param->m_thread_sizing; + thread_lost= 0; + + events_waits_history_per_thread= param->m_events_waits_history_sizing; + thread_history_sizing= param->m_thread_sizing + * events_waits_history_per_thread; + + per_thread_rwlock_class_start= param->m_mutex_class_sizing; + per_thread_cond_class_start= per_thread_rwlock_class_start + + param->m_rwlock_class_sizing; + per_thread_file_class_start= per_thread_cond_class_start + + param->m_cond_class_sizing; + instr_class_per_thread= per_thread_file_class_start + + param->m_file_class_sizing; + + thread_instr_class_waits_sizing= param->m_thread_sizing + * instr_class_per_thread; + + mutex_array= NULL; + rwlock_array= NULL; + cond_array= NULL; + file_array= NULL; + file_handle_array= NULL; + table_array= NULL; + thread_array= NULL; + thread_history_array= NULL; + thread_instr_class_waits_array= NULL; + thread_internal_id_counter= 0; + + if (mutex_max > 0) + { + mutex_array= PFS_MALLOC_ARRAY(mutex_max, PFS_mutex, MYF(MY_ZEROFILL)); + if (unlikely(mutex_array == NULL)) + return 1; + } + + if (rwlock_max > 0) + { + rwlock_array= PFS_MALLOC_ARRAY(rwlock_max, PFS_rwlock, MYF(MY_ZEROFILL)); + if (unlikely(rwlock_array == NULL)) + return 1; + } + + if (cond_max > 0) + { + cond_array= PFS_MALLOC_ARRAY(cond_max, PFS_cond, MYF(MY_ZEROFILL)); + if (unlikely(cond_array == NULL)) + return 1; + } + + if (file_max > 0) + { + file_array= PFS_MALLOC_ARRAY(file_max, PFS_file, MYF(MY_ZEROFILL)); + if (unlikely(file_array == NULL)) + return 1; + } + + if (file_handle_max > 0) + { + file_handle_array= PFS_MALLOC_ARRAY(file_handle_max, PFS_file*, MYF(MY_ZEROFILL)); + if (unlikely(file_handle_array == NULL)) + return 1; + } + + if (table_max > 0) + { + table_array= PFS_MALLOC_ARRAY(table_max, PFS_table, MYF(MY_ZEROFILL)); + if (unlikely(table_array == NULL)) + return 1; + } + + if (thread_max > 0) + { + thread_array= PFS_MALLOC_ARRAY(thread_max, PFS_thread, MYF(MY_ZEROFILL)); + if (unlikely(thread_array == NULL)) + return 1; + } + + if (thread_history_sizing > 0) + { + thread_history_array= + PFS_MALLOC_ARRAY(thread_history_sizing, PFS_events_waits, + MYF(MY_ZEROFILL)); + if (unlikely(thread_history_array == NULL)) + return 1; + } + + if (thread_instr_class_waits_sizing > 0) + { + thread_instr_class_waits_array= + PFS_MALLOC_ARRAY(thread_instr_class_waits_sizing, + PFS_single_stat_chain, MYF(MY_ZEROFILL)); + if (unlikely(thread_instr_class_waits_array == NULL)) + return 1; + } + + for (index= 0; index < thread_instr_class_waits_sizing; index++) + { + /* + Currently, this chain is of length 1, + but it's still implemented as a stat chain, + since more aggregations are planned to be implemented in m_parent. + */ + thread_instr_class_waits_array[index].m_control_flag= + &flag_events_waits_summary_by_thread_by_event_name; + thread_instr_class_waits_array[index].m_parent= NULL; + } + + for (index= 0; index < thread_max; index++) + { + thread_array[index].m_waits_history= + &thread_history_array[index * events_waits_history_per_thread]; + thread_array[index].m_instr_class_wait_stats= + &thread_instr_class_waits_array[index * instr_class_per_thread]; + } + + return 0; +} + +/** + Find the per-thread wait statistics for a mutex class. + @param thread input thread + @param klass mutex class + @return the per thread per mutex class wait stat +*/ +PFS_single_stat_chain * +find_per_thread_mutex_class_wait_stat(PFS_thread *thread, + PFS_mutex_class *klass) +{ + PFS_single_stat_chain *stat; + uint index; + + DBUG_ASSERT(thread != NULL); + DBUG_ASSERT(klass != NULL); + index= klass->m_index; + DBUG_ASSERT(index < mutex_class_max); + + stat= &(thread->m_instr_class_wait_stats[index]); + return stat; +} + +/** + Find the per-thread wait statistics for a rwlock class. + @param thread input thread + @param klass rwlock class + @return the per thread per rwlock class wait stat +*/ +PFS_single_stat_chain * +find_per_thread_rwlock_class_wait_stat(PFS_thread *thread, + PFS_rwlock_class *klass) +{ + PFS_single_stat_chain *stat; + uint index; + + DBUG_ASSERT(thread != NULL); + DBUG_ASSERT(klass != NULL); + index= klass->m_index; + DBUG_ASSERT(index < rwlock_class_max); + + stat= &(thread->m_instr_class_wait_stats + [per_thread_rwlock_class_start + index]); + return stat; +} + +/** + Find the per-thread wait statistics for a condition class. + @param thread input thread + @param klass condition class + @return the per thread per condition class wait stat +*/ +PFS_single_stat_chain * +find_per_thread_cond_class_wait_stat(PFS_thread *thread, + PFS_cond_class *klass) +{ + PFS_single_stat_chain *stat; + uint index; + + DBUG_ASSERT(thread != NULL); + DBUG_ASSERT(klass != NULL); + index= klass->m_index; + DBUG_ASSERT(index < cond_class_max); + + stat= &(thread->m_instr_class_wait_stats + [per_thread_cond_class_start + index]); + return stat; +} + +/** + Find the per-thread wait statistics for a file class. + @param thread input thread + @param klass file class + @return the per thread per file class wait stat +*/ +PFS_single_stat_chain * +find_per_thread_file_class_wait_stat(PFS_thread *thread, + PFS_file_class *klass) +{ + PFS_single_stat_chain *stat; + uint index; + + DBUG_ASSERT(thread != NULL); + DBUG_ASSERT(klass != NULL); + index= klass->m_index; + DBUG_ASSERT(index < file_class_max); + + stat= &(thread->m_instr_class_wait_stats + [per_thread_file_class_start + index]); + return stat; +} + +/** Reset the wait statistics per thread. */ +void reset_per_thread_wait_stat(void) +{ + PFS_single_stat_chain *stat= thread_instr_class_waits_array; + PFS_single_stat_chain *stat_last= stat + thread_instr_class_waits_sizing; + + for ( ; stat < stat_last; stat++) + reset_single_stat_link(stat); +} + +/** Cleanup all the instruments buffers. */ +void cleanup_instruments(void) +{ + pfs_free(mutex_array); + mutex_array= NULL; + mutex_max= 0; + pfs_free(rwlock_array); + rwlock_array= NULL; + rwlock_max= 0; + pfs_free(cond_array); + cond_array= NULL; + cond_max= 0; + pfs_free(file_array); + file_array= NULL; + file_max= 0; + pfs_free(file_handle_array); + file_handle_array= NULL; + file_handle_max= 0; + pfs_free(table_array); + table_array= NULL; + table_max= 0; + pfs_free(thread_array); + thread_array= NULL; + thread_max= 0; + pfs_free(thread_history_array); + thread_history_array= NULL; + pfs_free(thread_instr_class_waits_array); + thread_instr_class_waits_array= NULL; +} + +static uchar *filename_hash_get_key(const uchar *entry, size_t *length, + my_bool) +{ + const PFS_file * const *typed_entry; + const PFS_file *file; + const void *result; + typed_entry= reinterpret_cast<const PFS_file* const *> (entry); + DBUG_ASSERT(typed_entry != NULL); + file= *typed_entry; + DBUG_ASSERT(file != NULL); + *length= file->m_filename_length; + result= file->m_filename; + return const_cast<uchar*> (reinterpret_cast<const uchar*> (result)); +} + +/** + Initialize the file name hash. + @return 0 on success +*/ +int init_file_hash(void) +{ + if (! filename_hash_inited) + { + lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE, + 0, 0, filename_hash_get_key, &my_charset_bin); + filename_hash_inited= true; + } + return 0; +} + +/** Cleanup the file name hash. */ +void cleanup_file_hash(void) +{ + if (filename_hash_inited) + { + lf_hash_destroy(&filename_hash); + filename_hash_inited= false; + } +} + +/** + Create instrumentation for a mutex instance. + @param klass the mutex class + @param identity the mutex address + @return a mutex instance, or NULL +*/ +PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity) +{ + int pass; + uint i= randomized_index(identity, mutex_max); + + /* + Pass 1: [random, mutex_max - 1] + Pass 2: [0, mutex_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + PFS_mutex *pfs= mutex_array + i; + PFS_mutex *pfs_last= mutex_array + mutex_max; + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_identity= identity; + pfs->m_class= klass; + pfs->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_instance; + pfs->m_wait_stat.m_parent= &klass->m_wait_stat; + reset_single_stat_link(&pfs->m_wait_stat); + pfs->m_lock_stat.m_control_flag= + &flag_events_locks_summary_by_instance; + pfs->m_lock_stat.m_parent= &klass->m_lock_stat; + reset_single_stat_link(&pfs->m_lock_stat); + pfs->m_owner= NULL; + pfs->m_last_locked= 0; + pfs->m_lock.dirty_to_allocated(); + return pfs; + } + } + } + } + + mutex_lost++; + return NULL; +} + +/** + Destroy instrumentation for a mutex instance. + @param pfs the mutex to destroy +*/ +void destroy_mutex(PFS_mutex *pfs) +{ + DBUG_ASSERT(pfs != NULL); + pfs->m_lock.allocated_to_free(); +} + +/** + Create instrumentation for a rwlock instance. + @param klass the rwlock class + @param identity the rwlock address + @return a rwlock instance, or NULL +*/ +PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity) +{ + int pass; + uint i= randomized_index(identity, rwlock_max); + + /* + Pass 1: [random, rwlock_max - 1] + Pass 2: [0, rwlock_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + PFS_rwlock *pfs= rwlock_array + i; + PFS_rwlock *pfs_last= rwlock_array + rwlock_max; + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_identity= identity; + pfs->m_class= klass; + pfs->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_instance; + pfs->m_wait_stat.m_parent= &klass->m_wait_stat; + reset_single_stat_link(&pfs->m_wait_stat); + pfs->m_lock.dirty_to_allocated(); + pfs->m_read_lock_stat.m_control_flag= + &flag_events_locks_summary_by_instance; + pfs->m_read_lock_stat.m_parent= &klass->m_read_lock_stat; + reset_single_stat_link(&pfs->m_read_lock_stat); + pfs->m_write_lock_stat.m_control_flag= + &flag_events_locks_summary_by_instance; + pfs->m_write_lock_stat.m_parent= &klass->m_write_lock_stat; + reset_single_stat_link(&pfs->m_write_lock_stat); + pfs->m_writer= NULL; + pfs->m_readers= 0; + pfs->m_last_written= 0; + pfs->m_last_read= 0; + return pfs; + } + } + } + } + + rwlock_lost++; + return NULL; +} + +/** + Destroy instrumentation for a rwlock instance. + @param pfs the rwlock to destroy +*/ +void destroy_rwlock(PFS_rwlock *pfs) +{ + DBUG_ASSERT(pfs != NULL); + pfs->m_lock.allocated_to_free(); +} + +/** + Create instrumentation for a condition instance. + @param klass the condition class + @param identity the condition address + @return a condition instance, or NULL +*/ +PFS_cond* create_cond(PFS_cond_class *klass, const void *identity) +{ + int pass; + uint i= randomized_index(identity, cond_max); + + /* + Pass 1: [random, cond_max - 1] + Pass 2: [0, cond_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + PFS_cond *pfs= cond_array + i; + PFS_cond *pfs_last= cond_array + cond_max; + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_identity= identity; + pfs->m_class= klass; + pfs->m_cond_stat.m_signal_count= 0; + pfs->m_cond_stat.m_broadcast_count= 0; + pfs->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_instance; + pfs->m_wait_stat.m_parent= &klass->m_wait_stat; + reset_single_stat_link(&pfs->m_wait_stat); + pfs->m_lock.dirty_to_allocated(); + return pfs; + } + } + } + } + + cond_lost++; + return NULL; +} + +/** + Destroy instrumentation for a condition instance. + @param pfs the condition to destroy +*/ +void destroy_cond(PFS_cond *pfs) +{ + DBUG_ASSERT(pfs != NULL); + pfs->m_lock.allocated_to_free(); +} + +/** + Create instrumentation for a thread instance. + @param klass the thread class + @param identity the thread address, + or a value characteristic of this thread + @param thread_id the PROCESSLIST thread id, + or 0 if unknown + @return a thread instance, or NULL +*/ +PFS_thread* create_thread(PFS_thread_class *klass, const void *identity, + ulong thread_id) +{ + int pass; + uint i= randomized_index(identity, thread_max); + + /* + Pass 1: [random, thread_max - 1] + Pass 2: [0, thread_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + PFS_thread *pfs= thread_array + i; + PFS_thread *pfs_last= thread_array + thread_max; + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_thread_internal_id= + PFS_atomic::add_u32(&thread_internal_id_counter, 1); + pfs->m_thread_id= thread_id; + pfs->m_event_id= 1; + pfs->m_enabled= true; + pfs->m_class= klass; + pfs->m_wait_locker_count= 0; + pfs->m_waits_history_full= false; + pfs->m_waits_history_index= 0; + + PFS_single_stat_chain *stat= pfs->m_instr_class_wait_stats; + PFS_single_stat_chain *stat_last= stat + instr_class_per_thread; + for ( ; stat < stat_last; stat++) + reset_single_stat_link(stat); + pfs->m_filename_hash_pins= NULL; + pfs->m_table_share_hash_pins= NULL; + pfs->m_lock.dirty_to_allocated(); + return pfs; + } + } + } + } + + thread_lost++; + return NULL; +} + +/** + Sanitize a PFS_thread pointer. + Validate that the PFS_thread is part of thread_array. + Sanitizing data is required when the data can be + damaged with expected race conditions, for example + involving EVENTS_WAITS_HISTORY_LONG. + @param unsafe the pointer to sanitize + @return a valid pointer, or NULL +*/ +PFS_thread *sanitize_thread(PFS_thread *unsafe) +{ + if ((&thread_array[0] <= unsafe) && + (unsafe < &thread_array[thread_max])) + return unsafe; + return NULL; +} + +/** + Destroy instrumentation for a thread instance. + @param pfs the thread to destroy +*/ +void destroy_thread(PFS_thread *pfs) +{ + DBUG_ASSERT(pfs != NULL); + if (pfs->m_filename_hash_pins) + { + lf_hash_put_pins(pfs->m_filename_hash_pins); + pfs->m_filename_hash_pins= NULL; + } + if (pfs->m_table_share_hash_pins) + { + lf_hash_put_pins(pfs->m_table_share_hash_pins); + pfs->m_table_share_hash_pins= NULL; + } + pfs->m_lock.allocated_to_free(); +} + +/** + Find or create instrumentation for a file instance by file name. + @param thread the executing instrumented thread + @param klass the file class + @param filename the file name + @param len the length in bytes of filename + @return a file instance, or NULL +*/ +PFS_file* +find_or_create_file(PFS_thread *thread, PFS_file_class *klass, + const char *filename, uint len) +{ + PFS_file *pfs; + int pass; + + if (! filename_hash_inited) + { + /* File instrumentation can be turned off. */ + file_lost++; + return NULL; + } + + if (unlikely(thread->m_filename_hash_pins == NULL)) + { + thread->m_filename_hash_pins= lf_hash_get_pins(&filename_hash); + if (unlikely(thread->m_filename_hash_pins == NULL)) + { + file_lost++; + return NULL; + } + } + + if (len >= sizeof(pfs->m_filename)) + len= sizeof(pfs->m_filename) - 1; + + PFS_file **entry; + uint retry_count= 0; + const uint retry_max= 3; +search: + entry= reinterpret_cast<PFS_file**> + (lf_hash_search(&filename_hash, thread->m_filename_hash_pins, + filename, len)); + if (entry && (entry != MY_ERRPTR)) + { + pfs= *entry; + pfs->m_file_stat.m_open_count++; + lf_hash_search_unpin(thread->m_filename_hash_pins); + return pfs; + } + + /* filename is not constant, just using it for noise on create */ + uint i= randomized_index(filename, file_max); + + /* + Pass 1: [random, file_max - 1] + Pass 2: [0, file_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + pfs= file_array + i; + PFS_file *pfs_last= file_array + file_max; + + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_class= klass; + strncpy(pfs->m_filename, filename, len); + pfs->m_filename[len]= '\0'; + pfs->m_filename_length= len; + pfs->m_file_stat.m_open_count= 1; + pfs->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_instance; + pfs->m_wait_stat.m_parent= &klass->m_wait_stat; + reset_single_stat_link(&pfs->m_wait_stat); + + int res; + res= lf_hash_insert(&filename_hash, thread->m_filename_hash_pins, + &pfs); + if (likely(res == 0)) + { + pfs->m_lock.dirty_to_allocated(); + return pfs; + } + + pfs->m_lock.dirty_to_free(); + + if (res > 0) + { + /* Duplicate insert by another thread */ + if (++retry_count > retry_max) + { + /* Avoid infinite loops */ + file_lost++; + return NULL; + } + goto search; + } + + /* OOM in lf_hash_insert */ + file_lost++; + return NULL; + } + } + } + } + + file_lost++; + return NULL; +} + +/** + Release instrumentation for a file instance. + @param pfs the file to release +*/ +void release_file(PFS_file *pfs) +{ + DBUG_ASSERT(pfs != NULL); + pfs->m_file_stat.m_open_count--; +} + +/** + Destroy instrumentation for a file instance. + @param thread the executing thread instrumentation + @param pfs the file to destroy +*/ +void destroy_file(PFS_thread *thread, PFS_file *pfs) +{ + DBUG_ASSERT(thread != NULL); + DBUG_ASSERT(thread->m_filename_hash_pins != NULL); + DBUG_ASSERT(pfs != NULL); + lf_hash_delete(&filename_hash, thread->m_filename_hash_pins, + pfs->m_filename, pfs->m_filename_length); + pfs->m_lock.allocated_to_free(); +} + +/** + Create instrumentation for a table instance. + @param share the table share + @param identity the table address + @return a table instance, or NULL +*/ +PFS_table* create_table(PFS_table_share *share, const void *identity) +{ + int pass; + uint i= randomized_index(identity, table_max); + + /* + Pass 1: [random, table_max - 1] + Pass 2: [0, table_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + PFS_table *pfs= table_array + i; + PFS_table *pfs_last= table_array + table_max; + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_identity= identity; + pfs->m_share= share; + pfs->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_instance; + pfs->m_wait_stat.m_parent= &share->m_wait_stat; + reset_single_stat_link(&pfs->m_wait_stat); + pfs->m_lock.dirty_to_allocated(); + return pfs; + } + } + } + } + + table_lost++; + return NULL; +} + +/** + Destroy instrumentation for a table instance. + @param pfs the table to destroy +*/ +void destroy_table(PFS_table *pfs) +{ + DBUG_ASSERT(pfs != NULL); + pfs->m_lock.allocated_to_free(); +} + +static void reset_mutex_waits_by_instance(void) +{ + PFS_mutex *pfs= mutex_array; + PFS_mutex *pfs_last= mutex_array + mutex_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +static void reset_rwlock_waits_by_instance(void) +{ + PFS_rwlock *pfs= rwlock_array; + PFS_rwlock *pfs_last= rwlock_array + rwlock_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +static void reset_cond_waits_by_instance(void) +{ + PFS_cond *pfs= cond_array; + PFS_cond *pfs_last= cond_array + cond_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +static void reset_file_waits_by_instance(void) +{ + PFS_file *pfs= file_array; + PFS_file *pfs_last= file_array + file_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +/** Reset the wait statistics per object instance. */ +void reset_events_waits_by_instance(void) +{ + reset_mutex_waits_by_instance(); + reset_rwlock_waits_by_instance(); + reset_cond_waits_by_instance(); + reset_file_waits_by_instance(); +} + +/** Reset the io statistics per file instance. */ +void reset_file_instance_io(void) +{ + PFS_file *pfs= file_array; + PFS_file *pfs_last= file_array + file_max; + + for ( ; pfs < pfs_last; pfs++) + reset_file_stat(&pfs->m_file_stat); +} + +/** @} */ diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h new file mode 100644 index 00000000000..a150a13fb75 --- /dev/null +++ b/storage/perfschema/pfs_instr.h @@ -0,0 +1,266 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_INSTR_H +#define PFS_INSTR_H + +/** + @file storage/perfschema/pfs_instr.h + Performance schema instruments (declarations). +*/ + +#include <mysql_priv.h> +#include "pfs_lock.h" +#include "pfs_instr_class.h" +#include "pfs_events_waits.h" +#include "pfs_server.h" +#include "lf.h" + +/** + @addtogroup Performance_schema_buffers + @{ +*/ + +struct PFS_thread; + +struct PFS_instr +{ + /** Internal lock. */ + pfs_lock m_lock; + /** Instrument wait statistics chain. */ + PFS_single_stat_chain m_wait_stat; +}; + +/** Instrumented mutex implementation. @see PSI_mutex. */ +struct PFS_mutex : public PFS_instr +{ + /** Mutex identity, typically a pthread_mutex_t. */ + const void *m_identity; + /** Mutex class. */ + PFS_mutex_class *m_class; + /** + Mutex lock usage statistics chain. + This statistic is not exposed in user visible tables yet. + */ + PFS_single_stat_chain m_lock_stat; + /** Current owner. */ + PFS_thread *m_owner; + /** + Timestamp of the last lock. + This statistic is not exposed in user visible tables yet. + */ + ulonglong m_last_locked; +}; + +/** Instrumented rwlock implementation. @see PSI_rwlock. */ +struct PFS_rwlock : public PFS_instr +{ + /** RWLock identity, typically a pthread_rwlock_t. */ + const void *m_identity; + /** RWLock class. */ + PFS_rwlock_class *m_class; + /** + RWLock read lock usage statistics chain. + This statistic is not exposed in user visible tables yet. + */ + PFS_single_stat_chain m_read_lock_stat; + /** + RWLock write lock usage statistics chain. + This statistic is not exposed in user visible tables yet. + */ + PFS_single_stat_chain m_write_lock_stat; + /** Current writer thread. */ + PFS_thread *m_writer; + /** Current count of readers. */ + uint m_readers; + /** + Timestamp of the last write. + This statistic is not exposed in user visible tables yet. + */ + ulonglong m_last_written; + /** + Timestamp of the last read. + This statistic is not exposed in user visible tables yet. + */ + ulonglong m_last_read; +}; + +/** Instrumented cond implementation. @see PSI_cond. */ +struct PFS_cond : public PFS_instr +{ + /** Condition identity, typically a pthread_cond_t. */ + const void *m_identity; + /** Condition class. */ + PFS_cond_class *m_class; + /** Condition instance usage statistics. */ + PFS_cond_stat m_cond_stat; +}; + +/** Instrumented File and FILE implementation. @see PSI_file. */ +struct PFS_file : public PFS_instr +{ + /** File name. */ + char m_filename[FN_REFLEN]; + /** File name length in bytes. */ + uint m_filename_length; + /** File class. */ + PFS_file_class *m_class; + /** File usage statistics. */ + PFS_file_stat m_file_stat; +}; + +/** Instrumented table implementation. @see PSI_table. */ +struct PFS_table : public PFS_instr +{ + /** Table share. */ + PFS_table_share *m_share; + /** Table identity, typically a handler. */ + const void *m_identity; +}; + +/** + @def LOCKER_STACK_SIZE + Maximum number of nested waits. +*/ +#define LOCKER_STACK_SIZE 3 + +/** Instrumented thread implementation. @see PSI_thread. */ +struct PFS_thread +{ + /** Internal lock. */ + pfs_lock m_lock; + /** Pins for filename_hash. */ + LF_PINS *m_filename_hash_pins; + /** Pins for table_share_hash. */ + LF_PINS *m_table_share_hash_pins; + /** Event ID counter */ + ulonglong m_event_id; + /** Thread instrumentation flag. */ + bool m_enabled; + /** Internal thread identifier, unique. */ + ulong m_thread_internal_id; + /** External (SHOW PROCESSLIST) thread identifier, not unique. */ + ulong m_thread_id; + /** Thread class. */ + PFS_thread_class *m_class; + /** Size of @c m_wait_locker_stack. */ + uint m_wait_locker_count; + /** + Stack of wait lockers. + This member holds the data for the table + PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. + For most locks, only 1 wait locker is used at a given time. + For composite locks, several records are needed: + - 1 for a 'logical' wait (for example on the GLOBAL READ LOCK state) + - 1 for a 'physical' wait (for example on COND_refresh) + */ + PFS_wait_locker m_wait_locker_stack[LOCKER_STACK_SIZE]; + /** True if the circular buffer @c m_waits_history is full. */ + bool m_waits_history_full; + /** Current index in the circular buffer @c m_waits_history. */ + uint m_waits_history_index; + /** + Waits history circular buffer. + This member holds the data for the table + PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. + */ + PFS_events_waits *m_waits_history; + /** + Per thread waits aggregated statistics. + This member holds the data for the table + PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. + */ + PFS_single_stat_chain *m_instr_class_wait_stats; +}; + +PFS_thread *sanitize_thread(PFS_thread *unsafe); + +PFS_single_stat_chain* +find_per_thread_mutex_class_wait_stat(PFS_thread *thread, + PFS_mutex_class *klass); + +PFS_single_stat_chain* +find_per_thread_rwlock_class_wait_stat(PFS_thread *thread, + PFS_rwlock_class *klass); + +PFS_single_stat_chain* +find_per_thread_cond_class_wait_stat(PFS_thread *thread, + PFS_cond_class *klass); + +PFS_single_stat_chain* +find_per_thread_file_class_wait_stat(PFS_thread *thread, + PFS_file_class *klass); + +int init_instruments(const PFS_global_param *param); +void cleanup_instruments(); +int init_file_hash(); +void cleanup_file_hash(); +PFS_mutex* create_mutex(PFS_mutex_class *mutex_class, const void *identity); +void destroy_mutex(PFS_mutex *pfs); +PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity); +void destroy_rwlock(PFS_rwlock *pfs); +PFS_cond* create_cond(PFS_cond_class *klass, const void *identity); +void destroy_cond(PFS_cond *pfs); + +PFS_thread* create_thread(PFS_thread_class *klass, const void *identity, + ulong thread_id); + +void destroy_thread(PFS_thread *pfs); + +PFS_file* find_or_create_file(PFS_thread *thread, PFS_file_class *klass, + const char *filename, uint len); + +void release_file(PFS_file *pfs); +void destroy_file(PFS_thread *thread, PFS_file *pfs); +PFS_table* create_table(PFS_table_share *share, const void *identity); +void destroy_table(PFS_table *pfs); + +/* For iterators and show status. */ + +extern ulong mutex_max; +extern ulong mutex_lost; +extern ulong rwlock_max; +extern ulong rwlock_lost; +extern ulong cond_max; +extern ulong cond_lost; +extern ulong thread_max; +extern ulong thread_lost; +extern ulong file_max; +extern ulong file_lost; +extern long file_handle_max; +extern ulong file_handle_lost; +extern ulong table_max; +extern ulong table_lost; +extern ulong events_waits_history_per_thread; +extern ulong instr_class_per_thread; +extern ulong locker_lost; + +/* Exposing the data directly, for iterators. */ + +extern PFS_mutex *mutex_array; +extern PFS_rwlock *rwlock_array; +extern PFS_cond *cond_array; +extern PFS_thread *thread_array; +extern PFS_file *file_array; +extern PFS_file **file_handle_array; +extern PFS_table *table_array; + +void reset_events_waits_by_instance(); +void reset_per_thread_wait_stat(); +void reset_file_instance_io(); + +/** @} */ +#endif + diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc new file mode 100644 index 00000000000..ac8aa64b0c5 --- /dev/null +++ b/storage/perfschema/pfs_instr_class.cc @@ -0,0 +1,878 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_instr_class.cc + Performance schema instruments meta data (implementation). +*/ + +#include "my_global.h" +#include "my_sys.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" +#include "pfs_global.h" +#include "pfs_events_waits.h" +#include "pfs_atomic.h" +#include "mysql/psi/mysql_thread.h" +#include "lf.h" + +#include <string.h> + +/** + @defgroup Performance_schema_buffers Performance Schema Buffers + @ingroup Performance_schema_implementation + @{ +*/ + +/** + Global performance schema flag. + Indicate if the performance schema is enabled. + This flag is set at startup, and never changes. +*/ +my_bool pfs_enabled= TRUE; + +/** + Current number of elements in mutex_class_array. + This global variable is written to during: + - the performance schema initialization + - a plugin initialization +*/ +static volatile uint32 mutex_class_dirty_count= 0; +static volatile uint32 mutex_class_allocated_count= 0; +static volatile uint32 rwlock_class_dirty_count= 0; +static volatile uint32 rwlock_class_allocated_count= 0; +static volatile uint32 cond_class_dirty_count= 0; +static volatile uint32 cond_class_allocated_count= 0; + +/** Size of the mutex class array. @sa mutex_class_array */ +ulong mutex_class_max= 0; +/** Number of mutex class lost. @sa mutex_class_array */ +ulong mutex_class_lost= 0; +/** Size of the rwlock class array. @sa rwlock_class_array */ +ulong rwlock_class_max= 0; +/** Number of rwlock class lost. @sa rwlock_class_array */ +ulong rwlock_class_lost= 0; +/** Size of the condition class array. @sa cond_class_array */ +ulong cond_class_max= 0; +/** Number of condition class lost. @sa cond_class_array */ +ulong cond_class_lost= 0; +/** Size of the thread class array. @sa thread_class_array */ +ulong thread_class_max= 0; +/** Number of thread class lost. @sa thread_class_array */ +ulong thread_class_lost= 0; +/** Size of the file class array. @sa file_class_array */ +ulong file_class_max= 0; +/** Number of file class lost. @sa file_class_array */ +ulong file_class_lost= 0; +/** Size of the table share array. @sa table_share_array */ +ulong table_share_max= 0; +/** Number of table share lost. @sa table_share_array */ +ulong table_share_lost= 0; + +static PFS_mutex_class *mutex_class_array= NULL; +static PFS_rwlock_class *rwlock_class_array= NULL; +static PFS_cond_class *cond_class_array= NULL; + +/** + Current number or elements in thread_class_array. + This global variable is written to during: + - the performance schema initialization + - a plugin initialization +*/ +static volatile uint32 thread_class_dirty_count= 0; +static volatile uint32 thread_class_allocated_count= 0; + +static PFS_thread_class *thread_class_array= NULL; + +/** + Table instance array. + @sa table_share_max + @sa table_share_lost + @sa table_share_hash +*/ +PFS_table_share *table_share_array= NULL; + +PFS_instr_class global_table_class= +{ + "wait/table", /* name */ + 10, /* name length */ + 0, /* flags */ + true, /* enabled */ + true, /* timed */ + { &flag_events_waits_current, NULL, 0, 0, 0, 0} /* wait stat chain */ +}; + +/** Hash table for instrumented tables. */ +static LF_HASH table_share_hash; +/** True if table_share_hash is initialized. */ +static bool table_share_hash_inited= false; + +static volatile uint32 file_class_dirty_count= 0; +static volatile uint32 file_class_allocated_count= 0; + +static PFS_file_class *file_class_array= NULL; + +/** + Initialize the instrument synch class buffers. + @param mutex_class_sizing max number of mutex class + @param rwlock_class_sizing max number of rwlock class + @param cond_class_sizing max number of condition class + @return 0 on success +*/ +int init_sync_class(uint mutex_class_sizing, + uint rwlock_class_sizing, + uint cond_class_sizing) +{ + mutex_class_dirty_count= mutex_class_allocated_count= 0; + rwlock_class_dirty_count= rwlock_class_allocated_count= 0; + cond_class_dirty_count= cond_class_allocated_count= 0; + mutex_class_max= mutex_class_sizing; + rwlock_class_max= rwlock_class_sizing; + cond_class_max= cond_class_sizing; + mutex_class_lost= rwlock_class_lost= cond_class_lost= 0; + + mutex_class_array= NULL; + rwlock_class_array= NULL; + cond_class_array= NULL; + + if (mutex_class_max > 0) + { + mutex_class_array= PFS_MALLOC_ARRAY(mutex_class_max, PFS_mutex_class, + MYF(MY_ZEROFILL)); + if (unlikely(mutex_class_array == NULL)) + return 1; + } + + if (rwlock_class_max > 0) + { + rwlock_class_array= PFS_MALLOC_ARRAY(rwlock_class_max, PFS_rwlock_class, + MYF(MY_ZEROFILL)); + if (unlikely(rwlock_class_array == NULL)) + return 1; + } + + if (cond_class_max > 0) + { + cond_class_array= PFS_MALLOC_ARRAY(cond_class_max, PFS_cond_class, + MYF(MY_ZEROFILL)); + if (unlikely(cond_class_array == NULL)) + return 1; + } + + return 0; +} + +/** Cleanup the instrument synch class buffers. */ +void cleanup_sync_class(void) +{ + pfs_free(mutex_class_array); + mutex_class_array= NULL; + mutex_class_dirty_count= mutex_class_allocated_count= mutex_class_max= 0; + pfs_free(rwlock_class_array); + rwlock_class_array= NULL; + rwlock_class_dirty_count= rwlock_class_allocated_count= rwlock_class_max= 0; + pfs_free(cond_class_array); + cond_class_array= NULL; + cond_class_dirty_count= cond_class_allocated_count= cond_class_max= 0; +} + +/** + Initialize the thread class buffer. + @param thread_class_sizing max number of thread class + @return 0 on success +*/ +int init_thread_class(uint thread_class_sizing) +{ + int result= 0; + thread_class_dirty_count= thread_class_allocated_count= 0; + thread_class_max= thread_class_sizing; + thread_class_lost= 0; + + if (thread_class_max > 0) + { + thread_class_array= PFS_MALLOC_ARRAY(thread_class_max, PFS_thread_class, + MYF(MY_ZEROFILL)); + if (unlikely(thread_class_array == NULL)) + result= 1; + } + else + thread_class_array= NULL; + + return result; +} + +/** Cleanup the thread class buffers. */ +void cleanup_thread_class(void) +{ + pfs_free(thread_class_array); + thread_class_array= NULL; + thread_class_dirty_count= thread_class_allocated_count= 0; + thread_class_max= 0; +} + +/** + Initialize the table share buffer. + @param table_share_sizing max number of table share + @return 0 on success +*/ +int init_table_share(uint table_share_sizing) +{ + int result= 0; + table_share_max= table_share_sizing; + table_share_lost= 0; + + if (table_share_max > 0) + { + table_share_array= PFS_MALLOC_ARRAY(table_share_max, PFS_table_share, + MYF(MY_ZEROFILL)); + if (unlikely(table_share_array == NULL)) + result= 1; + } + else + table_share_array= NULL; + + return result; +} + +/** Cleanup the table share buffers. */ +void cleanup_table_share(void) +{ + pfs_free(table_share_array); + table_share_array= NULL; + table_share_max= 0; +} + +static uchar *table_share_hash_get_key(const uchar *entry, size_t *length, + my_bool) +{ + const PFS_table_share * const *typed_entry; + const PFS_table_share *share; + const void *result; + typed_entry= reinterpret_cast<const PFS_table_share* const *> (entry); + DBUG_ASSERT(typed_entry != NULL); + share= *typed_entry; + DBUG_ASSERT(share != NULL); + *length= share->m_key.m_key_length; + result= &share->m_key.m_hash_key[0]; + return const_cast<uchar*> (reinterpret_cast<const uchar*> (result)); +} + +/** Initialize the table share hash table. */ +int init_table_share_hash(void) +{ + if ((! table_share_hash_inited) && (table_share_max > 0)) + { + lf_hash_init(&table_share_hash, sizeof(PFS_table_share*), LF_HASH_UNIQUE, + 0, 0, table_share_hash_get_key, &my_charset_bin); + table_share_hash_inited= true; + } + return 0; +} + +/** Cleanup the table share hash table. */ +void cleanup_table_share_hash(void) +{ + if (table_share_hash_inited) + { + lf_hash_destroy(&table_share_hash); + table_share_hash_inited= false; + } +} + +/** + Initialize the file class buffer. + @param file_class_sizing max number of file class + @return 0 on success +*/ +int init_file_class(uint file_class_sizing) +{ + int result= 0; + file_class_dirty_count= file_class_allocated_count= 0; + file_class_max= file_class_sizing; + file_class_lost= 0; + + if (file_class_max > 0) + { + file_class_array= PFS_MALLOC_ARRAY(file_class_max, PFS_file_class, + MYF(MY_ZEROFILL)); + if (unlikely(file_class_array == NULL)) + return 1; + } + else + file_class_array= NULL; + + return result; +} + +/** Cleanup the file class buffers. */ +void cleanup_file_class(void) +{ + pfs_free(file_class_array); + file_class_array= NULL; + file_class_dirty_count= file_class_allocated_count= 0; + file_class_max= 0; +} + +static void init_instr_class(PFS_instr_class *klass, + const char *name, + uint name_length, + int flags) +{ + DBUG_ASSERT(name_length <= PFS_MAX_INFO_NAME_LENGTH); + memset(klass, 0, sizeof(PFS_instr_class)); + strncpy(klass->m_name, name, name_length); + klass->m_name_length= name_length; + klass->m_flags= flags; + klass->m_enabled= true; + klass->m_timed= true; +} + +#define REGISTER_CLASS_BODY_PART(INDEX, ARRAY, MAX, NAME, NAME_LENGTH) \ + for (INDEX= 0; INDEX < MAX; INDEX++) \ + { \ + entry= &ARRAY[INDEX]; \ + if ((entry->m_name_length == NAME_LENGTH) && \ + (strncmp(entry->m_name, NAME, NAME_LENGTH) == 0)) \ + { \ + DBUG_ASSERT(entry->m_flags == flags); \ + return (INDEX + 1); \ + } \ + } + +/** + Register a mutex instrumentation metadata. + @param name the instrumented name + @param name_length length in bytes of name + @param flags the instrumentation flags + @return a mutex instrumentation key +*/ +PFS_sync_key register_mutex_class(const char *name, uint name_length, + int flags) +{ + uint32 index; + PFS_mutex_class *entry; + + /* + This is a full array scan, which is not optimal. + This is acceptable since this code is only used at startup, + or when a plugin is loaded. + */ + REGISTER_CLASS_BODY_PART(index, mutex_class_array, mutex_class_max, + name, name_length) + /* + Note that: + mutex_class_dirty_count is incremented *before* an entry is added + mutex_class_allocated_count is incremented *after* an entry is added + */ + index= PFS_atomic::add_u32(&mutex_class_dirty_count, 1); + + if (index < mutex_class_max) + { + /* + The instrument was not found (from a possible previous + load / unload of a plugin), allocate it. + This code is safe when 2 threads execute in parallel + for different mutex classes: + - thread 1 registering class A + - thread 2 registering class B + will not collide in the same mutex_class_array[index] entry. + This code does not protect against 2 threads registering + in parallel the same class: + - thread 1 registering class A + - thread 2 registering class A + could lead to a duplicate class A entry. + This is ok, since this case can not happen in the caller: + - classes names are derived from a plugin name + ('wait/synch/mutex/<plugin>/xxx') + - 2 threads can not register concurrently the same plugin + in INSTALL PLUGIN. + */ + entry= &mutex_class_array[index]; + init_instr_class(entry, name, name_length, flags); + entry->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_event_name; + entry->m_wait_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_wait_stat); + entry->m_lock_stat.m_control_flag= + &flag_events_locks_summary_by_event_name; + entry->m_lock_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_lock_stat); + entry->m_index= index; + /* + Now that this entry is populated, advertise it + + Technically, there is a small race condition here: + T0: + mutex_class_dirty_count= 10 + mutex_class_allocated_count= 10 + T1: Thread A increment mutex_class_dirty_count to 11 + T2: Thread B increment mutex_class_dirty_count to 12 + T3: Thread A populate entry 11 + T4: Thread B populate entry 12 + T5: Thread B increment mutex_class_allocated_count to 11, + advertise thread A incomplete record 11, + but does not advertise thread B complete record 12 + T6: Thread A increment mutex_class_allocated_count to 12 + This has no impact, and is acceptable. + A reader will not see record 12 for a short time. + A reader will see an incomplete record 11 for a short time, + which is ok: the mutex name / statistics will be temporarily + empty/NULL/zero, but this won't cause a crash + (mutex_class_array is initialized with MY_ZEROFILL). + */ + PFS_atomic::add_u32(&mutex_class_allocated_count, 1); + return (index + 1); + } + + /* + Out of space, report to SHOW STATUS that + the allocated memory was too small. + */ + mutex_class_lost++; + return 0; +} + +/** + Register a rwlock instrumentation metadata. + @param name the instrumented name + @param name_length length in bytes of name + @param flags the instrumentation flags + @return a rwlock instrumentation key +*/ +PFS_sync_key register_rwlock_class(const char *name, uint name_length, + int flags) +{ + /* See comments in register_mutex_class */ + uint32 index; + PFS_rwlock_class *entry; + + REGISTER_CLASS_BODY_PART(index, rwlock_class_array, rwlock_class_max, + name, name_length) + + index= PFS_atomic::add_u32(&rwlock_class_dirty_count, 1); + + if (index < rwlock_class_max) + { + entry= &rwlock_class_array[index]; + init_instr_class(entry, name, name_length, flags); + entry->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_event_name; + entry->m_wait_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_wait_stat); + entry->m_read_lock_stat.m_control_flag= + &flag_events_locks_summary_by_event_name; + entry->m_read_lock_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_read_lock_stat); + entry->m_write_lock_stat.m_control_flag= + &flag_events_locks_summary_by_event_name; + entry->m_write_lock_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_write_lock_stat); + entry->m_index= index; + PFS_atomic::add_u32(&rwlock_class_allocated_count, 1); + return (index + 1); + } + + rwlock_class_lost++; + return 0; +} + +/** + Register a condition instrumentation metadata. + @param name the instrumented name + @param name_length length in bytes of name + @param flags the instrumentation flags + @return a condition instrumentation key +*/ +PFS_sync_key register_cond_class(const char *name, uint name_length, + int flags) +{ + /* See comments in register_mutex_class */ + uint32 index; + PFS_cond_class *entry; + + REGISTER_CLASS_BODY_PART(index, cond_class_array, cond_class_max, + name, name_length) + + index= PFS_atomic::add_u32(&cond_class_dirty_count, 1); + + if (index < cond_class_max) + { + entry= &cond_class_array[index]; + init_instr_class(entry, name, name_length, flags); + entry->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_event_name; + entry->m_wait_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_wait_stat); + entry->m_index= index; + PFS_atomic::add_u32(&cond_class_allocated_count, 1); + return (index + 1); + } + + cond_class_lost++; + return 0; +} + +#define FIND_CLASS_BODY(KEY, COUNT, ARRAY) \ + if ((KEY == 0) || (KEY > COUNT)) \ + return NULL; \ + return &ARRAY[KEY - 1] + +/** + Find a mutex instrumentation class by key. + @param key the instrument key + @return the instrument class, or NULL +*/ +PFS_mutex_class *find_mutex_class(PFS_sync_key key) +{ + FIND_CLASS_BODY(key, mutex_class_allocated_count, mutex_class_array); +} + +#define SANITIZE_ARRAY_BODY(ARRAY, MAX, UNSAFE) \ + if ((&ARRAY[0] <= UNSAFE) && \ + (UNSAFE < &ARRAY[MAX])) \ + return UNSAFE; \ + return NULL + +PFS_mutex_class *sanitize_mutex_class(PFS_mutex_class *unsafe) +{ + SANITIZE_ARRAY_BODY(mutex_class_array, mutex_class_max, unsafe); +} + +/** + Find a rwlock instrumentation class by key. + @param key the instrument key + @return the instrument class, or NULL +*/ +PFS_rwlock_class *find_rwlock_class(PFS_sync_key key) +{ + FIND_CLASS_BODY(key, rwlock_class_allocated_count, rwlock_class_array); +} + +PFS_rwlock_class *sanitize_rwlock_class(PFS_rwlock_class *unsafe) +{ + SANITIZE_ARRAY_BODY(rwlock_class_array, rwlock_class_max, unsafe); +} + +/** + Find a condition instrumentation class by key. + @param key the instrument key + @return the instrument class, or NULL +*/ +PFS_cond_class *find_cond_class(PFS_sync_key key) +{ + FIND_CLASS_BODY(key, cond_class_allocated_count, cond_class_array); +} + +PFS_cond_class *sanitize_cond_class(PFS_cond_class *unsafe) +{ + SANITIZE_ARRAY_BODY(cond_class_array, cond_class_max, unsafe); +} + +/** + Register a thread instrumentation metadata. + @param name the instrumented name + @param name_length length in bytes of name + @param flags the instrumentation flags + @return a thread instrumentation key +*/ +PFS_thread_key register_thread_class(const char *name, uint name_length, + int flags) +{ + /* See comments in register_mutex_class */ + uint32 index; + PFS_thread_class *entry; + + for (index= 0; index < thread_class_max; index++) + { + entry= &thread_class_array[index]; + + if ((entry->m_name_length == name_length) && + (strncmp(entry->m_name, name, name_length) == 0)) + return (index + 1); + } + + index= PFS_atomic::add_u32(&thread_class_dirty_count, 1); + + if (index < thread_class_max) + { + entry= &thread_class_array[index]; + DBUG_ASSERT(name_length <= PFS_MAX_INFO_NAME_LENGTH); + strncpy(entry->m_name, name, name_length); + entry->m_name_length= name_length; + entry->m_enabled= true; + PFS_atomic::add_u32(&thread_class_allocated_count, 1); + return (index + 1); + } + + thread_class_lost++; + return 0; +} + +/** + Find a thread instrumentation class by key. + @param key the instrument key + @return the instrument class, or NULL +*/ +PFS_thread_class *find_thread_class(PFS_sync_key key) +{ + FIND_CLASS_BODY(key, thread_class_allocated_count, thread_class_array); +} + +PFS_thread_class *sanitize_thread_class(PFS_thread_class *unsafe) +{ + SANITIZE_ARRAY_BODY(thread_class_array, thread_class_max, unsafe); +} + +/** + Register a file instrumentation metadata. + @param name the instrumented name + @param name_length length in bytes of name + @param flags the instrumentation flags + @return a file instrumentation key +*/ +PFS_file_key register_file_class(const char *name, uint name_length, + int flags) +{ + /* See comments in register_mutex_class */ + uint32 index; + PFS_file_class *entry; + + REGISTER_CLASS_BODY_PART(index, file_class_array, file_class_max, + name, name_length) + + index= PFS_atomic::add_u32(&file_class_dirty_count, 1); + + if (index < file_class_max) + { + entry= &file_class_array[index]; + init_instr_class(entry, name, name_length, flags); + entry->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_event_name; + entry->m_wait_stat.m_parent= NULL; + reset_single_stat_link(&entry->m_wait_stat); + entry->m_index= index; + PFS_atomic::add_u32(&file_class_allocated_count, 1); + return (index + 1); + } + + file_class_lost++; + return 0; +} + +/** + Find a file instrumentation class by key. + @param key the instrument key + @return the instrument class, or NULL +*/ +PFS_file_class *find_file_class(PFS_file_key key) +{ + FIND_CLASS_BODY(key, file_class_allocated_count, file_class_array); +} + +PFS_file_class *sanitize_file_class(PFS_file_class *unsafe) +{ + SANITIZE_ARRAY_BODY(file_class_array, file_class_max, unsafe); +} + +/** + Find or create a table instance by name. + @param thread the executing instrumented thread + @param schema_name the table schema name + @param schema_name_length the table schema name length + @param table_name the table name + @param table_name_length the table name length + @return a table instance, or NULL +*/ +PFS_table_share* find_or_create_table_share(PFS_thread *thread, + const char *schema_name, + uint schema_name_length, + const char *table_name, + uint table_name_length) +{ + /* See comments in register_mutex_class */ + int pass; + PFS_table_share_key key; + + if (! table_share_hash_inited) + { + /* Table instrumentation can be turned off. */ + table_share_lost++; + return NULL; + } + + if (unlikely(thread->m_table_share_hash_pins == NULL)) + { + thread->m_table_share_hash_pins= lf_hash_get_pins(&table_share_hash); + if (unlikely(thread->m_table_share_hash_pins == NULL)) + { + table_share_lost++; + return NULL; + } + } + + DBUG_ASSERT(schema_name_length <= NAME_LEN); + DBUG_ASSERT(table_name_length <= NAME_LEN); + + char *ptr= &key.m_hash_key[0]; + memcpy(ptr, schema_name, schema_name_length); + ptr+= schema_name_length; + ptr[0]= 0; ptr++; + memcpy(ptr, table_name, table_name_length); + ptr+= table_name_length; + ptr[0]= 0; ptr++; + key.m_key_length= ptr - &key.m_hash_key[0]; + + PFS_table_share **entry; + uint retry_count= 0; + const uint retry_max= 3; +search: + entry= reinterpret_cast<PFS_table_share**> + (lf_hash_search(&table_share_hash, thread->m_table_share_hash_pins, + &key.m_hash_key[0], key.m_key_length)); + if (entry && (entry != MY_ERRPTR)) + { + PFS_table_share *pfs; + pfs= *entry; + lf_hash_search_unpin(thread->m_table_share_hash_pins); + return pfs; + } + + /* table_name is not constant, just using it for noise on create */ + uint i= randomized_index(table_name, table_share_max); + + /* + Pass 1: [random, table_share_max - 1] + Pass 2: [0, table_share_max - 1] + */ + for (pass= 1; pass <= 2; i=0, pass++) + { + PFS_table_share *pfs= table_share_array + i; + PFS_table_share *pfs_last= table_share_array + table_share_max; + for ( ; pfs < pfs_last; pfs++) + { + if (pfs->m_lock.is_free()) + { + if (pfs->m_lock.free_to_dirty()) + { + pfs->m_key= key; + pfs->m_schema_name= &pfs->m_key.m_hash_key[0]; + pfs->m_schema_name_length= schema_name_length; + pfs->m_table_name= &pfs->m_key.m_hash_key[schema_name_length + 1]; + pfs->m_table_name_length= table_name_length; + pfs->m_wait_stat.m_control_flag= + &flag_events_waits_summary_by_instance; + pfs->m_wait_stat.m_parent= NULL; + reset_single_stat_link(&pfs->m_wait_stat); + pfs->m_enabled= true; + pfs->m_timed= true; + pfs->m_aggregated= false; + + int res; + res= lf_hash_insert(&table_share_hash, + thread->m_table_share_hash_pins, &pfs); + if (likely(res == 0)) + { + pfs->m_lock.dirty_to_allocated(); + return pfs; + } + + pfs->m_lock.dirty_to_free(); + + if (res > 0) + { + /* Duplicate insert by another thread */ + if (++retry_count > retry_max) + { + /* Avoid infinite loops */ + table_share_lost++; + return NULL; + } + goto search; + } + + /* OOM in lf_hash_insert */ + table_share_lost++; + return NULL; + } + } + } + } + + table_share_lost++; + return NULL; +} + +PFS_table_share *sanitize_table_share(PFS_table_share *unsafe) +{ + SANITIZE_ARRAY_BODY(table_share_array, table_share_max, unsafe); +} + +static void reset_mutex_class_waits(void) +{ + PFS_mutex_class *pfs= mutex_class_array; + PFS_mutex_class *pfs_last= mutex_class_array + mutex_class_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +static void reset_rwlock_class_waits(void) +{ + PFS_rwlock_class *pfs= rwlock_class_array; + PFS_rwlock_class *pfs_last= rwlock_class_array + rwlock_class_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +static void reset_cond_class_waits(void) +{ + PFS_cond_class *pfs= cond_class_array; + PFS_cond_class *pfs_last= cond_class_array + cond_class_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +static void reset_file_class_waits(void) +{ + PFS_file_class *pfs= file_class_array; + PFS_file_class *pfs_last= file_class_array + file_class_max; + + for ( ; pfs < pfs_last; pfs++) + reset_single_stat_link(&pfs->m_wait_stat); +} + +/** Reset the wait statistics for every instrument class. */ +void reset_instrument_class_waits(void) +{ + reset_mutex_class_waits(); + reset_rwlock_class_waits(); + reset_cond_class_waits(); + reset_file_class_waits(); +} + +/** Reset the io statistics per file class. */ +void reset_file_class_io(void) +{ + PFS_file_class *pfs= file_class_array; + PFS_file_class *pfs_last= file_class_array + file_class_max; + + for ( ; pfs < pfs_last; pfs++) + reset_file_stat(&pfs->m_file_stat); +} + +/** @} */ + diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h new file mode 100644 index 00000000000..0a58095d612 --- /dev/null +++ b/storage/perfschema/pfs_instr_class.h @@ -0,0 +1,251 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_INSTR_CLASS_H +#define PFS_INSTR_CLASS_H + +/** + @file storage/perfschema/pfs_instr_class.h + Performance schema instruments meta data (declarations). +*/ + +/** + Maximum length of an instrument name. + For example, 'wait/sync/mutex/sql/LOCK_open' is an instrument name. +*/ +#define PFS_MAX_INFO_NAME_LENGTH 128 + +/** + Maximum length of the 'full' prefix of an instrument name. + For example, for the instrument name 'wait/sync/mutex/sql/LOCK_open', + the full prefix is 'wait/sync/mutex/sql/', which in turn derives from + a prefix 'wait/sync/mutex' for mutexes, and a category of 'sql' for mutexes + of the sql layer in the server. +*/ +#define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32 + +#include <mysql_priv.h> +#include <mysql/psi/psi.h> +#include "pfs_lock.h" +#include "pfs_stat.h" + +/** + @addtogroup Performance_schema_buffers + @{ +*/ + +extern my_bool pfs_enabled; + +/** Key, naming a synch instrument (mutex, rwlock, cond). */ +typedef unsigned int PFS_sync_key; +/** Key, naming a thread instrument. */ +typedef unsigned int PFS_thread_key; +/** Key, naming a file instrument. */ +typedef unsigned int PFS_file_key; + +struct PFS_thread; + +/** 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; + /** Wait statistics chain. */ + PFS_single_stat_chain m_wait_stat; +}; + +/** Instrumentation metadata for a MUTEX. */ +struct PFS_mutex_class : public PFS_instr_class +{ + /** + Lock statistics chain. + This statistic is not exposed in user visible tables yet. + */ + PFS_single_stat_chain m_lock_stat; + /** Self index in @c mutex_class_array. */ + uint m_index; +}; + +/** Instrumentation metadata for a RWLOCK. */ +struct PFS_rwlock_class : public PFS_instr_class +{ + /** + Read lock statistics chain. + This statistic is not exposed in user visible tables yet. + */ + PFS_single_stat_chain m_read_lock_stat; + /** + Write lock statistics chain. + This statistic is not exposed in user visible tables yet. + */ + PFS_single_stat_chain m_write_lock_stat; + /** Self index in @c rwlock_class_array. */ + uint m_index; +}; + +/** Instrumentation metadata for a COND. */ +struct PFS_cond_class : public PFS_instr_class +{ + /** + Condition usage statistics. + 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; +}; + +/** 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; +}; + +/** Key identifying a table share. */ +struct PFS_table_share_key +{ + /** + Hash search key. + This has to be a string for LF_HASH, + the format is "<schema_name><0x00><object_name><0x00>" + @see create_table_def_key + */ + char m_hash_key[NAME_LEN + 1 + NAME_LEN + 1]; + /** Length in bytes of @c m_hash_key. */ + uint m_key_length; +}; + +/** Instrumentation metadata for a table share. */ +struct PFS_table_share +{ + /** Internal lock. */ + pfs_lock m_lock; + /** Search key. */ + PFS_table_share_key m_key; + /** Schema name. */ + const char *m_schema_name; + /** Length in bytes of @c m_schema_name. */ + uint m_schema_name_length; + /** Table name. */ + const char *m_table_name; + /** Length in bytes of @c m_table_name. */ + uint m_table_name_length; + /** Wait statistics chain. */ + PFS_single_stat_chain m_wait_stat; + /** True if this table instrument is enabled. */ + bool m_enabled; + /** True if this table instrument is timed. */ + bool m_timed; + /** True if this table instrument is aggregated. */ + bool m_aggregated; +}; + +/** + Instrument controlling all tables. + This instrument is used as a default when there is no + entry present in SETUP_OBJECTS. +*/ +extern PFS_instr_class global_table_class; + +/** Instrumentation metadata for a file. */ +struct PFS_file_class : public PFS_instr_class +{ + /** File usage statistics. */ + PFS_file_stat m_file_stat; + /** Self index in @c file_class_array. */ + uint m_index; +}; + +int init_sync_class(uint mutex_class_sizing, + uint rwlock_class_sizing, + uint cond_class_sizing); + +void cleanup_sync_class(); +int init_thread_class(uint thread_class_sizing); +void cleanup_thread_class(); +int init_table_share(uint table_share_sizing); +void cleanup_table_share(); +int init_table_share_hash(); +void cleanup_table_share_hash(); +int init_file_class(uint file_class_sizing); +void cleanup_file_class(); + +PFS_sync_key register_mutex_class(const char *name, uint name_length, + int flags); + +PFS_sync_key register_rwlock_class(const char *name, uint name_length, + int flags); + +PFS_sync_key register_cond_class(const char *name, uint name_length, + int flags); + +PFS_thread_key register_thread_class(const char *name, uint name_length, + int flags); + +PFS_file_key register_file_class(const char *name, uint name_length, + int flags); + +PFS_mutex_class *find_mutex_class(PSI_mutex_key key); +PFS_mutex_class *sanitize_mutex_class(PFS_mutex_class *unsafe); +PFS_rwlock_class *find_rwlock_class(PSI_rwlock_key key); +PFS_rwlock_class *sanitize_rwlock_class(PFS_rwlock_class *unsafe); +PFS_cond_class *find_cond_class(PSI_cond_key key); +PFS_cond_class *sanitize_cond_class(PFS_cond_class *unsafe); +PFS_thread_class *find_thread_class(PSI_thread_key key); +PFS_thread_class *sanitize_thread_class(PFS_thread_class *unsafe); +PFS_file_class *find_file_class(PSI_file_key key); +PFS_file_class *sanitize_file_class(PFS_file_class *unsafe); + +PFS_table_share *find_or_create_table_share(PFS_thread *thread, + const char *schema_name, + uint schema_name_length, + const char *table_name, + uint table_name_length); + +PFS_table_share *sanitize_table_share(PFS_table_share *unsafe); + +extern ulong mutex_class_max; +extern ulong mutex_class_lost; +extern ulong rwlock_class_max; +extern ulong rwlock_class_lost; +extern ulong cond_class_max; +extern ulong cond_class_lost; +extern ulong thread_class_max; +extern ulong thread_class_lost; +extern ulong file_class_max; +extern ulong file_class_lost; +extern ulong table_share_max; +extern ulong table_share_lost; +extern PFS_table_share *table_share_array; + +void reset_instrument_class_waits(); +void reset_file_class_io(); + +/** @} */ +#endif + diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h new file mode 100644 index 00000000000..46d7d33617b --- /dev/null +++ b/storage/perfschema/pfs_lock.h @@ -0,0 +1,173 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_LOCK_H +#define PFS_LOCK_H + +/** + @file storage/perfschema/pfs_lock.h + Performance schema internal locks (declarations). +*/ + +#include "pfs_atomic.h" + +/** + @addtogroup Performance_schema_buffers + @{ +*/ + +/** + State of a free record. + Values of a free record should not be read by a reader. + Writers can concurrently attempt to allocate a free record. +*/ +#define PFS_LOCK_FREE 0 +/** + State of a dirty record. + Values of a dirty record should not be read by a reader, + as the record is currently being modified. + Only one writer, the writer which owns the record, should + modify the record content. +*/ +#define PFS_LOCK_DIRTY 1 +/** + State of an allocated record. + Values of an allocated record are safe to read by a reader. + A writer may modify some but not all properties of the record: + only modifying values that can never cause the reader to crash is allowed. +*/ +#define PFS_LOCK_ALLOCATED 2 + +/** + A 'lock' protecting performance schema internal buffers. + This lock is used to mark the state of a record. + Access to the record is not enforced here, + it's up to the readers and writers to look at the record state + before making an actual read or write operation. +*/ +struct pfs_lock +{ + /** + The record internal state. + @sa PFS_LOCK_FREE + @sa PFS_LOCK_DIRTY + @sa PFS_LOCK_ALLOCATED + */ + volatile int32 m_state; + /** + The record internal version number. + This version number is to transform the 'ABA' problem + (see http://en.wikipedia.org/wiki/ABA_problem) + into an 'A(n)BA(n + 1)' problem, where 'n' is the m_version number. + When the performance schema instrumentation deletes a record, + then create a different record reusing the same memory allocation, + the version number is incremented, so that a reader can detect that + the record was changed. Note that the version number is never + reset to zero when a new record is created. + */ + volatile uint32 m_version; + + /** Returns true if the record is free. */ + bool is_free(void) + { + /* This is a dirty read */ + return (m_state == PFS_LOCK_FREE); + } + + /** Returns true if the record contains values that can be read. */ + bool is_populated(void) + { + int32 copy= m_state; /* non volatile copy, and dirty read */ + return (copy == PFS_LOCK_ALLOCATED); + } + + /** + Execute a free to dirty transition. + This transition is safe to execute concurrently by multiple writers. + Only one writer will succeed to acquire the record. + @return true if the operation succeed + */ + bool free_to_dirty(void) + { + int32 old_state= PFS_LOCK_FREE; + int32 new_state= PFS_LOCK_DIRTY; + + return (PFS_atomic::cas_32(&m_state, &old_state, new_state)); + } + + /** + Execute a dirty to allocated transition. + This transition should be executed by the writer that owns the record, + after the record is in a state ready to be read. + */ + void dirty_to_allocated(void) + { + DBUG_ASSERT(m_state == PFS_LOCK_DIRTY); + PFS_atomic::add_u32(&m_version, 1); + PFS_atomic::store_32(&m_state, PFS_LOCK_ALLOCATED); + } + + /** + Execute a dirty to free transition. + This transition should be executed by the writer that owns the record. + */ + void dirty_to_free(void) + { + DBUG_ASSERT(m_state == PFS_LOCK_DIRTY); + PFS_atomic::store_32(&m_state, PFS_LOCK_FREE); + } + + /** + Execute an allocated to free transition. + This transition should be executed by the writer that owns the record. + */ + void allocated_to_free(void) + { + DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED); + PFS_atomic::store_32(&m_state, PFS_LOCK_FREE); + } + + /** + Start an optimistic read operation. + @sa end_optimist_lock. + */ + void begin_optimistic_lock(struct pfs_lock *copy) + { + copy->m_version= PFS_atomic::load_u32(&m_version); + copy->m_state= PFS_atomic::load_32(&m_state); + } + + /** + End an optimistic read operation. + @sa begin_optimist_lock. + @return true if the data read is safe to use. + */ + bool end_optimistic_lock(struct pfs_lock *copy) + { + /* + return true if: + - the version + state has not changed + - and there was valid data to look at + */ + return ((copy->m_version == PFS_atomic::load_u32(&m_version)) && + (copy->m_state == PFS_atomic::load_32(&m_state)) && + (copy->m_state == PFS_LOCK_ALLOCATED)); + } +}; + + +/** @} */ +#endif + diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc new file mode 100644 index 00000000000..66b8a7fb22b --- /dev/null +++ b/storage/perfschema/pfs_server.cc @@ -0,0 +1,131 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_server.cc + Private interface for the server (implementation). +*/ + +#include "my_global.h" +#include "my_sys.h" +#include "mysys_err.h" +#include "mysql_priv.h" +#include "pfs_server.h" +#include "pfs.h" +#include "pfs_global.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" +#include "pfs_events_waits.h" +#include "pfs_timer.h" + +PFS_global_param pfs_param; + +static void destroy_pfs_thread(void *key); +void cleanup_performance_schema(void); + +struct PSI_bootstrap* +initialize_performance_schema(const PFS_global_param *param) +{ + pfs_initialized= false; + + if (! param->m_enabled) + { + /* + The performance schema is disabled in the startup command line. + All the instrumentation is turned off. + */ + return NULL; + } + + init_timers(); + PFS_atomic::init(); + + if (pthread_key_create(&THR_PFS, destroy_pfs_thread)) + return NULL; + + THR_PFS_initialized= true; + + if (init_sync_class(param->m_mutex_class_sizing, + param->m_rwlock_class_sizing, + param->m_cond_class_sizing) || + init_thread_class(param->m_thread_class_sizing) || + init_table_share(param->m_table_share_sizing) || + init_file_class(param->m_file_class_sizing) || + init_instruments(param) || + init_events_waits_history_long( + param->m_events_waits_history_long_sizing) || + init_file_hash() || + init_table_share_hash()) + { + /* + The performance schema initialization failed. + Free the memory used, and disable the instrumentation. + */ + cleanup_performance_schema(); + return NULL; + } + + pfs_initialized= true; + return &PFS_bootstrap; +} + +static void destroy_pfs_thread(void *key) +{ + PFS_thread* pfs= reinterpret_cast<PFS_thread*> (key); + DBUG_ASSERT(pfs); + /* + This automatic cleanup is a last resort and best effort to avoid leaks, + and may not work on windows due to the implementation of pthread_key_create(). + Please either use: + - my_thread_end() + - or PSI_server->delete_current_thread() + in the instrumented code, to explicitly cleanup the instrumentation. + + Avoid invalid writes when the main() thread completes after shutdown: + the memory pointed by pfs is already released. + */ + if (pfs_initialized) + destroy_thread(pfs); +} + +void cleanup_performance_schema(void) +{ + cleanup_instruments(); + cleanup_sync_class(); + cleanup_thread_class(); + cleanup_table_share(); + cleanup_file_class(); + cleanup_events_waits_history_long(); + cleanup_table_share_hash(); + cleanup_file_hash(); + PFS_atomic::cleanup(); +} + +void shutdown_performance_schema(void) +{ + pfs_initialized= false; + cleanup_performance_schema(); + /* + Be careful to not delete un-initialized keys, + this would affect key 0, which is THR_KEY_mysys, + */ + if (THR_PFS_initialized) + { + my_pthread_setspecific_ptr(THR_PFS, NULL); + pthread_key_delete(THR_PFS); + THR_PFS_initialized= false; + } +} + diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h new file mode 100644 index 00000000000..acf483e1f86 --- /dev/null +++ b/storage/perfschema/pfs_server.h @@ -0,0 +1,101 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_SERVER_H +#define PFS_SERVER_H + +/** + @file storage/perfschema/pfs_server.h + Private interface for the server (declarations). +*/ + +#ifndef PFS_MAX_MUTEX_CLASS + #define PFS_MAX_MUTEX_CLASS 200 +#endif +#ifndef PFS_MAX_MUTEX + #define PFS_MAX_MUTEX 1000 +#endif +#ifndef PFS_MAX_RWLOCK_CLASS + #define PFS_MAX_RWLOCK_CLASS 20 +#endif +#ifndef PFS_MAX_RWLOCK + #define PFS_MAX_RWLOCK 1000 +#endif +#ifndef PFS_MAX_COND_CLASS + #define PFS_MAX_COND_CLASS 80 +#endif +#ifndef PFS_MAX_COND + #define PFS_MAX_COND 1000 +#endif +#ifndef PFS_MAX_THREAD_CLASS + #define PFS_MAX_THREAD_CLASS 50 +#endif +#ifndef PFS_MAX_THREAD + #define PFS_MAX_THREAD 1000 +#endif +#ifndef PFS_MAX_FILE_CLASS + #define PFS_MAX_FILE_CLASS 50 +#endif +#ifndef PFS_MAX_FILE + #define PFS_MAX_FILE 10000 +#endif +#ifndef PFS_MAX_FILE_HANDLE + #define PFS_MAX_FILE_HANDLE 32768 +#endif +#ifndef PFS_MAX_TABLE_SHARE + #define PFS_MAX_TABLE_SHARE 50000 +#endif +#ifndef PFS_MAX_TABLE + #define PFS_MAX_TABLE 100000 +#endif +#ifndef PFS_WAITS_HISTORY_SIZE + #define PFS_WAITS_HISTORY_SIZE 10 +#endif +#ifndef PFS_WAITS_HISTORY_LONG_SIZE + #define PFS_WAITS_HISTORY_LONG_SIZE 10000 +#endif + +struct PFS_global_param +{ + bool m_enabled; + ulong m_mutex_class_sizing; + ulong m_rwlock_class_sizing; + ulong m_cond_class_sizing; + ulong m_thread_class_sizing; + ulong m_table_share_sizing; + ulong m_file_class_sizing; + ulong m_mutex_sizing; + ulong m_rwlock_sizing; + ulong m_cond_sizing; + ulong m_thread_sizing; + ulong m_table_sizing; + ulong m_file_sizing; + ulong m_file_handle_sizing; + ulong m_events_waits_history_sizing; + ulong m_events_waits_history_long_sizing; +}; + +extern PFS_global_param pfs_param; + +struct PSI_bootstrap* +initialize_performance_schema(const PFS_global_param *param); + +void initialize_performance_schema_acl(bool bootstrap); + +void check_performance_schema(); + +void shutdown_performance_schema(); + +#endif diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h new file mode 100644 index 00000000000..654f292d82c --- /dev/null +++ b/storage/perfschema/pfs_stat.h @@ -0,0 +1,125 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_STAT_H +#define PFS_STAT_H + +/** + @file storage/perfschema/pfs_stat.h + Statistics (declarations). +*/ + +/** + @addtogroup Performance_schema_buffers + @{ +*/ + +/** Usage statistics chain, for a single value and its aggregates. */ +struct PFS_single_stat_chain +{ + /** + Control flag. + Statistics are aggregated only if the control flag is true. + */ + bool *m_control_flag; + /** Next link in the statistics chain. */ + struct PFS_single_stat_chain *m_parent; + /** Count of values. */ + ulonglong m_count; + /** Sum of values. */ + ulonglong m_sum; + /** Minimum value. */ + ulonglong m_min; + /** Maximum value. */ + ulonglong m_max; +}; + +/** + Reset a single statistic link. + Only the current link is reset, parents are not affected. + @param stat the statistics link to reset +*/ +inline void reset_single_stat_link(PFS_single_stat_chain *stat) +{ + stat->m_count= 0; + stat->m_sum= 0; + stat->m_min= ULONGLONG_MAX; + stat->m_max= 0; +} + +/** + Aggregate a value to a statistic chain. + @param stat the aggregated statistic chain + @param value the value to aggregate +*/ +inline void aggregate_single_stat_chain(PFS_single_stat_chain *stat, + ulonglong value) +{ + do + { + if (*stat->m_control_flag) + { + stat->m_count++; + stat->m_sum+= value; + if (stat->m_min > value) + stat->m_min= value; + if (stat->m_max < value) + stat->m_max= value; + } + stat= stat->m_parent; + } + while (stat); +} + +/** Statistics for COND usage. */ +struct PFS_cond_stat +{ + /** Number of times a condition was signalled. */ + ulonglong m_signal_count; + /** Number of times a condition was broadcasted. */ + ulonglong m_broadcast_count; +}; + +/** Statistics for FILE usage. */ +struct PFS_file_stat +{ + /** Number of current open handles. */ + ulong m_open_count; + /** Count of READ operations. */ + ulonglong m_count_read; + /** Count of WRITE operations. */ + ulonglong m_count_write; + /** Number of bytes read. */ + ulonglong m_read_bytes; + /** Number of bytes written. */ + ulonglong m_write_bytes; +}; + +/** + Reset file statistic. + @param stat the statistics to reset +*/ +inline void reset_file_stat(PFS_file_stat *stat) +{ + stat->m_open_count= 0; + stat->m_count_read= 0; + stat->m_count_write= 0; + stat->m_read_bytes= 0; + stat->m_write_bytes= 0; +} + +/** @} */ +#endif + diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc new file mode 100644 index 00000000000..65883b62c32 --- /dev/null +++ b/storage/perfschema/pfs_timer.cc @@ -0,0 +1,119 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/pfs_timer.cc + Performance schema timers (implementation). +*/ + +#include "my_global.h" +#include "pfs_timer.h" +#include "my_rdtsc.h" + +enum_timer_name wait_timer= TIMER_NAME_CYCLE; +MY_TIMER_INFO pfs_timer_info; + +static ulonglong cycle_v0; +static ulonglong nanosec_v0; +static ulonglong microsec_v0; +static ulonglong millisec_v0; +static ulonglong tick_v0; + +static ulong cycle_to_pico; /* 1000 at 1 GHz, 333 at 3GHz, 250 at 4GHz */ +static ulong nanosec_to_pico; /* In theory, 1 000 */ +static ulong microsec_to_pico; /* In theory, 1 000 000 */ +static ulong millisec_to_pico; /* In theory, 1 000 000 000, fits in uint32 */ +static ulonglong tick_to_pico; /* 1e10 at 100 Hz, 1.666e10 at 60 Hz */ + +static inline ulong round_to_ulong(double value) +{ + return (ulong) (value + 0.5); +} + +static inline ulonglong round_to_ulonglong(double value) +{ + return (ulonglong) (value + 0.5); +} + +void init_timers(void) +{ + double pico_frequency= 1.0e12; + + my_timer_init(&pfs_timer_info); + + cycle_v0= my_timer_cycles(); + nanosec_v0= my_timer_nanoseconds(); + microsec_v0= my_timer_microseconds(); + millisec_v0= my_timer_milliseconds(); + tick_v0= my_timer_ticks(); + + if (pfs_timer_info.cycles.frequency > 0) + cycle_to_pico= round_to_ulong(pico_frequency/ + (double)pfs_timer_info.cycles.frequency); + else + cycle_to_pico= 0; + + if (pfs_timer_info.nanoseconds.frequency > 0) + nanosec_to_pico= round_to_ulong(pico_frequency/ + (double)pfs_timer_info.nanoseconds.frequency); + else + nanosec_to_pico= 0; + + if (pfs_timer_info.microseconds.frequency > 0) + microsec_to_pico= round_to_ulong(pico_frequency/ + (double)pfs_timer_info.microseconds.frequency); + else + microsec_to_pico= 0; + + if (pfs_timer_info.milliseconds.frequency > 0) + millisec_to_pico= round_to_ulong(pico_frequency/ + (double)pfs_timer_info.milliseconds.frequency); + else + millisec_to_pico= 0; + + if (pfs_timer_info.ticks.frequency > 0) + tick_to_pico= round_to_ulonglong(pico_frequency/ + (double)pfs_timer_info.ticks.frequency); + else + tick_to_pico= 0; +} + +ulonglong get_timer_value(enum_timer_name timer_name) +{ + ulonglong result; + + switch (timer_name) { + case TIMER_NAME_CYCLE: + result= (my_timer_cycles() - cycle_v0) * cycle_to_pico; + break; + case TIMER_NAME_NANOSEC: + result= (my_timer_nanoseconds() - nanosec_v0) * nanosec_to_pico; + break; + case TIMER_NAME_MICROSEC: + result= (my_timer_microseconds() - microsec_v0) * microsec_to_pico; + break; + case TIMER_NAME_MILLISEC: + result= (my_timer_milliseconds() - millisec_v0) * millisec_to_pico; + break; + case TIMER_NAME_TICK: + result= (my_timer_ticks() - tick_v0) * tick_to_pico; + break; + default: + result= 0; + DBUG_ASSERT(false); + } + return result; +} + diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h new file mode 100644 index 00000000000..beba263f45a --- /dev/null +++ b/storage/perfschema/pfs_timer.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef PFS_TIMER_H +#define PFS_TIMER_H + +/** + @file storage/perfschema/pfs_timer.h + Performance schema timers (declarations). +*/ +#include <my_rdtsc.h> +#include "pfs_column_types.h" + +extern enum_timer_name wait_timer; +extern MY_TIMER_INFO pfs_timer_info; + +void init_timers(); + +ulonglong get_timer_value(enum_timer_name timer_name); + +#endif + diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in new file mode 100644 index 00000000000..e6539dc1260 --- /dev/null +++ b/storage/perfschema/plug.in @@ -0,0 +1,26 @@ +dnl -*- ksh -*- + +# Copyright (C) 2008-2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +dnl This file is part of the configure scripts used by autoconf. + +MYSQL_STORAGE_ENGINE(perfschema, + perfschema, + [Performance Schema], + [Performance Schema], + [default,max,max-no-ndb]) +MYSQL_PLUGIN_DIRECTORY(perfschema, [storage/perfschema]) +MYSQL_PLUGIN_STATIC(perfschema, [libperfschema.a]) diff --git a/storage/perfschema/table_all_instr.cc b/storage/perfschema/table_all_instr.cc new file mode 100644 index 00000000000..e6cd7897f6f --- /dev/null +++ b/storage/perfschema/table_all_instr.cc @@ -0,0 +1,264 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_all_instr.cc + Abstract tables for all instruments (implementation). +*/ + +#include "mysql_priv.h" +#include "table_all_instr.h" +#include "pfs_global.h" + +table_all_instr::table_all_instr(const PFS_engine_table_share *share) + : PFS_readonly_table(share, &m_pos), + m_pos(), m_next_pos() +{} + +void table_all_instr::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_all_instr::rnd_next(void) +{ + PFS_mutex *mutex; + PFS_rwlock *rwlock; + PFS_cond *cond; + PFS_file *file; + + for (m_pos.set_at(&m_next_pos); + m_pos.has_more_view(); + m_pos.next_view()) + { + switch (m_pos.m_index_1) { + case pos_all_instr::VIEW_MUTEX: + for ( ; m_pos.m_index_2 < mutex_max; m_pos.m_index_2++) + { + mutex= &mutex_array[m_pos.m_index_2]; + if (mutex->m_lock.is_populated()) + { + make_mutex_row(mutex); + m_next_pos.set_after(&m_pos); + return 0; + } + } + break; + case pos_all_instr::VIEW_RWLOCK: + for ( ; m_pos.m_index_2 < rwlock_max; m_pos.m_index_2++) + { + rwlock= &rwlock_array[m_pos.m_index_2]; + if (rwlock->m_lock.is_populated()) + { + make_rwlock_row(rwlock); + m_next_pos.set_after(&m_pos); + return 0; + } + } + break; + case pos_all_instr::VIEW_COND: + for ( ; m_pos.m_index_2 < cond_max; m_pos.m_index_2++) + { + cond= &cond_array[m_pos.m_index_2]; + if (cond->m_lock.is_populated()) + { + make_cond_row(cond); + m_next_pos.set_after(&m_pos); + return 0; + } + } + break; + case pos_all_instr::VIEW_FILE: + for ( ; m_pos.m_index_2 < file_max; m_pos.m_index_2++) + { + file= &file_array[m_pos.m_index_2]; + if (file->m_lock.is_populated()) + { + make_file_row(file); + m_next_pos.set_after(&m_pos); + return 0; + } + } + break; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_all_instr::rnd_pos(const void *pos) +{ + PFS_mutex *mutex; + PFS_rwlock *rwlock; + PFS_cond *cond; + PFS_file *file; + + set_position(pos); + + switch (m_pos.m_index_1) { + case pos_all_instr::VIEW_MUTEX: + DBUG_ASSERT(m_pos.m_index_2 < mutex_max); + mutex= &mutex_array[m_pos.m_index_2]; + if (mutex->m_lock.is_populated()) + { + make_mutex_row(mutex); + return 0; + } + break; + case pos_all_instr::VIEW_RWLOCK: + DBUG_ASSERT(m_pos.m_index_2 < rwlock_max); + rwlock= &rwlock_array[m_pos.m_index_2]; + if (rwlock->m_lock.is_populated()) + { + make_rwlock_row(rwlock); + return 0; + } + break; + case pos_all_instr::VIEW_COND: + DBUG_ASSERT(m_pos.m_index_2 < cond_max); + cond= &cond_array[m_pos.m_index_2]; + if (cond->m_lock.is_populated()) + { + make_cond_row(cond); + return 0; + } + break; + case pos_all_instr::VIEW_FILE: + DBUG_ASSERT(m_pos.m_index_2 < file_max); + file= &file_array[m_pos.m_index_2]; + if (file->m_lock.is_populated()) + { + make_file_row(file); + return 0; + } + break; + } + + return HA_ERR_RECORD_DELETED; +} + +table_all_instr_class::table_all_instr_class +(const PFS_engine_table_share *share) + : PFS_readonly_table(share, &m_pos), + m_pos(), m_next_pos() +{} + +void table_all_instr_class::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_all_instr_class::rnd_next(void) +{ + PFS_mutex_class *mutex_class; + PFS_rwlock_class *rwlock_class; + PFS_cond_class *cond_class; + PFS_file_class *file_class; + + for (m_pos.set_at(&m_next_pos); + m_pos.has_more_view(); + m_pos.next_view()) + { + switch (m_pos.m_index_1) { + case pos_all_instr_class::VIEW_MUTEX: + mutex_class= find_mutex_class(m_pos.m_index_2); + if (mutex_class) + { + make_instr_row(mutex_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_all_instr_class::VIEW_RWLOCK: + rwlock_class= find_rwlock_class(m_pos.m_index_2); + if (rwlock_class) + { + make_instr_row(rwlock_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_all_instr_class::VIEW_COND: + cond_class= find_cond_class(m_pos.m_index_2); + if (cond_class) + { + make_instr_row(cond_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_all_instr_class::VIEW_FILE: + file_class= find_file_class(m_pos.m_index_2); + if (file_class) + { + make_instr_row(file_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_all_instr_class::rnd_pos(const void *pos) +{ + PFS_mutex_class *mutex_class; + PFS_rwlock_class *rwlock_class; + PFS_cond_class *cond_class; + PFS_file_class *file_class; + + set_position(pos); + switch (m_pos.m_index_1) { + case pos_all_instr_class::VIEW_MUTEX: + mutex_class= find_mutex_class(m_pos.m_index_2); + if (mutex_class) + { + make_instr_row(mutex_class); + return 0; + } + break; + case pos_all_instr_class::VIEW_RWLOCK: + rwlock_class= find_rwlock_class(m_pos.m_index_2); + if (rwlock_class) + { + make_instr_row(rwlock_class); + return 0; + } + break; + case pos_all_instr_class::VIEW_COND: + cond_class= find_cond_class(m_pos.m_index_2); + if (cond_class) + { + make_instr_row(cond_class); + return 0; + } + break; + case pos_all_instr_class::VIEW_FILE: + file_class= find_file_class(m_pos.m_index_2); + if (file_class) + { + make_instr_row(file_class); + return 0; + } + break; + } + + return HA_ERR_RECORD_DELETED; +} + diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h new file mode 100644 index 00000000000..a8767695602 --- /dev/null +++ b/storage/perfschema/table_all_instr.h @@ -0,0 +1,168 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_ALL_INSTR_H +#define TABLE_ALL_INSTR_H + +/** + @file storage/perfschema/table_all_instr.h + Abstract tables for all instruments (declarations). +*/ + +#include "pfs_instr_class.h" +#include "pfs_instr.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** Position of a cursor on table_all_instr_class. */ +struct pos_all_instr_class : public PFS_double_index, + public PFS_instrument_view_constants +{ + pos_all_instr_class() + : PFS_double_index(VIEW_MUTEX, 1) + {} + + inline void reset(void) + { + m_index_1= VIEW_MUTEX; + m_index_2= 1; + } + + inline bool has_more_view(void) + { return (m_index_1 <= VIEW_FILE); } + + inline void next_view(void) + { + m_index_1++; + /* Instrument keys start at 1, not 0. */ + m_index_2= 1; + } +}; + +/** + Abstract table, a union of all instrumentations class metadata. + This table is a union of: + - a view on all mutex classes, + - a view on all rwlock classes, + - a view on all cond classes, + - a view on all file classes +*/ +class table_all_instr_class : public PFS_readonly_table +{ +public: + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + table_all_instr_class(const PFS_engine_table_share *share); + +public: + ~table_all_instr_class() + {} + +protected: + /** + Build a row. + @param klass the instrument class + */ + virtual void make_instr_row(PFS_instr_class *klass)= 0; + + /** Current position. */ + pos_all_instr_class m_pos; + /** Next position. */ + pos_all_instr_class m_next_pos; +}; + +/** Position of a cursor on table_all_instr. */ +struct pos_all_instr : public PFS_double_index, + public PFS_instrument_view_constants +{ + pos_all_instr() + : PFS_double_index(VIEW_MUTEX, 0) + {} + + inline void reset(void) + { + m_index_1= VIEW_MUTEX; + m_index_2= 0; + } + + inline bool has_more_view(void) + { return (m_index_1 <= VIEW_FILE); } + + inline void next_view(void) + { + m_index_1++; + m_index_2= 0; + } +}; + +/** + Abstract table, a union of all instrumentations instances. + This table is a union of: + - a view on all mutex instances, + - a view on all rwlock instances, + - a view on all cond instances, + - a view on all file instances +*/ +class table_all_instr : public PFS_readonly_table +{ +public: + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + table_all_instr(const PFS_engine_table_share *share); + +public: + ~table_all_instr() + {} + +protected: + /** + Build a row in the mutex instance view. + @param pfs the mutex instance + */ + virtual void make_mutex_row(PFS_mutex *pfs)= 0; + /** + Build a row in the rwlock instance view. + @param pfs the rwlock instance + */ + virtual void make_rwlock_row(PFS_rwlock *pfs)= 0; + /** + Build a row in the condition instance view. + @param pfs the condition instance + */ + virtual void make_cond_row(PFS_cond *pfs)= 0; + /** + Build a row in the file instance view. + @param pfs the file instance + */ + virtual void make_file_row(PFS_file *pfs)= 0; + + /** Current position. */ + pos_all_instr m_pos; + /** Next position. */ + pos_all_instr m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc new file mode 100644 index 00000000000..3a12578597e --- /dev/null +++ b/storage/perfschema/table_events_waits.cc @@ -0,0 +1,773 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_events_waits.cc + Table EVENTS_WAITS_xxx (implementation). +*/ + +#include "mysql_priv.h" +#include "table_events_waits.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" +#include "pfs_events_waits.h" + +THR_LOCK table_events_waits_current::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("THREAD_ID") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("EVENT_ID") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SOURCE") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_START") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_END") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SPINS") }, + { C_STRING_WITH_LEN("int(10)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_SCHEMA") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_NAME") }, + { C_STRING_WITH_LEN("varchar(512)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_TYPE") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("NESTING_EVENT_ID") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OPERATION") }, + { C_STRING_WITH_LEN("varchar(16)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("NUMBER_OF_BYTES") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("FLAGS") }, + { C_STRING_WITH_LEN("int(10)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_events_waits_current::m_field_def= +{ 16, field_types }; + +PFS_engine_table_share +table_events_waits_current::m_share= +{ + { C_STRING_WITH_LEN("EVENTS_WAITS_CURRENT") }, + &pfs_truncatable_acl, + &table_events_waits_current::create, + NULL, /* write_row */ + &table_events_waits_current::delete_all_rows, + 1000, /* records */ + sizeof(pos_events_waits_current), /* ref length */ + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +THR_LOCK table_events_waits_history::m_table_lock; + +PFS_engine_table_share +table_events_waits_history::m_share= +{ + { C_STRING_WITH_LEN("EVENTS_WAITS_HISTORY") }, + &pfs_truncatable_acl, + &table_events_waits_history::create, + NULL, /* write_row */ + &table_events_waits_history::delete_all_rows, + 1000, /* records */ + sizeof(pos_events_waits_history), /* ref length */ + &m_table_lock, + &table_events_waits_current::m_field_def, + false /* checked */ +}; + +THR_LOCK table_events_waits_history_long::m_table_lock; + +PFS_engine_table_share +table_events_waits_history_long::m_share= +{ + { C_STRING_WITH_LEN("EVENTS_WAITS_HISTORY_LONG") }, + &pfs_truncatable_acl, + &table_events_waits_history_long::create, + NULL, /* write_row */ + &table_events_waits_history_long::delete_all_rows, + 10000, /* records */ + sizeof(PFS_simple_index), /* ref length */ + &m_table_lock, + &table_events_waits_current::m_field_def, + false /* checked */ +}; + +table_events_waits_common::table_events_waits_common +(const PFS_engine_table_share *share, void *pos) + : PFS_readonly_table(share, pos), + m_row_exists(false) +{} + +void table_events_waits_common::clear_object_columns() +{ + m_row.m_object_type= NULL; + m_row.m_object_type_length= 0; + m_row.m_object_schema_length= 0; + m_row.m_object_name_length= 0; +} + +/** + Build a row. + @param thread_own_wait True if the memory for the wait + is owned by pfs_thread + @param pfs_thread the thread the cursor is reading + @param wait the wait the cursor is reading +*/ +void table_events_waits_common::make_row(bool thread_own_wait, + PFS_thread *pfs_thread, + PFS_events_waits *wait) +{ + pfs_lock lock; + PFS_thread *safe_thread; + PFS_instr_class *safe_class; + const char *base; + const char *safe_source_file; + + m_row_exists= false; + safe_thread= sanitize_thread(pfs_thread); + if (unlikely(safe_thread == NULL)) + return; + + /* Protect this reader against a thread termination */ + if (thread_own_wait) + safe_thread->m_lock.begin_optimistic_lock(&lock); + + /* + Design choice: + We could have used a pfs_lock in PFS_events_waits here, + to protect the reader from concurrent event generation, + but this leads to too many pfs_lock atomic operations + each time an event is recorded: + - 1 dirty() + 1 allocated() per event start, for EVENTS_WAITS_CURRENT + - 1 dirty() + 1 allocated() per event end, for EVENTS_WAITS_CURRENT + - 1 dirty() + 1 allocated() per copy to EVENTS_WAITS_HISTORY + - 1 dirty() + 1 allocated() per copy to EVENTS_WAITS_HISTORY_LONG + or 8 atomics per recorded event. + The problem is that we record a *lot* of events ... + + Instead, a *dirty* marking is done using m_wait_class. + Using m_wait_class alone does not guarantee anything, it just filters + out most of the bad data. + This is acceptable because this code is garbage-proof, + and won't crash on bad data, only display it, + very rarely (which is accepted). + + If a bad record is displayed, it's a very transient failure: + the next select * from EVENTS_WAITS_CURRENT/_HISTORY/_HISTORY_LONG will + show clean data again. + */ + + m_row.m_thread_internal_id= safe_thread->m_thread_internal_id; + m_row.m_event_id= wait->m_event_id; + m_row.m_timer_state= wait->m_timer_state; + m_row.m_timer_start= wait->m_timer_start; + m_row.m_timer_end= wait->m_timer_end; + m_row.m_object_instance_addr= (intptr) wait->m_object_instance_addr; + + /* + PFS_events_waits::m_class needs to be sanitized, + for race conditions when this code: + - reads a new value in m_wait_class, + - reads an old value in m_class. + */ + switch (wait->m_wait_class) + { + case WAIT_CLASS_MUTEX: + clear_object_columns(); + safe_class= sanitize_mutex_class((PFS_mutex_class*) wait->m_class); + break; + case WAIT_CLASS_RWLOCK: + clear_object_columns(); + safe_class= sanitize_rwlock_class((PFS_rwlock_class*) wait->m_class); + break; + case WAIT_CLASS_COND: + clear_object_columns(); + safe_class= sanitize_cond_class((PFS_cond_class*) wait->m_class); + break; + case WAIT_CLASS_TABLE: + m_row.m_object_type= "TABLE"; + m_row.m_object_type_length= 5; + memcpy(m_row.m_object_schema, wait->m_schema_name, + wait->m_schema_name_length); + m_row.m_object_schema_length= wait->m_schema_name_length; + memcpy(m_row.m_object_name, wait->m_object_name, + wait->m_object_name_length); + m_row.m_object_name_length= wait->m_object_name_length; + safe_class= &global_table_class; + break; + case WAIT_CLASS_FILE: + m_row.m_object_type= "FILE"; + m_row.m_object_type_length= 4; + m_row.m_object_schema_length= 0; + memcpy(m_row.m_object_name, wait->m_object_name, + wait->m_object_name_length); + m_row.m_object_name_length= wait->m_object_name_length; + safe_class= sanitize_file_class((PFS_file_class*) wait->m_class); + break; + case NO_WAIT_CLASS: + default: + return; + } + if (unlikely(safe_class == NULL)) + return; + m_row.m_name= safe_class->m_name; + m_row.m_name_length= safe_class->m_name_length; + + /* + We are assuming this pointer is sane, + since it comes from __FILE__. + */ + safe_source_file= wait->m_source_file; + if (unlikely(safe_source_file == NULL)) + return; + + base= base_name(wait->m_source_file); + m_row.m_source_length= my_snprintf(m_row.m_source, sizeof(m_row.m_source), + "%s:%d", base, wait->m_source_line); + if (m_row.m_source_length > sizeof(m_row.m_source)) + m_row.m_source_length= sizeof(m_row.m_source); + m_row.m_operation= wait->m_operation; + m_row.m_number_of_bytes= wait->m_number_of_bytes; + m_row.m_flags= 0; + + if (thread_own_wait) + { + if (safe_thread->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; + } + else + { + /* + For EVENTS_WAITS_HISTORY_LONG (thread_own_wait is false), + the wait record is always valid, because it is not stored + in memory owned by pfs_thread. + Even when the thread terminated, the record is mostly readable, + so this record is displayed. + */ + m_row_exists= true; + } +} + +/** + Operations names map, as displayed in the 'OPERATION' column. + Indexed by enum_operation_type - 1. + Note: enum_operation_type contains a more precise definition, + since more details are needed internally by the instrumentation. + Different similar operations (CLOSE vs STREAMCLOSE) are displayed + with the same name 'close'. +*/ +static const LEX_STRING operation_names_map[]= +{ + /* Mutex operations */ + { C_STRING_WITH_LEN("lock") }, + { C_STRING_WITH_LEN("try_lock") }, + + /* RWLock operations */ + { C_STRING_WITH_LEN("read_lock") }, + { C_STRING_WITH_LEN("write_lock") }, + { C_STRING_WITH_LEN("try_read_lock") }, + { C_STRING_WITH_LEN("try_write_lock") }, + + /* Condition operations */ + { C_STRING_WITH_LEN("wait") }, + { C_STRING_WITH_LEN("timed_wait") }, + + /* File operations */ + { C_STRING_WITH_LEN("create") }, + { C_STRING_WITH_LEN("create") }, /* create tmp */ + { C_STRING_WITH_LEN("open") }, + { C_STRING_WITH_LEN("open") }, /* stream open */ + { C_STRING_WITH_LEN("close") }, + { C_STRING_WITH_LEN("close") }, /* stream close */ + { C_STRING_WITH_LEN("read") }, + { C_STRING_WITH_LEN("write") }, + { C_STRING_WITH_LEN("seek") }, + { C_STRING_WITH_LEN("tell") }, + { C_STRING_WITH_LEN("flush") }, + { C_STRING_WITH_LEN("stat") }, + { C_STRING_WITH_LEN("stat") }, /* fstat */ + { C_STRING_WITH_LEN("chsize") }, + { C_STRING_WITH_LEN("delete") }, + { C_STRING_WITH_LEN("rename") }, + { C_STRING_WITH_LEN("sync") } +}; + + +int table_events_waits_common::read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) +{ + Field *f; + const LEX_STRING *operation; + + compile_time_assert(COUNT_OPERATION_TYPE == + array_elements(operation_names_map)); + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 2); + buf[0]= 0; + buf[1]= 0; + + /* + Some columns are unreliable, because they are joined with other buffers, + which could have changed and been reused for something else. + These columns are: + - THREAD_ID (m_thread joins with PFS_thread), + - SCHEMA_NAME (m_schema_name joins with PFS_table_share) + - OBJECT_NAME (m_object_name joins with PFS_table_share) + */ + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* THREAD_ID */ + set_field_ulong(f, m_row.m_thread_internal_id); + break; + case 1: /* EVENT_ID */ + set_field_ulonglong(f, m_row.m_event_id); + break; + case 2: /* EVENT_NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 3: /* SOURCE */ + set_field_varchar_utf8(f, m_row.m_source, m_row.m_source_length); + break; + case 4: /* TIMER_START */ + if ((m_row.m_timer_state == TIMER_STATE_STARTED) || + (m_row.m_timer_state == TIMER_STATE_TIMED)) + set_field_ulonglong(f, m_row.m_timer_start); + else + f->set_null(); + break; + case 5: /* TIMER_END */ + if (m_row.m_timer_state == TIMER_STATE_TIMED) + set_field_ulonglong(f, m_row.m_timer_end); + else + f->set_null(); + break; + case 6: /* TIMER_WAIT */ + if (m_row.m_timer_state == TIMER_STATE_TIMED) + set_field_ulonglong(f, m_row.m_timer_end - m_row.m_timer_start); + else + f->set_null(); + break; + case 7: /* SPINS */ + f->set_null(); + break; + case 8: /* OBJECT_SCHEMA */ + if (m_row.m_object_schema_length > 0) + { + set_field_varchar_utf8(f, m_row.m_object_schema, + m_row.m_object_schema_length); + } + else + f->set_null(); + break; + case 9: /* OBJECT_NAME */ + if (m_row.m_object_name_length > 0) + { + set_field_varchar_utf8(f, m_row.m_object_name, + m_row.m_object_name_length); + } + else + f->set_null(); + break; + case 10: /* OBJECT_TYPE */ + if (m_row.m_object_type) + { + set_field_varchar_utf8(f, m_row.m_object_type, + m_row.m_object_type_length); + } + else + f->set_null(); + break; + case 11: /* OBJECT_INSTANCE */ + set_field_ulonglong(f, m_row.m_object_instance_addr); + break; + case 12: /* NESTING_EVENT_ID */ + f->set_null(); + break; + case 13: /* OPERATION */ + operation= &operation_names_map[(int) m_row.m_operation - 1]; + set_field_varchar_utf8(f, operation->str, operation->length); + break; + case 14: /* NUMBER_OF_BYTES */ + if ((m_row.m_operation == OPERATION_TYPE_FILEREAD) || + (m_row.m_operation == OPERATION_TYPE_FILEWRITE) || + (m_row.m_operation == OPERATION_TYPE_FILECHSIZE)) + set_field_ulonglong(f, m_row.m_number_of_bytes); + else + f->set_null(); + break; + case 15: /* FLAGS */ + set_field_ulong(f, m_row.m_flags); + break; + default: + DBUG_ASSERT(false); + } + } + } + return 0; +} + +PFS_engine_table* table_events_waits_current::create(void) +{ + return new table_events_waits_current(); +} + +table_events_waits_current::table_events_waits_current() + : table_events_waits_common(&m_share, &m_pos), + m_pos(), m_next_pos() +{} + +void table_events_waits_current::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_events_waits_current::rnd_next(void) +{ + PFS_thread *pfs_thread; + PFS_events_waits *wait; + + for (m_pos.set_at(&m_next_pos); + m_pos.m_index_1 < thread_max; + m_pos.next_thread()) + { + pfs_thread= &thread_array[m_pos.m_index_1]; + + if (! pfs_thread->m_lock.is_populated()) + { + /* This thread does not exist */ + continue; + } + + /* + We do not show nested events for now, + this will be revised with TABLE io + */ +#define ONLY_SHOW_ONE_WAIT + +#ifdef ONLY_SHOW_ONE_WAIT + if (m_pos.m_index_2 >= 1) + continue; +#else + if (m_pos.m_index_2 >= pfs_thread->m_wait_locker_count) + continue; +#endif + + wait= &pfs_thread->m_wait_locker_stack[m_pos.m_index_2].m_waits_current; + + if (wait->m_wait_class == NO_WAIT_CLASS) + { + /* + This locker does not exist. + There can not be more lockers in the stack, skip to the next thread + */ + continue; + } + + make_row(true, pfs_thread, wait); + /* Next iteration, look for the next locker in this thread */ + m_next_pos.set_after(&m_pos); + return 0; + } + + return HA_ERR_END_OF_FILE; +} + +int table_events_waits_current::rnd_pos(const void *pos) +{ + PFS_thread *pfs_thread; + PFS_events_waits *wait; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index_1 < thread_max); + pfs_thread= &thread_array[m_pos.m_index_1]; + + if (! pfs_thread->m_lock.is_populated()) + return HA_ERR_RECORD_DELETED; + +#ifdef ONLY_SHOW_CURRENT_WAITS + if (m_pos.m_index_2 >= pfs_thread->m_wait_locker_count) + return HA_ERR_RECORD_DELETED; +#endif + + DBUG_ASSERT(m_pos.m_index_2 < LOCKER_STACK_SIZE); + + wait= &pfs_thread->m_wait_locker_stack[m_pos.m_index_2].m_waits_current; + + if (wait->m_wait_class == NO_WAIT_CLASS) + return HA_ERR_RECORD_DELETED; + + make_row(true, pfs_thread, wait); + return 0; +} + +int table_events_waits_current::delete_all_rows(void) +{ + reset_events_waits_current(); + return 0; +} + +PFS_engine_table* table_events_waits_history::create(void) +{ + return new table_events_waits_history(); +} + +table_events_waits_history::table_events_waits_history() + : table_events_waits_common(&m_share, &m_pos), + m_pos(), m_next_pos() +{} + +void table_events_waits_history::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_events_waits_history::rnd_next(void) +{ + PFS_thread *pfs_thread; + PFS_events_waits *wait; + + if (events_waits_history_per_thread == 0) + return HA_ERR_END_OF_FILE; + + for (m_pos.set_at(&m_next_pos); + m_pos.m_index_1 < thread_max; + m_pos.next_thread()) + { + pfs_thread= &thread_array[m_pos.m_index_1]; + + if (! pfs_thread->m_lock.is_populated()) + { + /* This thread does not exist */ + continue; + } + + if (m_pos.m_index_2 >= events_waits_history_per_thread) + { + /* This thread does not have more (full) history */ + continue; + } + + if ( ! pfs_thread->m_waits_history_full && + (m_pos.m_index_2 >= pfs_thread->m_waits_history_index)) + { + /* This thread does not have more (not full) history */ + continue; + } + + if (pfs_thread->m_waits_history[m_pos.m_index_2].m_wait_class + == NO_WAIT_CLASS) + { + /* + This locker does not exist. + There can not be more lockers in the stack, skip to the next thread + */ + continue; + } + + wait= &pfs_thread->m_waits_history[m_pos.m_index_2]; + + make_row(true, pfs_thread, wait); + /* Next iteration, look for the next history in this thread */ + m_next_pos.set_after(&m_pos); + return 0; + } + + return HA_ERR_END_OF_FILE; +} + +int table_events_waits_history::rnd_pos(const void *pos) +{ + PFS_thread *pfs_thread; + PFS_events_waits *wait; + + DBUG_ASSERT(events_waits_history_per_thread != 0); + set_position(pos); + DBUG_ASSERT(m_pos.m_index_1 < thread_max); + pfs_thread= &thread_array[m_pos.m_index_1]; + + if (! pfs_thread->m_lock.is_populated()) + return HA_ERR_RECORD_DELETED; + + DBUG_ASSERT(m_pos.m_index_2 < events_waits_history_per_thread); + + if ( ! pfs_thread->m_waits_history_full && + (m_pos.m_index_2 >= pfs_thread->m_waits_history_index)) + return HA_ERR_RECORD_DELETED; + + if (pfs_thread->m_waits_history[m_pos.m_index_2].m_wait_class + == NO_WAIT_CLASS) + return HA_ERR_RECORD_DELETED; + + wait= &pfs_thread->m_waits_history[m_pos.m_index_2]; + + make_row(true, pfs_thread, wait); + return 0; +} + +int table_events_waits_history::delete_all_rows(void) +{ + reset_events_waits_history(); + return 0; +} + +PFS_engine_table* table_events_waits_history_long::create(void) +{ + return new table_events_waits_history_long(); +} + +table_events_waits_history_long::table_events_waits_history_long() + : table_events_waits_common(&m_share, &m_pos), + m_pos(0), m_next_pos(0) +{} + +void table_events_waits_history_long::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_events_waits_history_long::rnd_next(void) +{ + PFS_events_waits *wait; + uint limit; + + if (events_waits_history_long_size == 0) + return HA_ERR_END_OF_FILE; + + if (events_waits_history_long_full) + limit= events_waits_history_long_size; + else + limit= events_waits_history_long_index % events_waits_history_long_size; + + for (m_pos.set_at(&m_next_pos); m_pos.m_index < limit; m_pos.next()) + { + wait= &events_waits_history_long_array[m_pos.m_index]; + + if (wait->m_wait_class != NO_WAIT_CLASS) + { + make_row(false, wait->m_thread, wait); + /* Next iteration, look for the next entry */ + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_events_waits_history_long::rnd_pos(const void *pos) +{ + PFS_events_waits *wait; + uint limit; + + if (events_waits_history_long_size == 0) + return HA_ERR_RECORD_DELETED; + + set_position(pos); + + if (events_waits_history_long_full) + limit= events_waits_history_long_size; + else + limit= events_waits_history_long_index % events_waits_history_long_size; + + if (m_pos.m_index >= limit) + return HA_ERR_RECORD_DELETED; + + wait= &events_waits_history_long_array[m_pos.m_index]; + + if (wait->m_wait_class == NO_WAIT_CLASS) + return HA_ERR_RECORD_DELETED; + + make_row(false, wait->m_thread, wait); + return 0; +} + +int table_events_waits_history_long::delete_all_rows(void) +{ + reset_events_waits_history_long(); + return 0; +} + diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h new file mode 100644 index 00000000000..5aa16cc0cab --- /dev/null +++ b/storage/perfschema/table_events_waits.h @@ -0,0 +1,248 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_EVENTS_WAITS_H +#define TABLE_EVENTS_WAITS_H + +/** + @file storage/perfschema/table_events_waits.h + Table EVENTS_WAITS_xxx (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" +#include "pfs_events_waits.h" + +struct PFS_thread; + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of table_events_waits_common. */ +struct row_events_waits +{ + /** Column THREAD_ID. */ + ulong m_thread_internal_id; + /** Column EVENT_ID. */ + ulonglong m_event_id; + /** Column EVENT_NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Timer state. */ + enum timer_state m_timer_state; + /** Column TIMER_START. */ + ulonglong m_timer_start; + /** True if TIMER_END is null. */ + bool m_timer_end_null; + /** Column TIMER_END. */ + ulonglong m_timer_end; + /** Column OBJECT_TYPE. */ + const char *m_object_type; + /** Length in bytes of @c m_object_type. */ + uint m_object_type_length; + /** Column OBJECT_SCHEMA. */ + char m_object_schema[COL_OBJECT_SCHEMA_SIZE]; + /** Length in bytes of @c m_object_schema. */ + uint m_object_schema_length; + /** Column OBJECT_NAME. */ + char m_object_name[COL_OBJECT_NAME_EXTENDED_SIZE]; + /** Length in bytes of @c m_object_name. */ + uint m_object_name_length; + /** Column OBJECT_INSTANCE_BEGIN. */ + intptr m_object_instance_addr; + /** Column SOURCE. */ + char m_source[COL_SOURCE_SIZE]; + /** Length in bytes of @c m_source. */ + uint m_source_length; + /** Column OPERATION. */ + enum_operation_type m_operation; + /** Column NUMBER_OF_BYTES. */ + ulonglong m_number_of_bytes; + /** Column FLAGS. */ + uint m_flags; +}; + +/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */ +struct pos_events_waits_current : public PFS_double_index +{ + pos_events_waits_current() + : PFS_double_index(0, 0) + {} + + inline void reset(void) + { + m_index_1= 0; + m_index_2= 0; + } + + inline void next_thread(void) + { + m_index_1++; + m_index_2= 0; + } +}; + +/** Position of a cursor on PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. */ +struct pos_events_waits_history : public PFS_double_index +{ + pos_events_waits_history() + : PFS_double_index(0, 0) + {} + + inline void reset(void) + { + m_index_1= 0; + m_index_2= 0; + } + + inline void next_thread(void) + { + m_index_1++; + m_index_2= 0; + } +}; + +/** + Adapter, for table sharing the structure of + PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. +*/ +class table_events_waits_common : public PFS_readonly_table +{ +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_events_waits_common(const PFS_engine_table_share *share, void *pos); + + ~table_events_waits_common() + {} + + void clear_object_columns(); + + void make_row(bool thread_own_wait, PFS_thread *pfs_thread, + PFS_events_waits *wait); + + /** Current row. */ + row_events_waits m_row; + /** True is the current row exists. */ + bool m_row_exists; +}; + +/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */ +class table_events_waits_current : public table_events_waits_common +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + table_events_waits_current(); + +public: + ~table_events_waits_current() + {} + +private: + friend class table_events_waits_history; + friend class table_events_waits_history_long; + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** + Fields definition. + Also used by table_events_waits_history + and table_events_waits_history_long. + */ + static TABLE_FIELD_DEF m_field_def; + + /** Current position. */ + pos_events_waits_current m_pos; + /** Next position. */ + pos_events_waits_current m_next_pos; +}; + +/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY. */ +class table_events_waits_history : public table_events_waits_common +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + table_events_waits_history(); + +public: + ~table_events_waits_history() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + + /** Current position. */ + pos_events_waits_history m_pos; + /** Next position. */ + pos_events_waits_history m_next_pos; +}; + +/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_HISTORY_LONG. */ +class table_events_waits_history_long : public table_events_waits_common +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + table_events_waits_history_long(); + +public: + ~table_events_waits_history_long() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc new file mode 100644 index 00000000000..c3d678d374c --- /dev/null +++ b/storage/perfschema/table_events_waits_summary.cc @@ -0,0 +1,696 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_events_waits_summary.cc + Table EVENTS_WAITS_SUMMARY_BY_xxx (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_instr_class.h" +#include "pfs_column_types.h" +#include "pfs_column_values.h" +#include "table_events_waits_summary.h" +#include "pfs_global.h" + +THR_LOCK table_events_waits_summary_by_thread_by_event_name::m_table_lock; + +static const TABLE_FIELD_TYPE ews_by_thread_by_event_name_field_types[]= +{ + { + { C_STRING_WITH_LEN("THREAD_ID") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_STAR") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("MIN_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("AVG_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("MAX_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_events_waits_summary_by_thread_by_event_name::m_field_def= +{ 7, ews_by_thread_by_event_name_field_types }; + +PFS_engine_table_share +table_events_waits_summary_by_thread_by_event_name::m_share= +{ + { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME") }, + &pfs_truncatable_acl, + &table_events_waits_summary_by_thread_by_event_name::create, + NULL, /* write_row */ + &table_events_waits_summary_by_thread_by_event_name::delete_all_rows, + 1000, /* records */ + sizeof(pos_events_waits_summary_by_thread_by_event_name), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* +table_events_waits_summary_by_thread_by_event_name::create(void) +{ + return new table_events_waits_summary_by_thread_by_event_name(); +} + +int +table_events_waits_summary_by_thread_by_event_name::delete_all_rows(void) +{ + reset_per_thread_wait_stat(); + return 0; +} + +table_events_waits_summary_by_thread_by_event_name +::table_events_waits_summary_by_thread_by_event_name() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(), m_next_pos() +{} + +void table_events_waits_summary_by_thread_by_event_name::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_events_waits_summary_by_thread_by_event_name::rnd_next(void) +{ + PFS_thread *thread; + PFS_mutex_class *mutex_class; + PFS_rwlock_class *rwlock_class; + PFS_cond_class *cond_class; + PFS_file_class *file_class; + + for (m_pos.set_at(&m_next_pos); + m_pos.has_more_thread(); + m_pos.next_thread()) + { + thread= &thread_array[m_pos.m_index_1]; + if (thread->m_lock.is_populated()) + { + for ( ; m_pos.has_more_view(); m_pos.next_view()) + { + switch (m_pos.m_index_2) { + case pos_events_waits_summary_by_thread_by_event_name::VIEW_MUTEX: + mutex_class= find_mutex_class(m_pos.m_index_3); + if (mutex_class) + { + make_mutex_row(thread, mutex_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_events_waits_summary_by_thread_by_event_name::VIEW_RWLOCK: + rwlock_class= find_rwlock_class(m_pos.m_index_3); + if (rwlock_class) + { + make_rwlock_row(thread, rwlock_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_events_waits_summary_by_thread_by_event_name::VIEW_COND: + cond_class= find_cond_class(m_pos.m_index_3); + if (cond_class) + { + make_cond_row(thread, cond_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_events_waits_summary_by_thread_by_event_name::VIEW_FILE: + file_class= find_file_class(m_pos.m_index_3); + if (file_class) + { + make_file_row(thread, file_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + } + } + } + } + + return HA_ERR_END_OF_FILE; +} + +int +table_events_waits_summary_by_thread_by_event_name::rnd_pos(const void *pos) +{ + PFS_thread *thread; + PFS_mutex_class *mutex_class; + PFS_rwlock_class *rwlock_class; + PFS_cond_class *cond_class; + PFS_file_class *file_class; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index_1 < thread_max); + + thread= &thread_array[m_pos.m_index_1]; + if (! thread->m_lock.is_populated()) + return HA_ERR_RECORD_DELETED; + + switch (m_pos.m_index_2) { + case pos_events_waits_summary_by_thread_by_event_name::VIEW_MUTEX: + mutex_class= find_mutex_class(m_pos.m_index_3); + if (mutex_class) + { + make_mutex_row(thread, mutex_class); + return 0; + } + break; + case pos_events_waits_summary_by_thread_by_event_name::VIEW_RWLOCK: + rwlock_class= find_rwlock_class(m_pos.m_index_3); + if (rwlock_class) + { + make_rwlock_row(thread, rwlock_class); + return 0; + } + break; + case pos_events_waits_summary_by_thread_by_event_name::VIEW_COND: + cond_class= find_cond_class(m_pos.m_index_3); + if (cond_class) + { + make_cond_row(thread, cond_class); + return 0; + } + break; + case pos_events_waits_summary_by_thread_by_event_name::VIEW_FILE: + file_class= find_file_class(m_pos.m_index_3); + if (file_class) + { + make_file_row(thread, file_class); + return 0; + } + break; + } + return HA_ERR_RECORD_DELETED; +} + +void table_events_waits_summary_by_thread_by_event_name +::make_instr_row(PFS_thread *thread, PFS_instr_class *klass, + PFS_single_stat_chain *stat) +{ + pfs_lock lock; + + m_row_exists= false; + + /* Protect this reader against a thread termination */ + thread->m_lock.begin_optimistic_lock(&lock); + + m_row.m_thread_internal_id= thread->m_thread_internal_id; + m_row.m_name= klass->m_name; + m_row.m_name_length= klass->m_name_length; + + m_row.m_count= stat->m_count; + m_row.m_sum= stat->m_sum; + m_row.m_min= stat->m_min; + m_row.m_max= stat->m_max; + + if (m_row.m_count) + m_row.m_avg= m_row.m_sum / m_row.m_count; + else + { + m_row.m_min= 0; + m_row.m_avg= 0; + } + + if (thread->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +void table_events_waits_summary_by_thread_by_event_name +::make_mutex_row(PFS_thread *thread, PFS_mutex_class *klass) +{ + PFS_single_stat_chain *stat; + stat= find_per_thread_mutex_class_wait_stat(thread, klass); + make_instr_row(thread, klass, stat); +} + +void table_events_waits_summary_by_thread_by_event_name +::make_rwlock_row(PFS_thread *thread, PFS_rwlock_class *klass) +{ + PFS_single_stat_chain *stat; + stat= find_per_thread_rwlock_class_wait_stat(thread, klass); + make_instr_row(thread, klass, stat); +} + +void table_events_waits_summary_by_thread_by_event_name +::make_cond_row(PFS_thread *thread, PFS_cond_class *klass) +{ + PFS_single_stat_chain *stat; + stat= find_per_thread_cond_class_wait_stat(thread, klass); + make_instr_row(thread, klass, stat); +} + +void table_events_waits_summary_by_thread_by_event_name +::make_file_row(PFS_thread *thread, PFS_file_class *klass) +{ + PFS_single_stat_chain *stat; + stat= find_per_thread_file_class_wait_stat(thread, klass); + make_instr_row(thread, klass, stat); +} + +int table_events_waits_summary_by_thread_by_event_name +::read_row_values(TABLE *table, unsigned char *, Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* THREAD_ID */ + set_field_ulong(f, m_row.m_thread_internal_id); + break; + case 1: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 2: /* COUNT */ + set_field_ulonglong(f, m_row.m_count); + break; + case 3: /* SUM */ + set_field_ulonglong(f, m_row.m_sum); + break; + case 4: /* MIN */ + set_field_ulonglong(f, m_row.m_min); + break; + case 5: /* AVG */ + set_field_ulonglong(f, m_row.m_avg); + break; + case 6: /* MAX */ + set_field_ulonglong(f, m_row.m_max); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +THR_LOCK table_events_waits_summary_by_event_name::m_table_lock; + +static const TABLE_FIELD_TYPE ews_by_event_name_field_types[]= +{ + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_STAR") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("MIN_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("AVG_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("MAX_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_events_waits_summary_by_event_name::m_field_def= +{ 6, ews_by_event_name_field_types }; + +PFS_engine_table_share +table_events_waits_summary_by_event_name::m_share= +{ + { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_EVENT_NAME") }, + &pfs_truncatable_acl, + &table_events_waits_summary_by_event_name::create, + NULL, /* write_row */ + &table_events_waits_summary_by_event_name::delete_all_rows, + 1000, /* records */ + sizeof(pos_all_instr_class), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_events_waits_summary_by_event_name::create(void) +{ + return new table_events_waits_summary_by_event_name(); +} + +int table_events_waits_summary_by_event_name::delete_all_rows(void) +{ + reset_instrument_class_waits(); + return 0; +} + +table_events_waits_summary_by_event_name +::table_events_waits_summary_by_event_name() + : table_all_instr_class(&m_share) +{} + +void table_events_waits_summary_by_event_name +::make_instr_row(PFS_instr_class *klass) +{ + m_row.m_name= klass->m_name; + m_row.m_name_length= klass->m_name_length; + + m_row.m_count= klass->m_wait_stat.m_count; + m_row.m_sum= klass->m_wait_stat.m_sum; + m_row.m_min= klass->m_wait_stat.m_min; + m_row.m_max= klass->m_wait_stat.m_max; + + if (m_row.m_count) + m_row.m_avg= m_row.m_sum / m_row.m_count; + else + { + m_row.m_min= 0; + m_row.m_avg= 0; + } +} + +int table_events_waits_summary_by_event_name +::read_row_values(TABLE *table, unsigned char *, Field **fields, + bool read_all) +{ + Field *f; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + /* + The row always exist, + the instrument classes are static and never disappear. + */ + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* COUNT */ + set_field_ulonglong(f, m_row.m_count); + break; + case 2: /* SUM */ + set_field_ulonglong(f, m_row.m_sum); + break; + case 3: /* MIN */ + set_field_ulonglong(f, m_row.m_min); + break; + case 4: /* AVG */ + set_field_ulonglong(f, m_row.m_avg); + break; + case 5: /* MAX */ + set_field_ulonglong(f, m_row.m_max); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +THR_LOCK table_events_waits_summary_by_instance::m_table_lock; + +static const TABLE_FIELD_TYPE ews_by_instance_field_types[]= +{ + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_STAR") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("MIN_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("AVG_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("MAX_TIMER_WAIT") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_events_waits_summary_by_instance::m_field_def= +{ 7, ews_by_instance_field_types }; + +PFS_engine_table_share +table_events_waits_summary_by_instance::m_share= +{ + { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_INSTANCE") }, + &pfs_truncatable_acl, + &table_events_waits_summary_by_instance::create, + NULL, /* write_row */ + &table_events_waits_summary_by_instance::delete_all_rows, + 1000, /* records */ + sizeof(pos_all_instr), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_events_waits_summary_by_instance::create(void) +{ + return new table_events_waits_summary_by_instance(); +} + +int table_events_waits_summary_by_instance::delete_all_rows(void) +{ + reset_events_waits_by_instance(); + return 0; +} + +table_events_waits_summary_by_instance +::table_events_waits_summary_by_instance() + : table_all_instr(&m_share), m_row_exists(false) +{} + +void table_events_waits_summary_by_instance +::make_instr_row(PFS_instr *pfs, PFS_instr_class *klass, + const void *object_instance_begin) +{ + pfs_lock lock; + + m_row_exists= false; + + /* + Protect this reader against a mutex/rwlock/cond destroy, + file delete, table drop. + */ + pfs->m_lock.begin_optimistic_lock(&lock); + + m_row.m_name= klass->m_name; + m_row.m_name_length= klass->m_name_length; + m_row.m_object_instance_addr= (intptr) object_instance_begin; + + m_row.m_count= pfs->m_wait_stat.m_count; + m_row.m_sum= pfs->m_wait_stat.m_sum; + m_row.m_min= pfs->m_wait_stat.m_min; + m_row.m_max= pfs->m_wait_stat.m_max; + + if (m_row.m_count) + m_row.m_avg= m_row.m_sum / m_row.m_count; + else + { + m_row.m_min= 0; + m_row.m_avg= 0; + } + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +/** + Build a row, for mutex statistics in a thread. + @param pfs the mutex this cursor is reading +*/ +void table_events_waits_summary_by_instance::make_mutex_row(PFS_mutex *pfs) +{ + PFS_mutex_class *safe_class; + safe_class= sanitize_mutex_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + make_instr_row(pfs, safe_class, pfs->m_identity); +} + +/** + Build a row, for rwlock statistics in a thread. + @param pfs the rwlock this cursor is reading +*/ +void table_events_waits_summary_by_instance::make_rwlock_row(PFS_rwlock *pfs) +{ + PFS_rwlock_class *safe_class; + safe_class= sanitize_rwlock_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + make_instr_row(pfs, safe_class, pfs->m_identity); +} + +/** + Build a row, for condition statistics in a thread. + @param pfs the condition this cursor is reading +*/ +void table_events_waits_summary_by_instance::make_cond_row(PFS_cond *pfs) +{ + PFS_cond_class *safe_class; + safe_class= sanitize_cond_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + make_instr_row(pfs, safe_class, pfs->m_identity); +} + +/** + Build a row, for file statistics in a thread. + @param pfs the file this cursor is reading +*/ +void table_events_waits_summary_by_instance::make_file_row(PFS_file *pfs) +{ + PFS_file_class *safe_class; + safe_class= sanitize_file_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + /* + Files don't have a in memory structure associated to it, + so we use the address of the PFS_file buffer as object_instance_begin + */ + make_instr_row(pfs, safe_class, pfs); +} + +int table_events_waits_summary_by_instance +::read_row_values(TABLE *table, unsigned char *, Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* OBJECT_INSTANCE */ + set_field_ulonglong(f, m_row.m_object_instance_addr); + break; + case 2: /* COUNT */ + set_field_ulonglong(f, m_row.m_count); + break; + case 3: /* SUM */ + set_field_ulonglong(f, m_row.m_sum); + break; + case 4: /* MIN */ + set_field_ulonglong(f, m_row.m_min); + break; + case 5: /* AVG */ + set_field_ulonglong(f, m_row.m_avg); + break; + case 6: /* MAX */ + set_field_ulonglong(f, m_row.m_max); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h new file mode 100644 index 00000000000..28c820e5c81 --- /dev/null +++ b/storage/perfschema/table_events_waits_summary.h @@ -0,0 +1,261 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_EVENTS_WAITS_SUMMARY_H +#define TABLE_EVENTS_WAITS_SUMMARY_H + +/** + @file storage/perfschema/table_events_waits_summary.h + Table EVENTS_WAITS_SUMMARY_BY_xxx (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" +#include "table_all_instr.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** + A row of table + PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. +*/ +struct row_events_waits_summary_by_thread_by_event_name +{ + /** Column THREAD_ID. */ + ulong m_thread_internal_id; + /** Column EVENT_NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column COUNT_STAR. */ + ulonglong m_count; + /** Column SUM_TIMER_WAIT. */ + ulonglong m_sum; + /** Column MIN_TIMER_WAIT. */ + ulonglong m_min; + /** Column AVG_TIMER_WAIT. */ + ulonglong m_avg; + /** Column MAX_TIMER_WAIT. */ + ulonglong m_max; +}; + +/** + Position of a cursor on + PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. +*/ +struct pos_events_waits_summary_by_thread_by_event_name +: public PFS_triple_index, public PFS_instrument_view_constants +{ + pos_events_waits_summary_by_thread_by_event_name() + : PFS_triple_index(0, VIEW_MUTEX, 1) + {} + + inline void reset(void) + { + m_index_1= 0; + m_index_2= VIEW_MUTEX; + m_index_3= 1; + } + + inline bool has_more_thread(void) + { return (m_index_1 < thread_max); } + + inline bool has_more_view(void) + { return (m_index_2 <= VIEW_FILE); } + + inline void next_thread(void) + { + m_index_1++; + m_index_2= VIEW_MUTEX; + m_index_3= 1; + } + + inline void next_view(void) + { + m_index_2++; + m_index_3= 1; + } +}; + +/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. */ +class table_events_waits_summary_by_thread_by_event_name + : public PFS_readonly_table +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_events_waits_summary_by_thread_by_event_name(); + +public: + ~table_events_waits_summary_by_thread_by_event_name() + {} + +protected: + void make_instr_row(PFS_thread *thread, PFS_instr_class *klass, + PFS_single_stat_chain *stat); + void make_mutex_row(PFS_thread *thread, PFS_mutex_class *klass); + void make_rwlock_row(PFS_thread *thread, PFS_rwlock_class *klass); + void make_cond_row(PFS_thread *thread, PFS_cond_class *klass); + void make_file_row(PFS_thread *thread, PFS_file_class *klass); + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_events_waits_summary_by_thread_by_event_name m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + pos_events_waits_summary_by_thread_by_event_name m_pos; + /** Next position. */ + pos_events_waits_summary_by_thread_by_event_name m_next_pos; +}; + +/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */ +struct row_events_waits_summary_by_event_name +{ + /** Column EVENT_NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column COUNT_STAR. */ + ulonglong m_count; + /** Column SUM_TIMER_WAIT. */ + ulonglong m_sum; + /** Column MIN_TIMER_WAIT. */ + ulonglong m_min; + /** Column AVG_TIMER_WAIT. */ + ulonglong m_avg; + /** Column MAX_TIMER_WAIT. */ + ulonglong m_max; +}; + +/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */ +class table_events_waits_summary_by_event_name : public table_all_instr_class +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + +protected: + virtual void make_instr_row(PFS_instr_class *klass); + + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_events_waits_summary_by_event_name(); + +public: + ~table_events_waits_summary_by_event_name() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_events_waits_summary_by_event_name m_row; +}; + +/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_INSTANCE. */ +struct row_events_waits_summary_by_instance +{ + /** Column EVENT_NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column OBJECT_INSTANCE_BEGIN. */ + intptr m_object_instance_addr; + /** Column COUNT_STAR. */ + ulonglong m_count; + /** Column SUM_TIMER_WAIT. */ + ulonglong m_sum; + /** Column MIN_TIMER_WAIT. */ + ulonglong m_min; + /** Column AVG_TIMER_WAIT. */ + ulonglong m_avg; + /** Column MAX_TIMER_WAIT. */ + ulonglong m_max; +}; + +/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_INSTANCE. */ +class table_events_waits_summary_by_instance : public table_all_instr +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + +protected: + void make_instr_row(PFS_instr *pfs, PFS_instr_class *klass, + const void *object_instance_begin); + virtual void make_mutex_row(PFS_mutex *pfs); + virtual void make_rwlock_row(PFS_rwlock *pfs); + virtual void make_cond_row(PFS_cond *pfs); + virtual void make_file_row(PFS_file *pfs); + + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_events_waits_summary_by_instance(); + +public: + ~table_events_waits_summary_by_instance() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_events_waits_summary_by_instance m_row; + /** True is the current row exists. */ + bool m_row_exists; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc new file mode 100644 index 00000000000..b6bc7ecbcf3 --- /dev/null +++ b/storage/perfschema/table_file_instances.cc @@ -0,0 +1,180 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_file_instances.cc + Table FILE_INSTANCES (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_instr.h" +#include "pfs_column_types.h" +#include "pfs_column_values.h" +#include "table_file_instances.h" +#include "pfs_global.h" + +THR_LOCK table_file_instances::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("FILE_NAME") }, + { C_STRING_WITH_LEN("varchar(512)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OPEN_COUNT") }, + { C_STRING_WITH_LEN("int(10)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_file_instances::m_field_def= +{ 3, field_types }; + +PFS_engine_table_share +table_file_instances::m_share= +{ + { C_STRING_WITH_LEN("FILE_INSTANCES") }, + &pfs_readonly_acl, + &table_file_instances::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + 1000, /* records */ + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_file_instances::create(void) +{ + return new table_file_instances(); +} + +table_file_instances::table_file_instances() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(0), m_next_pos(0) +{} + +void table_file_instances::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_file_instances::rnd_next(void) +{ + PFS_file *pfs; + + for (m_pos.set_at(&m_next_pos); + m_pos.m_index < file_max; + m_pos.next()) + { + pfs= &file_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_file_instances::rnd_pos(const void *pos) +{ + PFS_file *pfs; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index < file_max); + pfs= &file_array[m_pos.m_index]; + + if (! pfs->m_lock.is_populated()) + return HA_ERR_RECORD_DELETED; + + make_row(pfs); + return 0; +} + +void table_file_instances::make_row(PFS_file *pfs) +{ + pfs_lock lock; + PFS_file_class *safe_class; + + m_row_exists= false; + + /* Protect this reader against a file delete */ + pfs->m_lock.begin_optimistic_lock(&lock); + + safe_class= sanitize_file_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + m_row.m_filename= pfs->m_filename; + m_row.m_filename_length= pfs->m_filename_length; + m_row.m_event_name= safe_class->m_name; + m_row.m_event_name_length= safe_class->m_name_length; + m_row.m_open_count= pfs->m_file_stat.m_open_count; + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_file_instances::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* FILENAME */ + set_field_varchar_utf8(f, m_row.m_filename, m_row.m_filename_length); + break; + case 1: /* EVENT_NAME */ + set_field_varchar_utf8(f, m_row.m_event_name, + m_row.m_event_name_length); + break; + case 2: /* OPEN_COUNT */ + set_field_ulong(f, m_row.m_open_count); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h new file mode 100644 index 00000000000..fb5298f37b3 --- /dev/null +++ b/storage/perfschema/table_file_instances.h @@ -0,0 +1,90 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_FILE_INSTANCES_H +#define TABLE_FILE_INSTANCES_H + +/** + @file storage/perfschema/table_file_instances.h + Table FILE_INSTANCES (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.FILE_INSTANCES. */ +struct row_file_instances +{ + /** Column FILE_NAME. */ + const char *m_filename; + /** Length in bytes of @c m_filename. */ + uint m_filename_length; + /** Column EVENT_NAME. */ + const char *m_event_name; + /** Length in bytes of @c m_event_name. */ + uint m_event_name_length; + /** Column OPEN_COUNT. */ + uint m_open_count; +}; + +/** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */ +class table_file_instances : public PFS_readonly_table +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +private: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_file_instances(); + +public: + ~table_file_instances() + {} + +private: + void make_row(PFS_file *pfs); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_file_instances m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc new file mode 100644 index 00000000000..0db4e08625a --- /dev/null +++ b/storage/perfschema/table_file_summary.cc @@ -0,0 +1,371 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_file_summary.cc + Table FILE_SUMMARY_BY_xxx (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_instr_class.h" +#include "pfs_column_types.h" +#include "pfs_column_values.h" +#include "table_file_summary.h" +#include "pfs_global.h" + +THR_LOCK table_file_summary_by_event_name::m_table_lock; + +static const TABLE_FIELD_TYPE fs_by_event_name_field_types[]= +{ + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_READ") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_WRITE") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_file_summary_by_event_name::m_field_def= +{ 5, fs_by_event_name_field_types }; + +PFS_engine_table_share +table_file_summary_by_event_name::m_share= +{ + { C_STRING_WITH_LEN("FILE_SUMMARY_BY_EVENT_NAME") }, + &pfs_truncatable_acl, + &table_file_summary_by_event_name::create, + NULL, /* write_row */ + table_file_summary_by_event_name::delete_all_rows, + 1000, /* records */ + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_file_summary_by_event_name::create(void) +{ + return new table_file_summary_by_event_name(); +} + +int table_file_summary_by_event_name::delete_all_rows(void) +{ + reset_file_class_io(); + return 0; +} + +table_file_summary_by_event_name::table_file_summary_by_event_name() + : PFS_readonly_table(&m_share, &m_pos), + m_pos(1), m_next_pos(1) +{} + +void table_file_summary_by_event_name::reset_position(void) +{ + m_pos.m_index= 1; + m_next_pos.m_index= 1; +} + +int table_file_summary_by_event_name::rnd_next(void) +{ + PFS_file_class *file_class; + + m_pos.set_at(&m_next_pos); + + file_class= find_file_class(m_pos.m_index); + if (file_class) + { + make_row(file_class); + m_next_pos.set_after(&m_pos); + return 0; + } + + return HA_ERR_END_OF_FILE; +} + +int table_file_summary_by_event_name::rnd_pos(const void *pos) +{ + PFS_file_class *file_class; + + set_position(pos); + + file_class= find_file_class(m_pos.m_index); + if (file_class) + { + make_row(file_class); + return 0; + } + + return HA_ERR_RECORD_DELETED; +} + +/** + Build a row. + @param klass the file class the cursor is reading +*/ +void table_file_summary_by_event_name::make_row(PFS_file_class *klass) +{ + m_row.m_name= &klass->m_name[0]; + m_row.m_name_length= klass->m_name_length; + m_row.m_file_stat= klass->m_file_stat; +} + +int table_file_summary_by_event_name::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + /* The row always exists for classes */ + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* COUNT_READ */ + set_field_ulonglong(f, m_row.m_file_stat.m_count_read); + break; + case 2: /* COUNT_WRITE */ + set_field_ulonglong(f, m_row.m_file_stat.m_count_write); + break; + case 3: /* READ_BYTES */ + set_field_ulonglong(f, m_row.m_file_stat.m_read_bytes); + break; + case 4: /* WRITE_BYTES */ + set_field_ulonglong(f, m_row.m_file_stat.m_write_bytes); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +THR_LOCK table_file_summary_by_instance::m_table_lock; + +static const TABLE_FIELD_TYPE fs_by_instance_field_types[]= +{ + { + { C_STRING_WITH_LEN("FILE_NAME") }, + { C_STRING_WITH_LEN("varchar(512)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("EVENT_NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_READ") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("COUNT_WRITE") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_file_summary_by_instance::m_field_def= +{ 6, fs_by_instance_field_types }; + +PFS_engine_table_share +table_file_summary_by_instance::m_share= +{ + { C_STRING_WITH_LEN("FILE_SUMMARY_BY_INSTANCE") }, + &pfs_truncatable_acl, + &table_file_summary_by_instance::create, + NULL, /* write_row */ + table_file_summary_by_instance::delete_all_rows, + 1000, /* records */ + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_file_summary_by_instance::create(void) +{ + return new table_file_summary_by_instance(); +} + +int table_file_summary_by_instance::delete_all_rows(void) +{ + reset_file_instance_io(); + return 0; +} + +table_file_summary_by_instance::table_file_summary_by_instance() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(0), m_next_pos(0) +{} + +void table_file_summary_by_instance::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_file_summary_by_instance::rnd_next(void) +{ + PFS_file *pfs; + + for (m_pos.set_at(&m_next_pos); + m_pos.m_index < file_max; + m_pos.next()) + { + pfs= &file_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_file_summary_by_instance::rnd_pos(const void *pos) +{ + PFS_file *pfs; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index < file_max); + pfs= &file_array[m_pos.m_index]; + + if (! pfs->m_lock.is_populated()) + return HA_ERR_RECORD_DELETED; + + make_row(pfs); + return 0; +} + +/** + Build a row. + @param pfs the file the cursor is reading +*/ +void table_file_summary_by_instance::make_row(PFS_file *pfs) +{ + pfs_lock lock; + PFS_file_class *safe_class; + + m_row_exists= false; + + /* Protect this reader against a file delete */ + pfs->m_lock.begin_optimistic_lock(&lock); + + safe_class= sanitize_file_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + m_row.m_filename= pfs->m_filename; + m_row.m_filename_length= pfs->m_filename_length; + m_row.m_name= safe_class->m_name; + m_row.m_name_length= safe_class->m_name_length; + m_row.m_file_stat= pfs->m_file_stat; + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_file_summary_by_instance::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* FILENAME */ + set_field_varchar_utf8(f, m_row.m_filename, m_row.m_filename_length); + break; + case 1: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 2: /* COUNT_READ */ + set_field_ulonglong(f, m_row.m_file_stat.m_count_read); + break; + case 3: /* COUNT_WRITE */ + set_field_ulonglong(f, m_row.m_file_stat.m_count_write); + break; + case 4: /* READ_BYTES */ + set_field_ulonglong(f, m_row.m_file_stat.m_read_bytes); + break; + case 5: /* WRITE_BYTES */ + set_field_ulonglong(f, m_row.m_file_stat.m_write_bytes); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_file_summary.h b/storage/perfschema/table_file_summary.h new file mode 100644 index 00000000000..e962292a725 --- /dev/null +++ b/storage/perfschema/table_file_summary.h @@ -0,0 +1,151 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_FILE_SUMMARY_H +#define TABLE_FILE_SUMMARY_H + +/** + @file storage/perfschema/table_file_summary.h + Table FILE_SUMMARY_BY_xxx (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ +struct row_file_summary_by_event_name +{ + /** Column EVENT_NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** + Columns COUNT_READ, COUNT_WRITE, + SUM_NUMBER_OF_BYTES_READ, SUM_NUMBER_OF_BYTES_WRITE. + */ + PFS_file_stat m_file_stat; +}; + +/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ +class table_file_summary_by_event_name : public PFS_readonly_table +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + void make_row(PFS_file_class *klass); + + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_file_summary_by_event_name(); + +public: + ~table_file_summary_by_event_name() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_file_summary_by_event_name m_row; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */ +struct row_file_summary_by_instance +{ + /** Column FILE_NAME. */ + const char *m_filename; + /** Length in bytes of @c m_filename. */ + uint m_filename_length; + /** Column EVENT_NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** + Columns COUNT_READ, COUNT_WRITE, + SUM_NUMBER_OF_BYTES_READ, SUM_NUMBER_OF_BYTES_WRITE. + */ + PFS_file_stat m_file_stat; +}; + +/** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */ +class table_file_summary_by_instance : public PFS_readonly_table +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + void make_row(PFS_file *pfs); + + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_file_summary_by_instance(); + +public: + ~table_file_summary_by_instance() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_file_summary_by_instance m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc new file mode 100644 index 00000000000..ab4e72b89fa --- /dev/null +++ b/storage/perfschema/table_performance_timers.cc @@ -0,0 +1,187 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_performance_timers.cc + Table PERFORMANCE_TIMERS (implementation). +*/ + +#include "mysql_priv.h" +#include "table_performance_timers.h" +#include "pfs_timer.h" +#include "pfs_global.h" + +THR_LOCK table_performance_timers::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("TIMER_NAME") }, + { C_STRING_WITH_LEN("enum(\'CYCLE\',\'NANOSECOND\',\'MICROSECOND\'," + "\'MILLISECOND\',\'TICK\')") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_FREQUENCY") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_RESOLUTION") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_OVERHEAD") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_performance_timers::m_field_def= +{ 4, field_types }; + +PFS_engine_table_share +table_performance_timers::m_share= +{ + { C_STRING_WITH_LEN("PERFORMANCE_TIMERS") }, + &pfs_readonly_acl, + &table_performance_timers::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + COUNT_TIMER_NAME, /* records */ + sizeof(PFS_simple_index), /* ref length */ + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_performance_timers::create(void) +{ + return new table_performance_timers(); +} + +table_performance_timers::table_performance_timers() + : PFS_readonly_table(&m_share, &m_pos), + m_row(NULL), m_pos(0), m_next_pos(0) +{ + int index; + + index= (int)TIMER_NAME_CYCLE - FIRST_TIMER_NAME; + m_data[index].m_timer_name= TIMER_NAME_CYCLE; + m_data[index].m_info= pfs_timer_info.cycles; + + index= (int)TIMER_NAME_NANOSEC - FIRST_TIMER_NAME; + m_data[index].m_timer_name= TIMER_NAME_NANOSEC; + m_data[index].m_info= pfs_timer_info.nanoseconds; + + index= (int)TIMER_NAME_MICROSEC - FIRST_TIMER_NAME; + m_data[index].m_timer_name= TIMER_NAME_MICROSEC; + m_data[index].m_info= pfs_timer_info.microseconds; + + index= (int)TIMER_NAME_MILLISEC - FIRST_TIMER_NAME; + m_data[index].m_timer_name= TIMER_NAME_MILLISEC; + m_data[index].m_info= pfs_timer_info.milliseconds; + + index= (int)TIMER_NAME_TICK - FIRST_TIMER_NAME; + m_data[index].m_timer_name= TIMER_NAME_TICK; + m_data[index].m_info= pfs_timer_info.ticks; +} + +void table_performance_timers::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_performance_timers::rnd_next(void) +{ + int result; + + m_pos.set_at(&m_next_pos); + + if (m_pos.m_index < COUNT_TIMER_NAME) + { + m_row= &m_data[m_pos.m_index]; + m_next_pos.set_after(&m_pos); + result= 0; + } + else + { + m_row= NULL; + result= HA_ERR_END_OF_FILE; + } + + return result; +} + +int table_performance_timers::rnd_pos(const void *pos) +{ + set_position(pos); + DBUG_ASSERT(m_pos.m_index < COUNT_TIMER_NAME); + m_row= &m_data[m_pos.m_index]; + return 0; +} + +int table_performance_timers::read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) +{ + Field *f; + + DBUG_ASSERT(m_row); + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 1); + buf[0]= 0; + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* TIMER_NAME */ + set_field_enum(f, m_row->m_timer_name); + break; + case 1: /* TIMER_FREQUENCY */ + if (m_row->m_info.routine != 0) + set_field_ulonglong(f, m_row->m_info.frequency); + else + f->set_null(); + break; + case 2: /* TIMER_RESOLUTION */ + if (m_row->m_info.routine != 0) + set_field_ulonglong(f, m_row->m_info.resolution); + else + f->set_null(); + break; + case 3: /* TIMER_OVERHEAD */ + if (m_row->m_info.routine != 0) + set_field_ulonglong(f, m_row->m_info.overhead); + else + f->set_null(); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h new file mode 100644 index 00000000000..0818a0af2fe --- /dev/null +++ b/storage/perfschema/table_performance_timers.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_PERFORMANCE_TIMERS_H +#define TABLE_PERFORMANCE_TIMERS_H + +/** + @file storage/perfschema/table_performance_timers.h + Table PERFORMANCE_TIMERS (declarations). +*/ + +#include <my_rdtsc.h> +#include "pfs_column_types.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.PERFORMANCE_TIMERS. */ +struct row_performance_timers +{ + /** Column TIMER_NAME. */ + enum_timer_name m_timer_name; + /** + Columns ROUTINE (not displayed), TIMER_OVERHEAD, + TIMER_FREQUENCY, TIMER_RESOLUTION. + */ + struct my_timer_unit_info m_info; +}; + +/** Table PERFORMANCE_SCHEMA.PERFORMANCE_TIMERS. */ +class table_performance_timers : public PFS_readonly_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + +protected: + table_performance_timers(); + +public: + ~table_performance_timers() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_performance_timers *m_row; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; + row_performance_timers m_data[COUNT_TIMER_NAME]; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_processlist.cc b/storage/perfschema/table_processlist.cc new file mode 100644 index 00000000000..d0707b9df60 --- /dev/null +++ b/storage/perfschema/table_processlist.cc @@ -0,0 +1,176 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_processlist.cc + Table PROCESSLIST (implementation). +*/ + +#include "mysql_priv.h" +#include "table_processlist.h" +#include "pfs_instr_class.h" +#include "pfs_instr.h" + +THR_LOCK table_processlist::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("THREAD_ID") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("ID") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_processlist::m_field_def= +{ 3, field_types }; + +PFS_engine_table_share +table_processlist::m_share= +{ + { C_STRING_WITH_LEN("PROCESSLIST") }, + &pfs_readonly_acl, + &table_processlist::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + 1000, /* records */ + sizeof(PFS_simple_index), /* ref length */ + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_processlist::create(void) +{ + return new table_processlist(); +} + +table_processlist::table_processlist() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(0), m_next_pos(0) +{} + +void table_processlist::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_processlist::rnd_next(void) +{ + PFS_thread *pfs; + + for (m_pos.set_at(&m_next_pos); + m_pos.m_index < thread_max; + m_pos.next()) + { + pfs= &thread_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_processlist::rnd_pos(const void *pos) +{ + PFS_thread *pfs; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index < thread_max); + pfs= &thread_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + return 0; + } + + return HA_ERR_RECORD_DELETED; +} + +void table_processlist::make_row(PFS_thread *pfs) +{ + pfs_lock lock; + PFS_thread_class *safe_class; + + m_row_exists= false; + + /* Protect this reader against thread termination */ + pfs->m_lock.begin_optimistic_lock(&lock); + + safe_class= sanitize_thread_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + m_row.m_thread_internal_id= pfs->m_thread_internal_id; + m_row.m_thread_id= pfs->m_thread_id; + m_row.m_name= safe_class->m_name; + m_row.m_name_length= safe_class->m_name_length; + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_processlist::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* THREAD_ID */ + set_field_ulong(f, m_row.m_thread_internal_id); + break; + case 1: /* ID */ + set_field_ulong(f, m_row.m_thread_id); + break; + case 2: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + default: + DBUG_ASSERT(false); + } + } + } + return 0; +} + diff --git a/storage/perfschema/table_processlist.h b/storage/perfschema/table_processlist.h new file mode 100644 index 00000000000..2c6d5160f41 --- /dev/null +++ b/storage/perfschema/table_processlist.h @@ -0,0 +1,91 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_PROCESSIST_H +#define TABLE_PROCESSIST_H + +/** + @file storage/perfschema/table_processlist.h + Table PROCESSLIST (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" + +struct PFS_thread; + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.PROCESSLIST. */ +struct row_processlist +{ + /** Column THREAD_ID. */ + ulong m_thread_internal_id; + /** Column ID. */ + ulong m_thread_id; + /** Column NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; +}; + +/** Table PERFORMANCE_SCHEMA.PROCESSLIST. */ +class table_processlist : public PFS_readonly_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + +protected: + table_processlist(); + +public: + ~table_processlist() + {} + +private: + void make_row(PFS_thread *pfs); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_processlist m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc new file mode 100644 index 00000000000..f23dca8a675 --- /dev/null +++ b/storage/perfschema/table_setup_consumers.cc @@ -0,0 +1,211 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_setup_consumers.cc + Table SETUP_CONSUMERS (implementation). +*/ + +#include "mysql_priv.h" +#include "table_setup_consumers.h" +#include "pfs_instr.h" +#include "pfs_events_waits.h" + +#define COUNT_SETUP_CONSUMERS 8 +static row_setup_consumers all_setup_consumers_data[COUNT_SETUP_CONSUMERS]= +{ + { + { C_STRING_WITH_LEN("events_waits_current") }, + &flag_events_waits_current + }, + { + { C_STRING_WITH_LEN("events_waits_history") }, + &flag_events_waits_history + }, + { + { C_STRING_WITH_LEN("events_waits_history_long") }, + &flag_events_waits_history_long + }, + { + { C_STRING_WITH_LEN("events_waits_summary_by_thread_by_event_name") }, + &flag_events_waits_summary_by_thread_by_event_name + }, + { + { C_STRING_WITH_LEN("events_waits_summary_by_event_name") }, + &flag_events_waits_summary_by_event_name + }, + { + { C_STRING_WITH_LEN("events_waits_summary_by_instance") }, + &flag_events_waits_summary_by_instance + }, + { + { C_STRING_WITH_LEN("file_summary_by_event_name") }, + &flag_file_summary_by_event_name + }, + { + { C_STRING_WITH_LEN("file_summary_by_instance") }, + &flag_file_summary_by_instance + } +}; + +THR_LOCK table_setup_consumers::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("ENABLED") }, + { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_setup_consumers::m_field_def= +{ 2, field_types }; + +PFS_engine_table_share +table_setup_consumers::m_share= +{ + { C_STRING_WITH_LEN("SETUP_CONSUMERS") }, + &pfs_updatable_acl, + &table_setup_consumers::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + COUNT_SETUP_CONSUMERS, /* records */ + sizeof(PFS_simple_index), /* ref length */ + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_setup_consumers::create(void) +{ + return new table_setup_consumers(); +} + +table_setup_consumers::table_setup_consumers() + : PFS_engine_table(&m_share, &m_pos), + m_row(NULL), m_pos(0), m_next_pos(0) +{} + +void table_setup_consumers::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_setup_consumers::rnd_next(void) +{ + int result; + + m_pos.set_at(&m_next_pos); + + if (m_pos.m_index < COUNT_SETUP_CONSUMERS) + { + m_row= &all_setup_consumers_data[m_pos.m_index]; + m_next_pos.set_after(&m_pos); + result= 0; + } + else + { + m_row= NULL; + result= HA_ERR_END_OF_FILE; + } + + return result; +} + +int table_setup_consumers::rnd_pos(const void *pos) +{ + set_position(pos); + DBUG_ASSERT(m_pos.m_index < COUNT_SETUP_CONSUMERS); + m_row= &all_setup_consumers_data[m_pos.m_index]; + return 0; +} + +int table_setup_consumers::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + DBUG_ASSERT(m_row); + + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row->m_name.str, m_row->m_name.length); + break; + case 1: /* ENABLED */ + set_field_enum(f, (*m_row->m_enabled_ptr) ? ENUM_YES : ENUM_NO); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +int table_setup_consumers::update_row_values(TABLE *table, + const unsigned char *, + unsigned char *, + Field **fields) +{ + Field *f; + enum_yes_no value; + + DBUG_ASSERT(m_row); + + for (; (f= *fields) ; fields++) + { + if (bitmap_is_set(table->write_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + return HA_ERR_WRONG_COMMAND; + case 1: /* ENABLED */ + { + value= (enum_yes_no) get_field_enum(f); + *m_row->m_enabled_ptr= (value == ENUM_YES) ? true : false; + break; + } + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + + diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h new file mode 100644 index 00000000000..f54f69fcef5 --- /dev/null +++ b/storage/perfschema/table_setup_consumers.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_SETUP_CONSUMERS_H +#define TABLE_SETUP_CONSUMERS_H + +/** + @file storage/perfschema/table_setup_consumers.h + Table SETUP_CONSUMERS (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.SETUP_CONSUMERS. */ +struct row_setup_consumers +{ + /** Column NAME. */ + LEX_STRING m_name; + /** Column ENABLED. */ + bool *m_enabled_ptr; +}; + +/** Table PERFORMANCE_SCHEMA.SETUP_CONSUMERS. */ +class table_setup_consumers : public PFS_engine_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + virtual int update_row_values(TABLE *table, + const unsigned char *old_buf, + unsigned char *new_buf, + Field **fields); + + table_setup_consumers(); + +public: + ~table_setup_consumers() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_setup_consumers *m_row; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc new file mode 100644 index 00000000000..6756e780d78 --- /dev/null +++ b/storage/perfschema/table_setup_instruments.cc @@ -0,0 +1,276 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_setup_instruments.cc + Table SETUP_INSTRUMENTS (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_instr_class.h" +#include "pfs_column_types.h" +#include "pfs_column_values.h" +#include "table_setup_instruments.h" +#include "pfs_global.h" + +THR_LOCK table_setup_instruments::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("ENABLED") }, + { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMED") }, + { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_setup_instruments::m_field_def= +{ 3, field_types }; + +PFS_engine_table_share +table_setup_instruments::m_share= +{ + { C_STRING_WITH_LEN("SETUP_INSTRUMENTS") }, + &pfs_updatable_acl, + &table_setup_instruments::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + 1000, /* records */ + sizeof(pos_setup_instruments), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_setup_instruments::create(void) +{ + return new table_setup_instruments(); +} + +table_setup_instruments::table_setup_instruments() + : PFS_engine_table(&m_share, &m_pos), + m_pos(), m_next_pos() +{} + +void table_setup_instruments::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_setup_instruments::rnd_next(void) +{ + PFS_mutex_class *mutex_class; + PFS_rwlock_class *rwlock_class; + PFS_cond_class *cond_class; + PFS_file_class *file_class; + + for (m_pos.set_at(&m_next_pos); + m_pos.has_more_view(); + m_pos.next_view()) + { + switch (m_pos.m_index_1) { + case pos_setup_instruments::VIEW_MUTEX: + mutex_class= find_mutex_class(m_pos.m_index_2); + if (mutex_class) + { + make_row(mutex_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_setup_instruments::VIEW_RWLOCK: + rwlock_class= find_rwlock_class(m_pos.m_index_2); + if (rwlock_class) + { + make_row(rwlock_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_setup_instruments::VIEW_COND: + cond_class= find_cond_class(m_pos.m_index_2); + if (cond_class) + { + make_row(cond_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + case pos_setup_instruments::VIEW_THREAD: + /* Reserved for WL#4674, PERFORMANCE_SCHEMA Setup For Actors. */ + break; + case pos_setup_instruments::VIEW_FILE: + file_class= find_file_class(m_pos.m_index_2); + if (file_class) + { + make_row(file_class); + m_next_pos.set_after(&m_pos); + return 0; + } + break; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_setup_instruments::rnd_pos(const void *pos) +{ + PFS_mutex_class *mutex_class; + PFS_rwlock_class *rwlock_class; + PFS_cond_class *cond_class; + PFS_file_class *file_class; + + set_position(pos); + + switch (m_pos.m_index_1) { + case pos_setup_instruments::VIEW_MUTEX: + mutex_class= find_mutex_class(m_pos.m_index_2); + if (mutex_class) + { + make_row(mutex_class); + return 0; + } + break; + case pos_setup_instruments::VIEW_RWLOCK: + rwlock_class= find_rwlock_class(m_pos.m_index_2); + if (rwlock_class) + { + make_row(rwlock_class); + return 0; + } + break; + case pos_setup_instruments::VIEW_COND: + cond_class= find_cond_class(m_pos.m_index_2); + if (cond_class) + { + make_row(cond_class); + return 0; + } + break; + case pos_setup_instruments::VIEW_THREAD: + /* Reserved for WL#4674, PERFORMANCE_SCHEMA Setup For Actors. */ + break; + case pos_setup_instruments::VIEW_FILE: + file_class= find_file_class(m_pos.m_index_2); + if (file_class) + { + make_row(file_class); + return 0; + } + break; + } + + return HA_ERR_RECORD_DELETED; +} + +void table_setup_instruments::make_row(PFS_instr_class *klass) +{ + m_row.m_name= &klass->m_name[0]; + m_row.m_name_length= klass->m_name_length; + m_row.m_enabled_ptr= &klass->m_enabled; + m_row.m_timed_ptr= &klass->m_timed; +} + +int table_setup_instruments::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + DBUG_ASSERT(table->s->null_bytes == 0); + + /* + The row always exist, the instrument classes + are static and never disappear. + */ + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* ENABLED */ + set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO); + break; + case 2: /* TIMED */ + if (m_row.m_timed_ptr) + set_field_enum(f, (*m_row.m_timed_ptr) ? ENUM_YES : ENUM_NO); + else + set_field_enum(f, ENUM_NO); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +int table_setup_instruments::update_row_values(TABLE *table, + const unsigned char *, + unsigned char *, + Field **fields) +{ + Field *f; + enum_yes_no value; + + for (; (f= *fields) ; fields++) + { + if (bitmap_is_set(table->write_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + return HA_ERR_WRONG_COMMAND; + case 1: /* ENABLED */ + value= (enum_yes_no) get_field_enum(f); + *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false; + break; + case 2: /* TIMED */ + if (m_row.m_timed_ptr) + { + value= (enum_yes_no) get_field_enum(f); + *m_row.m_timed_ptr= (value == ENUM_YES) ? true : false; + } + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h new file mode 100644 index 00000000000..549fe4fa5f9 --- /dev/null +++ b/storage/perfschema/table_setup_instruments.h @@ -0,0 +1,121 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_SETUP_INSTRUMENTS_H +#define TABLE_SETUP_INSTRUMENTS_H + +/** + @file storage/perfschema/table_setup_instruments.h + Table SETUP_INSTRUMENTS (declarations). +*/ + +#include "pfs_instr_class.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */ +struct row_setup_instruments +{ + /** Column NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column ENABLED. */ + bool *m_enabled_ptr; + /** Column TIMED. */ + bool *m_timed_ptr; +}; + +/** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */ +struct pos_setup_instruments : public PFS_double_index +{ + static const uint VIEW_MUTEX= 1; + static const uint VIEW_RWLOCK= 2; + static const uint VIEW_COND= 3; + /** Reverved for WL#4674, PERFORMANCE_SCHEMA Setup For Actors. */ + static const uint VIEW_THREAD= 4; + static const uint VIEW_FILE= 5; + + pos_setup_instruments() + : PFS_double_index(VIEW_MUTEX, 1) + {} + + inline void reset(void) + { + m_index_1= VIEW_MUTEX; + m_index_2= 1; + } + + inline bool has_more_view(void) + { return (m_index_1 <= VIEW_FILE); } + + inline void next_view(void) + { + m_index_1++; + m_index_2= 1; + } +}; + +/** Table PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */ +class table_setup_instruments : public PFS_engine_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + virtual int update_row_values(TABLE *table, + const unsigned char *old_buf, + unsigned char *new_buf, + Field **fields); + + table_setup_instruments(); + +public: + ~table_setup_instruments() + {} + +private: + void make_row(PFS_instr_class *klass); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_setup_instruments m_row; + /** Current position. */ + pos_setup_instruments m_pos; + /** Next position. */ + pos_setup_instruments m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc new file mode 100644 index 00000000000..53a80782da0 --- /dev/null +++ b/storage/perfschema/table_setup_objects.cc @@ -0,0 +1,280 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_setup_objects.cc + Table SETUP_OBJECTS (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_instr_class.h" +#include "pfs_column_types.h" +#include "pfs_column_values.h" +#include "table_setup_objects.h" +#include "pfs_global.h" + +THR_LOCK table_setup_objects::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("OBJECT_TYPE") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_SCHEMA") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_NAME") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("ENABLED") }, + { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMED") }, + { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("AGGREGATED") }, + { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_setup_objects::m_field_def= +{ 6, field_types }; + +PFS_engine_table_share +table_setup_objects::m_share= +{ + { C_STRING_WITH_LEN("SETUP_OBJECTS") }, + &pfs_editable_acl, + &table_setup_objects::create, + table_setup_objects::write_row, + table_setup_objects::delete_all_rows, + 1000, /* records */ + sizeof(pos_setup_objects), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_setup_objects::create(void) +{ + return new table_setup_objects(); +} + +int table_setup_objects::write_row(TABLE *table, unsigned char *buf, + Field **fields) +{ + /* Not implemented */ + return HA_ERR_WRONG_COMMAND; +} + +int table_setup_objects::delete_all_rows(void) +{ + /* Not implemented */ + return HA_ERR_WRONG_COMMAND; +} + +table_setup_objects::table_setup_objects() + : PFS_engine_table(&m_share, &m_pos), + m_row_exists(false), m_pos(), m_next_pos() +{} + +void table_setup_objects::reset_position(void) +{ + m_pos.reset(); + m_next_pos.reset(); +} + +int table_setup_objects::rnd_next(void) +{ + PFS_table_share *table_share; + + for (m_pos.set_at(&m_next_pos); + m_pos.has_more_view(); + m_pos.next_view()) + { + switch (m_pos.m_index_1) { + case pos_setup_objects::VIEW_TABLE: + for ( ; m_pos.m_index_2 < table_share_max; m_pos.m_index_2++) + { + table_share= &table_share_array[m_pos.m_index_2]; + if (table_share->m_lock.is_populated()) + { + make_row(table_share); + m_next_pos.set_after(&m_pos); + return 0; + } + } + break; + case pos_setup_objects::VIEW_EVENT: + case pos_setup_objects::VIEW_PROCEDURE: + case pos_setup_objects::VIEW_FUNCTION: + default: + break; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_setup_objects::rnd_pos(const void *pos) +{ + PFS_table_share *share; + + set_position(pos); + + switch (m_pos.m_index_1) { + case pos_setup_objects::VIEW_TABLE: + DBUG_ASSERT(m_pos.m_index_2 < table_share_max); + share= &table_share_array[m_pos.m_index_2]; + if (share->m_lock.is_populated()) + { + make_row(share); + return 0; + } + break; + case pos_setup_objects::VIEW_EVENT: + case pos_setup_objects::VIEW_PROCEDURE: + case pos_setup_objects::VIEW_FUNCTION: + default: + break; + } + + return HA_ERR_RECORD_DELETED; +} + +void table_setup_objects::make_row(PFS_table_share *share) +{ + pfs_lock lock; + + m_row_exists= false; + if (share == NULL) + return; + + share->m_lock.begin_optimistic_lock(&lock); + + m_row.m_schema_name= &share->m_schema_name[0]; + m_row.m_schema_name_length= share->m_schema_name_length; + m_row.m_object_name= &share->m_table_name[0]; + m_row.m_object_name_length= share->m_table_name_length; + m_row.m_enabled_ptr= &share->m_enabled; + m_row.m_timed_ptr= &share->m_timed; + m_row.m_aggregated_ptr= &share->m_aggregated; + + if (share->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_setup_objects::read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 1); + buf[0]= 0; + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* OBJECT_TYPE */ + set_field_varchar_utf8(f, "TABLE", 5); + break; + case 1: /* OBJECT_SCHEMA */ + set_field_varchar_utf8(f, m_row.m_schema_name, + m_row.m_schema_name_length); + break; + case 2: /* OBJECT_NAME */ + set_field_varchar_utf8(f, m_row.m_object_name, + m_row.m_object_name_length); + break; + case 3: /* ENABLED */ + set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO); + break; + case 4: /* TIMED */ + set_field_enum(f, (*m_row.m_timed_ptr) ? ENUM_YES : ENUM_NO); + break; + case 5: /* AGGREGATED */ + set_field_enum(f, (*m_row.m_aggregated_ptr) ? ENUM_YES : ENUM_NO); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +int table_setup_objects::update_row_values(TABLE *table, + const unsigned char *, + unsigned char *, + Field **fields) +{ + Field *f; + enum_yes_no value; + + for (; (f= *fields) ; fields++) + { + if (bitmap_is_set(table->write_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* OBJECT_TYPE */ + case 1: /* OBJECT_SCHEMA */ + case 2: /* OBJECT_NAME */ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + return HA_ERR_WRONG_COMMAND; + case 3: /* ENABLED */ + value= (enum_yes_no) get_field_enum(f); + *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false; + break; + case 4: /* TIMED */ + value= (enum_yes_no) get_field_enum(f); + *m_row.m_timed_ptr= (value == ENUM_YES) ? true : false; + break; + case 5: /* AGGREGATED */ + value= (enum_yes_no) get_field_enum(f); + *m_row.m_aggregated_ptr= (value == ENUM_YES) ? true : false; + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h new file mode 100644 index 00000000000..994e12016a6 --- /dev/null +++ b/storage/perfschema/table_setup_objects.h @@ -0,0 +1,125 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_SETUP_OBJECTS_H +#define TABLE_SETUP_OBJECTS_H + +/** + @file storage/perfschema/table_setup_objects.h + Table SETUP_OBJECTS (declarations). +*/ + +#include "pfs_instr_class.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of PERFORMANCE_SCHEMA.SETUP_OBJECTS. */ +struct row_setup_objects +{ + /** Column SCHEMA_NAME. */ + const char *m_schema_name; + /** Length in bytes of @c m_schema_name. */ + uint m_schema_name_length; + /** Column OBJECT_NAME. */ + const char *m_object_name; + /** Length in bytes of @c m_object_name. */ + uint m_object_name_length; + /** Column ENABLED. */ + bool *m_enabled_ptr; + /** Column TIMED. */ + bool *m_timed_ptr; + /** Column AGGREGATED. */ + bool *m_aggregated_ptr; +}; + +/** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_OBJECTS. */ +struct pos_setup_objects : public PFS_double_index, + public PFS_object_view_constants +{ + pos_setup_objects() + : PFS_double_index(VIEW_TABLE, 0) + {} + + inline void reset(void) + { + m_index_1= VIEW_TABLE; + m_index_2= 0; + } + + inline bool has_more_view(void) + { return (m_index_1 <= VIEW_FUNCTION); } + + inline void next_view(void) + { + m_index_1++; + m_index_2= 0; + } +}; + +/** Table PERFORMANCE_SCHEMA.SETUP_OBJECTS. */ +class table_setup_objects : public PFS_engine_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + static int write_row(TABLE *table, unsigned char *buf, Field **fields); + static int delete_all_rows(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + virtual int update_row_values(TABLE *table, + const unsigned char *old_buf, + unsigned char *new_buf, + Field **fields); + + table_setup_objects(); + +public: + ~table_setup_objects() + {} + +private: + void make_row(PFS_table_share *share); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_setup_objects m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + pos_setup_objects m_pos; + /** Next position. */ + pos_setup_objects m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc new file mode 100644 index 00000000000..2d57adb3a85 --- /dev/null +++ b/storage/perfschema/table_setup_timers.cc @@ -0,0 +1,183 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_setup_timers.cc + Table SETUP_TIMERS (implementation). +*/ + +#include "mysql_priv.h" +#include "table_setup_timers.h" +#include "pfs_column_values.h" +#include "pfs_timer.h" + +#define COUNT_SETUP_TIMERS 1 +static row_setup_timers all_setup_timers_data[COUNT_SETUP_TIMERS]= +{ + { + { C_STRING_WITH_LEN("wait") }, + &wait_timer + } +}; + +THR_LOCK table_setup_timers::m_table_lock; + +static const TABLE_FIELD_TYPE field_types[]= +{ + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(64)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("TIMER_NAME") }, + { C_STRING_WITH_LEN("enum(\'CYCLE\',\'NANOSECOND\',\'MICROSECOND\'," + "\'MILLISECOND\',\'TICK\')") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_setup_timers::m_field_def= +{ 2, field_types }; + +PFS_engine_table_share +table_setup_timers::m_share= +{ + { C_STRING_WITH_LEN("SETUP_TIMERS") }, + &pfs_updatable_acl, + &table_setup_timers::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + COUNT_SETUP_TIMERS, + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_setup_timers::create(void) +{ + return new table_setup_timers(); +} + +table_setup_timers::table_setup_timers() + : PFS_engine_table(&m_share, &m_pos), + m_row(NULL), m_pos(0), m_next_pos(0) +{} + +void table_setup_timers::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_setup_timers::rnd_next(void) +{ + int result; + + m_pos.set_at(&m_next_pos); + + if (m_pos.m_index < COUNT_SETUP_TIMERS) + { + m_row= &all_setup_timers_data[m_pos.m_index]; + m_next_pos.set_after(&m_pos); + result= 0; + } + else + { + m_row= NULL; + result= HA_ERR_END_OF_FILE; + } + + return result; +} + +int table_setup_timers::rnd_pos(const void *pos) +{ + set_position(pos); + DBUG_ASSERT(m_pos.m_index < COUNT_SETUP_TIMERS); + m_row= &all_setup_timers_data[m_pos.m_index]; + return 0; +} + +int table_setup_timers::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + DBUG_ASSERT(m_row); + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row->m_name.str, m_row->m_name.length); + break; + case 1: /* TIMER_NAME */ + set_field_enum(f, *(m_row->m_timer_name_ptr)); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +int table_setup_timers::update_row_values(TABLE *table, + const unsigned char *, + unsigned char *, + Field **fields) +{ + Field *f; + longlong value; + + DBUG_ASSERT(m_row); + + for (; (f= *fields) ; fields++) + { + if (bitmap_is_set(table->write_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + return HA_ERR_WRONG_COMMAND; + case 1: /* TIMER_NAME */ + value= get_field_enum(f); + if ((value >= FIRST_TIMER_NAME) && (value <= LAST_TIMER_NAME)) + *(m_row->m_timer_name_ptr)= (enum_timer_name) value; + else + return HA_ERR_WRONG_COMMAND; + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h new file mode 100644 index 00000000000..96af76ae05c --- /dev/null +++ b/storage/perfschema/table_setup_timers.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_SETUP_TIMERS_H +#define TABLE_SETUP_TIMERS_H + +/** + @file storage/perfschema/table_setup_timers.h + Table SETUP_TIMERS (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of table PERFORMANCE_SCHEMA.SETUP_TIMERS. */ +struct row_setup_timers +{ + /** Column NAME. */ + LEX_STRING m_name; + /** Column TIMER_NAME. */ + enum_timer_name *m_timer_name_ptr; +}; + +/** Table PERFORMANCE_SCHEMA.SETUP_TIMERS. */ +class table_setup_timers : public PFS_engine_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +protected: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + virtual int update_row_values(TABLE *table, + const unsigned char *old_buf, + unsigned char *new_buf, + Field **fields); + + table_setup_timers(); + +public: + ~table_setup_timers() + {} + +private: + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_setup_timers *m_row; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc new file mode 100644 index 00000000000..a783b5b817b --- /dev/null +++ b/storage/perfschema/table_sync_instances.cc @@ -0,0 +1,507 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file storage/perfschema/table_sync_instances.cc + Table MUTEX_INSTANCES, RWLOCK_INSTANCES + and COND_INSTANCES (implementation). +*/ + +#include "mysql_priv.h" +#include "pfs_instr.h" +#include "pfs_column_types.h" +#include "pfs_column_values.h" +#include "table_sync_instances.h" +#include "pfs_global.h" + +THR_LOCK table_mutex_instances::m_table_lock; + +static const TABLE_FIELD_TYPE mutex_field_types[]= +{ + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("LOCKED_BY_THREAD_ID") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_mutex_instances::m_field_def= +{ 3, mutex_field_types }; + +PFS_engine_table_share +table_mutex_instances::m_share= +{ + { C_STRING_WITH_LEN("MUTEX_INSTANCES") }, + &pfs_readonly_acl, + &table_mutex_instances::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + 1000, /* records */ + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_mutex_instances::create(void) +{ + return new table_mutex_instances(); +} + +table_mutex_instances::table_mutex_instances() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(0), m_next_pos(0) +{} + +void table_mutex_instances::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_mutex_instances::rnd_next(void) +{ + PFS_mutex *pfs; + + for (m_pos.set_at(&m_next_pos); m_pos.m_index < mutex_max; m_pos.next()) + { + pfs= &mutex_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_mutex_instances::rnd_pos(const void *pos) +{ + PFS_mutex *pfs; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index < mutex_max); + pfs= &mutex_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + return 0; + } + + return HA_ERR_RECORD_DELETED; +} + +void table_mutex_instances::make_row(PFS_mutex *pfs) +{ + pfs_lock lock; + PFS_mutex_class *safe_class; + + m_row_exists= false; + + /* Protect this reader against a mutex destroy */ + pfs->m_lock.begin_optimistic_lock(&lock); + + safe_class= sanitize_mutex_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + m_row.m_name= safe_class->m_name; + m_row.m_name_length= safe_class->m_name_length; + m_row.m_identity= pfs->m_identity; + + /* Protect this reader against a mutex unlock */ + PFS_thread *safe_owner= sanitize_thread(pfs->m_owner); + if (safe_owner) + { + m_row.m_locked_by_thread_id= safe_owner->m_thread_internal_id; + m_row.m_locked= true; + } + else + m_row.m_locked= false; + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_mutex_instances::read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 1); + buf[0]= 0; + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* OBJECT_INSTANCE */ + set_field_ulonglong(f, (intptr) m_row.m_identity); + break; + case 2: /* LOCKED_BY_THREAD_ID */ + if (m_row.m_locked) + set_field_ulong(f, m_row.m_locked_by_thread_id); + else + f->set_null(); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +THR_LOCK table_rwlock_instances::m_table_lock; + +static const TABLE_FIELD_TYPE rwlock_field_types[]= +{ + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("WRITE_LOCKED_BY_THREAD_ID") }, + { C_STRING_WITH_LEN("int(11)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("READ_LOCKED_BY_COUNT") }, + { C_STRING_WITH_LEN("int(10)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_rwlock_instances::m_field_def= +{ 4, rwlock_field_types }; + +PFS_engine_table_share +table_rwlock_instances::m_share= +{ + { C_STRING_WITH_LEN("RWLOCK_INSTANCES") }, + &pfs_readonly_acl, + &table_rwlock_instances::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + 1000, /* records */ + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_rwlock_instances::create(void) +{ + return new table_rwlock_instances(); +} + +table_rwlock_instances::table_rwlock_instances() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(0), m_next_pos(0) +{} + +void table_rwlock_instances::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_rwlock_instances::rnd_next(void) +{ + PFS_rwlock *pfs; + + for (m_pos.set_at(&m_next_pos); m_pos.m_index < rwlock_max; m_pos.next()) + { + pfs= &rwlock_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_rwlock_instances::rnd_pos(const void *pos) +{ + PFS_rwlock *pfs; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index < rwlock_max); + pfs= &rwlock_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + return 0; + } + + return HA_ERR_RECORD_DELETED; +} + +void table_rwlock_instances::make_row(PFS_rwlock *pfs) +{ + pfs_lock lock; + PFS_rwlock_class *safe_class; + + m_row_exists= false; + + /* Protect this reader against a rwlock destroy */ + pfs->m_lock.begin_optimistic_lock(&lock); + + safe_class= sanitize_rwlock_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + m_row.m_name= safe_class->m_name; + m_row.m_name_length= safe_class->m_name_length; + m_row.m_identity= pfs->m_identity; + + /* Protect this reader against a rwlock unlock in the writer */ + PFS_thread *safe_writer= sanitize_thread(pfs->m_writer); + if (safe_writer) + { + m_row.m_write_locked_by_thread_id= safe_writer->m_thread_internal_id; + m_row.m_readers= 0; + m_row.m_write_locked= true; + } + else + { + m_row.m_readers= pfs->m_readers; + m_row.m_write_locked= false; + } + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_rwlock_instances::read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 1); + buf[0]= 0; + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* OBJECT_INSTANCE */ + set_field_ulonglong(f, (intptr) m_row.m_identity); + break; + case 2: /* WRITE_LOCKED_BY_THREAD_ID */ + if (m_row.m_write_locked) + set_field_ulong(f, m_row.m_write_locked_by_thread_id); + else + f->set_null(); + break; + case 3: /* READ_LOCKED_BY_COUNT */ + set_field_ulong(f, m_row.m_readers); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + +THR_LOCK table_cond_instances::m_table_lock; + +static const TABLE_FIELD_TYPE cond_field_types[]= +{ + { + { C_STRING_WITH_LEN("NAME") }, + { C_STRING_WITH_LEN("varchar(128)") }, + { NULL, 0} + }, + { + { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") }, + { C_STRING_WITH_LEN("bigint(20)") }, + { NULL, 0} + } +}; + +TABLE_FIELD_DEF +table_cond_instances::m_field_def= +{ 2, cond_field_types }; + +PFS_engine_table_share +table_cond_instances::m_share= +{ + { C_STRING_WITH_LEN("COND_INSTANCES") }, + &pfs_readonly_acl, + &table_cond_instances::create, + NULL, /* write_row */ + NULL, /* delete_all_rows */ + 1000, /* records */ + sizeof(PFS_simple_index), + &m_table_lock, + &m_field_def, + false /* checked */ +}; + +PFS_engine_table* table_cond_instances::create(void) +{ + return new table_cond_instances(); +} + +table_cond_instances::table_cond_instances() + : PFS_readonly_table(&m_share, &m_pos), + m_row_exists(false), m_pos(0), m_next_pos(0) +{} + +void table_cond_instances::reset_position(void) +{ + m_pos.m_index= 0; + m_next_pos.m_index= 0; +} + +int table_cond_instances::rnd_next(void) +{ + PFS_cond *pfs; + + for (m_pos.set_at(&m_next_pos); m_pos.m_index < cond_max; m_pos.next()) + { + pfs= &cond_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + m_next_pos.set_after(&m_pos); + return 0; + } + } + + return HA_ERR_END_OF_FILE; +} + +int table_cond_instances::rnd_pos(const void *pos) +{ + PFS_cond *pfs; + + set_position(pos); + DBUG_ASSERT(m_pos.m_index < cond_max); + pfs= &cond_array[m_pos.m_index]; + if (pfs->m_lock.is_populated()) + { + make_row(pfs); + return 0; + } + + return HA_ERR_RECORD_DELETED; +} + +void table_cond_instances::make_row(PFS_cond *pfs) +{ + pfs_lock lock; + PFS_cond_class *safe_class; + + m_row_exists= false; + + /* Protect this reader against a cond destroy */ + pfs->m_lock.begin_optimistic_lock(&lock); + + safe_class= sanitize_cond_class(pfs->m_class); + if (unlikely(safe_class == NULL)) + return; + + m_row.m_name= safe_class->m_name; + m_row.m_name_length= safe_class->m_name_length; + m_row.m_identity= pfs->m_identity; + + if (pfs->m_lock.end_optimistic_lock(&lock)) + m_row_exists= true; +} + +int table_cond_instances::read_row_values(TABLE *table, + unsigned char *, + Field **fields, + bool read_all) +{ + Field *f; + + if (unlikely(! m_row_exists)) + return HA_ERR_RECORD_DELETED; + + /* Set the null bits */ + DBUG_ASSERT(table->s->null_bytes == 0); + + for (; (f= *fields) ; fields++) + { + if (read_all || bitmap_is_set(table->read_set, f->field_index)) + { + switch(f->field_index) + { + case 0: /* NAME */ + set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length); + break; + case 1: /* OBJECT_INSTANCE */ + set_field_ulonglong(f, (intptr) m_row.m_identity); + break; + default: + DBUG_ASSERT(false); + } + } + } + + return 0; +} + diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h new file mode 100644 index 00000000000..a8a9cdaa071 --- /dev/null +++ b/storage/perfschema/table_sync_instances.h @@ -0,0 +1,206 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef TABLE_SYNC_INSTANCE_H +#define TABLE_SYNC_INSTANCE_H + +/** + @file storage/perfschema/table_sync_instances.h + Table MUTEX_INSTANCES, RWLOCK_INSTANCES and COND_INSTANCES (declarations). +*/ + +#include "pfs_column_types.h" +#include "pfs_engine_table.h" + +struct PFS_mutex; +struct PFS_rwlock; +struct PFS_cond; + +/** + @addtogroup Performance_schema_tables + @{ +*/ + +/** A row of table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */ +struct row_mutex_instances +{ + /** Column NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column OBJECT_INSTANCE_BEGIN. */ + const void *m_identity; + /** True if column LOCKED_BY_THREAD_ID is not null. */ + bool m_locked; + /** Column LOCKED_BY_THREAD_ID. */ + ulong m_locked_by_thread_id; +}; + +/** Table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */ +class table_mutex_instances : public PFS_readonly_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +private: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_mutex_instances(); + +public: + ~table_mutex_instances() + {} + +private: + void make_row(PFS_mutex *pfs); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_mutex_instances m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** A row of table PERFORMANCE_SCHEMA.RWLOCK_INSTANCES. */ +struct row_rwlock_instances +{ + /** Column NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column OBJECT_INSTANCE_BEGIN. */ + const void *m_identity; + /** True if column WRITE_LOCKED_BY_THREAD_ID is not null. */ + bool m_write_locked; + /** Column WRITE_LOCKED_BY_THREAD_ID. */ + ulong m_write_locked_by_thread_id; + /** Column READ_LOCKED_BY_COUNT. */ + ulong m_readers; +}; + +/** Table PERFORMANCE_SCHEMA.RWLOCK_INSTANCES. */ +class table_rwlock_instances : public PFS_readonly_table +{ +public: + /** Table share */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +private: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_rwlock_instances(); + +public: + ~table_rwlock_instances() + {} + +private: + void make_row(PFS_rwlock *pfs); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_rwlock_instances m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** A row of table PERFORMANCE_SCHEMA.COND_INSTANCES. */ +struct row_cond_instances +{ + /** Column NAME. */ + const char *m_name; + /** Length in bytes of @c m_name. */ + uint m_name_length; + /** Column OBJECT_INSTANCE_BEGIN. */ + const void *m_identity; +}; + +/** Table PERFORMANCE_SCHEMA.COND_INSTANCES. */ +class table_cond_instances : public PFS_readonly_table +{ +public: + /** Table share. */ + static PFS_engine_table_share m_share; + static PFS_engine_table* create(); + + virtual int rnd_next(); + virtual int rnd_pos(const void *pos); + virtual void reset_position(void); + +private: + virtual int read_row_values(TABLE *table, + unsigned char *buf, + Field **fields, + bool read_all); + + table_cond_instances(); + +public: + ~table_cond_instances() + {} + +private: + void make_row(PFS_cond *pfs); + + /** Table share lock. */ + static THR_LOCK m_table_lock; + /** Fields definition. */ + static TABLE_FIELD_DEF m_field_def; + + /** Current row. */ + row_cond_instances m_row; + /** True is the current row exists. */ + bool m_row_exists; + /** Current position. */ + PFS_simple_index m_pos; + /** Next position. */ + PFS_simple_index m_next_pos; +}; + +/** @} */ +#endif diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt new file mode 100644 index 00000000000..01f3fbb8c98 --- /dev/null +++ b/storage/perfschema/unittest/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/include/mysql + ${CMAKE_SOURCE_DIR}/regex + ${CMAKE_SOURCE_DIR}/sql + ${CMAKE_SOURCE_DIR}/extra/yassl/include + ${CMAKE_SOURCE_DIR}/unittest/mytap + ${CMAKE_SOURCE_DIR}/storage/perfschema) + +ADD_DEFINITIONS(-DMYSQL_SERVER) + +LINK_LIBRARIES(perfschema mytap mysys dbug strings) + +ADD_EXECUTABLE(pfs_instr_class-t pfs_instr_class-t.cc) + +ADD_EXECUTABLE(pfs_instr_class-oom-t pfs_instr_class-oom-t.cc) + +ADD_EXECUTABLE(pfs_instr-t pfs_instr-t.cc) + +ADD_EXECUTABLE(pfs_instr-oom-t pfs_instr-oom-t.cc) + +ADD_EXECUTABLE(pfs_timer-t pfs_timer-t.cc) + +ADD_EXECUTABLE(pfs-t pfs-t.cc) + diff --git a/storage/perfschema/unittest/Makefile.am b/storage/perfschema/unittest/Makefile.am new file mode 100644 index 00000000000..7d82753c9e5 --- /dev/null +++ b/storage/perfschema/unittest/Makefile.am @@ -0,0 +1,58 @@ +# Copyright (C) 2008-2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +INCLUDES = -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/mysql \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/unittest/mytap \ + -I$(top_srcdir)/sql \ + -I$(top_srcdir)/storage/perfschema + +DEFS = -DMYSQL_SERVER @DEFS@ + +TEST_CODE = $(top_builddir)/unittest/mytap/libmytap.a + +$(TEST_CODE) : + (cd $(top_builddir)/unittest/mytap; $(MAKE)) + +PROD_CODE = $(top_builddir)/storage/perfschema/libperfschema.a \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/dbug/libdbug.a \ + $(top_builddir)/strings/libmystrings.a + +noinst_PROGRAMS = pfs_instr_class-t pfs_instr_class-oom-t \ + pfs_instr-t pfs_instr-oom-t pfs_timer-t pfs-t + +pfs_t_SOURCES = pfs-t.cc stub_print_error.h +pfs_t_LDADD = $(TEST_CODE) $(PROD_CODE) + +pfs_instr_class_t_SOURCES = pfs_instr_class-t.cc +pfs_instr_class_t_LDADD = $(TEST_CODE) $(PROD_CODE) + +pfs_instr_class_oom_t_SOURCES = pfs_instr_class-oom-t.cc stub_pfs_global.h +pfs_instr_class_oom_t_LDADD = $(TEST_CODE) $(PROD_CODE) + +pfs_instr_t_SOURCES = pfs_instr-t.cc +pfs_instr_t_LDADD = $(TEST_CODE) $(PROD_CODE) + +pfs_instr_oom_t_SOURCES = pfs_instr-oom-t.cc stub_pfs_global.h +pfs_instr_oom_t_LDADD = $(TEST_CODE) $(PROD_CODE) + +pfs_timer_t_SOURCES = pfs_timer-t.cc +pfs_timer_t_LDADD = $(TEST_CODE) $(PROD_CODE) + +EXTRA_DIST = conf.txt CMakeLists.txt + diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt new file mode 100644 index 00000000000..a3bee9c3be5 --- /dev/null +++ b/storage/perfschema/unittest/conf.txt @@ -0,0 +1,420 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Performance schema test configurations. +(Used internally for performance testing) + +Configuration PERFSCHEMA-COMPILED-OUT +===================================== + +Description +----------- + +Reference for timings, server built without the performance schema. + +Compiling options +----------------- + +./configure --without-perfschema + +Server start options +-------------------- + +N/A + +Configuration +------------- + +N/A + +Pre-test queries +---------------- + +select version(); + +This is just to make sure the build is not including the performance schema. + +Post-test queries +----------------- + +N/A + +Configuration PERFSCHEMA-DISABLED +================================= + +Description +----------- + +Server built with the performance schema, +but the performance schema is disabled at startup. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --disable-performance-schema + +Configuration +------------- + +N/A + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +N/A + +Configuration PERFSCHEMA-ENABLED-STANDBY +======================================== + +Description +----------- + +Server built with the performance schema. +The performance schema is enabled at startup, +but configured to not record anything. +This is a "stanby" configuration, in the sense that the DBA can add +dynamically more setup options later to get data. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --enable-performance-schema + +Configuration +------------- + +UPDATE performance_schema.SETUP_INSTRUMENTS + set enabled='NO', timed='NO'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='NO'; + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; + +Configuration PERFSCHEMA-ENABLED-CURRENT +======================================== + +Description +----------- + +Server built with the performance schema. +The performance schema is enabled at startup. +All instruments are enabled but not timed, +and only one consumer (EVENTS_WAITS_CURRENT) is set. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --enable-performance-schema + +Configuration +------------- + +UPDATE performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='NO'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='NO'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES' where name='EVENTS_WAITS_CURRENT'; + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; + +Configuration PERFSCHEMA-ENABLED-CURRENT-CYCLE +============================================== + +Description +----------- + +Server built with the performance schema. +The performance schema is enabled at startup. +All instruments are enabled and timed, +and only one consumer (EVENTS_WAITS_CURRENT) is set. +The timer used is CYCLE. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --enable-performance-schema + +Configuration +------------- + +UPDATE performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='YES'; + +UPDATE performance_schema.SETUP_TIMERS + set timer_name='CYCLE'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='NO'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES' where name='EVENTS_WAITS_CURRENT'; + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; + +Configuration PERFSCHEMA-ENABLED-HISTORY-CYCLE +============================================== + +Description +----------- + +Server built with the performance schema. +The performance schema is enabled at startup. +All instruments are enabled and timed, in CYCLE. +Two consumers (EVENTS_WAITS_CURRENT, EVENTS_WAITS_HISTORY) are set. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --enable-performance-schema + +Configuration +------------- + +UPDATE performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='YES'; + +UPDATE performance_schema.SETUP_TIMERS + set timer_name='CYCLE'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='NO'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES' where name='EVENTS_WAITS_CURRENT'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES' where name='EVENTS_WAITS_HISTORY'; + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; + +Configuration PERFSCHEMA-ENABLED-HISTORY_LONG-CYCLE +=================================================== + +Description +----------- + +Server built with the performance schema. +The performance schema is enabled at startup. +All instruments are enabled and timed, in CYCLE. +Two consumers (EVENTS_WAITS_CURRENT, EVENTS_WAITS_HISTORY_LONG) are set. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --enable-performance-schema + +Configuration +------------- + +UPDATE performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='YES'; + +UPDATE performance_schema.SETUP_TIMERS + set timer_name='CYCLE'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='NO'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES' where name='EVENTS_WAITS_CURRENT'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES' where name='EVENTS_WAITS_HISTORY_LONG'; + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; + +Configuration PERFSCHEMA-ENABLED-BIGBANG-CYCLE +============================================== + +Description +----------- + +Server built with the performance schema. +The performance schema is enabled at startup. +All instruments are enabled and timed, in CYCLE. +All possible consumers are enabled. + +Compiling options +----------------- + +./configure --with-perfschema + +Server start options +-------------------- + +./mysqld --enable-performance-schema + +Configuration +------------- + +UPDATE performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='YES'; + +UPDATE performance_schema.SETUP_TIMERS + set timer_name='CYCLE'; + +UPDATE performance_schema.SETUP_CONSUMERS + set enabled='YES'; + +Pre-test queries +---------------- + +select version(); +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_TIMERS; + +Post-test queries +----------------- + +show engine performance_schema status; +show variables like "performance%"; +show status like "performance%"; + diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc new file mode 100644 index 00000000000..fcbaf4aeb8f --- /dev/null +++ b/storage/perfschema/unittest/pfs-t.cc @@ -0,0 +1,1201 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql_priv.h> +#include <pfs_server.h> +#include <pfs_instr_class.h> +#include <pfs_instr.h> +#include <pfs_global.h> +#include <tap.h> + +#include "stub_print_error.h" + +/* test helpers, to simulate the setup */ + +void setup_thread(PSI_thread *t, bool enabled) +{ + PFS_thread *t2= (PFS_thread*) t; + t2->m_enabled= enabled; +} + +/* test helpers, to inspect data */ + +PFS_file* lookup_file_by_name(const char* name) +{ + uint i; + PFS_file *pfs; + uint len= strlen(name); + + for (i= 0; i < file_max; i++) + { + pfs= & file_array[i]; + if (pfs->m_lock.is_populated()) + { + if ((len == pfs->m_filename_length) && + (strncmp(name, pfs->m_filename, pfs->m_filename_length) == 0)) + return pfs; + } + } + + return NULL; +} + +/* tests */ + +void test_bootstrap() +{ + void *psi; + void *psi_2; + PSI_bootstrap *boot; + PFS_global_param param; + + diag("test_bootstrap"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + boot= initialize_performance_schema(& param); + ok(boot != NULL, "boot"); + ok(boot->get_interface != NULL, "boot->get_interface"); + + psi= boot->get_interface(0); + ok(psi == NULL, "no version 0"); + + psi= boot->get_interface(PSI_VERSION_1); + ok(psi != NULL, "version 1"); + + psi_2= boot->get_interface(PSI_VERSION_2); + ok(psi_2 == NULL, "version 2"); + + shutdown_performance_schema(); +} + +/* + Not a test, helper for testing pfs.cc +*/ +PSI * load_perfschema() +{ + void *psi; + PSI_bootstrap *boot; + PFS_global_param param; + + param.m_enabled= true; + param.m_mutex_class_sizing= 10; + param.m_rwlock_class_sizing= 10; + param.m_cond_class_sizing= 10; + param.m_thread_class_sizing= 10; + param.m_table_share_sizing= 10; + param.m_file_class_sizing= 10; + param.m_mutex_sizing= 10; + param.m_rwlock_sizing= 10; + param.m_cond_sizing= 10; + param.m_thread_sizing= 10; + param.m_table_sizing= 10; + param.m_file_sizing= 10; + param.m_file_handle_sizing= 50; + param.m_events_waits_history_sizing= 10; + param.m_events_waits_history_long_sizing= 10; + + /* test_bootstrap() covered this, assuming it just works */ + boot= initialize_performance_schema(& param); + psi= boot->get_interface(PSI_VERSION_1); + + return (PSI*) psi; +} + +void test_bad_registration() +{ + PSI *psi; + + diag("test_bad_registration"); + + psi= load_perfschema(); + + /* + Test that length('wait/synch/mutex/' (17) + category + '/' (1)) < 32 + --> category can be up to 13 chars for a mutex. + */ + + PSI_mutex_key dummy_mutex_key= 9999; + PSI_mutex_info bad_mutex_1[]= + { + { & dummy_mutex_key, "X", 0} + }; + + psi->register_mutex("/", bad_mutex_1, 1); + ok(dummy_mutex_key == 0, "zero key"); + dummy_mutex_key= 9999; + psi->register_mutex("a/", bad_mutex_1, 1); + ok(dummy_mutex_key == 0, "zero key"); + dummy_mutex_key= 9999; + psi->register_mutex("/b", bad_mutex_1, 1); + ok(dummy_mutex_key == 0, "zero key"); + dummy_mutex_key= 9999; + psi->register_mutex("a/b", bad_mutex_1, 1); + ok(dummy_mutex_key == 0, "zero key"); + dummy_mutex_key= 9999; + psi->register_mutex("12345678901234", bad_mutex_1, 1); + ok(dummy_mutex_key == 0, "zero key"); + dummy_mutex_key= 9999; + psi->register_mutex("1234567890123", bad_mutex_1, 1); + ok(dummy_mutex_key == 1, "assigned key"); + + /* + Test that length('wait/synch/mutex/' (17) + category + '/' (1) + name) <= 128 + --> category + name can be up to 110 chars for a mutex. + */ + + dummy_mutex_key= 9999; + PSI_mutex_info bad_mutex_2[]= + { + { & dummy_mutex_key, + /* 110 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "1234567890", + 0} + }; + + psi->register_mutex("X", bad_mutex_2, 1); + ok(dummy_mutex_key == 0, "zero key"); + + dummy_mutex_key= 9999; + PSI_mutex_info bad_mutex_3[]= + { + { & dummy_mutex_key, + /* 109 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "123456789", + 0} + }; + + psi->register_mutex("XX", bad_mutex_3, 1); + ok(dummy_mutex_key == 0, "zero key"); + + psi->register_mutex("X", bad_mutex_3, 1); + ok(dummy_mutex_key == 2, "assigned key"); + + /* + Test that length('wait/synch/rwlock/' (18) + category + '/' (1)) < 32 + --> category can be up to 12 chars for a rwlock. + */ + + PSI_rwlock_key dummy_rwlock_key= 9999; + PSI_rwlock_info bad_rwlock_1[]= + { + { & dummy_rwlock_key, "X", 0} + }; + + psi->register_rwlock("/", bad_rwlock_1, 1); + ok(dummy_rwlock_key == 0, "zero key"); + dummy_rwlock_key= 9999; + psi->register_rwlock("a/", bad_rwlock_1, 1); + ok(dummy_rwlock_key == 0, "zero key"); + dummy_rwlock_key= 9999; + psi->register_rwlock("/b", bad_rwlock_1, 1); + ok(dummy_rwlock_key == 0, "zero key"); + dummy_rwlock_key= 9999; + psi->register_rwlock("a/b", bad_rwlock_1, 1); + ok(dummy_rwlock_key == 0, "zero key"); + dummy_rwlock_key= 9999; + psi->register_rwlock("1234567890123", bad_rwlock_1, 1); + ok(dummy_rwlock_key == 0, "zero key"); + dummy_rwlock_key= 9999; + psi->register_rwlock("123456789012", bad_rwlock_1, 1); + ok(dummy_rwlock_key == 1, "assigned key"); + + /* + Test that length('wait/synch/rwlock/' (18) + category + '/' (1) + name) <= 128 + --> category + name can be up to 109 chars for a rwlock. + */ + + dummy_rwlock_key= 9999; + PSI_rwlock_info bad_rwlock_2[]= + { + { & dummy_rwlock_key, + /* 109 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "123456789", + 0} + }; + + psi->register_rwlock("X", bad_rwlock_2, 1); + ok(dummy_rwlock_key == 0, "zero key"); + + dummy_rwlock_key= 9999; + PSI_rwlock_info bad_rwlock_3[]= + { + { & dummy_rwlock_key, + /* 108 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678", + 0} + }; + + psi->register_rwlock("XX", bad_rwlock_3, 1); + ok(dummy_rwlock_key == 0, "zero key"); + + psi->register_rwlock("X", bad_rwlock_3, 1); + ok(dummy_rwlock_key == 2, "assigned key"); + + /* + Test that length('wait/synch/cond/' (16) + category + '/' (1)) < 32 + --> category can be up to 14 chars for a cond. + */ + + PSI_cond_key dummy_cond_key= 9999; + PSI_cond_info bad_cond_1[]= + { + { & dummy_cond_key, "X", 0} + }; + + psi->register_cond("/", bad_cond_1, 1); + ok(dummy_cond_key == 0, "zero key"); + dummy_cond_key= 9999; + psi->register_cond("a/", bad_cond_1, 1); + ok(dummy_cond_key == 0, "zero key"); + dummy_cond_key= 9999; + psi->register_cond("/b", bad_cond_1, 1); + ok(dummy_cond_key == 0, "zero key"); + dummy_cond_key= 9999; + psi->register_cond("a/b", bad_cond_1, 1); + ok(dummy_cond_key == 0, "zero key"); + dummy_cond_key= 9999; + psi->register_cond("123456789012345", bad_cond_1, 1); + ok(dummy_cond_key == 0, "zero key"); + dummy_cond_key= 9999; + psi->register_cond("12345678901234", bad_cond_1, 1); + ok(dummy_cond_key == 1, "assigned key"); + + /* + Test that length('wait/synch/cond/' (16) + category + '/' (1) + name) <= 128 + --> category + name can be up to 111 chars for a cond. + */ + + dummy_cond_key= 9999; + PSI_cond_info bad_cond_2[]= + { + { & dummy_cond_key, + /* 111 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901", + 0} + }; + + psi->register_cond("X", bad_cond_2, 1); + ok(dummy_cond_key == 0, "zero key"); + + dummy_cond_key= 9999; + PSI_cond_info bad_cond_3[]= + { + { & dummy_cond_key, + /* 110 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "1234567890", + 0} + }; + + psi->register_cond("XX", bad_cond_3, 1); + ok(dummy_cond_key == 0, "zero key"); + + psi->register_cond("X", bad_cond_3, 1); + ok(dummy_cond_key == 2, "assigned key"); + + /* + Test that length('thread/' (7) + category + '/' (1)) < 32 + --> category can be up to 23 chars for a thread. + */ + + PSI_thread_key dummy_thread_key= 9999; + PSI_thread_info bad_thread_1[]= + { + { & dummy_thread_key, "X", 0} + }; + + psi->register_thread("/", bad_thread_1, 1); + ok(dummy_thread_key == 0, "zero key"); + dummy_thread_key= 9999; + psi->register_thread("a/", bad_thread_1, 1); + ok(dummy_thread_key == 0, "zero key"); + dummy_thread_key= 9999; + psi->register_thread("/b", bad_thread_1, 1); + ok(dummy_thread_key == 0, "zero key"); + dummy_thread_key= 9999; + psi->register_thread("a/b", bad_thread_1, 1); + ok(dummy_thread_key == 0, "zero key"); + dummy_thread_key= 9999; + psi->register_thread("123456789012345678901234", bad_thread_1, 1); + ok(dummy_thread_key == 0, "zero key"); + dummy_thread_key= 9999; + psi->register_thread("12345678901234567890123", bad_thread_1, 1); + ok(dummy_thread_key == 1, "assigned key"); + + /* + Test that length('thread/' (7) + category + '/' (1) + name) <= 128 + --> category + name can be up to 120 chars for a thread. + */ + + dummy_thread_key= 9999; + PSI_thread_info bad_thread_2[]= + { + { & dummy_thread_key, + /* 120 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234567890", + 0} + }; + + psi->register_thread("X", bad_thread_2, 1); + ok(dummy_thread_key == 0, "zero key"); + + dummy_thread_key= 9999; + PSI_thread_info bad_thread_3[]= + { + { & dummy_thread_key, + /* 119 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "1234567890123456789", + 0} + }; + + psi->register_thread("XX", bad_thread_3, 1); + ok(dummy_thread_key == 0, "zero key"); + + psi->register_thread("X", bad_thread_3, 1); + ok(dummy_thread_key == 2, "assigned key"); + + /* + Test that length('wait/io/file/' (13) + category + '/' (1)) < 32 + --> category can be up to 17 chars for a file. + */ + + PSI_file_key dummy_file_key= 9999; + PSI_file_info bad_file_1[]= + { + { & dummy_file_key, "X", 0} + }; + + psi->register_file("/", bad_file_1, 1); + ok(dummy_file_key == 0, "zero key"); + dummy_file_key= 9999; + psi->register_file("a/", bad_file_1, 1); + ok(dummy_file_key == 0, "zero key"); + dummy_file_key= 9999; + psi->register_file("/b", bad_file_1, 1); + ok(dummy_file_key == 0, "zero key"); + dummy_file_key= 9999; + psi->register_file("a/b", bad_file_1, 1); + ok(dummy_file_key == 0, "zero key"); + dummy_file_key= 9999; + psi->register_file("123456789012345678", bad_file_1, 1); + ok(dummy_file_key == 0, "zero key"); + dummy_file_key= 9999; + psi->register_file("12345678901234567", bad_file_1, 1); + ok(dummy_file_key == 1, "assigned key"); + + /* + Test that length('wait/io/file/' (13) + category + '/' (1) + name) <= 128 + --> category + name can be up to 114 chars for a file. + */ + + dummy_file_key= 9999; + PSI_file_info bad_file_2[]= + { + { & dummy_file_key, + /* 114 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "12345678901234", + 0} + }; + + psi->register_file("X", bad_file_2, 1); + ok(dummy_file_key == 0, "zero key"); + + dummy_file_key= 9999; + PSI_file_info bad_file_3[]= + { + { & dummy_file_key, + /* 113 chars name */ + "12345678901234567890123456789012345678901234567890" + "12345678901234567890123456789012345678901234567890" + "1234567890123", + 0} + }; + + psi->register_file("XX", bad_file_3, 1); + ok(dummy_file_key == 0, "zero key"); + + psi->register_file("X", bad_file_3, 1); + ok(dummy_file_key == 2, "assigned key"); + + shutdown_performance_schema(); +} + +void test_init_disabled() +{ + PSI *psi; + + diag("test_init_disabled"); + + psi= load_perfschema(); + + PSI_mutex_key mutex_key_A; + PSI_mutex_info all_mutex[]= + { + { & mutex_key_A, "M-A", 0} + }; + + PSI_rwlock_key rwlock_key_A; + PSI_rwlock_info all_rwlock[]= + { + { & rwlock_key_A, "RW-A", 0} + }; + + PSI_cond_key cond_key_A; + PSI_cond_info all_cond[]= + { + { & cond_key_A, "C-A", 0} + }; + + PSI_file_key file_key_A; + PSI_file_info all_file[]= + { + { & file_key_A, "F-A", 0} + }; + + PSI_thread_key thread_key_1; + PSI_thread_info all_thread[]= + { + { & thread_key_1, "T-1", 0} + }; + + psi->register_mutex("test", all_mutex, 1); + psi->register_rwlock("test", all_rwlock, 1); + psi->register_cond("test", all_cond, 1); + psi->register_file("test", all_file, 1); + psi->register_thread("test", all_thread, 1); + + PFS_mutex_class *mutex_class_A; + PFS_rwlock_class *rwlock_class_A; + PFS_cond_class *cond_class_A; + PFS_file_class *file_class_A; + PSI_mutex *mutex_A1; + PSI_rwlock *rwlock_A1; + PSI_cond *cond_A1; + PFS_file *file_A1; + PSI_thread *thread_1; + + /* Preparation */ + + thread_1= psi->new_thread(thread_key_1, NULL, 0); + ok(thread_1 != NULL, "T-1"); + psi->set_thread_id(thread_1, 1); + + mutex_class_A= find_mutex_class(mutex_key_A); + ok(mutex_class_A != NULL, "mutex class A"); + + rwlock_class_A= find_rwlock_class(rwlock_key_A); + ok(rwlock_class_A != NULL, "rwlock class A"); + + cond_class_A= find_cond_class(cond_key_A); + ok(cond_class_A != NULL, "cond class A"); + + file_class_A= find_file_class(file_key_A); + ok(file_class_A != NULL, "file class A"); + + /* Pretend thread T-1 is running, and disabled */ + /* ------------------------------------------- */ + + psi->set_thread(thread_1); + setup_thread(thread_1, false); + + /* disabled M-A + disabled T-1: no instrumentation */ + + mutex_class_A->m_enabled= false; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* enabled M-A + disabled T-1: no instrumentation */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* broken key + disabled T-1: no instrumentation */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(0, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + mutex_A1= psi->init_mutex(99, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* disabled RW-A + disabled T-1: no instrumentation */ + + rwlock_class_A->m_enabled= false; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* enabled RW-A + disabled T-1: no instrumentation */ + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* broken key + disabled T-1: no instrumentation */ + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(0, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + rwlock_A1= psi->init_rwlock(99, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* disabled C-A + disabled T-1: no instrumentation */ + + cond_class_A->m_enabled= false; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* enabled C-A + disabled T-1: no instrumentation */ + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* broken key + disabled T-1: no instrumentation */ + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(0, NULL); + ok(cond_A1 == NULL, "not instrumented"); + cond_A1= psi->init_cond(99, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* disabled F-A + disabled T-1: no instrumentation */ + + file_class_A->m_enabled= false; + psi->create_file(file_key_A, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* enabled F-A + disabled T-1: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(file_key_A, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* broken key + disabled T-1: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(0, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + psi->create_file(99, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* Pretend thread T-1 is enabled */ + /* ----------------------------- */ + + setup_thread(thread_1, true); + + /* disabled M-A + enabled T-1: no instrumentation */ + + mutex_class_A->m_enabled= false; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* enabled M-A + enabled T-1: instrumentation */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 != NULL, "instrumented"); + psi->destroy_mutex(mutex_A1); + + /* broken key + enabled T-1: no instrumentation */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(0, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + mutex_A1= psi->init_mutex(99, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* disabled RW-A + enabled T-1: no instrumentation */ + + rwlock_class_A->m_enabled= false; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* enabled RW-A + enabled T-1: instrumentation */ + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 != NULL, "instrumented"); + psi->destroy_rwlock(rwlock_A1); + + /* broken key + enabled T-1: no instrumentation */ + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(0, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + rwlock_A1= psi->init_rwlock(99, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* disabled C-A + enabled T-1: no instrumentation */ + + cond_class_A->m_enabled= false; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* enabled C-A + enabled T-1: instrumentation */ + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 != NULL, "instrumented"); + psi->destroy_cond(cond_A1); + + /* broken key + enabled T-1: no instrumentation */ + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(0, NULL); + ok(cond_A1 == NULL, "not instrumented"); + cond_A1= psi->init_cond(99, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* disabled F-A + enabled T-1: no instrumentation */ + + file_class_A->m_enabled= false; + psi->create_file(file_key_A, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* enabled F-A + open failed + enabled T-1: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(file_key_A, "foo", (File) -1); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* enabled F-A + out-of-descriptors + enabled T-1: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(file_key_A, "foo", (File) 65000); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + ok(file_handle_lost == 1, "lost a file handle"); + file_handle_lost= 0; + + /* enabled F-A + enabled T-1: instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(file_key_A, "foo-instrumented", (File) 12); + file_A1= lookup_file_by_name("foo-instrumented"); + ok(file_A1 != NULL, "instrumented"); + + /* broken key + enabled T-1: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(0, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + psi->create_file(99, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* Pretend the running thread is not instrumented */ + /* ---------------------------------------------- */ + + psi->delete_current_thread(); + + /* disabled M-A + unknown thread: no instrumentation */ + + mutex_class_A->m_enabled= false; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* enabled M-A + unknown thread: no instrumentation */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* broken key + unknown thread: no instrumentation */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(0, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + mutex_A1= psi->init_mutex(99, NULL); + ok(mutex_A1 == NULL, "not instrumented"); + + /* disabled RW-A + unknown thread: no instrumentation */ + + rwlock_class_A->m_enabled= false; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* enabled RW-A + unknown thread: no instrumentation */ + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* broken key + unknown thread: no instrumentation */ + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(0, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + rwlock_A1= psi->init_rwlock(99, NULL); + ok(rwlock_A1 == NULL, "not instrumented"); + + /* disabled C-A + unknown thread: no instrumentation */ + + cond_class_A->m_enabled= false; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* enabled C-A + unknown thread: no instrumentation */ + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* broken key + unknown thread: no instrumentation */ + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(0, NULL); + ok(cond_A1 == NULL, "not instrumented"); + cond_A1= psi->init_cond(99, NULL); + ok(cond_A1 == NULL, "not instrumented"); + + /* disabled F-A + unknown thread: no instrumentation */ + + file_class_A->m_enabled= false; + psi->create_file(file_key_A, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* enabled F-A + unknown thread: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(file_key_A, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + /* broken key + unknown thread: no instrumentation */ + + file_class_A->m_enabled= true; + psi->create_file(0, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + psi->create_file(99, "foo", (File) 12); + file_A1= lookup_file_by_name("foo"); + ok(file_A1 == NULL, "not instrumented"); + + shutdown_performance_schema(); +} + +void test_locker_disabled() +{ + PSI *psi; + + diag("test_locker_disabled"); + + psi= load_perfschema(); + + PSI_mutex_key mutex_key_A; + PSI_mutex_info all_mutex[]= + { + { & mutex_key_A, "M-A", 0} + }; + + PSI_rwlock_key rwlock_key_A; + PSI_rwlock_info all_rwlock[]= + { + { & rwlock_key_A, "RW-A", 0} + }; + + PSI_cond_key cond_key_A; + PSI_cond_info all_cond[]= + { + { & cond_key_A, "C-A", 0} + }; + + PSI_file_key file_key_A; + PSI_file_info all_file[]= + { + { & file_key_A, "F-A", 0} + }; + + PSI_thread_key thread_key_1; + PSI_thread_info all_thread[]= + { + { & thread_key_1, "T-1", 0} + }; + + psi->register_mutex("test", all_mutex, 1); + psi->register_rwlock("test", all_rwlock, 1); + psi->register_cond("test", all_cond, 1); + psi->register_file("test", all_file, 1); + psi->register_thread("test", all_thread, 1); + + PFS_mutex_class *mutex_class_A; + PFS_rwlock_class *rwlock_class_A; + PFS_cond_class *cond_class_A; + PFS_file_class *file_class_A; + PSI_mutex *mutex_A1; + PSI_rwlock *rwlock_A1; + PSI_cond *cond_A1; + PSI_file *file_A1; + PSI_thread *thread_1; + + /* Preparation */ + + thread_1= psi->new_thread(thread_key_1, NULL, 0); + ok(thread_1 != NULL, "T-1"); + psi->set_thread_id(thread_1, 1); + + mutex_class_A= find_mutex_class(mutex_key_A); + ok(mutex_class_A != NULL, "mutex info A"); + + rwlock_class_A= find_rwlock_class(rwlock_key_A); + ok(rwlock_class_A != NULL, "rwlock info A"); + + cond_class_A= find_cond_class(cond_key_A); + ok(cond_class_A != NULL, "cond info A"); + + file_class_A= find_file_class(file_key_A); + ok(file_class_A != NULL, "file info A"); + + /* Pretend thread T-1 is running, and enabled */ + /* ------------------------------------------ */ + + psi->set_thread(thread_1); + setup_thread(thread_1, true); + + /* Enable all instruments, instantiate objects */ + + mutex_class_A->m_enabled= true; + mutex_A1= psi->init_mutex(mutex_key_A, NULL); + ok(mutex_A1 != NULL, "instrumented"); + + rwlock_class_A->m_enabled= true; + rwlock_A1= psi->init_rwlock(rwlock_key_A, NULL); + ok(rwlock_A1 != NULL, "instrumented"); + + cond_class_A->m_enabled= true; + cond_A1= psi->init_cond(cond_key_A, NULL); + ok(cond_A1 != NULL, "instrumented"); + + file_class_A->m_enabled= true; + psi->create_file(file_key_A, "foo", (File) 12); + file_A1= (PSI_file*) lookup_file_by_name("foo"); + ok(file_A1 != NULL, "instrumented"); + + PSI_mutex_locker *mutex_locker; + PSI_rwlock_locker *rwlock_locker; + PSI_cond_locker *cond_locker; + PSI_file_locker *file_locker; + + /* Pretend thread T-1 is disabled */ + /* ------------------------------ */ + + setup_thread(thread_1, false); + flag_events_waits_current= true; + mutex_class_A->m_enabled= true; + rwlock_class_A->m_enabled= true; + cond_class_A->m_enabled= true; + file_class_A->m_enabled= true; + + mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + ok(mutex_locker == NULL, "no locker"); + rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + ok(rwlock_locker == NULL, "no locker"); + cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + ok(cond_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + + /* Pretend the consumer is disabled */ + /* -------------------------------- */ + + setup_thread(thread_1, true); + flag_events_waits_current= false; + mutex_class_A->m_enabled= true; + rwlock_class_A->m_enabled= true; + cond_class_A->m_enabled= true; + file_class_A->m_enabled= true; + + mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + ok(mutex_locker == NULL, "no locker"); + rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + ok(rwlock_locker == NULL, "no locker"); + cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + ok(cond_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + + /* Pretend the instrument is disabled */ + /* ---------------------------------- */ + + setup_thread(thread_1, true); + flag_events_waits_current= true; + mutex_class_A->m_enabled= false; + rwlock_class_A->m_enabled= false; + cond_class_A->m_enabled= false; + file_class_A->m_enabled= false; + + mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + ok(mutex_locker == NULL, "no locker"); + rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + ok(rwlock_locker == NULL, "no locker"); + cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + ok(cond_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + + /* Pretend everything is enabled */ + /* ----------------------------- */ + + setup_thread(thread_1, true); + flag_events_waits_current= true; + mutex_class_A->m_enabled= true; + rwlock_class_A->m_enabled= true; + cond_class_A->m_enabled= true; + file_class_A->m_enabled= true; + + mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + ok(mutex_locker != NULL, "locker"); + psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__); + psi->end_mutex_wait(mutex_locker, 0); + rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + ok(rwlock_locker != NULL, "locker"); + psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__); + psi->end_rwlock_rdwait(rwlock_locker, 0); + cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + ok(cond_locker != NULL, "locker"); + psi->start_cond_wait(cond_locker, __FILE__, __LINE__); + psi->end_cond_wait(cond_locker, 0); + file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + ok(file_locker != NULL, "locker"); + psi->start_file_open_wait(file_locker, __FILE__, __LINE__); + psi->end_file_open_wait(file_locker); + file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + ok(file_locker != NULL, "locker"); + psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); + psi->end_file_wait(file_locker, 10); + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + ok(file_locker != NULL, "locker"); + psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); + psi->end_file_wait(file_locker, 10); + + /* Pretend the running thread is not instrumented */ + /* ---------------------------------------------- */ + + psi->delete_current_thread(); + flag_events_waits_current= true; + mutex_class_A->m_enabled= true; + rwlock_class_A->m_enabled= true; + cond_class_A->m_enabled= true; + file_class_A->m_enabled= true; + + mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + ok(mutex_locker == NULL, "no locker"); + rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + ok(rwlock_locker == NULL, "no locker"); + cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + ok(cond_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + ok(file_locker == NULL, "no locker"); + + shutdown_performance_schema(); +} + +void test_file_instrumentation_leak() +{ + PSI *psi; + + diag("test_file_instrumentation_leak"); + + psi= load_perfschema(); + + PSI_file_key file_key_A; + PSI_file_key file_key_B; + PSI_file_info all_file[]= + { + { & file_key_A, "F-A", 0}, + { & file_key_B, "F-B", 0} + }; + + PSI_thread_key thread_key_1; + PSI_thread_info all_thread[]= + { + { & thread_key_1, "T-1", 0} + }; + + psi->register_file("test", all_file, 2); + psi->register_thread("test", all_thread, 1); + + PFS_file_class *file_class_A; + PFS_file_class *file_class_B; + PSI_thread *thread_1; + + /* Preparation */ + + thread_1= psi->new_thread(thread_key_1, NULL, 0); + ok(thread_1 != NULL, "T-1"); + psi->set_thread_id(thread_1, 1); + + file_class_A= find_file_class(file_key_A); + ok(file_class_A != NULL, "file info A"); + + file_class_B= find_file_class(file_key_B); + ok(file_class_B != NULL, "file info B"); + + psi->set_thread(thread_1); + + /* Pretend everything is enabled */ + /* ----------------------------- */ + + setup_thread(thread_1, true); + flag_events_waits_current= true; + file_class_A->m_enabled= true; + file_class_B->m_enabled= true; + + PSI_file_locker *file_locker; + + /* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */ + + file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL); + ok(file_locker != NULL, "locker"); + psi->start_file_open_wait(file_locker, __FILE__, __LINE__); + psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12); + + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + ok(file_locker != NULL, "locker"); + psi->start_file_wait(file_locker, 100, __FILE__, __LINE__); + psi->end_file_wait(file_locker, 100); + + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE); + ok(file_locker != NULL, "locker"); + psi->start_file_wait(file_locker, 0, __FILE__, __LINE__); + psi->end_file_wait(file_locker, 0); + + /* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */ + + file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE); + ok(file_locker == NULL, "no locker, since the open was not instrumented"); + + /* + Simulate uninstrumented-OPEN + WRITE on descriptor 12 : + the instrumentation should not leak (don't charge the file io on unknown B to "AAA") + */ + + file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE); + ok(file_locker == NULL, "no locker, no leak"); + + shutdown_performance_schema(); +} + +void test_enabled() +{ +#ifdef LATER + PSI *psi; + + diag("test_enabled"); + + psi= load_perfschema(); + + PSI_mutex_key mutex_key_A; + PSI_mutex_key mutex_key_B; + PSI_mutex_info all_mutex[]= + { + { & mutex_key_A, "M-A", 0}, + { & mutex_key_B, "M-B", 0} + }; + + PSI_rwlock_key rwlock_key_A; + PSI_rwlock_key rwlock_key_B; + PSI_rwlock_info all_rwlock[]= + { + { & rwlock_key_A, "RW-A", 0}, + { & rwlock_key_B, "RW-B", 0} + }; + + PSI_cond_key cond_key_A; + PSI_cond_key cond_key_B; + PSI_cond_info all_cond[]= + { + { & cond_key_A, "C-A", 0}, + { & cond_key_B, "C-B", 0} + }; + + shutdown_performance_schema(); +#endif +} + +void do_all_tests() +{ + test_bootstrap(); + test_bad_registration(); + test_init_disabled(); + test_locker_disabled(); + test_file_instrumentation_leak(); +} + +int main(int, char **) +{ + plan(153); + MY_INIT("pfs-t"); + do_all_tests(); + return 0; +} + diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc new file mode 100644 index 00000000000..d7810eedb04 --- /dev/null +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -0,0 +1,210 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql_priv.h> +#include <pfs_instr.h> +#include <pfs_stat.h> +#include <pfs_global.h> +#include <tap.h> + +#include "stub_pfs_global.h" + +void test_oom() +{ + int rc; + PFS_global_param param; + + stub_alloc_always_fails= true; + + param.m_enabled= true; + param.m_mutex_class_sizing= 10; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 1000; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 1, "oom (mutex)"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 10; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 1000; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 1, "oom (rwlock)"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 10; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 1000; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 1, "oom (cond)"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 10; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 1000; + param.m_file_handle_sizing= 1000; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 1, "oom (file)"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 10; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 1000; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 1, "oom (table)"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 10; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 1000; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 1, "oom (thread)"); + + stub_alloc_always_fails= false; + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 10; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 1000; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 10; + param.m_events_waits_history_long_sizing= 0; + + stub_alloc_fails_after_count= 2; + rc= init_instruments(& param); + ok(rc == 1, "oom (thread history sizing)"); + + param.m_enabled= true; + param.m_mutex_class_sizing= 50; + param.m_rwlock_class_sizing= 50; + param.m_cond_class_sizing= 50; + param.m_thread_class_sizing= 10; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 50; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 1000; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + stub_alloc_fails_after_count= 2; + rc= init_instruments(& param); + ok(rc == 1, "oom (per thread wait)"); + + cleanup_instruments(); +} + +void do_all_tests() +{ + test_oom(); +} + +int main(int, char **) +{ + plan(8); + MY_INIT("pfs_instr-oom-t"); + do_all_tests(); + return 0; +} + diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc new file mode 100644 index 00000000000..f85de601579 --- /dev/null +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -0,0 +1,411 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql_priv.h> +#include <pfs_instr.h> +#include <pfs_stat.h> +#include <pfs_global.h> +#include <tap.h> + +void test_no_instruments() +{ + int rc; + PFS_global_param param; + + param.m_enabled= true; + param.m_mutex_class_sizing= 0; + param.m_rwlock_class_sizing= 0; + param.m_cond_class_sizing= 0; + param.m_thread_class_sizing= 0; + param.m_table_share_sizing= 0; + param.m_file_class_sizing= 0; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 0, "zero init"); + + cleanup_instruments(); +} + +void test_no_instances() +{ + int rc; + PFS_mutex_class dummy_mutex_class; + PFS_rwlock_class dummy_rwlock_class; + PFS_cond_class dummy_cond_class; + PFS_thread_class dummy_thread_class; + PFS_file_class dummy_file_class; + PFS_table_share dummy_table_share; + PFS_mutex *mutex; + PFS_rwlock *rwlock; + PFS_cond *cond; + PFS_thread *thread; + PFS_file *file; + PFS_table *table; + PFS_global_param param; + + param.m_enabled= true; + param.m_mutex_class_sizing= 1; + param.m_rwlock_class_sizing= 1; + param.m_cond_class_sizing= 1; + param.m_thread_class_sizing= 1; + param.m_table_share_sizing= 1; + param.m_file_class_sizing= 1; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 0; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 0; + param.m_events_waits_history_long_sizing= 0; + + rc= init_instruments(& param); + ok(rc == 0, "no instances init"); + + mutex= create_mutex(& dummy_mutex_class, NULL); + ok(mutex == NULL, "no mutex"); + ok(mutex_lost == 1, "lost 1"); + mutex= create_mutex(& dummy_mutex_class, NULL); + ok(mutex == NULL, "no mutex"); + ok(mutex_lost == 2, "lost 2"); + + rwlock= create_rwlock(& dummy_rwlock_class, NULL); + ok(rwlock == NULL, "no rwlock"); + ok(rwlock_lost == 1, "lost 1"); + rwlock= create_rwlock(& dummy_rwlock_class, NULL); + ok(rwlock == NULL, "no rwlock"); + ok(rwlock_lost == 2, "lost 2"); + + cond= create_cond(& dummy_cond_class, NULL); + ok(cond == NULL, "no cond"); + ok(cond_lost == 1, "lost 1"); + cond= create_cond(& dummy_cond_class, NULL); + ok(cond == NULL, "no cond"); + ok(cond_lost == 2, "lost 2"); + + thread= create_thread(& dummy_thread_class, NULL, 0); + ok(thread == NULL, "no thread"); + ok(thread_lost == 1, "lost 1"); + thread= create_thread(& dummy_thread_class, NULL, 0); + ok(thread == NULL, "no thread"); + ok(thread_lost == 2, "lost 2"); + + PFS_thread fake_thread; + fake_thread.m_filename_hash_pins= NULL; + + file= find_or_create_file(& fake_thread, & dummy_file_class, "dummy", 5); + ok(file == NULL, "no file"); + ok(file_lost == 1, "lost 1"); + file= find_or_create_file(& fake_thread, & dummy_file_class, "dummy", 5); + ok(file == NULL, "no file"); + ok(file_lost == 2, "lost 2"); + + init_file_hash(); + + file= find_or_create_file(& fake_thread, & dummy_file_class, "dummy", 5); + ok(file == NULL, "no file"); + ok(file_lost == 3, "lost 3"); + file= find_or_create_file(& fake_thread, & dummy_file_class, "dummy", 5); + ok(file == NULL, "no file"); + ok(file_lost == 4, "lost 4"); + + char long_file_name[10000]; + int size= sizeof(long_file_name); + memset(long_file_name, 'X', size); + + file= find_or_create_file(& fake_thread, & dummy_file_class, long_file_name, size); + ok(file == NULL, "no file"); + ok(file_lost == 5, "lost 5"); + + table= create_table(& dummy_table_share, NULL); + ok(table == NULL, "no table"); + ok(table_lost == 1, "lost 1"); + table= create_table(& dummy_table_share, NULL); + ok(table == NULL, "no table"); + ok(table_lost == 2, "lost 2"); + + /* No result to test, just make sure it does not crash */ + reset_events_waits_by_instance(); + reset_per_thread_wait_stat(); + + cleanup_file_hash(); + cleanup_instruments(); +} + +void test_with_instances() +{ + int rc; + PFS_mutex_class dummy_mutex_class; + PFS_rwlock_class dummy_rwlock_class; + PFS_cond_class dummy_cond_class; + PFS_thread_class dummy_thread_class; + PFS_file_class dummy_file_class; + PFS_table_share dummy_table_share; + PFS_mutex *mutex_1; + PFS_mutex *mutex_2; + PFS_rwlock *rwlock_1; + PFS_rwlock *rwlock_2; + PFS_cond *cond_1; + PFS_cond *cond_2; + PFS_thread *thread_1; + PFS_thread *thread_2; + PFS_file *file_1; + PFS_file *file_2; + PFS_table *table_1; + PFS_table *table_2; + PFS_global_param param; + + param.m_enabled= true; + param.m_mutex_class_sizing= 1; + param.m_rwlock_class_sizing= 1; + param.m_cond_class_sizing= 1; + param.m_thread_class_sizing= 1; + param.m_table_share_sizing= 1; + param.m_file_class_sizing= 1; + param.m_mutex_sizing= 2; + param.m_rwlock_sizing= 2; + param.m_cond_sizing= 2; + param.m_thread_sizing= 2; + param.m_table_sizing= 2; + param.m_file_sizing= 2; + param.m_file_handle_sizing= 100; + param.m_events_waits_history_sizing= 10; + param.m_events_waits_history_long_sizing= 10000; + + rc= init_instruments(& param); + ok(rc == 0, "instances init"); + + mutex_1= create_mutex(& dummy_mutex_class, NULL); + ok(mutex_1 != NULL, "mutex"); + ok(mutex_lost == 0, "not lost"); + mutex_2= create_mutex(& dummy_mutex_class, NULL); + ok(mutex_2 != NULL, "mutex"); + ok(mutex_lost == 0, "not lost"); + mutex_2= create_mutex(& dummy_mutex_class, NULL); + ok(mutex_2 == NULL, "no mutex"); + ok(mutex_lost == 1, "lost 1"); + destroy_mutex(mutex_1); + mutex_2= create_mutex(& dummy_mutex_class, NULL); + ok(mutex_2 != NULL, "mutex"); + ok(mutex_lost == 1, "no new loss"); + + rwlock_1= create_rwlock(& dummy_rwlock_class, NULL); + ok(rwlock_1 != NULL, "rwlock"); + ok(rwlock_lost == 0, "not lost"); + rwlock_2= create_rwlock(& dummy_rwlock_class, NULL); + ok(rwlock_2 != NULL, "rwlock"); + ok(rwlock_lost == 0, "not lost"); + rwlock_2= create_rwlock(& dummy_rwlock_class, NULL); + ok(rwlock_2 == NULL, "no rwlock"); + ok(rwlock_lost == 1, "lost 1"); + destroy_rwlock(rwlock_1); + rwlock_2= create_rwlock(& dummy_rwlock_class, NULL); + ok(rwlock_2 != NULL, "rwlock"); + ok(rwlock_lost == 1, "no new loss"); + + cond_1= create_cond(& dummy_cond_class, NULL); + ok(cond_1 != NULL, "cond"); + ok(cond_lost == 0, "not lost"); + cond_2= create_cond(& dummy_cond_class, NULL); + ok(cond_2 != NULL, "cond"); + ok(cond_lost == 0, "not lost"); + cond_2= create_cond(& dummy_cond_class, NULL); + ok(cond_2 == NULL, "no cond"); + ok(cond_lost == 1, "lost 1"); + destroy_cond(cond_1); + cond_2= create_cond(& dummy_cond_class, NULL); + ok(cond_2 != NULL, "cond"); + ok(cond_lost == 1, "no new loss"); + + thread_1= create_thread(& dummy_thread_class, NULL, 0); + ok(thread_1 != NULL, "thread"); + ok(thread_lost == 0, "not lost"); + thread_2= create_thread(& dummy_thread_class, NULL, 0); + ok(thread_2 != NULL, "thread"); + ok(thread_lost == 0, "not lost"); + thread_2= create_thread(& dummy_thread_class, NULL, 0); + ok(thread_2 == NULL, "no thread"); + ok(thread_lost == 1, "lost 1"); + destroy_thread(thread_1); + thread_2= create_thread(& dummy_thread_class, NULL, 0); + ok(thread_2 != NULL, "thread"); + ok(thread_lost == 1, "no new loss"); + + PFS_thread fake_thread; + fake_thread.m_filename_hash_pins= NULL; + + file_1= find_or_create_file(& fake_thread, & dummy_file_class, "dummy", 5); + ok(file_1 == NULL, "no file"); + ok(file_lost == 1, "lost 1"); + file_1= find_or_create_file(& fake_thread, & dummy_file_class, "dummy", 5); + ok(file_1 == NULL, "no file"); + ok(file_lost == 2, "lost 2"); + + init_file_hash(); + file_lost= 0; + + file_1= find_or_create_file(& fake_thread, & dummy_file_class, "dummy_A", 7); + ok(file_1 != NULL, "file"); + ok(file_1->m_file_stat.m_open_count == 1, "open count 1"); + ok(file_lost == 0, "not lost"); + file_2= find_or_create_file(& fake_thread, & dummy_file_class, "dummy_A", 7); + ok(file_1 == file_2, "same file"); + ok(file_1->m_file_stat.m_open_count == 2, "open count 2"); + ok(file_lost == 0, "not lost"); + release_file(file_2); + ok(file_1->m_file_stat.m_open_count == 1, "open count 1"); + file_2= find_or_create_file(& fake_thread, & dummy_file_class, "dummy_B", 7); + ok(file_2 != NULL, "file"); + ok(file_lost == 0, "not lost"); + file_2= find_or_create_file(& fake_thread, & dummy_file_class, "dummy_C", 7); + ok(file_2 == NULL, "no file"); + ok(file_lost == 1, "lost"); + release_file(file_1); + /* the file still exists, not destroyed */ + ok(file_1->m_file_stat.m_open_count == 0, "open count 0"); + file_2= find_or_create_file(& fake_thread, & dummy_file_class, "dummy_D", 7); + ok(file_2 == NULL, "no file"); + ok(file_lost == 2, "lost"); + + table_1= create_table(& dummy_table_share, NULL); + ok(table_1 != NULL, "table"); + ok(table_lost == 0, "not lost"); + table_2= create_table(& dummy_table_share, NULL); + ok(table_2 != NULL, "table"); + ok(table_lost == 0, "not lost"); + table_2= create_table(& dummy_table_share, NULL); + ok(table_2 == NULL, "no table"); + ok(table_lost == 1, "lost 1"); + destroy_table(table_1); + table_2= create_table(& dummy_table_share, NULL); + ok(table_2 != NULL, "table"); + ok(table_lost == 1, "no new loss"); + + //TODO: test that cleanup works + reset_events_waits_by_instance(); + reset_per_thread_wait_stat(); + + cleanup_file_hash(); + cleanup_instruments(); +} + +void test_per_thread_wait() +{ + int rc; + PFS_mutex_class dummy_mutex_class; + PFS_rwlock_class dummy_rwlock_class; + PFS_cond_class dummy_cond_class; + PFS_thread_class dummy_thread_class; + PFS_file_class dummy_file_class; + PFS_thread *thread; + PFS_single_stat_chain *base; + PFS_single_stat_chain *stat; + PFS_global_param param; + + + /* Per mutex info waits should be at [0..9] */ + mutex_class_max= 10; + /* Per rwlock info waits should be at [10..29] */ + rwlock_class_max= 20; + /* Per cond info waits should be at [30..69] */ + cond_class_max= 40; + /* Per file info waits should be at [70..149] */ + file_class_max= 80; + /* Per table info waits should be at [150..309] */ + table_share_max= 160; + + param.m_enabled= true; + param.m_mutex_class_sizing= mutex_class_max; + param.m_rwlock_class_sizing= rwlock_class_max; + param.m_cond_class_sizing= cond_class_max; + param.m_thread_class_sizing= 2; + param.m_table_share_sizing= table_share_max; + param.m_file_class_sizing= file_class_max; + param.m_mutex_sizing= 0; + param.m_rwlock_sizing= 0; + param.m_cond_sizing= 0; + param.m_thread_sizing= 2; + param.m_table_sizing= 0; + param.m_file_sizing= 0; + param.m_file_handle_sizing= 0; + param.m_events_waits_history_sizing= 10; + param.m_events_waits_history_long_sizing= 10000; + + rc= init_instruments(& param); + ok(rc == 0, "instances init"); + + thread= create_thread(& dummy_thread_class, NULL, 0); + ok(thread != NULL, "thread"); + ok(thread_lost == 0, "not lost"); + + base= & thread->m_instr_class_wait_stats[0]; + + dummy_mutex_class.m_index= 0; + stat= find_per_thread_mutex_class_wait_stat(thread, & dummy_mutex_class); + ok(base + 0 == stat, "fist mutex info slot at 0"); + dummy_mutex_class.m_index= mutex_class_max - 1; + stat= find_per_thread_mutex_class_wait_stat(thread, & dummy_mutex_class); + ok(base + 9 == stat, "last mutex info slot at 9"); + + dummy_rwlock_class.m_index= 0; + stat= find_per_thread_rwlock_class_wait_stat(thread, & dummy_rwlock_class); + ok(base + 10 == stat, "fist rwlock info slot at 10"); + dummy_rwlock_class.m_index= rwlock_class_max - 1; + stat= find_per_thread_rwlock_class_wait_stat(thread, & dummy_rwlock_class); + ok(base + 29 == stat, "last rwlock info slot at 29"); + + dummy_cond_class.m_index= 0; + stat= find_per_thread_cond_class_wait_stat(thread, & dummy_cond_class); + ok(base + 30 == stat, "fist cond info slot at 30"); + dummy_cond_class.m_index= cond_class_max - 1; + stat= find_per_thread_cond_class_wait_stat(thread, & dummy_cond_class); + ok(base + 69 == stat, "last cond info slot at 69"); + + dummy_file_class.m_index= 0; + stat= find_per_thread_file_class_wait_stat(thread, & dummy_file_class); + ok(base + 70 == stat, "fist file info slot at 70"); + dummy_file_class.m_index= file_class_max - 1; + stat= find_per_thread_file_class_wait_stat(thread, & dummy_file_class); + ok(base + 149 == stat, "last file info slot at 149"); + + cleanup_instruments(); +} + +void do_all_tests() +{ + test_no_instruments(); + test_no_instances(); + test_with_instances(); + test_per_thread_wait(); +} + +int main(int, char **) +{ + plan(102); + MY_INIT("pfs_instr-t"); + do_all_tests(); + return 0; +} + diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc new file mode 100644 index 00000000000..53100571323 --- /dev/null +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc @@ -0,0 +1,58 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql_priv.h> +#include <pfs_instr_class.h> +#include <pfs_global.h> +#include <tap.h> + +#include "stub_pfs_global.h" + +void test_oom() +{ + int rc; + + rc= init_sync_class(1000, 0, 0); + ok(rc == 1, "oom (mutex)"); + rc= init_sync_class(0, 1000, 0); + ok(rc == 1, "oom (rwlock)"); + rc= init_sync_class(0, 0, 1000); + ok(rc == 1, "oom (cond)"); + rc= init_thread_class(1000); + ok(rc == 1, "oom (thread)"); + rc= init_file_class(1000); + ok(rc == 1, "oom (file)"); + rc= init_table_share(1000); + ok(rc == 1, "oom (cond)"); + + cleanup_sync_class(); + cleanup_thread_class(); + cleanup_file_class(); + cleanup_table_share(); +} + +void do_all_tests() +{ + test_oom(); +} + +int main(int, char **) +{ + plan(6); + MY_INIT("pfs_instr_info-oom-t"); + do_all_tests(); + return 0; +} + diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc new file mode 100644 index 00000000000..0a1e0c2d0b1 --- /dev/null +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -0,0 +1,570 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql_priv.h> +#include <pfs_instr_class.h> +#include <pfs_instr.h> +#include <pfs_global.h> +#include <tap.h> + +void test_no_registration() +{ + int rc; + PFS_sync_key key; + PFS_thread_key thread_key; + PFS_file_key file_key; + PFS_mutex_class *mutex; + PFS_rwlock_class *rwlock; + PFS_cond_class *cond; + PFS_thread_class *thread; + PFS_file_class *file; + PFS_table_share *table; + + rc= init_sync_class(0, 0, 0); + ok(rc == 0, "zero init (sync)"); + rc= init_thread_class(0); + ok(rc == 0, "zero init (thread)"); + rc= init_file_class(0); + ok(rc == 0, "zero init (file)"); + rc= init_table_share(0); + ok(rc == 0, "zero init (table)"); + + key= register_mutex_class("FOO", 3, 0); + ok(key == 0, "no mutex registered"); + key= register_mutex_class("BAR", 3, 0); + ok(key == 0, "no mutex registered"); + key= register_mutex_class("FOO", 3, 0); + ok(key == 0, "no mutex registered"); + + key= register_rwlock_class("FOO", 3, 0); + ok(key == 0, "no rwlock registered"); + key= register_rwlock_class("BAR", 3, 0); + ok(key == 0, "no rwlock registered"); + key= register_rwlock_class("FOO", 3, 0); + ok(key == 0, "no rwlock registered"); + + key= register_cond_class("FOO", 3, 0); + ok(key == 0, "no cond registered"); + key= register_cond_class("BAR", 3, 0); + ok(key == 0, "no cond registered"); + key= register_cond_class("FOO", 3, 0); + ok(key == 0, "no cond registered"); + + thread_key= register_thread_class("FOO", 3, 0); + ok(thread_key == 0, "no thread registered"); + thread_key= register_thread_class("BAR", 3, 0); + ok(thread_key == 0, "no thread registered"); + thread_key= register_thread_class("FOO", 3, 0); + ok(thread_key == 0, "no thread registered"); + + file_key= register_file_class("FOO", 3, 0); + ok(file_key == 0, "no file registered"); + file_key= register_file_class("BAR", 3, 0); + ok(file_key == 0, "no file registered"); + file_key= register_file_class("FOO", 3, 0); + ok(file_key == 0, "no file registered"); + + PFS_thread fake_thread; + fake_thread.m_table_share_hash_pins= NULL; + + table= find_or_create_table_share(& fake_thread, "foo_db", 6, "foo_table", 9); + ok(table == NULL, "not created"); + table= find_or_create_table_share(& fake_thread, "bar_db", 6, "bar_table", 9); + ok(table == NULL, "not created"); + table= find_or_create_table_share(& fake_thread, "foo_db", 6, "foo_table", 9); + ok(table == NULL, "not created"); + + mutex= find_mutex_class(0); + ok(mutex == NULL, "no mutex key 0"); + mutex= find_mutex_class(1); + ok(mutex == NULL, "no mutex key 1"); + mutex= find_mutex_class(9999); + ok(mutex == NULL, "no mutex key 9999"); + + rwlock= find_rwlock_class(0); + ok(rwlock == NULL, "no rwlock key 0"); + rwlock= find_rwlock_class(1); + ok(rwlock == NULL, "no rwlock key 1"); + rwlock= find_rwlock_class(9999); + ok(rwlock == NULL, "no rwlock key 9999"); + + cond= find_cond_class(0); + ok(cond == NULL, "no cond key 0"); + cond= find_cond_class(1); + ok(cond == NULL, "no cond key 1"); + cond= find_cond_class(9999); + ok(cond == NULL, "no cond key 9999"); + + thread= find_thread_class(0); + ok(thread == NULL, "no thread key 0"); + thread= find_thread_class(1); + ok(thread == NULL, "no thread key 1"); + thread= find_thread_class(9999); + ok(thread == NULL, "no thread key 9999"); + + file= find_file_class(0); + ok(file == NULL, "no file key 0"); + file= find_file_class(1); + ok(file == NULL, "no file key 1"); + file= find_file_class(9999); + ok(file == NULL, "no file key 9999"); + + cleanup_sync_class(); + cleanup_thread_class(); + cleanup_file_class(); + cleanup_table_share(); +} + +void test_mutex_registration() +{ + int rc; + PFS_sync_key key; + PFS_mutex_class *mutex; + + rc= init_sync_class(5, 0, 0); + ok(rc == 0, "room for 5 mutex"); + + key= register_mutex_class("FOO", 3, 0); + ok(key == 1, "foo registered"); + key= register_mutex_class("BAR", 3, 0); + ok(key == 2, "bar registered"); + key= register_mutex_class("FOO", 3, 0); + ok(key == 1, "foo re registered"); + key= register_mutex_class("M-3", 3, 0); + ok(key == 3, "M-3 registered"); + key= register_mutex_class("M-4", 3, 0); + ok(key == 4, "M-4 registered"); + key= register_mutex_class("M-5", 3, 0); + ok(key == 5, "M-5 registered"); + ok(mutex_class_lost == 0, "lost nothing"); + key= register_mutex_class("M-6", 3, 0); + ok(key == 0, "M-6 not registered"); + ok(mutex_class_lost == 1, "lost 1 mutex"); + key= register_mutex_class("M-7", 3, 0); + ok(key == 0, "M-7 not registered"); + ok(mutex_class_lost == 2, "lost 2 mutex"); + key= register_mutex_class("M-3", 3, 0); + ok(key == 3, "M-3 re registered"); + ok(mutex_class_lost == 2, "lost 2 mutex"); + key= register_mutex_class("M-5", 3, 0); + ok(key == 5, "M-5 re registered"); + ok(mutex_class_lost == 2, "lost 2 mutex"); + + mutex= find_mutex_class(0); + ok(mutex == NULL, "no key 0"); + mutex= find_mutex_class(3); + ok(mutex != NULL, "found key 3"); + ok(strncmp(mutex->m_name, "M-3", 3) == 0, "key 3 is M-3"); + ok(mutex->m_name_length == 3, "name length 3"); + mutex= find_mutex_class(9999); + ok(mutex == NULL, "no key 9999"); + + cleanup_sync_class(); +} + +void test_rwlock_registration() +{ + int rc; + PFS_sync_key key; + PFS_rwlock_class *rwlock; + + rc= init_sync_class(0, 5, 0); + ok(rc == 0, "room for 5 rwlock"); + + key= register_rwlock_class("FOO", 3, 0); + ok(key == 1, "foo registered"); + key= register_rwlock_class("BAR", 3, 0); + ok(key == 2, "bar registered"); + key= register_rwlock_class("FOO", 3, 0); + ok(key == 1, "foo re registered"); + key= register_rwlock_class("RW-3", 4, 0); + ok(key == 3, "RW-3 registered"); + key= register_rwlock_class("RW-4", 4, 0); + ok(key == 4, "RW-4 registered"); + key= register_rwlock_class("RW-5", 4, 0); + ok(key == 5, "RW-5 registered"); + key= register_rwlock_class("RW-6", 4, 0); + ok(key == 0, "RW-6 not registered"); + key= register_rwlock_class("RW-7", 4, 0); + ok(key == 0, "RW-7 not registered"); + key= register_rwlock_class("RW-3", 4, 0); + ok(key == 3, "RW-3 re registered"); + key= register_rwlock_class("RW-5", 4, 0); + ok(key == 5, "RW-5 re registered"); + + rwlock= find_rwlock_class(0); + ok(rwlock == NULL, "no key 0"); + rwlock= find_rwlock_class(3); + ok(rwlock != NULL, "found key 3"); + ok(strncmp(rwlock->m_name, "RW-3", 4) == 0, "key 3 is RW-3"); + ok(rwlock->m_name_length == 4, "name length 4"); + rwlock= find_rwlock_class(9999); + ok(rwlock == NULL, "no key 9999"); + + cleanup_sync_class(); +} + +void test_cond_registration() +{ + int rc; + PFS_sync_key key; + PFS_cond_class *cond; + + rc= init_sync_class(0, 0, 5); + ok(rc == 0, "room for 5 cond"); + + key= register_cond_class("FOO", 3, 0); + ok(key == 1, "foo registered"); + key= register_cond_class("BAR", 3, 0); + ok(key == 2, "bar registered"); + key= register_cond_class("FOO", 3, 0); + ok(key == 1, "foo re registered"); + key= register_cond_class("C-3", 3, 0); + ok(key == 3, "C-3 registered"); + key= register_cond_class("C-4", 3, 0); + ok(key == 4, "C-4 registered"); + key= register_cond_class("C-5", 3, 0); + ok(key == 5, "C-5 registered"); + key= register_cond_class("C-6", 3, 0); + ok(key == 0, "C-6 not registered"); + key= register_cond_class("C-7", 3, 0); + ok(key == 0, "C-7 not registered"); + key= register_cond_class("C-3", 3, 0); + ok(key == 3, "C-3 re registered"); + key= register_cond_class("C-5", 3, 0); + ok(key == 5, "C-5 re registered"); + + cond= find_cond_class(0); + ok(cond == NULL, "no key 0"); + cond= find_cond_class(3); + ok(cond != NULL, "found key 3"); + ok(strncmp(cond->m_name, "C-3", 3) == 0, "key 3 is C-3"); + ok(cond->m_name_length == 3, "name length 3"); + cond= find_cond_class(9999); + ok(cond == NULL, "no key 9999"); + + cleanup_sync_class(); +} + +void test_thread_registration() +{ + int rc; + PFS_thread_key key; + PFS_thread_class *thread; + + rc= init_thread_class(5); + ok(rc == 0, "room for 5 thread"); + + key= register_thread_class("FOO", 3, 0); + ok(key == 1, "foo registered"); + key= register_thread_class("BAR", 3, 0); + ok(key == 2, "bar registered"); + key= register_thread_class("FOO", 3, 0); + ok(key == 1, "foo re registered"); + key= register_thread_class("Thread-3", 8, 0); + ok(key == 3, "Thread-3 registered"); + key= register_thread_class("Thread-4", 8, 0); + ok(key == 4, "Thread-4 registered"); + key= register_thread_class("Thread-5", 8, 0); + ok(key == 5, "Thread-5 registered"); + key= register_thread_class("Thread-6", 8, 0); + ok(key == 0, "Thread-6 not registered"); + key= register_thread_class("Thread-7", 8, 0); + ok(key == 0, "Thread-7 not registered"); + key= register_thread_class("Thread-3", 8, 0); + ok(key == 3, "Thread-3 re registered"); + key= register_thread_class("Thread-5", 8, 0); + ok(key == 5, "Thread-5 re registered"); + + thread= find_thread_class(0); + ok(thread == NULL, "no key 0"); + thread= find_thread_class(3); + ok(thread != NULL, "found key 3"); + ok(strncmp(thread->m_name, "Thread-3", 8) == 0, "key 3 is Thread-3"); + ok(thread->m_name_length == 8, "name length 8"); + thread= find_thread_class(9999); + ok(thread == NULL, "no key 9999"); + + cleanup_thread_class(); +} + +void test_file_registration() +{ + int rc; + PFS_file_key key; + PFS_file_class *file; + + rc= init_file_class(5); + ok(rc == 0, "room for 5 file"); + + key= register_file_class("FOO", 3, 0); + ok(key == 1, "foo registered"); + key= register_file_class("BAR", 3, 0); + ok(key == 2, "bar registered"); + key= register_file_class("FOO", 3, 0); + ok(key == 1, "foo re registered"); + key= register_file_class("File-3", 6, 0); + ok(key == 3, "File-3 registered"); + key= register_file_class("File-4", 6, 0); + ok(key == 4, "File-4 registered"); + key= register_file_class("File-5", 6, 0); + ok(key == 5, "File-5 registered"); + key= register_file_class("File-6", 6, 0); + ok(key == 0, "File-6 not registered"); + key= register_file_class("File-7", 6, 0); + ok(key == 0, "File-7 not registered"); + key= register_file_class("File-3", 6, 0); + ok(key == 3, "File-3 re registered"); + key= register_file_class("File-5", 6, 0); + ok(key == 5, "File-5 re registered"); + + file= find_file_class(0); + ok(file == NULL, "no key 0"); + file= find_file_class(3); + ok(file != NULL, "found key 3"); + ok(strncmp(file->m_name, "File-3", 6) == 0, "key 3 is File-3"); + ok(file->m_name_length == 6, "name length 6"); + file= find_file_class(9999); + ok(file == NULL, "no key 9999"); + + cleanup_file_class(); +} + +void test_table_registration() +{ + PFS_table_share *table_share; + PFS_table_share *table_share_2; + + PFS_thread fake_thread; + fake_thread.m_table_share_hash_pins= NULL; + + table_share_lost= 0; + table_share= find_or_create_table_share(& fake_thread, "db1", 3, "t1", 2); + ok(table_share == NULL, "not created"); + ok(table_share_lost == 1, "lost the table"); + + table_share_lost= 0; + init_table_share(5); + init_table_share_hash(); + + table_share= find_or_create_table_share(& fake_thread, "db1", 3, "t1", 2); + ok(table_share != NULL, "created db1.t1"); + ok(table_share_lost == 0, "not lost"); + + table_share_2= find_or_create_table_share(& fake_thread, "db1", 3, "t1", 2); + ok(table_share_2 != NULL, "found db1.t1"); + ok(table_share_lost == 0, "not lost"); + ok(table_share == table_share_2, "same table"); + + table_share_2= find_or_create_table_share(& fake_thread, "db1", 3, "t2", 2); + ok(table_share_2 != NULL, "created db1.t2"); + ok(table_share_lost == 0, "not lost"); + + table_share_2= find_or_create_table_share(& fake_thread, "db2", 3, "t1", 2); + ok(table_share_2 != NULL, "created db2.t1"); + ok(table_share_lost == 0, "not lost"); + + table_share_2= find_or_create_table_share(& fake_thread, "db2", 3, "t2", 2); + ok(table_share_2 != NULL, "created db2.t2"); + ok(table_share_lost == 0, "not lost"); + + table_share_2= find_or_create_table_share(& fake_thread, "db3", 3, "t3", 2); + ok(table_share_2 != NULL, "created db3.t3"); + ok(table_share_lost == 0, "not lost"); + + table_share_2= find_or_create_table_share(& fake_thread, "db4", 3, "t4", 2); + ok(table_share_2 == NULL, "lost db4.t4"); + ok(table_share_lost == 1, "lost"); + + table_share_lost= 0; + table_share_2= find_or_create_table_share(& fake_thread, "db1", 3, "t2", 2); + ok(table_share_2 != NULL, "found db1.t2"); + ok(table_share_lost == 0, "not lost"); + ok(strncmp(table_share_2->m_schema_name, "db1", 3) == 0 , "schema db1"); + ok(table_share_2->m_schema_name_length == 3, "length 3"); + ok(strncmp(table_share_2->m_table_name, "t2", 2) == 0 , "table t2"); + ok(table_share_2->m_table_name_length == 2, "length 2"); + + cleanup_table_share_hash(); + cleanup_table_share(); +} + +void set_wait_stat(PFS_single_stat_chain *stat) +{ + stat->m_count= 12; + stat->m_min= 5; + stat->m_max= 120; + stat->m_sum= 999; +} + +bool is_empty_stat(PFS_single_stat_chain *stat) +{ + if (stat->m_count != 0) + return false; + if (stat->m_min != (ulonglong) -1) + return false; + if (stat->m_max != 0) + return false; + if (stat->m_sum != 0) + return false; + return true; +} + +void test_instruments_reset() +{ + int rc; + PFS_sync_key key; + PFS_file_key file_key; + PFS_mutex_class *mutex_1; + PFS_mutex_class *mutex_2; + PFS_mutex_class *mutex_3; + PFS_rwlock_class *rwlock_1; + PFS_rwlock_class *rwlock_2; + PFS_rwlock_class *rwlock_3; + PFS_cond_class *cond_1; + PFS_cond_class *cond_2; + PFS_cond_class *cond_3; + PFS_file_class *file_1; + PFS_file_class *file_2; + PFS_file_class *file_3; + + rc= init_sync_class(3, 3, 3); + ok(rc == 0, "init (sync)"); + rc= init_thread_class(3); + ok(rc == 0, "init (thread)"); + rc= init_file_class(3); + ok(rc == 0, "init (file)"); + + key= register_mutex_class("M-1", 3, 0); + ok(key == 1, "mutex registered"); + key= register_mutex_class("M-2", 3, 0); + ok(key == 2, "mutex registered"); + key= register_mutex_class("M-3", 3, 0); + ok(key == 3, "mutex registered"); + + key= register_rwlock_class("RW-1", 4, 0); + ok(key == 1, "rwlock registered"); + key= register_rwlock_class("RW-2", 4, 0); + ok(key == 2, "rwlock registered"); + key= register_rwlock_class("RW-3", 4, 0); + ok(key == 3, "rwlock registered"); + + key= register_cond_class("C-1", 3, 0); + ok(key == 1, "cond registered"); + key= register_cond_class("C-2", 3, 0); + ok(key == 2, "cond registered"); + key= register_cond_class("C-3", 3, 0); + ok(key == 3, "cond registered"); + + file_key= register_file_class("F-1", 3, 0); + ok(file_key == 1, "file registered"); + file_key= register_file_class("F-2", 3, 0); + ok(file_key == 2, "file registered"); + file_key= register_file_class("F-3", 3, 0); + ok(file_key == 3, "file registered"); + + mutex_1= find_mutex_class(1); + ok(mutex_1 != NULL, "mutex key 1"); + mutex_2= find_mutex_class(2); + ok(mutex_2 != NULL, "mutex key 2"); + mutex_3= find_mutex_class(3); + ok(mutex_3 != NULL, "mutex key 3"); + + rwlock_1= find_rwlock_class(1); + ok(rwlock_1 != NULL, "rwlock key 1"); + rwlock_2= find_rwlock_class(2); + ok(rwlock_2 != NULL, "rwlock key 2"); + rwlock_3= find_rwlock_class(3); + ok(rwlock_3 != NULL, "rwlock key 3"); + + cond_1= find_cond_class(1); + ok(cond_1 != NULL, "cond key 1"); + cond_2= find_cond_class(2); + ok(cond_2 != NULL, "cond key 2"); + cond_3= find_cond_class(3); + ok(cond_3 != NULL, "cond key 3"); + + file_1= find_file_class(1); + ok(file_1 != NULL, "file key 1"); + file_2= find_file_class(2); + ok(file_2 != NULL, "file key 2"); + file_3= find_file_class(3); + ok(file_3 != NULL, "file key 3"); + + set_wait_stat(& mutex_1->m_wait_stat); + set_wait_stat(& mutex_2->m_wait_stat); + set_wait_stat(& mutex_3->m_wait_stat); + set_wait_stat(& rwlock_1->m_wait_stat); + set_wait_stat(& rwlock_2->m_wait_stat); + set_wait_stat(& rwlock_3->m_wait_stat); + set_wait_stat(& cond_1->m_wait_stat); + set_wait_stat(& cond_2->m_wait_stat); + set_wait_stat(& cond_3->m_wait_stat); + set_wait_stat(& file_1->m_wait_stat); + set_wait_stat(& file_2->m_wait_stat); + set_wait_stat(& file_3->m_wait_stat); + + ok(! is_empty_stat(& mutex_1->m_wait_stat), "mutex_1 stat is populated"); + ok(! is_empty_stat(& mutex_2->m_wait_stat), "mutex_2 stat is populated"); + ok(! is_empty_stat(& mutex_3->m_wait_stat), "mutex_3 stat is populated"); + ok(! is_empty_stat(& rwlock_1->m_wait_stat), "rwlock_1 stat is populated"); + ok(! is_empty_stat(& rwlock_2->m_wait_stat), "rwlock_2 stat is populated"); + ok(! is_empty_stat(& rwlock_3->m_wait_stat), "rwlock_3 stat is populated"); + ok(! is_empty_stat(& cond_1->m_wait_stat), "cond_1 stat is populated"); + ok(! is_empty_stat(& cond_2->m_wait_stat), "cond_2 stat is populated"); + ok(! is_empty_stat(& cond_3->m_wait_stat), "cond_3 stat is populated"); + ok(! is_empty_stat(& file_1->m_wait_stat), "file_1 stat is populated"); + ok(! is_empty_stat(& file_2->m_wait_stat), "file_2 stat is populated"); + ok(! is_empty_stat(& file_3->m_wait_stat), "file_3 stat is populated"); + + reset_instrument_class_waits(); + + ok(is_empty_stat(& mutex_1->m_wait_stat), "mutex_1 stat is cleared"); + ok(is_empty_stat(& mutex_2->m_wait_stat), "mutex_2 stat is cleared"); + ok(is_empty_stat(& mutex_3->m_wait_stat), "mutex_3 stat is cleared"); + ok(is_empty_stat(& rwlock_1->m_wait_stat), "rwlock_1 stat is cleared"); + ok(is_empty_stat(& rwlock_2->m_wait_stat), "rwlock_2 stat is cleared"); + ok(is_empty_stat(& rwlock_3->m_wait_stat), "rwlock_3 stat is cleared"); + ok(is_empty_stat(& cond_1->m_wait_stat), "cond_1 stat is cleared"); + ok(is_empty_stat(& cond_2->m_wait_stat), "cond_2 stat is cleared"); + ok(is_empty_stat(& cond_3->m_wait_stat), "cond_3 stat is cleared"); + ok(is_empty_stat(& file_1->m_wait_stat), "file_1 stat is cleared"); + ok(is_empty_stat(& file_2->m_wait_stat), "file_2 stat is cleared"); + ok(is_empty_stat(& file_3->m_wait_stat), "file_3 stat is cleared"); + + cleanup_sync_class(); + cleanup_file_class(); +} + +void do_all_tests() +{ + test_no_registration(); + test_mutex_registration(); + test_rwlock_registration(); + test_cond_registration(); + test_thread_registration(); + test_file_registration(); + test_table_registration(); + test_instruments_reset(); +} + +int main(int, char **) +{ + plan(196); + MY_INIT("pfs_instr_info-t"); + do_all_tests(); + return 0; +} + diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc new file mode 100644 index 00000000000..8fa29306982 --- /dev/null +++ b/storage/perfschema/unittest/pfs_timer-t.cc @@ -0,0 +1,116 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql_priv.h> +#include <pfs_timer.h> +#include <tap.h> + +void test_timers() +{ + ulonglong t1_a; + ulonglong t2_a; + ulonglong t3_a; + ulonglong t4_a; + ulonglong t5_a; + ulonglong t1_b; + ulonglong t2_b; + ulonglong t3_b; + ulonglong t4_b; + ulonglong t5_b; + + init_timers(); + + t1_a= get_timer_value(TIMER_NAME_CYCLE); + /* Wait 5 seconds */ + my_sleep(5000000); + t1_b= get_timer_value(TIMER_NAME_CYCLE); + + t2_a= get_timer_value(TIMER_NAME_NANOSEC); + my_sleep(5000000); + t2_b= get_timer_value(TIMER_NAME_NANOSEC); + + t3_a= get_timer_value(TIMER_NAME_MICROSEC); + my_sleep(5000000); + t3_b= get_timer_value(TIMER_NAME_MICROSEC); + + t4_a= get_timer_value(TIMER_NAME_MILLISEC); + my_sleep(5000000); + t4_b= get_timer_value(TIMER_NAME_MILLISEC); + + t5_a= get_timer_value(TIMER_NAME_TICK); + my_sleep(5000000); + t5_b= get_timer_value(TIMER_NAME_TICK); + + /* + Print the timer values, for manual inspection by a human. + Tests involving low level timers can not be automated. + */ + diag("cycle a: %13llu", t1_a); + diag("nano a: %13llu", t2_a); + diag("micro a: %13llu", t3_a); + diag("milli a: %13llu", t4_a); + diag("tick a: %13llu", t5_a); + + diag("cycle b: %13llu", t1_b); + diag("nano b: %13llu", t2_b); + diag("micro b: %13llu", t3_b); + diag("milli b: %13llu", t4_b); + diag("tick b: %13llu", t5_b); + + diag("cycle b-a: %13llu", t1_b-t1_a); + diag("nano b-a: %13llu", t2_b-t2_a); + diag("micro b-a: %13llu", t3_b-t3_a); + diag("milli b-a: %13llu", t4_b-t4_a); + diag("tick b-a: %13llu", t5_b-t5_a); + + if ((t1_a == 0) && (t1_b == 0)) + skip(1, "cycle timer not implemented"); + else + ok(t1_b > t1_a, "cycle timer ascending"); + + if ((t2_a == 0) && (t2_b == 0)) + skip(1, "nano timer not implemented"); + else + ok(t2_b > t2_a, "nano timer ascending"); + + if ((t3_a == 0) && (t3_b == 0)) + skip(1, "micro timer not implemented"); + else + ok(t3_b > t3_a, "micro timer ascending"); + + if ((t4_a == 0) && (t4_b == 0)) + skip(1, "milli timer not implemented"); + else + ok(t4_b > t4_a, "milli timer ascending"); + + if ((t5_a == 0) && (t5_b == 0)) + skip(1, "tick timer not implemented"); + else + ok(t5_b > t5_a, "tick timer ascending"); +} + +void do_all_tests() +{ + test_timers(); +} + +int main(int, char **) +{ + plan(5); + MY_INIT("pfs_timer-t"); + do_all_tests(); + return 0; +} + diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h new file mode 100644 index 00000000000..85088061d3f --- /dev/null +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <my_global.h> +#include <my_sys.h> +#include <pfs_global.h> + +bool pfs_initialized= false; + +bool stub_alloc_always_fails= true; +int stub_alloc_fails_after_count= 0; + +void *pfs_malloc(size_t, myf) +{ + static char garbage[100]; + + if (stub_alloc_always_fails) + return NULL; + + if (--stub_alloc_fails_after_count <= 0) + return NULL; + + return garbage; +} + +void pfs_free(void *) +{ +} + diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h new file mode 100644 index 00000000000..12dabb46ceb --- /dev/null +++ b/storage/perfschema/unittest/stub_print_error.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2008-2009 Sun Microsystems, Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <my_global.h> +#include <my_sys.h> +#include <pfs_global.h> + +bool pfs_initialized= false; + +void *pfs_malloc(size_t size, myf flags) +{ + void *ptr= malloc(size); + if (ptr && (flags & MY_ZEROFILL)) + memset(ptr, 0, size); + return ptr; +} + +void pfs_free(void *ptr) +{ + if (ptr != NULL) + free(ptr); +} + +void pfs_print_error(const char *format, ...) +{ + /* Do not pollute the unit test output with annoying messages. */ +} + diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 3da307b82fc..966acdfa8f0 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -176,6 +176,623 @@ static uchar NEAR sort_order_big5[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; + +static MY_UNICASE_INFO cA2[256]= +{ + /* A200-A20F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A210-A21F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A220-A22F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A230-A23F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A240-A24F */ + {0xA240,0xA240,0xFFFD}, + {0xA241,0xA241,0xFF0F}, + {0xA242,0xA242,0xFF3C}, + {0xA243,0xA243,0xFF04}, + {0xA244,0xA244,0x00A5}, + {0xA245,0xA245,0x3012}, + {0xA246,0xA246,0x00A2}, + {0xA247,0xA247,0x00A3}, + {0xA248,0xA248,0xFF05}, + {0xA249,0xA249,0xFF20}, + {0xA24A,0xA24A,0x2103}, + {0xA24B,0xA24B,0x2109}, + {0xA24C,0xA24C,0xFE69}, + {0xA24D,0xA24D,0xFE6A}, + {0xA24E,0xA24E,0xFE6B}, + {0xA24F,0xA24F,0x33D5}, + /* A250-A25F */ + {0xA250,0xA250,0x339C}, + {0xA251,0xA251,0x339D}, + {0xA252,0xA252,0x339E}, + {0xA253,0xA253,0x33CE}, + {0xA254,0xA254,0x33A1}, + {0xA255,0xA255,0x338E}, + {0xA256,0xA256,0x338F}, + {0xA257,0xA257,0x33C4}, + {0xA258,0xA258,0x00B0}, + {0xA259,0xA259,0x5159}, + {0xA25A,0xA25A,0x515B}, + {0xA25B,0xA25B,0x515E}, + {0xA25C,0xA25C,0x515D}, + {0xA25D,0xA25D,0x5161}, + {0xA25E,0xA25E,0x5163}, + {0xA25F,0xA25F,0x55E7}, + /* A260-A26F */ + {0xA260,0xA260,0x74E9}, + {0xA261,0xA261,0x7CCE}, + {0xA262,0xA262,0x2581}, + {0xA263,0xA263,0x2582}, + {0xA264,0xA264,0x2583}, + {0xA265,0xA265,0x2584}, + {0xA266,0xA266,0x2585}, + {0xA267,0xA267,0x2586}, + {0xA268,0xA268,0x2587}, + {0xA269,0xA269,0x2588}, + {0xA26A,0xA26A,0x258F}, + {0xA26B,0xA26B,0x258E}, + {0xA26C,0xA26C,0x258D}, + {0xA26D,0xA26D,0x258C}, + {0xA26E,0xA26E,0x258B}, + {0xA26F,0xA26F,0x258A}, + /* A270-A27F */ + {0xA270,0xA270,0x2589}, + {0xA271,0xA271,0x253C}, + {0xA272,0xA272,0x2534}, + {0xA273,0xA273,0x252C}, + {0xA274,0xA274,0x2524}, + {0xA275,0xA275,0x251C}, + {0xA276,0xA276,0x2594}, + {0xA277,0xA277,0x2500}, + {0xA278,0xA278,0x2502}, + {0xA279,0xA279,0x2595}, + {0xA27A,0xA27A,0x250C}, + {0xA27B,0xA27B,0x2510}, + {0xA27C,0xA27C,0x2514}, + {0xA27D,0xA27D,0x2518}, + {0xA27E,0xA27E,0x256D}, + {0x0000,0x0000,0x0000}, + /* A280-A28F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A290-A29F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A2A0-A2AF */ + {0x0000,0x0000,0x0000}, + {0xA2A1,0xA2A1,0x256E}, + {0xA2A2,0xA2A2,0x2570}, + {0xA2A3,0xA2A3,0x256F}, + {0xA2A4,0xA2A4,0x2550}, + {0xA2A5,0xA2A5,0x255E}, + {0xA2A6,0xA2A6,0x256A}, + {0xA2A7,0xA2A7,0x2561}, + {0xA2A8,0xA2A8,0x25E2}, + {0xA2A9,0xA2A9,0x25E3}, + {0xA2AA,0xA2AA,0x25E5}, + {0xA2AB,0xA2AB,0x25E4}, + {0xA2AC,0xA2AC,0x2571}, + {0xA2AD,0xA2AD,0x2572}, + {0xA2AE,0xA2AE,0x2573}, + {0xA2AF,0xA2AF,0xFF10}, + /* A2B0-A2BF */ + {0xA2B0,0xA2B0,0xFF11}, + {0xA2B1,0xA2B1,0xFF12}, + {0xA2B2,0xA2B2,0xFF13}, + {0xA2B3,0xA2B3,0xFF14}, + {0xA2B4,0xA2B4,0xFF15}, + {0xA2B5,0xA2B5,0xFF16}, + {0xA2B6,0xA2B6,0xFF17}, + {0xA2B7,0xA2B7,0xFF18}, + {0xA2B8,0xA2B8,0xFF19}, + {0xA2B9,0xA2B9,0x2160}, + {0xA2BA,0xA2BA,0x2161}, + {0xA2BB,0xA2BB,0x2162}, + {0xA2BC,0xA2BC,0x2163}, + {0xA2BD,0xA2BD,0x2164}, + {0xA2BE,0xA2BE,0x2165}, + {0xA2BF,0xA2BF,0x2166}, + /* A2C0-A2CF */ + {0xA2C0,0xA2C0,0x2167}, + {0xA2C1,0xA2C1,0x2168}, + {0xA2C2,0xA2C2,0x2169}, + {0xA2C3,0xA2C3,0x3021}, + {0xA2C4,0xA2C4,0x3022}, + {0xA2C5,0xA2C5,0x3023}, + {0xA2C6,0xA2C6,0x3024}, + {0xA2C7,0xA2C7,0x3025}, + {0xA2C8,0xA2C8,0x3026}, + {0xA2C9,0xA2C9,0x3027}, + {0xA2CA,0xA2CA,0x3028}, + {0xA2CB,0xA2CB,0x3029}, + {0xA2CC,0xA2CC,0xFFFD}, + {0xA2CD,0xA2CD,0x5344}, + {0xA2CE,0xA2CE,0xFFFD}, + {0xA2CF,0xA2E9,0xFF21}, + /* A2D0-A2DF */ + {0xA2D0,0xA2EA,0xFF22}, + {0xA2D1,0xA2EB,0xFF23}, + {0xA2D2,0xA2EC,0xFF24}, + {0xA2D3,0xA2ED,0xFF25}, + {0xA2D4,0xA2EE,0xFF26}, + {0xA2D5,0xA2EF,0xFF27}, + {0xA2D6,0xA2F0,0xFF28}, + {0xA2D7,0xA2F1,0xFF29}, + {0xA2D8,0xA2F2,0xFF2A}, + {0xA2D9,0xA2F3,0xFF2B}, + {0xA2DA,0xA2F4,0xFF2C}, + {0xA2DB,0xA2F5,0xFF2D}, + {0xA2DC,0xA2F6,0xFF2E}, + {0xA2DD,0xA2F7,0xFF2F}, + {0xA2DE,0xA2F8,0xFF30}, + {0xA2DF,0xA2F9,0xFF31}, + /* A2E0-A2EF */ + {0xA2E0,0xA2FA,0xFF32}, + {0xA2E1,0xA2FB,0xFF33}, + {0xA2E2,0xA2FC,0xFF34}, + {0xA2E3,0xA2FD,0xFF35}, + {0xA2E4,0xA2FE,0xFF36}, + {0xA2E5,0xA340,0xFF37}, + {0xA2E6,0xA341,0xFF38}, + {0xA2E7,0xA342,0xFF39}, + {0xA2E8,0xA343,0xFF3A}, + {0xA2CF,0xA2E9,0xFF41}, + {0xA2D0,0xA2EA,0xFF42}, + {0xA2D1,0xA2EB,0xFF43}, + {0xA2D2,0xA2EC,0xFF44}, + {0xA2D3,0xA2ED,0xFF45}, + {0xA2D4,0xA2EE,0xFF46}, + {0xA2D5,0xA2EF,0xFF47}, + /* A2F0-A2FF */ + {0xA2D6,0xA2F0,0xFF48}, + {0xA2D7,0xA2F1,0xFF49}, + {0xA2D8,0xA2F2,0xFF4A}, + {0xA2D9,0xA2F3,0xFF4B}, + {0xA2DA,0xA2F4,0xFF4C}, + {0xA2DB,0xA2F5,0xFF4D}, + {0xA2DC,0xA2F6,0xFF4E}, + {0xA2DD,0xA2F7,0xFF4F}, + {0xA2DE,0xA2F8,0xFF50}, + {0xA2DF,0xA2F9,0xFF51}, + {0xA2E0,0xA2FA,0xFF52}, + {0xA2E1,0xA2FB,0xFF53}, + {0xA2E2,0xA2FC,0xFF54}, + {0xA2E3,0xA2FD,0xFF55}, + {0xA2E4,0xA2FE,0xFF56}, + {0x0000,0x0000,0x0000} +}; + + +static MY_UNICASE_INFO cA3[256]= +{ + /* A300-A30F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A310-A31F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A320-A32F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A330-A33F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A340-A34F */ + {0xA2E5,0xA340,0xFF57}, + {0xA2E6,0xA341,0xFF58}, + {0xA2E7,0xA342,0xFF59}, + {0xA2E8,0xA343,0xFF5A}, + {0xA344,0xA35C,0x0391}, + {0xA345,0xA35D,0x0392}, + {0xA346,0xA35E,0x0393}, + {0xA347,0xA35F,0x0394}, + {0xA348,0xA360,0x0395}, + {0xA349,0xA361,0x0396}, + {0xA34A,0xA362,0x0397}, + {0xA34B,0xA363,0x0398}, + {0xA34C,0xA364,0x0399}, + {0xA34D,0xA365,0x039A}, + {0xA34E,0xA366,0x039B}, + {0xA34F,0xA367,0x039C}, + /* A350-A35F */ + {0xA350,0xA368,0x039D}, + {0xA351,0xA369,0x039E}, + {0xA352,0xA36A,0x039F}, + {0xA353,0xA36B,0x03A0}, + {0xA354,0xA36C,0x03A1}, + {0xA355,0xA36D,0x03A3}, + {0xA356,0xA36E,0x03A4}, + {0xA357,0xA36F,0x03A5}, + {0xA358,0xA370,0x03A6}, + {0xA359,0xA371,0x03A7}, + {0xA35A,0xA372,0x03A8}, + {0xA35B,0xA373,0x03A9}, + {0xA344,0xA35C,0x03B1}, + {0xA345,0xA35D,0x03B2}, + {0xA346,0xA35E,0x03B3}, + {0xA347,0xA35F,0x03B4}, + /* A360-A36F */ + {0xA348,0xA360,0x03B5}, + {0xA349,0xA361,0x03B6}, + {0xA34A,0xA362,0x03B7}, + {0xA34B,0xA363,0x03B8}, + {0xA34C,0xA364,0x03B9}, + {0xA34D,0xA365,0x03BA}, + {0xA34E,0xA366,0x03BB}, + {0xA34F,0xA367,0x03BC}, + {0xA350,0xA368,0x03BD}, + {0xA351,0xA369,0x03BE}, + {0xA352,0xA36A,0x03BF}, + {0xA353,0xA36B,0x03C0}, + {0xA354,0xA36C,0x03C1}, + {0xA355,0xA36D,0x03C3}, + {0xA356,0xA36E,0x03C4}, + {0xA357,0xA36F,0x03C5}, + /* A370-A37F */ + {0xA358,0xA370,0x03C6}, + {0xA359,0xA371,0x03C7}, + {0xA35A,0xA372,0x03C8}, + {0xA35B,0xA373,0x03C9}, + {0xA374,0xA374,0x3105}, + {0xA375,0xA375,0x3106}, + {0xA376,0xA376,0x3107}, + {0xA377,0xA377,0x3108}, + {0xA378,0xA378,0x3109}, + {0xA379,0xA379,0x310A}, + {0xA37A,0xA37A,0x310B}, + {0xA37B,0xA37B,0x310C}, + {0xA37C,0xA37C,0x310D}, + {0xA37D,0xA37D,0x310E}, + {0xA37E,0xA37E,0x310F}, + {0x0000,0x0000,0x0000}, + /* A380-A38F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A390-A39F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* A3A0-A3AF */ + {0x0000,0x0000,0x0000}, + {0xA3A1,0xA3A1,0x3110}, + {0xA3A2,0xA3A2,0x3111}, + {0xA3A3,0xA3A3,0x3112}, + {0xA3A4,0xA3A4,0x3113}, + {0xA3A5,0xA3A5,0x3114}, + {0xA3A6,0xA3A6,0x3115}, + {0xA3A7,0xA3A7,0x3116}, + {0xA3A8,0xA3A8,0x3117}, + {0xA3A9,0xA3A9,0x3118}, + {0xA3AA,0xA3AA,0x3119}, + {0xA3AB,0xA3AB,0x311A}, + {0xA3AC,0xA3AC,0x311B}, + {0xA3AD,0xA3AD,0x311C}, + {0xA3AE,0xA3AE,0x311D}, + {0xA3AF,0xA3AF,0x311E}, + /* A3B0-A3BF */ + {0xA3B0,0xA3B0,0x311F}, + {0xA3B1,0xA3B1,0x3120}, + {0xA3B2,0xA3B2,0x3121}, + {0xA3B3,0xA3B3,0x3122}, + {0xA3B4,0xA3B4,0x3123}, + {0xA3B5,0xA3B5,0x3124}, + {0xA3B6,0xA3B6,0x3125}, + {0xA3B7,0xA3B7,0x3126}, + {0xA3B8,0xA3B8,0x3127}, + {0xA3B9,0xA3B9,0x3128}, + {0xA3BA,0xA3BA,0x3129}, + {0xA3BB,0xA3BB,0x02D9}, + {0xA3BC,0xA3BC,0x02C9}, + {0xA3BD,0xA3BD,0x02CA}, + {0xA3BE,0xA3BE,0x02C7}, + {0xA3BF,0xA3BF,0x02CB}, + /* A3C0-A3CF */ + {0xA3C0,0xA3C0,0x003F}, + {0xA3C1,0xA3C1,0x003F}, + {0xA3C2,0xA3C2,0x003F}, + {0xA3C3,0xA3C3,0x003F}, + {0xA3C4,0xA3C4,0x003F}, + {0xA3C5,0xA3C5,0x003F}, + {0xA3C6,0xA3C6,0x003F}, + {0xA3C7,0xA3C7,0x003F}, + {0xA3C8,0xA3C8,0x003F}, + {0xA3C9,0xA3C9,0x003F}, + {0xA3CA,0xA3CA,0x003F}, + {0xA3CB,0xA3CB,0x003F}, + {0xA3CC,0xA3CC,0x003F}, + {0xA3CD,0xA3CD,0x003F}, + {0xA3CE,0xA3CE,0x003F}, + {0xA3CF,0xA3CF,0x003F}, + /* A3D0-A3DF */ + {0xA3D0,0xA3D0,0x003F}, + {0xA3D1,0xA3D1,0x003F}, + {0xA3D2,0xA3D2,0x003F}, + {0xA3D3,0xA3D3,0x003F}, + {0xA3D4,0xA3D4,0x003F}, + {0xA3D5,0xA3D5,0x003F}, + {0xA3D6,0xA3D6,0x003F}, + {0xA3D7,0xA3D7,0x003F}, + {0xA3D8,0xA3D8,0x003F}, + {0xA3D9,0xA3D9,0x003F}, + {0xA3DA,0xA3DA,0x003F}, + {0xA3DB,0xA3DB,0x003F}, + {0xA3DC,0xA3DC,0x003F}, + {0xA3DD,0xA3DD,0x003F}, + {0xA3DE,0xA3DE,0x003F}, + {0xA3DF,0xA3DF,0x003F}, + /* A3E0-A3EF */ + {0xA3E0,0xA3E0,0x003F}, + {0xA3E1,0xA3E1,0x003F}, + {0xA3E2,0xA3E2,0x003F}, + {0xA3E3,0xA3E3,0x003F}, + {0xA3E4,0xA3E4,0x003F}, + {0xA3E5,0xA3E5,0x003F}, + {0xA3E6,0xA3E6,0x003F}, + {0xA3E7,0xA3E7,0x003F}, + {0xA3E8,0xA3E8,0x003F}, + {0xA3E9,0xA3E9,0x003F}, + {0xA3EA,0xA3EA,0x003F}, + {0xA3EB,0xA3EB,0x003F}, + {0xA3EC,0xA3EC,0x003F}, + {0xA3ED,0xA3ED,0x003F}, + {0xA3EE,0xA3EE,0x003F}, + {0xA3EF,0xA3EF,0x003F}, + /* A3F0-A3FF */ + {0xA3F0,0xA3F0,0x003F}, + {0xA3F1,0xA3F1,0x003F}, + {0xA3F2,0xA3F2,0x003F}, + {0xA3F3,0xA3F3,0x003F}, + {0xA3F4,0xA3F4,0x003F}, + {0xA3F5,0xA3F5,0x003F}, + {0xA3F6,0xA3F6,0x003F}, + {0xA3F7,0xA3F7,0x003F}, + {0xA3F8,0xA3F8,0x003F}, + {0xA3F9,0xA3F9,0x003F}, + {0xA3FA,0xA3FA,0x003F}, + {0xA3FB,0xA3FB,0x003F}, + {0xA3FC,0xA3FC,0x003F}, + {0xA3FD,0xA3FD,0x003F}, + {0xA3FE,0xA3FE,0x003F}, + {0x0000,0x0000,0x0000} +}; + + +static MY_UNICASE_INFO cC7[256]= +{ + /* C700-C70F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* C710-C71F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* C720-C72F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* C730-C73F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* C740-C74F */ + {0xC740,0xC740,0x30A8}, + {0xC741,0xC741,0x30A9}, + {0xC742,0xC742,0x30AA}, + {0xC743,0xC743,0x30AB}, + {0xC744,0xC744,0x30AC}, + {0xC745,0xC745,0x30AD}, + {0xC746,0xC746,0x30AE}, + {0xC747,0xC747,0x30AF}, + {0xC748,0xC748,0x30B0}, + {0xC749,0xC749,0x30B1}, + {0xC74A,0xC74A,0x30B2}, + {0xC74B,0xC74B,0x30B3}, + {0xC74C,0xC74C,0x30B4}, + {0xC74D,0xC74D,0x30B5}, + {0xC74E,0xC74E,0x30B6}, + {0xC74F,0xC74F,0x30B7}, + /* C750-C75F */ + {0xC750,0xC750,0x30B8}, + {0xC751,0xC751,0x30B9}, + {0xC752,0xC752,0x30BA}, + {0xC753,0xC753,0x30BB}, + {0xC754,0xC754,0x30BC}, + {0xC755,0xC755,0x30BD}, + {0xC756,0xC756,0x30BE}, + {0xC757,0xC757,0x30BF}, + {0xC758,0xC758,0x30C0}, + {0xC759,0xC759,0x30C1}, + {0xC75A,0xC75A,0x30C2}, + {0xC75B,0xC75B,0x30C3}, + {0xC75C,0xC75C,0x30C4}, + {0xC75D,0xC75D,0x30C5}, + {0xC75E,0xC75E,0x30C6}, + {0xC75F,0xC75F,0x30C7}, + /* C760-C76F */ + {0xC760,0xC760,0x30C8}, + {0xC761,0xC761,0x30C9}, + {0xC762,0xC762,0x30CA}, + {0xC763,0xC763,0x30CB}, + {0xC764,0xC764,0x30CC}, + {0xC765,0xC765,0x30CD}, + {0xC766,0xC766,0x30CE}, + {0xC767,0xC767,0x30CF}, + {0xC768,0xC768,0x30D0}, + {0xC769,0xC769,0x30D1}, + {0xC76A,0xC76A,0x30D2}, + {0xC76B,0xC76B,0x30D3}, + {0xC76C,0xC76C,0x30D4}, + {0xC76D,0xC76D,0x30D5}, + {0xC76E,0xC76E,0x30D6}, + {0xC76F,0xC76F,0x30D7}, + /* C770-C77F */ + {0xC770,0xC770,0x30D8}, + {0xC771,0xC771,0x30D9}, + {0xC772,0xC772,0x30DA}, + {0xC773,0xC773,0x30DB}, + {0xC774,0xC774,0x30DC}, + {0xC775,0xC775,0x30DD}, + {0xC776,0xC776,0x30DE}, + {0xC777,0xC777,0x30DF}, + {0xC778,0xC778,0x30E0}, + {0xC779,0xC779,0x30E1}, + {0xC77A,0xC77A,0x30E2}, + {0xC77B,0xC77B,0x30E3}, + {0xC77C,0xC77C,0x30E4}, + {0xC77D,0xC77D,0x30E5}, + {0xC77E,0xC77E,0x30E6}, + {0x0000,0x0000,0x0000}, + /* C780-C78F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* C790-C79F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* C7A0-C7AF */ + {0x0000,0x0000,0x0000}, + {0xC7A1,0xC7A1,0x30E7}, + {0xC7A2,0xC7A2,0x30E8}, + {0xC7A3,0xC7A3,0x30E9}, + {0xC7A4,0xC7A4,0x30EA}, + {0xC7A5,0xC7A5,0x30EB}, + {0xC7A6,0xC7A6,0x30EC}, + {0xC7A7,0xC7A7,0x30ED}, + {0xC7A8,0xC7A8,0x30EE}, + {0xC7A9,0xC7A9,0x30EF}, + {0xC7AA,0xC7AA,0x30F0}, + {0xC7AB,0xC7AB,0x30F1}, + {0xC7AC,0xC7AC,0x30F2}, + {0xC7AD,0xC7AD,0x30F3}, + {0xC7AE,0xC7AE,0x30F4}, + {0xC7AF,0xC7AF,0x30F5}, + /* C7B0-C7BF */ + {0xC7B0,0xC7B0,0x30F6}, + {0xC7B1,0xC7CC,0x0414}, + {0xC7B2,0xC7CD,0x0415}, + {0xC7B3,0xC7CE,0x0401}, + {0xC7B4,0xC7CF,0x0416}, + {0xC7B5,0xC7D0,0x0417}, + {0xC7B6,0xC7D1,0x0418}, + {0xC7B7,0xC7D2,0x0419}, + {0xC7B8,0xC7D3,0x041A}, + {0xC7B9,0xC7D4,0x041B}, + {0xC7BA,0xC7D5,0x041C}, + {0xC7BB,0xC7DC,0x0423}, + {0xC7BC,0xC7DD,0x0424}, + {0xC7BD,0xC7DE,0x0425}, + {0xC7BE,0xC7DF,0x0426}, + {0xC7BF,0xC7E0,0x0427}, + /* C7C0-C7CF */ + {0xC7C0,0xC7E1,0x0428}, + {0xC7C1,0xC7E2,0x0429}, + {0xC7C2,0xC7E3,0x042A}, + {0xC7C3,0xC7E4,0x042B}, + {0xC7C4,0xC7E5,0x042C}, + {0xC7C5,0xC7E6,0x042D}, + {0xC7C6,0xC7E7,0x042E}, + {0xC7C7,0xC7E8,0x042F}, + {0xC7C8,0xC7C8,0x0430}, + {0xC7C9,0xC7C9,0x0431}, + {0xC7CA,0xC7CA,0x0432}, + {0xC7CB,0xC7CB,0x0433}, + {0xC7B1,0xC7CC,0x0434}, + {0xC7B2,0xC7CD,0x0435}, + {0xC7B3,0xC7CE,0x0451}, + {0xC7B4,0xC7CF,0x0436}, + /* C7D0-C7DF */ + {0xC7B5,0xC7D0,0x0437}, + {0xC7B6,0xC7D1,0x0438}, + {0xC7B7,0xC7D2,0x0439}, + {0xC7B8,0xC7D3,0x043A}, + {0xC7B9,0xC7D4,0x043B}, + {0xC7BA,0xC7D5,0x043C}, + {0xC7D6,0xC7D6,0x043D}, + {0xC7D7,0xC7D7,0x043E}, + {0xC7D8,0xC7D8,0x043F}, + {0xC7D9,0xC7D9,0x0440}, + {0xC7DA,0xC7DA,0x0441}, + {0xC7DB,0xC7DB,0x0442}, + {0xC7BB,0xC7DC,0x0443}, + {0xC7BC,0xC7DD,0x0444}, + {0xC7BD,0xC7DE,0x0445}, + {0xC7BE,0xC7DF,0x0446}, + /* C7E0-C7EF */ + {0xC7BF,0xC7E0,0x0447}, + {0xC7C0,0xC7E1,0x0448}, + {0xC7C1,0xC7E2,0x0449}, + {0xC7C2,0xC7E3,0x044A}, + {0xC7C3,0xC7E4,0x044B}, + {0xC7C4,0xC7E5,0x044C}, + {0xC7C5,0xC7E6,0x044D}, + {0xC7C6,0xC7E7,0x044E}, + {0xC7C7,0xC7E8,0x044F}, + {0xC7E9,0xC7E9,0x2460}, + {0xC7EA,0xC7EA,0x2461}, + {0xC7EB,0xC7EB,0x2462}, + {0xC7EC,0xC7EC,0x2463}, + {0xC7ED,0xC7ED,0x2464}, + {0xC7EE,0xC7EE,0x2465}, + {0xC7EF,0xC7EF,0x2466}, + /* C7F0-C7FF */ + {0xC7F0,0xC7F0,0x2467}, + {0xC7F1,0xC7F1,0x2468}, + {0xC7F2,0xC7F2,0x2469}, + {0xC7F3,0xC7F3,0x2474}, + {0xC7F4,0xC7F4,0x2475}, + {0xC7F5,0xC7F5,0x2476}, + {0xC7F6,0xC7F6,0x2477}, + {0xC7F7,0xC7F7,0x2478}, + {0xC7F8,0xC7F8,0x2479}, + {0xC7F9,0xC7F9,0x247A}, + {0xC7FA,0xC7FA,0x247B}, + {0xC7FB,0xC7FB,0x247C}, + {0xC7FC,0xC7FC,0x247D}, + {0xC7FD,0xC7FD,0x003F}, + {0xC7FE,0xC7FE,0x003F}, + {0x0000,0x0000,0x0000} +}; + + +static MY_UNICASE_INFO *my_caseinfo_big5[256]= +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, cA2, cA3, NULL, NULL, NULL, NULL, /* A */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, cC7, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +}; + + static uint16 big5strokexfrm(uint16 i) { if ((i == 0xA440) || (i == 0xA441)) return 0xA440; @@ -6393,7 +7010,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_big5, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ @@ -6426,7 +7043,7 @@ CHARSET_INFO my_charset_big5_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_big5, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 07191c436b7..f36f93b5527 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -197,6 +197,1512 @@ static uint mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) #define cp932code(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d)) +static MY_UNICASE_INFO c81[256]= +{ + /* 8100-810F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8110-811F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8120-812F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8130-813F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8140,0x8140,0x3000}, /* 8140-814F */ + {0x8141,0x8141,0x3001}, + {0x8142,0x8142,0x3002}, + {0x8143,0x8143,0xFF0C}, + {0x8144,0x8144,0xFF0E}, + {0x8145,0x8145,0x30FB}, + {0x8146,0x8146,0xFF1A}, + {0x8147,0x8147,0xFF1B}, + {0x8148,0x8148,0xFF1F}, + {0x8149,0x8149,0xFF01}, + {0x814A,0x814A,0x309B}, + {0x814B,0x814B,0x309C}, + {0x814C,0x814C,0x00B4}, + {0x814D,0x814D,0xFF40}, + {0x814E,0x814E,0x00A8}, + {0x814F,0x814F,0xFF3E}, + {0x8150,0x8150,0xFFE3}, /* 8150-815F */ + {0x8151,0x8151,0xFF3F}, + {0x8152,0x8152,0x30FD}, + {0x8153,0x8153,0x30FE}, + {0x8154,0x8154,0x309D}, + {0x8155,0x8155,0x309E}, + {0x8156,0x8156,0x3003}, + {0x8157,0x8157,0x4EDD}, + {0x8158,0x8158,0x3005}, + {0x8159,0x8159,0x3006}, + {0x815A,0x815A,0x3007}, + {0x815B,0x815B,0x30FC}, + {0x815C,0x815C,0x2015}, + {0x815D,0x815D,0x2010}, + {0x815E,0x815E,0xFF0F}, + {0x815F,0x815F,0xFF3C}, + {0x8160,0x8160,0xFF5E}, /* 8160-816F */ + {0x8161,0x8161,0x2225}, + {0x8162,0x8162,0xFF5C}, + {0x8163,0x8163,0x2026}, + {0x8164,0x8164,0x2025}, + {0x8165,0x8165,0x2018}, + {0x8166,0x8166,0x2019}, + {0x8167,0x8167,0x201C}, + {0x8168,0x8168,0x201D}, + {0x8169,0x8169,0xFF08}, + {0x816A,0x816A,0xFF09}, + {0x816B,0x816B,0x3014}, + {0x816C,0x816C,0x3015}, + {0x816D,0x816D,0xFF3B}, + {0x816E,0x816E,0xFF3D}, + {0x816F,0x816F,0xFF5B}, + {0x8170,0x8170,0xFF5D}, /* 8170-817F */ + {0x8171,0x8171,0x3008}, + {0x8172,0x8172,0x3009}, + {0x8173,0x8173,0x300A}, + {0x8174,0x8174,0x300B}, + {0x8175,0x8175,0x300C}, + {0x8176,0x8176,0x300D}, + {0x8177,0x8177,0x300E}, + {0x8178,0x8178,0x300F}, + {0x8179,0x8179,0x3010}, + {0x817A,0x817A,0x3011}, + {0x817B,0x817B,0xFF0B}, + {0x817C,0x817C,0xFF0D}, + {0x817D,0x817D,0x00B1}, + {0x817E,0x817E,0x00D7}, + {0,0,0}, + {0x8180,0x8180,0x00F7}, /* 8180-818F */ + {0x8181,0x8181,0xFF1D}, + {0x8182,0x8182,0x2260}, + {0x8183,0x8183,0xFF1C}, + {0x8184,0x8184,0xFF1E}, + {0x8185,0x8185,0x2266}, + {0x8186,0x8186,0x2267}, + {0x8187,0x8187,0x221E}, + {0x8188,0x8188,0x2234}, + {0x8189,0x8189,0x2642}, + {0x818A,0x818A,0x2640}, + {0x818B,0x818B,0x00B0}, + {0x818C,0x818C,0x2032}, + {0x818D,0x818D,0x2033}, + {0x818E,0x818E,0x2103}, + {0x818F,0x818F,0xFFE5}, + {0x8190,0x8190,0xFF04}, /* 8190-819F*/ + {0x8191,0x8191,0xFFE0}, + {0x8192,0x8192,0xFFE1}, + {0x8193,0x8193,0xFF05}, + {0x8194,0x8194,0xFF03}, + {0x8195,0x8195,0xFF06}, + {0x8196,0x8196,0xFF0A}, + {0x8197,0x8197,0xFF20}, + {0x8198,0x8198,0x00A7}, + {0x8199,0x8199,0x2606}, + {0x819A,0x819A,0x2605}, + {0x819B,0x819B,0x25CB}, + {0x819C,0x819C,0x25CF}, + {0x819D,0x819D,0x25CE}, + {0x819E,0x819E,0x25C7}, + {0x819F,0x819F,0x25C6}, + {0x81A0,0x81A0,0x25A1}, /* 81A0-81AF */ + {0x81A1,0x81A1,0x25A0}, + {0x81A2,0x81A2,0x25B3}, + {0x81A3,0x81A3,0x25B2}, + {0x81A4,0x81A4,0x25BD}, + {0x81A5,0x81A5,0x25BC}, + {0x81A6,0x81A6,0x203B}, + {0x81A7,0x81A7,0x3012}, + {0x81A8,0x81A8,0x2192}, + {0x81A9,0x81A9,0x2190}, + {0x81AA,0x81AA,0x2191}, + {0x81AB,0x81AB,0x2193}, + {0x81AC,0x81AC,0x3013}, + {0x81AD,0x81AD,0x003F}, + {0x81AE,0x81AE,0x003F}, + {0x81AF,0x81AF,0x003F}, + {0x81B0,0x81B0,0x003F}, /* 81B0-81BF */ + {0x81B1,0x81B1,0x003F}, + {0x81B2,0x81B2,0x003F}, + {0x81B3,0x81B3,0x003F}, + {0x81B4,0x81B4,0x003F}, + {0x81B5,0x81B5,0x003F}, + {0x81B6,0x81B6,0x003F}, + {0x81B7,0x81B7,0x003F}, + {0x81B8,0x81B8,0x2208}, + {0x81B9,0x81B9,0x220B}, + {0x81BA,0x81BA,0x2286}, + {0x81BB,0x81BB,0x2287}, + {0x81BC,0x81BC,0x2282}, + {0x81BD,0x81BD,0x2283}, + {0x81BE,0x81BE,0x222A}, + {0x81BF,0x81BF,0x2229}, + {0x81C0,0x81C0,0x003F}, /* 81C0-81CF */ + {0x81C1,0x81C1,0x003F}, + {0x81C2,0x81C2,0x003F}, + {0x81C3,0x81C3,0x003F}, + {0x81C4,0x81C4,0x003F}, + {0x81C5,0x81C5,0x003F}, + {0x81C6,0x81C6,0x003F}, + {0x81C7,0x81C7,0x003F}, + {0x81C8,0x81C8,0x2227}, + {0x81C9,0x81C9,0x2228}, + {0x81CA,0x81CA,0xFFE2}, + {0x81CB,0x81CB,0x21D2}, + {0x81CC,0x81CC,0x21D4}, + {0x81CD,0x81CD,0x2200}, + {0x81CE,0x81CE,0x2203}, + {0x81CF,0x81CF,0x003F}, + {0x81D0,0x81D0,0x003F}, /* 81D0-81DF */ + {0x81D1,0x81D1,0x003F}, + {0x81D2,0x81D2,0x003F}, + {0x81D3,0x81D3,0x003F}, + {0x81D4,0x81D4,0x003F}, + {0x81D5,0x81D5,0x003F}, + {0x81D6,0x81D6,0x003F}, + {0x81D7,0x81D7,0x003F}, + {0x81D8,0x81D8,0x003F}, + {0x81D9,0x81D9,0x003F}, + {0x81DA,0x81DA,0x2220}, + {0x81DB,0x81DB,0x22A5}, + {0x81DC,0x81DC,0x2312}, + {0x81DD,0x81DD,0x2202}, + {0x81DE,0x81DE,0x2207}, + {0x81DF,0x81DF,0x2261}, + {0x81E0,0x81E0,0x2252}, /* 81E0-81EF */ + {0x81E1,0x81E1,0x226A}, + {0x81E2,0x81E2,0x226B}, + {0x81E3,0x81E3,0x221A}, + {0x81E4,0x81E4,0x223D}, + {0x81E5,0x81E5,0x221D}, + {0x81E6,0x81E6,0x2235}, + {0x81E7,0x81E7,0x222B}, + {0x81E8,0x81E8,0x222C}, + {0x81E9,0x81E9,0x003F}, + {0x81EA,0x81EA,0x003F}, + {0x81EB,0x81EB,0x003F}, + {0x81EC,0x81EC,0x003F}, + {0x81ED,0x81ED,0x003F}, + {0x81EE,0x81EE,0x003F}, + {0x81EF,0x81EF,0x003F}, + {0x81F0,0x81F0,0x212B}, /* 81F0-81FF */ + {0x81F1,0x81F1,0x2030}, + {0x81F2,0x81F2,0x266F}, + {0x81F3,0x81F3,0x266D}, + {0x81F4,0x81F4,0x266A}, + {0x81F5,0x81F5,0x2020}, + {0x81F6,0x81F6,0x2021}, + {0x81F7,0x81F7,0x00B6}, + {0x81F8,0x81F8,0x003F}, + {0x81F9,0x81F9,0x003F}, + {0x81FA,0x81FA,0x003F}, + {0x81FB,0x81FB,0x003F}, + {0x81FC,0x81FC,0x25EF}, + {0,0,0}, + {0,0,0}, + {0,0,0}, +}; + + +static MY_UNICASE_INFO c82[256]= +{ + /* 8200-820F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8210-821F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8220-822F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8230-823F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8240,0x8240,0x003F}, /* 8240-824F */ + {0x8241,0x8241,0x003F}, + {0x8242,0x8242,0x003F}, + {0x8243,0x8243,0x003F}, + {0x8244,0x8244,0x003F}, + {0x8245,0x8245,0x003F}, + {0x8246,0x8246,0x003F}, + {0x8247,0x8247,0x003F}, + {0x8248,0x8248,0x003F}, + {0x8249,0x8249,0x003F}, + {0x824A,0x824A,0x003F}, + {0x824B,0x824B,0x003F}, + {0x824C,0x824C,0x003F}, + {0x824D,0x824D,0x003F}, + {0x824E,0x824E,0x003F}, + {0x824F,0x824F,0xFF10}, + {0x8250,0x8250,0xFF11}, /* 8250-825F */ + {0x8251,0x8251,0xFF12}, + {0x8252,0x8252,0xFF13}, + {0x8253,0x8253,0xFF14}, + {0x8254,0x8254,0xFF15}, + {0x8255,0x8255,0xFF16}, + {0x8256,0x8256,0xFF17}, + {0x8257,0x8257,0xFF18}, + {0x8258,0x8258,0xFF19}, + {0x8259,0x8259,0x003F}, + {0x825A,0x825A,0x003F}, + {0x825B,0x825B,0x003F}, + {0x825C,0x825C,0x003F}, + {0x825D,0x825D,0x003F}, + {0x825E,0x825E,0x003F}, + {0x825F,0x825F,0x003F}, + {0x8260,0x8281,0xFF21}, /* 8260-826F */ + {0x8261,0x8282,0xFF22}, + {0x8262,0x8283,0xFF23}, + {0x8263,0x8284,0xFF24}, + {0x8264,0x8285,0xFF25}, + {0x8265,0x8286,0xFF26}, + {0x8266,0x8287,0xFF27}, + {0x8267,0x8288,0xFF28}, + {0x8268,0x8289,0xFF29}, + {0x8269,0x828A,0xFF2A}, + {0x826A,0x828B,0xFF2B}, + {0x826B,0x828C,0xFF2C}, + {0x826C,0x828D,0xFF2D}, + {0x826D,0x828E,0xFF2E}, + {0x826E,0x828F,0xFF2F}, + {0x826F,0x8290,0xFF30}, + {0x8270,0x8291,0xFF31}, /* 8270-827F */ + {0x8271,0x8292,0xFF32}, + {0x8272,0x8293,0xFF33}, + {0x8273,0x8294,0xFF34}, + {0x8274,0x8295,0xFF35}, + {0x8275,0x8296,0xFF36}, + {0x8276,0x8297,0xFF37}, + {0x8277,0x8298,0xFF38}, + {0x8278,0x8299,0xFF39}, + {0x8279,0x829A,0xFF3A}, + {0x827A,0x827A,0x003F}, + {0x827B,0x827B,0x003F}, + {0x827C,0x827C,0x003F}, + {0x827D,0x827D,0x003F}, + {0x827E,0x827E,0x003F}, + {0,0,0}, + {0x8280,0x8280,0x003F}, /* 8280-828F */ + {0x8260,0x8281,0xFF41}, + {0x8261,0x8282,0xFF42}, + {0x8262,0x8283,0xFF43}, + {0x8263,0x8284,0xFF44}, + {0x8264,0x8285,0xFF45}, + {0x8265,0x8286,0xFF46}, + {0x8266,0x8287,0xFF47}, + {0x8267,0x8288,0xFF48}, + {0x8268,0x8289,0xFF49}, + {0x8269,0x828A,0xFF4A}, + {0x826A,0x828B,0xFF4B}, + {0x826B,0x828C,0xFF4C}, + {0x826C,0x828D,0xFF4D}, + {0x826D,0x828E,0xFF4E}, + {0x826E,0x828F,0xFF4F}, + {0x826F,0x8290,0xFF50}, /* 8290-829F */ + {0x8270,0x8291,0xFF51}, + {0x8271,0x8292,0xFF52}, + {0x8272,0x8293,0xFF53}, + {0x8273,0x8294,0xFF54}, + {0x8274,0x8295,0xFF55}, + {0x8275,0x8296,0xFF56}, + {0x8276,0x8297,0xFF57}, + {0x8277,0x8298,0xFF58}, + {0x8278,0x8299,0xFF59}, + {0x8279,0x829A,0xFF5A}, + {0x829B,0x829B,0x003F}, + {0x829C,0x829C,0x003F}, + {0x829D,0x829D,0x003F}, + {0x829E,0x829E,0x003F}, + {0x829F,0x829F,0x3041}, + {0x82A0,0x82A0,0x3042}, /* 82A0-82AF */ + {0x82A1,0x82A1,0x3043}, + {0x82A2,0x82A2,0x3044}, + {0x82A3,0x82A3,0x3045}, + {0x82A4,0x82A4,0x3046}, + {0x82A5,0x82A5,0x3047}, + {0x82A6,0x82A6,0x3048}, + {0x82A7,0x82A7,0x3049}, + {0x82A8,0x82A8,0x304A}, + {0x82A9,0x82A9,0x304B}, + {0x82AA,0x82AA,0x304C}, + {0x82AB,0x82AB,0x304D}, + {0x82AC,0x82AC,0x304E}, + {0x82AD,0x82AD,0x304F}, + {0x82AE,0x82AE,0x3050}, + {0x82AF,0x82AF,0x3051}, + {0x82B0,0x82B0,0x3052}, /* 82B0-82BF */ + {0x82B1,0x82B1,0x3053}, + {0x82B2,0x82B2,0x3054}, + {0x82B3,0x82B3,0x3055}, + {0x82B4,0x82B4,0x3056}, + {0x82B5,0x82B5,0x3057}, + {0x82B6,0x82B6,0x3058}, + {0x82B7,0x82B7,0x3059}, + {0x82B8,0x82B8,0x305A}, + {0x82B9,0x82B9,0x305B}, + {0x82BA,0x82BA,0x305C}, + {0x82BB,0x82BB,0x305D}, + {0x82BC,0x82BC,0x305E}, + {0x82BD,0x82BD,0x305F}, + {0x82BE,0x82BE,0x3060}, + {0x82BF,0x82BF,0x3061}, + {0x82C0,0x82C0,0x3062}, /* 82C0-82CF */ + {0x82C1,0x82C1,0x3063}, + {0x82C2,0x82C2,0x3064}, + {0x82C3,0x82C3,0x3065}, + {0x82C4,0x82C4,0x3066}, + {0x82C5,0x82C5,0x3067}, + {0x82C6,0x82C6,0x3068}, + {0x82C7,0x82C7,0x3069}, + {0x82C8,0x82C8,0x306A}, + {0x82C9,0x82C9,0x306B}, + {0x82CA,0x82CA,0x306C}, + {0x82CB,0x82CB,0x306D}, + {0x82CC,0x82CC,0x306E}, + {0x82CD,0x82CD,0x306F}, + {0x82CE,0x82CE,0x3070}, + {0x82CF,0x82CF,0x3071}, + {0x82D0,0x82D0,0x3072}, /* 82D0-82DF */ + {0x82D1,0x82D1,0x3073}, + {0x82D2,0x82D2,0x3074}, + {0x82D3,0x82D3,0x3075}, + {0x82D4,0x82D4,0x3076}, + {0x82D5,0x82D5,0x3077}, + {0x82D6,0x82D6,0x3078}, + {0x82D7,0x82D7,0x3079}, + {0x82D8,0x82D8,0x307A}, + {0x82D9,0x82D9,0x307B}, + {0x82DA,0x82DA,0x307C}, + {0x82DB,0x82DB,0x307D}, + {0x82DC,0x82DC,0x307E}, + {0x82DD,0x82DD,0x307F}, + {0x82DE,0x82DE,0x3080}, + {0x82DF,0x82DF,0x3081}, + {0x82E0,0x82E0,0x3082}, /* 82E0-82EF */ + {0x82E1,0x82E1,0x3083}, + {0x82E2,0x82E2,0x3084}, + {0x82E3,0x82E3,0x3085}, + {0x82E4,0x82E4,0x3086}, + {0x82E5,0x82E5,0x3087}, + {0x82E6,0x82E6,0x3088}, + {0x82E7,0x82E7,0x3089}, + {0x82E8,0x82E8,0x308A}, + {0x82E9,0x82E9,0x308B}, + {0x82EA,0x82EA,0x308C}, + {0x82EB,0x82EB,0x308D}, + {0x82EC,0x82EC,0x308E}, + {0x82ED,0x82ED,0x308F}, + {0x82EE,0x82EE,0x3090}, + {0x82EF,0x82EF,0x3091}, + {0x82F0,0x82F0,0x3092}, /* 82F0-82FF */ + {0x82F1,0x82F1,0x3093}, + {0x82F2,0x82F2,0x003F}, + {0x82F3,0x82F3,0x003F}, + {0x82F4,0x82F4,0x003F}, + {0x82F5,0x82F5,0x003F}, + {0x82F6,0x82F6,0x003F}, + {0x82F7,0x82F7,0x003F}, + {0x82F8,0x82F8,0x003F}, + {0x82F9,0x82F9,0x003F}, + {0x82FA,0x82FA,0x003F}, + {0x82FB,0x82FB,0x003F}, + {0x82FC,0x82FC,0x003F}, + {0,0,0} +}; + + +static MY_UNICASE_INFO c83[256]= +{ + /* 8300-830F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8310-831F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8320-832F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8330-833F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8340,0x8340,0x30A1}, /* 8340 */ + {0x8341,0x8341,0x30A2}, + {0x8342,0x8342,0x30A3}, + {0x8343,0x8343,0x30A4}, + {0x8344,0x8344,0x30A5}, + {0x8345,0x8345,0x30A6}, + {0x8346,0x8346,0x30A7}, + {0x8347,0x8347,0x30A8}, + {0x8348,0x8348,0x30A9}, + {0x8349,0x8349,0x30AA}, + {0x834A,0x834A,0x30AB}, + {0x834B,0x834B,0x30AC}, + {0x834C,0x834C,0x30AD}, + {0x834D,0x834D,0x30AE}, + {0x834E,0x834E,0x30AF}, + {0x834F,0x834F,0x30B0}, + {0x8350,0x8350,0x30B1}, /* 8350 */ + {0x8351,0x8351,0x30B2}, + {0x8352,0x8352,0x30B3}, + {0x8353,0x8353,0x30B4}, + {0x8354,0x8354,0x30B5}, + {0x8355,0x8355,0x30B6}, + {0x8356,0x8356,0x30B7}, + {0x8357,0x8357,0x30B8}, + {0x8358,0x8358,0x30B9}, + {0x8359,0x8359,0x30BA}, + {0x835A,0x835A,0x30BB}, + {0x835B,0x835B,0x30BC}, + {0x835C,0x835C,0x30BD}, + {0x835D,0x835D,0x30BE}, + {0x835E,0x835E,0x30BF}, + {0x835F,0x835F,0x30C0}, + {0x8360,0x8360,0x30C1}, /* 8360 */ + {0x8361,0x8361,0x30C2}, + {0x8362,0x8362,0x30C3}, + {0x8363,0x8363,0x30C4}, + {0x8364,0x8364,0x30C5}, + {0x8365,0x8365,0x30C6}, + {0x8366,0x8366,0x30C7}, + {0x8367,0x8367,0x30C8}, + {0x8368,0x8368,0x30C9}, + {0x8369,0x8369,0x30CA}, + {0x836A,0x836A,0x30CB}, + {0x836B,0x836B,0x30CC}, + {0x836C,0x836C,0x30CD}, + {0x836D,0x836D,0x30CE}, + {0x836E,0x836E,0x30CF}, + {0x836F,0x836F,0x30D0}, + {0x8370,0x8370,0x30D1}, /* 8370 */ + {0x8371,0x8371,0x30D2}, + {0x8372,0x8372,0x30D3}, + {0x8373,0x8373,0x30D4}, + {0x8374,0x8374,0x30D5}, + {0x8375,0x8375,0x30D6}, + {0x8376,0x8376,0x30D7}, + {0x8377,0x8377,0x30D8}, + {0x8378,0x8378,0x30D9}, + {0x8379,0x8379,0x30DA}, + {0x837A,0x837A,0x30DB}, + {0x837B,0x837B,0x30DC}, + {0x837C,0x837C,0x30DD}, + {0x837D,0x837D,0x30DE}, + {0x837E,0x837E,0x30DF}, + {0,0,0}, + {0x8380,0x8380,0x30E0}, /* 8380 */ + {0x8381,0x8381,0x30E1}, + {0x8382,0x8382,0x30E2}, + {0x8383,0x8383,0x30E3}, + {0x8384,0x8384,0x30E4}, + {0x8385,0x8385,0x30E5}, + {0x8386,0x8386,0x30E6}, + {0x8387,0x8387,0x30E7}, + {0x8388,0x8388,0x30E8}, + {0x8389,0x8389,0x30E9}, + {0x838A,0x838A,0x30EA}, + {0x838B,0x838B,0x30EB}, + {0x838C,0x838C,0x30EC}, + {0x838D,0x838D,0x30ED}, + {0x838E,0x838E,0x30EE}, + {0x838F,0x838F,0x30EF}, + {0x8390,0x8390,0x30F0}, /* 8390 */ + {0x8391,0x8391,0x30F1}, + {0x8392,0x8392,0x30F2}, + {0x8393,0x8393,0x30F3}, + {0x8394,0x8394,0x30F4}, + {0x8395,0x8395,0x30F5}, + {0x8396,0x8396,0x30F6}, + {0x8397,0x8397,0x003F}, + {0x8398,0x8398,0x003F}, + {0x8399,0x8399,0x003F}, + {0x839A,0x839A,0x003F}, + {0x839B,0x839B,0x003F}, + {0x839C,0x839C,0x003F}, + {0x839D,0x839D,0x003F}, + {0x839E,0x839E,0x003F}, + {0x839F,0x83BF,0x0391}, + {0x83A0,0x83C0,0x0392}, /* 83A0 */ + {0x83A1,0x83C1,0x0393}, + {0x83A2,0x83C2,0x0394}, + {0x83A3,0x83C3,0x0395}, + {0x83A4,0x83C4,0x0396}, + {0x83A5,0x83C5,0x0397}, + {0x83A6,0x83C6,0x0398}, + {0x83A7,0x83C7,0x0399}, + {0x83A8,0x83C8,0x039A}, + {0x83A9,0x83C9,0x039B}, + {0x83AA,0x83CA,0x039C}, + {0x83AB,0x83CB,0x039D}, + {0x83AC,0x83CC,0x039E}, + {0x83AD,0x83CD,0x039F}, + {0x83AE,0x83CE,0x03A0}, + {0x83AF,0x83CF,0x03A1}, + {0x83B0,0x83D0,0x03A3}, /* 83B0 */ + {0x83B1,0x83D1,0x03A4}, + {0x83B2,0x83D2,0x03A5}, + {0x83B3,0x83D3,0x03A6}, + {0x83B4,0x83D4,0x03A7}, + {0x83B5,0x83D5,0x03A8}, + {0x83B6,0x83D6,0x03A9}, + {0x83B7,0x83B7,0x003F}, + {0x83B8,0x83B8,0x003F}, + {0x83B9,0x83B9,0x003F}, + {0x83BA,0x83BA,0x003F}, + {0x83BB,0x83BB,0x003F}, + {0x83BC,0x83BC,0x003F}, + {0x83BD,0x83BD,0x003F}, + {0x83BE,0x83BE,0x003F}, + {0x839F,0x83BF,0x03B1}, + {0x83A0,0x83C0,0x03B2}, /* 83C0 */ + {0x83A1,0x83C1,0x03B3}, + {0x83A2,0x83C2,0x03B4}, + {0x83A3,0x83C3,0x03B5}, + {0x83A4,0x83C4,0x03B6}, + {0x83A5,0x83C5,0x03B7}, + {0x83A6,0x83C6,0x03B8}, + {0x83A7,0x83C7,0x03B9}, + {0x83A8,0x83C8,0x03BA}, + {0x83A9,0x83C9,0x03BB}, + {0x83AA,0x83CA,0x03BC}, + {0x83AB,0x83CB,0x03BD}, + {0x83AC,0x83CC,0x03BE}, + {0x83AD,0x83CD,0x03BF}, + {0x83AE,0x83CE,0x03C0}, + {0x83AF,0x83CF,0x03C1}, + {0x83B0,0x83D0,0x03C3}, /* 83D0 */ + {0x83B1,0x83D1,0x03C4}, + {0x83B2,0x83D2,0x03C5}, + {0x83B3,0x83D3,0x03C6}, + {0x83B4,0x83D4,0x03C7}, + {0x83B5,0x83D5,0x03C8}, + {0x83B6,0x83D6,0x03C9}, + {0x83D7,0x83D7,0x003F}, + {0x83D8,0x83D8,0x003F}, + {0x83D9,0x83D9,0x003F}, + {0x83DA,0x83DA,0x003F}, + {0x83DB,0x83DB,0x003F}, + {0x83DC,0x83DC,0x003F}, + {0x83DD,0x83DD,0x003F}, + {0x83DE,0x83DE,0x003F}, + {0x83DF,0x83DF,0x003F}, + {0x83E0,0x83E0,0x003F}, /* 83E0 */ + {0x83E1,0x83E1,0x003F}, + {0x83E2,0x83E2,0x003F}, + {0x83E3,0x83E3,0x003F}, + {0x83E4,0x83E4,0x003F}, + {0x83E5,0x83E5,0x003F}, + {0x83E6,0x83E6,0x003F}, + {0x83E7,0x83E7,0x003F}, + {0x83E8,0x83E8,0x003F}, + {0x83E9,0x83E9,0x003F}, + {0x83EA,0x83EA,0x003F}, + {0x83EB,0x83EB,0x003F}, + {0x83EC,0x83EC,0x003F}, + {0x83ED,0x83ED,0x003F}, + {0x83EE,0x83EE,0x003F}, + {0x83EF,0x83EF,0x003F}, + {0x83F0,0x83F0,0x003F}, /* 83F0 */ + {0x83F1,0x83F1,0x003F}, + {0x83F2,0x83F2,0x003F}, + {0x83F3,0x83F3,0x003F}, + {0x83F4,0x83F4,0x003F}, + {0x83F5,0x83F5,0x003F}, + {0x83F6,0x83F6,0x003F}, + {0x83F7,0x83F7,0x003F}, + {0x83F8,0x83F8,0x003F}, + {0x83F9,0x83F9,0x003F}, + {0x83FA,0x83FA,0x003F}, + {0x83FB,0x83FB,0x003F}, + {0x83FC,0x83FC,0x003F}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO c84[256]= +{ + /* 8400-840F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8410-841F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8420-842F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8430-843F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8440,0x8470,0x0410}, /* 8440 */ + {0x8441,0x8471,0x0411}, + {0x8442,0x8472,0x0412}, + {0x8443,0x8473,0x0413}, + {0x8444,0x8474,0x0414}, + {0x8445,0x8475,0x0415}, + {0x8446,0x8476,0x0401}, + {0x8447,0x8477,0x0416}, + {0x8448,0x8478,0x0417}, + {0x8449,0x8479,0x0418}, + {0x844A,0x847A,0x0419}, + {0x844B,0x847B,0x041A}, + {0x844C,0x847C,0x041B}, + {0x844D,0x847D,0x041C}, + {0x844E,0x847E,0x041D}, + {0x844F,0x8480,0x041E}, + {0x8450,0x8481,0x041F}, /* 8450 */ + {0x8451,0x8482,0x0420}, + {0x8452,0x8483,0x0421}, + {0x8453,0x8484,0x0422}, + {0x8454,0x8485,0x0423}, + {0x8455,0x8486,0x0424}, + {0x8456,0x8487,0x0425}, + {0x8457,0x8488,0x0426}, + {0x8458,0x8489,0x0427}, + {0x8459,0x848A,0x0428}, + {0x845A,0x848B,0x0429}, + {0x845B,0x848C,0x042A}, + {0x845C,0x848D,0x042B}, + {0x845D,0x848E,0x042C}, + {0x845E,0x848F,0x042D}, + {0x845F,0x8490,0x042E}, + {0x8460,0x8491,0x042F}, /* 8460 */ + {0x8461,0x8461,0x003F}, + {0x8462,0x8462,0x003F}, + {0x8463,0x8463,0x003F}, + {0x8464,0x8464,0x003F}, + {0x8465,0x8465,0x003F}, + {0x8466,0x8466,0x003F}, + {0x8467,0x8467,0x003F}, + {0x8468,0x8468,0x003F}, + {0x8469,0x8469,0x003F}, + {0x846A,0x846A,0x003F}, + {0x846B,0x846B,0x003F}, + {0x846C,0x846C,0x003F}, + {0x846D,0x846D,0x003F}, + {0x846E,0x846E,0x003F}, + {0x846F,0x846F,0x003F}, + {0x8440,0x8470,0x0430}, /* 8470 */ + {0x8441,0x8471,0x0431}, + {0x8442,0x8472,0x0432}, + {0x8443,0x8473,0x0433}, + {0x8444,0x8474,0x0434}, + {0x8445,0x8475,0x0435}, + {0x8446,0x8476,0x0451}, + {0x8447,0x8477,0x0436}, + {0x8448,0x8478,0x0437}, + {0x8449,0x8479,0x0438}, + {0x844A,0x847A,0x0439}, + {0x844B,0x847B,0x043A}, + {0x844C,0x847C,0x043B}, + {0x844D,0x847D,0x043C}, + {0x844E,0x847E,0x043D}, + {0,0,0}, + {0x844F,0x8480,0x043E}, /* 8480 */ + {0x8450,0x8481,0x043F}, + {0x8451,0x8482,0x0440}, + {0x8452,0x8483,0x0441}, + {0x8453,0x8484,0x0442}, + {0x8454,0x8485,0x0443}, + {0x8455,0x8486,0x0444}, + {0x8456,0x8487,0x0445}, + {0x8457,0x8488,0x0446}, + {0x8458,0x8489,0x0447}, + {0x8459,0x848A,0x0448}, + {0x845A,0x848B,0x0449}, + {0x845B,0x848C,0x044A}, + {0x845C,0x848D,0x044B}, + {0x845D,0x848E,0x044C}, + {0x845E,0x848F,0x044D}, + {0x845F,0x8490,0x044E}, /* 8490 */ + {0x8460,0x8491,0x044F}, + {0x8492,0x8492,0x003F}, + {0x8493,0x8493,0x003F}, + {0x8494,0x8494,0x003F}, + {0x8495,0x8495,0x003F}, + {0x8496,0x8496,0x003F}, + {0x8497,0x8497,0x003F}, + {0x8498,0x8498,0x003F}, + {0x8499,0x8499,0x003F}, + {0x849A,0x849A,0x003F}, + {0x849B,0x849B,0x003F}, + {0x849C,0x849C,0x003F}, + {0x849D,0x849D,0x003F}, + {0x849E,0x849E,0x003F}, + {0x849F,0x849F,0x2500}, + {0x84A0,0x84A0,0x2502}, /* 84A0 */ + {0x84A1,0x84A1,0x250C}, + {0x84A2,0x84A2,0x2510}, + {0x84A3,0x84A3,0x2518}, + {0x84A4,0x84A4,0x2514}, + {0x84A5,0x84A5,0x251C}, + {0x84A6,0x84A6,0x252C}, + {0x84A7,0x84A7,0x2524}, + {0x84A8,0x84A8,0x2534}, + {0x84A9,0x84A9,0x253C}, + {0x84AA,0x84AA,0x2501}, + {0x84AB,0x84AB,0x2503}, + {0x84AC,0x84AC,0x250F}, + {0x84AD,0x84AD,0x2513}, + {0x84AE,0x84AE,0x251B}, + {0x84AF,0x84AF,0x2517}, + {0x84B0,0x84B0,0x2523}, /* 84B0 */ + {0x84B1,0x84B1,0x2533}, + {0x84B2,0x84B2,0x252B}, + {0x84B3,0x84B3,0x253B}, + {0x84B4,0x84B4,0x254B}, + {0x84B5,0x84B5,0x2520}, + {0x84B6,0x84B6,0x252F}, + {0x84B7,0x84B7,0x2528}, + {0x84B8,0x84B8,0x2537}, + {0x84B9,0x84B9,0x253F}, + {0x84BA,0x84BA,0x251D}, + {0x84BB,0x84BB,0x2530}, + {0x84BC,0x84BC,0x2525}, + {0x84BD,0x84BD,0x2538}, + {0x84BE,0x84BE,0x2542}, + {0x84BF,0x84BF,0x003F}, + {0x84C0,0x84C0,0x003F}, /* 84C0 */ + {0x84C1,0x84C1,0x003F}, + {0x84C2,0x84C2,0x003F}, + {0x84C3,0x84C3,0x003F}, + {0x84C4,0x84C4,0x003F}, + {0x84C5,0x84C5,0x003F}, + {0x84C6,0x84C6,0x003F}, + {0x84C7,0x84C7,0x003F}, + {0x84C8,0x84C8,0x003F}, + {0x84C9,0x84C9,0x003F}, + {0x84CA,0x84CA,0x003F}, + {0x84CB,0x84CB,0x003F}, + {0x84CC,0x84CC,0x003F}, + {0x84CD,0x84CD,0x003F}, + {0x84CE,0x84CE,0x003F}, + {0x84CF,0x84CF,0x003F}, + {0x84D0,0x84D0,0x003F}, /* 84D0 */ + {0x84D1,0x84D1,0x003F}, + {0x84D2,0x84D2,0x003F}, + {0x84D3,0x84D3,0x003F}, + {0x84D4,0x84D4,0x003F}, + {0x84D5,0x84D5,0x003F}, + {0x84D6,0x84D6,0x003F}, + {0x84D7,0x84D7,0x003F}, + {0x84D8,0x84D8,0x003F}, + {0x84D9,0x84D9,0x003F}, + {0x84DA,0x84DA,0x003F}, + {0x84DB,0x84DB,0x003F}, + {0x84DC,0x84DC,0x003F}, + {0x84DD,0x84DD,0x003F}, + {0x84DE,0x84DE,0x003F}, + {0x84DF,0x84DF,0x003F}, + {0x84E0,0x84E0,0x003F}, /* 84E0 */ + {0x84E1,0x84E1,0x003F}, + {0x84E2,0x84E2,0x003F}, + {0x84E3,0x84E3,0x003F}, + {0x84E4,0x84E4,0x003F}, + {0x84E5,0x84E5,0x003F}, + {0x84E6,0x84E6,0x003F}, + {0x84E7,0x84E7,0x003F}, + {0x84E8,0x84E8,0x003F}, + {0x84E9,0x84E9,0x003F}, + {0x84EA,0x84EA,0x003F}, + {0x84EB,0x84EB,0x003F}, + {0x84EC,0x84EC,0x003F}, + {0x84ED,0x84ED,0x003F}, + {0x84EE,0x84EE,0x003F}, + {0x84EF,0x84EF,0x003F}, + {0x84F0,0x84F0,0x003F}, /* 84F0 */ + {0x84F1,0x84F1,0x003F}, + {0x84F2,0x84F2,0x003F}, + {0x84F3,0x84F3,0x003F}, + {0x84F4,0x84F4,0x003F}, + {0x84F5,0x84F5,0x003F}, + {0x84F6,0x84F6,0x003F}, + {0x84F7,0x84F7,0x003F}, + {0x84F8,0x84F8,0x003F}, + {0x84F9,0x84F9,0x003F}, + {0x84FA,0x84FA,0x003F}, + {0x84FB,0x84FB,0x003F}, + {0x84FC,0x84FC,0x003F}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO c87[256]= +{ + /* 8700-870F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8710-871F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8720-872F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8730-873F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8740,0x8740,0x2460}, /* 8740 */ + {0x8741,0x8741,0x2461}, + {0x8742,0x8742,0x2462}, + {0x8743,0x8743,0x2463}, + {0x8744,0x8744,0x2464}, + {0x8745,0x8745,0x2465}, + {0x8746,0x8746,0x2466}, + {0x8747,0x8747,0x2467}, + {0x8748,0x8748,0x2468}, + {0x8749,0x8749,0x2469}, + {0x874A,0x874A,0x246A}, + {0x874B,0x874B,0x246B}, + {0x874C,0x874C,0x246C}, + {0x874D,0x874D,0x246D}, + {0x874E,0x874E,0x246E}, + {0x874F,0x874F,0x246F}, + {0x8750,0x8750,0x2470}, /* 8750 */ + {0x8751,0x8751,0x2471}, + {0x8752,0x8752,0x2472}, + {0x8753,0x8753,0x2473}, + {0x8754,0xEEEF,0x2160}, + {0x8755,0xEEF0,0x2161}, + {0x8756,0xEEF1,0x2162}, + {0x8757,0xEEF2,0x2163}, + {0x8758,0xEEF3,0x2164}, + {0x8759,0xEEF4,0x2165}, + {0x875A,0xEEF5,0x2166}, + {0x875B,0xEEF6,0x2167}, + {0x875C,0xEEF7,0x2168}, + {0x875D,0xEEF8,0x2169}, + {0x875E,0x875E,0x003F}, + {0x875F,0x875F,0x3349}, + {0x8760,0x8760,0x3314}, /* 8760 */ + {0x8761,0x8761,0x3322}, + {0x8762,0x8762,0x334D}, + {0x8763,0x8763,0x3318}, + {0x8764,0x8764,0x3327}, + {0x8765,0x8765,0x3303}, + {0x8766,0x8766,0x3336}, + {0x8767,0x8767,0x3351}, + {0x8768,0x8768,0x3357}, + {0x8769,0x8769,0x330D}, + {0x876A,0x876A,0x3326}, + {0x876B,0x876B,0x3323}, + {0x876C,0x876C,0x332B}, + {0x876D,0x876D,0x334A}, + {0x876E,0x876E,0x333B}, + {0x876F,0x876F,0x339C}, + {0x8770,0x8770,0x339D}, /* 8770 */ + {0x8771,0x8771,0x339E}, + {0x8772,0x8772,0x338E}, + {0x8773,0x8773,0x338F}, + {0x8774,0x8774,0x33C4}, + {0x8775,0x8775,0x33A1}, + {0x8776,0x8776,0x003F}, + {0x8777,0x8777,0x003F}, + {0x8778,0x8778,0x003F}, + {0x8779,0x8779,0x003F}, + {0x877A,0x877A,0x003F}, + {0x877B,0x877B,0x003F}, + {0x877C,0x877C,0x003F}, + {0x877D,0x877D,0x003F}, + {0x877E,0x877E,0x337B}, + {0,0,0}, + {0x8780,0x8780,0x301D}, /* 8780 */ + {0x8781,0x8781,0x301F}, + {0x8782,0x8782,0x2116}, + {0x8783,0x8783,0x33CD}, + {0x8784,0x8784,0x2121}, + {0x8785,0x8785,0x32A4}, + {0x8786,0x8786,0x32A5}, + {0x8787,0x8787,0x32A6}, + {0x8788,0x8788,0x32A7}, + {0x8789,0x8789,0x32A8}, + {0x878A,0x878A,0x3231}, + {0x878B,0x878B,0x3232}, + {0x878C,0x878C,0x3239}, + {0x878D,0x878D,0x337E}, + {0x878E,0x878E,0x337D}, + {0x878F,0x878F,0x337C}, + {0x8790,0x8790,0x2252}, /* 8790 */ + {0x8791,0x8791,0x2261}, + {0x8792,0x8792,0x222B}, + {0x8793,0x8793,0x222E}, + {0x8794,0x8794,0x2211}, + {0x8795,0x8795,0x221A}, + {0x8796,0x8796,0x22A5}, + {0x8797,0x8797,0x2220}, + {0x8798,0x8798,0x221F}, + {0x8799,0x8799,0x22BF}, + {0x879A,0x879A,0x2235}, + {0x879B,0x879B,0x2229}, + {0x879C,0x879C,0x222A}, + {0x879D,0x879D,0x003F}, + {0x879E,0x879E,0x003F}, + {0x879F,0x879F,0x003F}, + {0x87A0,0x87A0,0x003F}, /* 87A0 */ + {0x87A1,0x87A1,0x003F}, + {0x87A2,0x87A2,0x003F}, + {0x87A3,0x87A3,0x003F}, + {0x87A4,0x87A4,0x003F}, + {0x87A5,0x87A5,0x003F}, + {0x87A6,0x87A6,0x003F}, + {0x87A7,0x87A7,0x003F}, + {0x87A8,0x87A8,0x003F}, + {0x87A9,0x87A9,0x003F}, + {0x87AA,0x87AA,0x003F}, + {0x87AB,0x87AB,0x003F}, + {0x87AC,0x87AC,0x003F}, + {0x87AD,0x87AD,0x003F}, + {0x87AE,0x87AE,0x003F}, + {0x87AF,0x87AF,0x003F}, + {0x87B0,0x87B0,0x003F}, /* 87B0 */ + {0x87B1,0x87B1,0x003F}, + {0x87B2,0x87B2,0x003F}, + {0x87B3,0x87B3,0x003F}, + {0x87B4,0x87B4,0x003F}, + {0x87B5,0x87B5,0x003F}, + {0x87B6,0x87B6,0x003F}, + {0x87B7,0x87B7,0x003F}, + {0x87B8,0x87B8,0x003F}, + {0x87B9,0x87B9,0x003F}, + {0x87BA,0x87BA,0x003F}, + {0x87BB,0x87BB,0x003F}, + {0x87BC,0x87BC,0x003F}, + {0x87BD,0x87BD,0x003F}, + {0x87BE,0x87BE,0x003F}, + {0x87BF,0x87BF,0x003F}, + {0x87C0,0x87C0,0x003F}, /* 87C0 */ + {0x87C1,0x87C1,0x003F}, + {0x87C2,0x87C2,0x003F}, + {0x87C3,0x87C3,0x003F}, + {0x87C4,0x87C4,0x003F}, + {0x87C5,0x87C5,0x003F}, + {0x87C6,0x87C6,0x003F}, + {0x87C7,0x87C7,0x003F}, + {0x87C8,0x87C8,0x003F}, + {0x87C9,0x87C9,0x003F}, + {0x87CA,0x87CA,0x003F}, + {0x87CB,0x87CB,0x003F}, + {0x87CC,0x87CC,0x003F}, + {0x87CD,0x87CD,0x003F}, + {0x87CE,0x87CE,0x003F}, + {0x87CF,0x87CF,0x003F}, + {0x87D0,0x87D0,0x003F}, /* 87D0 */ + {0x87D1,0x87D1,0x003F}, + {0x87D2,0x87D2,0x003F}, + {0x87D3,0x87D3,0x003F}, + {0x87D4,0x87D4,0x003F}, + {0x87D5,0x87D5,0x003F}, + {0x87D6,0x87D6,0x003F}, + {0x87D7,0x87D7,0x003F}, + {0x87D8,0x87D8,0x003F}, + {0x87D9,0x87D9,0x003F}, + {0x87DA,0x87DA,0x003F}, + {0x87DB,0x87DB,0x003F}, + {0x87DC,0x87DC,0x003F}, + {0x87DD,0x87DD,0x003F}, + {0x87DE,0x87DE,0x003F}, + {0x87DF,0x87DF,0x003F}, + {0x87E0,0x87E0,0x003F}, /* 87E0 */ + {0x87E1,0x87E1,0x003F}, + {0x87E2,0x87E2,0x003F}, + {0x87E3,0x87E3,0x003F}, + {0x87E4,0x87E4,0x003F}, + {0x87E5,0x87E5,0x003F}, + {0x87E6,0x87E6,0x003F}, + {0x87E7,0x87E7,0x003F}, + {0x87E8,0x87E8,0x003F}, + {0x87E9,0x87E9,0x003F}, + {0x87EA,0x87EA,0x003F}, + {0x87EB,0x87EB,0x003F}, + {0x87EC,0x87EC,0x003F}, + {0x87ED,0x87ED,0x003F}, + {0x87EE,0x87EE,0x003F}, + {0x87EF,0x87EF,0x003F}, + {0x87F0,0x87F0,0x003F}, /* 87F0 */ + {0x87F1,0x87F1,0x003F}, + {0x87F2,0x87F2,0x003F}, + {0x87F3,0x87F3,0x003F}, + {0x87F4,0x87F4,0x003F}, + {0x87F5,0x87F5,0x003F}, + {0x87F6,0x87F6,0x003F}, + {0x87F7,0x87F7,0x003F}, + {0x87F8,0x87F8,0x003F}, + {0x87F9,0x87F9,0x003F}, + {0x87FA,0x87FA,0x003F}, + {0x87FB,0x87FB,0x003F}, + {0x87FC,0x87FC,0x003F}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO cEE[256]= +{ + /* EE00-EE0F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* EE10-EE1F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* EE20-EE2F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* EE30-EE3F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0xEE40,0xEE40,0x72BE}, /* EE40 */ + {0xEE41,0xEE41,0x7324}, + {0xEE42,0xEE42,0xFA16}, + {0xEE43,0xEE43,0x7377}, + {0xEE44,0xEE44,0x73BD}, + {0xEE45,0xEE45,0x73C9}, + {0xEE46,0xEE46,0x73D6}, + {0xEE47,0xEE47,0x73E3}, + {0xEE48,0xEE48,0x73D2}, + {0xEE49,0xEE49,0x7407}, + {0xEE4A,0xEE4A,0x73F5}, + {0xEE4B,0xEE4B,0x7426}, + {0xEE4C,0xEE4C,0x742A}, + {0xEE4D,0xEE4D,0x7429}, + {0xEE4E,0xEE4E,0x742E}, + {0xEE4F,0xEE4F,0x7462}, + + {0xEE50,0xEE50,0x7489}, /* EE50 */ + {0xEE51,0xEE51,0x749F}, + {0xEE52,0xEE52,0x7501}, + {0xEE53,0xEE53,0x756F}, + {0xEE54,0xEE54,0x7682}, + {0xEE55,0xEE55,0x769C}, + {0xEE56,0xEE56,0x769E}, + {0xEE57,0xEE57,0x769B}, + {0xEE58,0xEE58,0x76A6}, + {0xEE59,0xEE59,0xFA17}, + {0xEE5A,0xEE5A,0x7746}, + {0xEE5B,0xEE5B,0x52AF}, + {0xEE5C,0xEE5C,0x7821}, + {0xEE5D,0xEE5D,0x784E}, + {0xEE5E,0xEE5E,0x7864}, + {0xEE5F,0xEE5F,0x787A}, + {0xEE60,0xEE60,0x7930}, /* EE60 */ + {0xEE61,0xEE61,0xFA18}, + {0xEE62,0xEE62,0xFA19}, + {0xEE63,0xEE63,0xFA1A}, + {0xEE64,0xEE64,0x7994}, + {0xEE65,0xEE65,0xFA1B}, + {0xEE66,0xEE66,0x799B}, + {0xEE67,0xEE67,0x7AD1}, + {0xEE68,0xEE68,0x7AE7}, + {0xEE69,0xEE69,0xFA1C}, + {0xEE6A,0xEE6A,0x7AEB}, + {0xEE6B,0xEE6B,0x7B9E}, + {0xEE6C,0xEE6C,0xFA1D}, + {0xEE6D,0xEE6D,0x7D48}, + {0xEE6E,0xEE6E,0x7D5C}, + {0xEE6F,0xEE6F,0x7DB7}, + {0xEE70,0xEE70,0x7DA0}, /* EE70 */ + {0xEE71,0xEE71,0x7DD6}, + {0xEE72,0xEE72,0x7E52}, + {0xEE73,0xEE73,0x7F47}, + {0xEE74,0xEE74,0x7FA1}, + {0xEE75,0xEE75,0xFA1E}, + {0xEE76,0xEE76,0x8301}, + {0xEE77,0xEE77,0x8362}, + {0xEE78,0xEE78,0x837F}, + {0xEE79,0xEE79,0x83C7}, + {0xEE7A,0xEE7A,0x83F6}, + {0xEE7B,0xEE7B,0x8448}, + {0xEE7C,0xEE7C,0x84B4}, + {0xEE7D,0xEE7D,0x8553}, + {0xEE7E,0xEE7E,0x8559}, + {0,0,0}, + {0xEE80,0xEE80,0x856B}, /* EE80 */ + {0xEE81,0xEE81,0xFA1F}, + {0xEE82,0xEE82,0x85B0}, + {0xEE83,0xEE83,0xFA20}, + {0xEE84,0xEE84,0xFA21}, + {0xEE85,0xEE85,0x8807}, + {0xEE86,0xEE86,0x88F5}, + {0xEE87,0xEE87,0x8A12}, + {0xEE88,0xEE88,0x8A37}, + {0xEE89,0xEE89,0x8A79}, + {0xEE8A,0xEE8A,0x8AA7}, + {0xEE8B,0xEE8B,0x8ABE}, + {0xEE8C,0xEE8C,0x8ADF}, + {0xEE8D,0xEE8D,0xFA22}, + {0xEE8E,0xEE8E,0x8AF6}, + {0xEE8F,0xEE8F,0x8B53}, + {0xEE90,0xEE90,0x8B7F}, /* EE90 */ + {0xEE91,0xEE91,0x8CF0}, + {0xEE92,0xEE92,0x8CF4}, + {0xEE93,0xEE93,0x8D12}, + {0xEE94,0xEE94,0x8D76}, + {0xEE95,0xEE95,0xFA23}, + {0xEE96,0xEE96,0x8ECF}, + {0xEE97,0xEE97,0xFA24}, + {0xEE98,0xEE98,0xFA25}, + {0xEE99,0xEE99,0x9067}, + {0xEE9A,0xEE9A,0x90DE}, + {0xEE9B,0xEE9B,0xFA26}, + {0xEE9C,0xEE9C,0x9115}, + {0xEE9D,0xEE9D,0x9127}, + {0xEE9E,0xEE9E,0x91DA}, + {0xEE9F,0xEE9F,0x91D7}, + {0xEEA0,0xEEA0,0x91DE}, /* EEA0 */ + {0xEEA1,0xEEA1,0x91ED}, + {0xEEA2,0xEEA2,0x91EE}, + {0xEEA3,0xEEA3,0x91E4}, + {0xEEA4,0xEEA4,0x91E5}, + {0xEEA5,0xEEA5,0x9206}, + {0xEEA6,0xEEA6,0x9210}, + {0xEEA7,0xEEA7,0x920A}, + {0xEEA8,0xEEA8,0x923A}, + {0xEEA9,0xEEA9,0x9240}, + {0xEEAA,0xEEAA,0x923C}, + {0xEEAB,0xEEAB,0x924E}, + {0xEEAC,0xEEAC,0x9259}, + {0xEEAD,0xEEAD,0x9251}, + {0xEEAE,0xEEAE,0x9239}, + {0xEEAF,0xEEAF,0x9267}, + {0xEEB0,0xEEB0,0x92A7}, /* EEB0 */ + {0xEEB1,0xEEB1,0x9277}, + {0xEEB2,0xEEB2,0x9278}, + {0xEEB3,0xEEB3,0x92E7}, + {0xEEB4,0xEEB4,0x92D7}, + {0xEEB5,0xEEB5,0x92D9}, + {0xEEB6,0xEEB6,0x92D0}, + {0xEEB7,0xEEB7,0xFA27}, + {0xEEB8,0xEEB8,0x92D5}, + {0xEEB9,0xEEB9,0x92E0}, + {0xEEBA,0xEEBA,0x92D3}, + {0xEEBB,0xEEBB,0x9325}, + {0xEEBC,0xEEBC,0x9321}, + {0xEEBD,0xEEBD,0x92FB}, + {0xEEBE,0xEEBE,0xFA28}, + {0xEEBF,0xEEBF,0x931E}, + {0xEEC0,0xEEC0,0x92FF}, /* EEC0 */ + {0xEEC1,0xEEC1,0x931D}, + {0xEEC2,0xEEC2,0x9302}, + {0xEEC3,0xEEC3,0x9370}, + {0xEEC4,0xEEC4,0x9357}, + {0xEEC5,0xEEC5,0x93A4}, + {0xEEC6,0xEEC6,0x93C6}, + {0xEEC7,0xEEC7,0x93DE}, + {0xEEC8,0xEEC8,0x93F8}, + {0xEEC9,0xEEC9,0x9431}, + {0xEECA,0xEECA,0x9445}, + {0xEECB,0xEECB,0x9448}, + {0xEECC,0xEECC,0x9592}, + {0xEECD,0xEECD,0xF9DC}, + {0xEECE,0xEECE,0xFA29}, + {0xEECF,0xEECF,0x969D}, + {0xEED0,0xEED0,0x96AF}, /* EED0 */ + {0xEED1,0xEED1,0x9733}, + {0xEED2,0xEED2,0x973B}, + {0xEED3,0xEED3,0x9743}, + {0xEED4,0xEED4,0x974D}, + {0xEED5,0xEED5,0x974F}, + {0xEED6,0xEED6,0x9751}, + {0xEED7,0xEED7,0x9755}, + {0xEED8,0xEED8,0x9857}, + {0xEED9,0xEED9,0x9865}, + {0xEEDA,0xEEDA,0xFA2A}, + {0xEEDB,0xEEDB,0xFA2B}, + {0xEEDC,0xEEDC,0x9927}, + {0xEEDD,0xEEDD,0xFA2C}, + {0xEEDE,0xEEDE,0x999E}, + {0xEEDF,0xEEDF,0x9A4E}, + {0xEEE0,0xEEE0,0x9AD9}, /* EEE0 */ + {0xEEE1,0xEEE1,0x9ADC}, + {0xEEE2,0xEEE2,0x9B75}, + {0xEEE3,0xEEE3,0x9B72}, + {0xEEE4,0xEEE4,0x9B8F}, + {0xEEE5,0xEEE5,0x9BB1}, + {0xEEE6,0xEEE6,0x9BBB}, + {0xEEE7,0xEEE7,0x9C00}, + {0xEEE8,0xEEE8,0x9D70}, + {0xEEE9,0xEEE9,0x9D6B}, + {0xEEEA,0xEEEA,0xFA2D}, + {0xEEEB,0xEEEB,0x9E19}, + {0xEEEC,0xEEEC,0x9ED1}, + {0xEEED,0xEEED,0x003F}, + {0xEEEE,0xEEEE,0x003F}, + {0x8754,0xEEEF,0x2170}, + {0x8755,0xEEF0,0x2171}, /* EEF0 */ + {0x8756,0xEEF1,0x2172}, + {0x8757,0xEEF2,0x2173}, + {0x8758,0xEEF3,0x2174}, + {0x8759,0xEEF4,0x2175}, + {0x875A,0xEEF5,0x2176}, + {0x875B,0xEEF6,0x2177}, + {0x875C,0xEEF7,0x2178}, + {0x875D,0xEEF8,0x2179}, + {0xEEF9,0xEEF9,0xFFE2}, + {0xEEFA,0xEEFA,0xFFE4}, + {0xEEFB,0xEEFB,0xFF07}, + {0xEEFC,0xEEFC,0xFF02}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO cFA[256]= +{ + /* FA00-FA0F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* FA10-FA1F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* FA20-FA2F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* FA30-FA3F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0xFA4A,0xFA40,0x2170}, /* FA40 */ + {0xFA4B,0xFA41,0x2171}, + {0xFA4C,0xFA42,0x2172}, + {0xFA4D,0xFA43,0x2173}, + {0xFA4E,0xFA44,0x2174}, + {0xFA4F,0xFA45,0x2175}, + {0xFA50,0xFA46,0x2176}, + {0xFA51,0xFA47,0x2177}, + {0xFA52,0xFA48,0x2178}, + {0xFA53,0xFA49,0x2179}, + {0xFA4A,0xFA40,0x2160}, + {0xFA4B,0xFA41,0x2161}, + {0xFA4C,0xFA42,0x2162}, + {0xFA4D,0xFA43,0x2163}, + {0xFA4E,0xFA44,0x2164}, + {0xFA4F,0xFA45,0x2165}, + {0xFA50,0xFA46,0x2166}, /* FA50 */ + {0xFA51,0xFA47,0x2167}, + {0xFA52,0xFA48,0x2168}, + {0xFA53,0xFA49,0x2169}, + {0xFA54,0xFA54,0xFFE2}, + {0xFA55,0xFA55,0xFFE4}, + {0xFA56,0xFA56,0xFF07}, + {0xFA57,0xFA57,0xFF02}, + {0xFA58,0xFA58,0x3231}, + {0xFA59,0xFA59,0x2116}, + {0xFA5A,0xFA5A,0x2121}, + {0xFA5B,0xFA5B,0x2235}, + {0xFA5C,0xFA5C,0x7E8A}, + {0xFA5D,0xFA5D,0x891C}, + {0xFA5E,0xFA5E,0x9348}, + {0xFA5F,0xFA5F,0x9288}, + {0xFA60,0xFA60,0x84DC}, /* FA60 */ + {0xFA61,0xFA61,0x4FC9}, + {0xFA62,0xFA62,0x70BB}, + {0xFA63,0xFA63,0x6631}, + {0xFA64,0xFA64,0x68C8}, + {0xFA65,0xFA65,0x92F9}, + {0xFA66,0xFA66,0x66FB}, + {0xFA67,0xFA67,0x5F45}, + {0xFA68,0xFA68,0x4E28}, + {0xFA69,0xFA69,0x4EE1}, + {0xFA6A,0xFA6A,0x4EFC}, + {0xFA6B,0xFA6B,0x4F00}, + {0xFA6C,0xFA6C,0x4F03}, + {0xFA6D,0xFA6D,0x4F39}, + {0xFA6E,0xFA6E,0x4F56}, + {0xFA6F,0xFA6F,0x4F92}, + {0xFA70,0xFA70,0x4F8A}, /* FA70 */ + {0xFA71,0xFA71,0x4F9A}, + {0xFA72,0xFA72,0x4F94}, + {0xFA73,0xFA73,0x4FCD}, + {0xFA74,0xFA74,0x5040}, + {0xFA75,0xFA75,0x5022}, + {0xFA76,0xFA76,0x4FFF}, + {0xFA77,0xFA77,0x501E}, + {0xFA78,0xFA78,0x5046}, + {0xFA79,0xFA79,0x5070}, + {0xFA7A,0xFA7A,0x5042}, + {0xFA7B,0xFA7B,0x5094}, + {0xFA7C,0xFA7C,0x50F4}, + {0xFA7D,0xFA7D,0x50D8}, + {0xFA7E,0xFA7E,0x514A}, + {0,0,0}, + {0xFA80,0xFA80,0x5164}, /* FA80 */ + {0xFA81,0xFA81,0x519D}, + {0xFA82,0xFA82,0x51BE}, + {0xFA83,0xFA83,0x51EC}, + {0xFA84,0xFA84,0x5215}, + {0xFA85,0xFA85,0x529C}, + {0xFA86,0xFA86,0x52A6}, + {0xFA87,0xFA87,0x52C0}, + {0xFA88,0xFA88,0x52DB}, + {0xFA89,0xFA89,0x5300}, + {0xFA8A,0xFA8A,0x5307}, + {0xFA8B,0xFA8B,0x5324}, + {0xFA8C,0xFA8C,0x5372}, + {0xFA8D,0xFA8D,0x5393}, + {0xFA8E,0xFA8E,0x53B2}, + {0xFA8F,0xFA8F,0x53DD}, + {0xFA90,0xFA90,0xFA0E}, /* FA90 */ + {0xFA91,0xFA91,0x549C}, + {0xFA92,0xFA92,0x548A}, + {0xFA93,0xFA93,0x54A9}, + {0xFA94,0xFA94,0x54FF}, + {0xFA95,0xFA95,0x5586}, + {0xFA96,0xFA96,0x5759}, + {0xFA97,0xFA97,0x5765}, + {0xFA98,0xFA98,0x57AC}, + {0xFA99,0xFA99,0x57C8}, + {0xFA9A,0xFA9A,0x57C7}, + {0xFA9B,0xFA9B,0xFA0F}, + {0xFA9C,0xFA9C,0xFA10}, + {0xFA9D,0xFA9D,0x589E}, + {0xFA9E,0xFA9E,0x58B2}, + {0xFA9F,0xFA9F,0x590B}, + {0xFAA0,0xFAA0,0x5953}, /* FAA0 */ + {0xFAA1,0xFAA1,0x595B}, + {0xFAA2,0xFAA2,0x595D}, + {0xFAA3,0xFAA3,0x5963}, + {0xFAA4,0xFAA4,0x59A4}, + {0xFAA5,0xFAA5,0x59BA}, + {0xFAA6,0xFAA6,0x5B56}, + {0xFAA7,0xFAA7,0x5BC0}, + {0xFAA8,0xFAA8,0x752F}, + {0xFAA9,0xFAA9,0x5BD8}, + {0xFAAA,0xFAAA,0x5BEC}, + {0xFAAB,0xFAAB,0x5C1E}, + {0xFAAC,0xFAAC,0x5CA6}, + {0xFAAD,0xFAAD,0x5CBA}, + {0xFAAE,0xFAAE,0x5CF5}, + {0xFAAF,0xFAAF,0x5D27}, + {0xFAB0,0xFAB0,0x5D53}, /* FAB0 */ + {0xFAB1,0xFAB1,0xFA11}, + {0xFAB2,0xFAB2,0x5D42}, + {0xFAB3,0xFAB3,0x5D6D}, + {0xFAB4,0xFAB4,0x5DB8}, + {0xFAB5,0xFAB5,0x5DB9}, + {0xFAB6,0xFAB6,0x5DD0}, + {0xFAB7,0xFAB7,0x5F21}, + {0xFAB8,0xFAB8,0x5F34}, + {0xFAB9,0xFAB9,0x5F67}, + {0xFABA,0xFABA,0x5FB7}, + {0xFABB,0xFABB,0x5FDE}, + {0xFABC,0xFABC,0x605D}, + {0xFABD,0xFABD,0x6085}, + {0xFABE,0xFABE,0x608A}, + {0xFABF,0xFABF,0x60DE}, + {0xFAC0,0xFAC0,0x60D5}, /* FAC0 */ + {0xFAC1,0xFAC1,0x6120}, + {0xFAC2,0xFAC2,0x60F2}, + {0xFAC3,0xFAC3,0x6111}, + {0xFAC4,0xFAC4,0x6137}, + {0xFAC5,0xFAC5,0x6130}, + {0xFAC6,0xFAC6,0x6198}, + {0xFAC7,0xFAC7,0x6213}, + {0xFAC8,0xFAC8,0x62A6}, + {0xFAC9,0xFAC9,0x63F5}, + {0xFACA,0xFACA,0x6460}, + {0xFACB,0xFACB,0x649D}, + {0xFACC,0xFACC,0x64CE}, + {0xFACD,0xFACD,0x654E}, + {0xFACE,0xFACE,0x6600}, + {0xFACF,0xFACF,0x6615}, + {0xFAD0,0xFAD0,0x663B}, /* FAD0 */ + {0xFAD1,0xFAD1,0x6609}, + {0xFAD2,0xFAD2,0x662E}, + {0xFAD3,0xFAD3,0x661E}, + {0xFAD4,0xFAD4,0x6624}, + {0xFAD5,0xFAD5,0x6665}, + {0xFAD6,0xFAD6,0x6657}, + {0xFAD7,0xFAD7,0x6659}, + {0xFAD8,0xFAD8,0xFA12}, + {0xFAD9,0xFAD9,0x6673}, + {0xFADA,0xFADA,0x6699}, + {0xFADB,0xFADB,0x66A0}, + {0xFADC,0xFADC,0x66B2}, + {0xFADD,0xFADD,0x66BF}, + {0xFADE,0xFADE,0x66FA}, + {0xFADF,0xFADF,0x670E}, + {0xFAE0,0xFAE0,0xF929}, /* FAE0 */ + {0xFAE1,0xFAE1,0x6766}, + {0xFAE2,0xFAE2,0x67BB}, + {0xFAE3,0xFAE3,0x6852}, + {0xFAE4,0xFAE4,0x67C0}, + {0xFAE5,0xFAE5,0x6801}, + {0xFAE6,0xFAE6,0x6844}, + {0xFAE7,0xFAE7,0x68CF}, + {0xFAE8,0xFAE8,0xFA13}, + {0xFAE9,0xFAE9,0x6968}, + {0xFAEA,0xFAEA,0xFA14}, + {0xFAEB,0xFAEB,0x6998}, + {0xFAEC,0xFAEC,0x69E2}, + {0xFAED,0xFAED,0x6A30}, + {0xFAEE,0xFAEE,0x6A6B}, + {0xFAEF,0xFAEF,0x6A46}, + {0xFAF0,0xFAF0,0x6A73}, /* FAF0 */ + {0xFAF1,0xFAF1,0x6A7E}, + {0xFAF2,0xFAF2,0x6AE2}, + {0xFAF3,0xFAF3,0x6AE4}, + {0xFAF4,0xFAF4,0x6BD6}, + {0xFAF5,0xFAF5,0x6C3F}, + {0xFAF6,0xFAF6,0x6C5C}, + {0xFAF7,0xFAF7,0x6C86}, + {0xFAF8,0xFAF8,0x6C6F}, + {0xFAF9,0xFAF9,0x6CDA}, + {0xFAFA,0xFAFA,0x6D04}, + {0xFAFB,0xFAFB,0x6D87}, + {0xFAFC,0xFAFC,0x6D6F}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO *my_caseinfo_cp932[256]= +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, c81, c82, c83, c84, NULL, NULL, c87, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* A */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, cEE, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, cFA, NULL, NULL, NULL, NULL, NULL +}; + + static int my_strnncoll_cp932_internal(CHARSET_INFO *cs, const uchar **a_res, size_t a_length, const uchar **b_res, size_t b_length) @@ -5524,7 +7030,7 @@ CHARSET_INFO my_charset_cp932_japanese_ci= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_cp932, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ @@ -5556,7 +7062,7 @@ CHARSET_INFO my_charset_cp932_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_cp932, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index fc0af7e35d5..154d49ed085 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -216,6 +216,1273 @@ static uint mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) } +static MY_UNICASE_INFO cA3[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA340,0xA340,0x003F}, /* A340 */ + {0xA341,0xA341,0xC971}, + {0xA342,0xA342,0xC972}, + {0xA343,0xA343,0xC973}, + {0xA344,0xA344,0xC975}, + {0xA345,0xA345,0xC976}, + {0xA346,0xA346,0xC977}, + {0xA347,0xA347,0xC978}, + {0xA348,0xA348,0xC979}, + {0xA349,0xA349,0xC97A}, + {0xA34A,0xA34A,0xC97B}, + {0xA34B,0xA34B,0xC97D}, + {0xA34C,0xA34C,0xC97E}, + {0xA34D,0xA34D,0xC97F}, + {0xA34E,0xA34E,0xC980}, + {0xA34F,0xA34F,0xC981}, + {0xA350,0xA350,0xC982}, /* A350 */ + {0xA351,0xA351,0xC983}, + {0xA352,0xA352,0xC984}, + {0xA353,0xA353,0xC985}, + {0xA354,0xA354,0xC986}, + {0xA355,0xA355,0xC987}, + {0xA356,0xA356,0xC98A}, + {0xA357,0xA357,0xC98B}, + {0xA358,0xA358,0xC98D}, + {0xA359,0xA359,0xC98E}, + {0xA35A,0xA35A,0xC98F}, + {0xA35B,0xA35B,0x003F}, + {0xA35C,0xA35C,0x003F}, + {0xA35D,0xA35D,0x003F}, + {0xA35E,0xA35E,0x003F}, + {0xA35F,0xA35F,0x003F}, + {0xA360,0xA360,0x003F}, /* A360 */ + {0xA361,0xA361,0xC991}, + {0xA362,0xA362,0xC992}, + {0xA363,0xA363,0xC993}, + {0xA364,0xA364,0xC994}, + {0xA365,0xA365,0xC995}, + {0xA366,0xA366,0xC996}, + {0xA367,0xA367,0xC997}, + {0xA368,0xA368,0xC99A}, + {0xA369,0xA369,0xC99C}, + {0xA36A,0xA36A,0xC99E}, + {0xA36B,0xA36B,0xC99F}, + {0xA36C,0xA36C,0xC9A0}, + {0xA36D,0xA36D,0xC9A1}, + {0xA36E,0xA36E,0xC9A2}, + {0xA36F,0xA36F,0xC9A3}, + {0xA370,0xA370,0xC9A4}, /* A370 */ + {0xA371,0xA371,0xC9A5}, + {0xA372,0xA372,0xC9A6}, + {0xA373,0xA373,0xC9A7}, + {0xA374,0xA374,0xC9A8}, + {0xA375,0xA375,0xC9A9}, + {0xA376,0xA376,0xC9AA}, + {0xA377,0xA377,0xC9AB}, + {0xA378,0xA378,0xC9AC}, + {0xA379,0xA379,0xC9AD}, + {0xA37A,0xA37A,0xC9AE}, + {0xA37B,0xA37B,0x003F}, + {0xA37C,0xA37C,0x003F}, + {0xA37D,0xA37D,0x003F}, + {0xA37E,0xA37E,0x003F}, + {0xA37F,0xA37F,0x003F}, + {0xA380,0xA380,0x003F}, /* A380 */ + {0xA381,0xA381,0xC9AF}, + {0xA382,0xA382,0xC9B0}, + {0xA383,0xA383,0xC9B1}, + {0xA384,0xA384,0xC9B2}, + {0xA385,0xA385,0xC9B3}, + {0xA386,0xA386,0xC9B4}, + {0xA387,0xA387,0xC9B5}, + {0xA388,0xA388,0xC9B6}, + {0xA389,0xA389,0xC9B7}, + {0xA38A,0xA38A,0xC9B8}, + {0xA38B,0xA38B,0xC9B9}, + {0xA38C,0xA38C,0xC9BA}, + {0xA38D,0xA38D,0xC9BB}, + {0xA38E,0xA38E,0xC9BC}, + {0xA38F,0xA38F,0xC9BD}, + {0xA390,0xA390,0xC9BE}, /* A390 */ + {0xA391,0xA391,0xC9BF}, + {0xA392,0xA392,0xC9C2}, + {0xA393,0xA393,0xC9C3}, + {0xA394,0xA394,0xC9C5}, + {0xA395,0xA395,0xC9C6}, + {0xA396,0xA396,0xC9C9}, + {0xA397,0xA397,0xC9CB}, + {0xA398,0xA398,0xC9CC}, + {0xA399,0xA399,0xC9CD}, + {0xA39A,0xA39A,0xC9CE}, + {0xA39B,0xA39B,0xC9CF}, + {0xA39C,0xA39C,0xC9D2}, + {0xA39D,0xA39D,0xC9D4}, + {0xA39E,0xA39E,0xC9D7}, + {0xA39F,0xA39F,0xC9D8}, + {0xA3A0,0xA3A0,0xC9DB}, /* A3A0 */ + {0xA3A1,0xA3A1,0xFF01}, + {0xA3A2,0xA3A2,0xFF02}, + {0xA3A3,0xA3A3,0xFF03}, + {0xA3A4,0xA3A4,0xFF04}, + {0xA3A5,0xA3A5,0xFF05}, + {0xA3A6,0xA3A6,0xFF06}, + {0xA3A7,0xA3A7,0xFF07}, + {0xA3A8,0xA3A8,0xFF08}, + {0xA3A9,0xA3A9,0xFF09}, + {0xA3AA,0xA3AA,0xFF0A}, + {0xA3AB,0xA3AB,0xFF0B}, + {0xA3AC,0xA3AC,0xFF0C}, + {0xA3AD,0xA3AD,0xFF0D}, + {0xA3AE,0xA3AE,0xFF0E}, + {0xA3AF,0xA3AF,0xFF0F}, + {0xA3B0,0xA3B0,0xFF10}, /* A3B0 */ + {0xA3B1,0xA3B1,0xFF11}, + {0xA3B2,0xA3B2,0xFF12}, + {0xA3B3,0xA3B3,0xFF13}, + {0xA3B4,0xA3B4,0xFF14}, + {0xA3B5,0xA3B5,0xFF15}, + {0xA3B6,0xA3B6,0xFF16}, + {0xA3B7,0xA3B7,0xFF17}, + {0xA3B8,0xA3B8,0xFF18}, + {0xA3B9,0xA3B9,0xFF19}, + {0xA3BA,0xA3BA,0xFF1A}, + {0xA3BB,0xA3BB,0xFF1B}, + {0xA3BC,0xA3BC,0xFF1C}, + {0xA3BD,0xA3BD,0xFF1D}, + {0xA3BE,0xA3BE,0xFF1E}, + {0xA3BF,0xA3BF,0xFF1F}, + {0xA3C0,0xA3C0,0xFF20}, /* A3C0 */ + {0xA3C1,0xA3E1,0xFF21}, + {0xA3C2,0xA3E2,0xFF22}, + {0xA3C3,0xA3E3,0xFF23}, + {0xA3C4,0xA3E4,0xFF24}, + {0xA3C5,0xA3E5,0xFF25}, + {0xA3C6,0xA3E6,0xFF26}, + {0xA3C7,0xA3E7,0xFF27}, + {0xA3C8,0xA3E8,0xFF28}, + {0xA3C9,0xA3E9,0xFF29}, + {0xA3CA,0xA3EA,0xFF2A}, + {0xA3CB,0xA3EB,0xFF2B}, + {0xA3CC,0xA3EC,0xFF2C}, + {0xA3CD,0xA3ED,0xFF2D}, + {0xA3CE,0xA3EE,0xFF2E}, + {0xA3CF,0xA3EF,0xFF2F}, + {0xA3D0,0xA3F0,0xFF30}, /* A3D0 */ + {0xA3D1,0xA3F1,0xFF31}, + {0xA3D2,0xA3F2,0xFF32}, + {0xA3D3,0xA3F3,0xFF33}, + {0xA3D4,0xA3F4,0xFF34}, + {0xA3D5,0xA3F5,0xFF35}, + {0xA3D6,0xA3F6,0xFF36}, + {0xA3D7,0xA3F7,0xFF37}, + {0xA3D8,0xA3F8,0xFF38}, + {0xA3D9,0xA3F9,0xFF39}, + {0xA3DA,0xA3FA,0xFF3A}, + {0xA3DB,0xA3DB,0xFF3B}, + {0xA3DC,0xA3DC,0xFFE6}, + {0xA3DD,0xA3DD,0xFF3D}, + {0xA3DE,0xA3DE,0xFF3E}, + {0xA3DF,0xA3DF,0xFF3F}, + {0xA3E0,0xA3E0,0xFF40}, /* A3E0 */ + {0xA3C1,0xA3E1,0xFF41}, + {0xA3C2,0xA3E2,0xFF42}, + {0xA3C3,0xA3E3,0xFF43}, + {0xA3C4,0xA3E4,0xFF44}, + {0xA3C5,0xA3E5,0xFF45}, + {0xA3C6,0xA3E6,0xFF46}, + {0xA3C7,0xA3E7,0xFF47}, + {0xA3C8,0xA3E8,0xFF48}, + {0xA3C9,0xA3E9,0xFF49}, + {0xA3CA,0xA3EA,0xFF4A}, + {0xA3CB,0xA3EB,0xFF4B}, + {0xA3CC,0xA3EC,0xFF4C}, + {0xA3CD,0xA3ED,0xFF4D}, + {0xA3CE,0xA3EE,0xFF4E}, + {0xA3CF,0xA3EF,0xFF4F}, + {0xA3D0,0xA3F0,0xFF50}, /* A3F0 */ + {0xA3D1,0xA3F1,0xFF51}, + {0xA3D2,0xA3F2,0xFF52}, + {0xA3D3,0xA3F3,0xFF53}, + {0xA3D4,0xA3F4,0xFF54}, + {0xA3D5,0xA3F5,0xFF55}, + {0xA3D6,0xA3F6,0xFF56}, + {0xA3D7,0xA3F7,0xFF57}, + {0xA3D8,0xA3F8,0xFF58}, + {0xA3D9,0xA3F9,0xFF59}, + {0xA3DA,0xA3FA,0xFF5A}, + {0xA3FB,0xA3FB,0xFF5B}, + {0xA3FC,0xA3FC,0xFF5C}, + {0xA3FD,0xA3FD,0xFF5D}, + {0xA3FE,0xA3FE,0xFFE3}, + {0xA3FF,0xA3FF,0x003F} +}; + + +static MY_UNICASE_INFO cA5[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA540,0xA540,0x003F}, /* A540 */ + {0xA541,0xA541,0xCA47}, + {0xA542,0xA542,0xCA48}, + {0xA543,0xA543,0xCA49}, + {0xA544,0xA544,0xCA4A}, + {0xA545,0xA545,0xCA4B}, + {0xA546,0xA546,0xCA4E}, + {0xA547,0xA547,0xCA4F}, + {0xA548,0xA548,0xCA51}, + {0xA549,0xA549,0xCA52}, + {0xA54A,0xA54A,0xCA53}, + {0xA54B,0xA54B,0xCA55}, + {0xA54C,0xA54C,0xCA56}, + {0xA54D,0xA54D,0xCA57}, + {0xA54E,0xA54E,0xCA58}, + {0xA54F,0xA54F,0xCA59}, + {0xA550,0xA550,0xCA5A}, /* A550 */ + {0xA551,0xA551,0xCA5B}, + {0xA552,0xA552,0xCA5E}, + {0xA553,0xA553,0xCA62}, + {0xA554,0xA554,0xCA63}, + {0xA555,0xA555,0xCA64}, + {0xA556,0xA556,0xCA65}, + {0xA557,0xA557,0xCA66}, + {0xA558,0xA558,0xCA67}, + {0xA559,0xA559,0xCA69}, + {0xA55A,0xA55A,0xCA6A}, + {0xA55B,0xA55B,0x003F}, + {0xA55C,0xA55C,0x003F}, + {0xA55D,0xA55D,0x003F}, + {0xA55E,0xA55E,0x003F}, + {0xA55F,0xA55F,0x003F}, + {0xA560,0xA560,0x003F}, /* A560 */ + {0xA561,0xA561,0xCA6B}, + {0xA562,0xA562,0xCA6C}, + {0xA563,0xA563,0xCA6D}, + {0xA564,0xA564,0xCA6E}, + {0xA565,0xA565,0xCA6F}, + {0xA566,0xA566,0xCA70}, + {0xA567,0xA567,0xCA71}, + {0xA568,0xA568,0xCA72}, + {0xA569,0xA569,0xCA73}, + {0xA56A,0xA56A,0xCA74}, + {0xA56B,0xA56B,0xCA75}, + {0xA56C,0xA56C,0xCA76}, + {0xA56D,0xA56D,0xCA77}, + {0xA56E,0xA56E,0xCA78}, + {0xA56F,0xA56F,0xCA79}, + {0xA570,0xA570,0xCA7A}, /* A570 */ + {0xA571,0xA571,0xCA7B}, + {0xA572,0xA572,0xCA7C}, + {0xA573,0xA573,0xCA7E}, + {0xA574,0xA574,0xCA7F}, + {0xA575,0xA575,0xCA80}, + {0xA576,0xA576,0xCA81}, + {0xA577,0xA577,0xCA82}, + {0xA578,0xA578,0xCA83}, + {0xA579,0xA579,0xCA85}, + {0xA57A,0xA57A,0xCA86}, + {0xA57B,0xA57B,0x003F}, + {0xA57C,0xA57C,0x003F}, + {0xA57D,0xA57D,0x003F}, + {0xA57E,0xA57E,0x003F}, + {0xA57F,0xA57F,0x003F}, + {0xA580,0xA580,0x003F}, /* A580 */ + {0xA581,0xA581,0xCA87}, + {0xA582,0xA582,0xCA88}, + {0xA583,0xA583,0xCA89}, + {0xA584,0xA584,0xCA8A}, + {0xA585,0xA585,0xCA8B}, + {0xA586,0xA586,0xCA8C}, + {0xA587,0xA587,0xCA8D}, + {0xA588,0xA588,0xCA8E}, + {0xA589,0xA589,0xCA8F}, + {0xA58A,0xA58A,0xCA90}, + {0xA58B,0xA58B,0xCA91}, + {0xA58C,0xA58C,0xCA92}, + {0xA58D,0xA58D,0xCA93}, + {0xA58E,0xA58E,0xCA94}, + {0xA58F,0xA58F,0xCA95}, + {0xA590,0xA590,0xCA96}, /* A590 */ + {0xA591,0xA591,0xCA97}, + {0xA592,0xA592,0xCA99}, + {0xA593,0xA593,0xCA9A}, + {0xA594,0xA594,0xCA9B}, + {0xA595,0xA595,0xCA9C}, + {0xA596,0xA596,0xCA9D}, + {0xA597,0xA597,0xCA9E}, + {0xA598,0xA598,0xCA9F}, + {0xA599,0xA599,0xCAA0}, + {0xA59A,0xA59A,0xCAA1}, + {0xA59B,0xA59B,0xCAA2}, + {0xA59C,0xA59C,0xCAA3}, + {0xA59D,0xA59D,0xCAA4}, + {0xA59E,0xA59E,0xCAA5}, + {0xA59F,0xA59F,0xCAA6}, + {0xA5A0,0xA5A0,0xCAA7}, /* A5A0 */ + {0xA5B0,0xA5A1,0x2170}, + {0xA5B1,0xA5A2,0x2171}, + {0xA5B2,0xA5A3,0x2172}, + {0xA5B3,0xA5A4,0x2173}, + {0xA5B4,0xA5A5,0x2174}, + {0xA5B5,0xA5A6,0x2175}, + {0xA5B6,0xA5A7,0x2176}, + {0xA5B7,0xA5A8,0x2177}, + {0xA5B8,0xA5A9,0x2178}, + {0xA5B9,0xA5AA,0x2179}, + {0xA5AB,0xA5AB,0x003F}, + {0xA5AC,0xA5AC,0x003F}, + {0xA5AD,0xA5AD,0x003F}, + {0xA5AE,0xA5AE,0x003F}, + {0xA5AF,0xA5AF,0x003F}, + {0xA5B0,0xA5A1,0x2160}, /* A5B0 */ + {0xA5B1,0xA5A2,0x2161}, + {0xA5B2,0xA5A3,0x2162}, + {0xA5B3,0xA5A4,0x2163}, + {0xA5B4,0xA5A5,0x2164}, + {0xA5B5,0xA5A6,0x2165}, + {0xA5B6,0xA5A7,0x2166}, + {0xA5B7,0xA5A8,0x2167}, + {0xA5B8,0xA5A9,0x2168}, + {0xA5B9,0xA5AA,0x2169}, + {0xA5BA,0xA5BA,0x003F}, + {0xA5BB,0xA5BB,0x003F}, + {0xA5BC,0xA5BC,0x003F}, + {0xA5BD,0xA5BD,0x003F}, + {0xA5BE,0xA5BE,0x003F}, + {0xA5BF,0xA5BF,0x003F}, + {0xA5C0,0xA5C0,0x003F}, /* A5C0 */ + {0xA5C1,0xA5E1,0x0391}, + {0xA5C2,0xA5E2,0x0392}, + {0xA5C3,0xA5E3,0x0393}, + {0xA5C4,0xA5E4,0x0394}, + {0xA5C5,0xA5E5,0x0395}, + {0xA5C6,0xA5E6,0x0396}, + {0xA5C7,0xA5E7,0x0397}, + {0xA5C8,0xA5E8,0x0398}, + {0xA5C9,0xA5E9,0x0399}, + {0xA5CA,0xA5EA,0x039A}, + {0xA5CB,0xA5EB,0x039B}, + {0xA5CC,0xA5EC,0x039C}, + {0xA5CD,0xA5ED,0x039D}, + {0xA5CE,0xA5EE,0x039E}, + {0xA5CF,0xA5EF,0x039F}, + {0xA5D0,0xA5F0,0x03A0}, /* A5D0 */ + {0xA5D1,0xA5F1,0x03A1}, + {0xA5D2,0xA5F2,0x03A3}, + {0xA5D3,0xA5F3,0x03A4}, + {0xA5D4,0xA5F4,0x03A5}, + {0xA5D5,0xA5F5,0x03A6}, + {0xA5D6,0xA5F6,0x03A7}, + {0xA5D7,0xA5F7,0x03A8}, + {0xA5D8,0xA5F8,0x03A9}, + {0xA5D9,0xA5D9,0x003F}, + {0xA5DA,0xA5DA,0x003F}, + {0xA5DB,0xA5DB,0x003F}, + {0xA5DC,0xA5DC,0x003F}, + {0xA5DD,0xA5DD,0x003F}, + {0xA5DE,0xA5DE,0x003F}, + {0xA5DF,0xA5DF,0x003F}, + {0xA5E0,0xA5E0,0x003F}, /* A5E0 */ + {0xA5C1,0xA5E1,0x03B1}, + {0xA5C2,0xA5E2,0x03B2}, + {0xA5C3,0xA5E3,0x03B3}, + {0xA5C4,0xA5E4,0x03B4}, + {0xA5C5,0xA5E5,0x03B5}, + {0xA5C6,0xA5E6,0x03B6}, + {0xA5C7,0xA5E7,0x03B7}, + {0xA5C8,0xA5E8,0x03B8}, + {0xA5C9,0xA5E9,0x03B9}, + {0xA5CA,0xA5EA,0x03BA}, + {0xA5CB,0xA5EB,0x03BB}, + {0xA5CC,0xA5EC,0x03BC}, + {0xA5CD,0xA5ED,0x03BD}, + {0xA5CE,0xA5EE,0x03BE}, + {0xA5CF,0xA5EF,0x03BF}, + {0xA5D0,0xA5F0,0x03C0}, /* A5F0 */ + {0xA5D1,0xA5F1,0x03C1}, + {0xA5D2,0xA5F2,0x03C3}, + {0xA5D3,0xA5F3,0x03C4}, + {0xA5D4,0xA5F4,0x03C5}, + {0xA5D5,0xA5F5,0x03C6}, + {0xA5D6,0xA5F6,0x03C7}, + {0xA5D7,0xA5F7,0x03C8}, + {0xA5D8,0xA5F8,0x03C9}, + {0xA5F9,0xA5F9,0x003F}, + {0xA5FA,0xA5FA,0x003F}, + {0xA5FB,0xA5FB,0x003F}, + {0xA5FC,0xA5FC,0x003F}, + {0xA5FD,0xA5FD,0x003F}, + {0xA5FE,0xA5FE,0x003F}, + {0xA5FF,0xA5FF,0x003F} +}; + + +static MY_UNICASE_INFO cA7[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA740,0xA740,0x003F}, /* A740 */ + {0xA741,0xA741,0xCB0B}, + {0xA742,0xA742,0xCB0C}, + {0xA743,0xA743,0xCB0D}, + {0xA744,0xA744,0xCB0E}, + {0xA745,0xA745,0xCB0F}, + {0xA746,0xA746,0xCB11}, + {0xA747,0xA747,0xCB12}, + {0xA748,0xA748,0xCB13}, + {0xA749,0xA749,0xCB15}, + {0xA74A,0xA74A,0xCB16}, + {0xA74B,0xA74B,0xCB17}, + {0xA74C,0xA74C,0xCB19}, + {0xA74D,0xA74D,0xCB1A}, + {0xA74E,0xA74E,0xCB1B}, + {0xA74F,0xA74F,0xCB1C}, + {0xA750,0xA750,0xCB1D}, /* A750 */ + {0xA751,0xA751,0xCB1E}, + {0xA752,0xA752,0xCB1F}, + {0xA753,0xA753,0xCB22}, + {0xA754,0xA754,0xCB23}, + {0xA755,0xA755,0xCB24}, + {0xA756,0xA756,0xCB25}, + {0xA757,0xA757,0xCB26}, + {0xA758,0xA758,0xCB27}, + {0xA759,0xA759,0xCB28}, + {0xA75A,0xA75A,0xCB29}, + {0xA75B,0xA75B,0x003F}, + {0xA75C,0xA75C,0x003F}, + {0xA75D,0xA75D,0x003F}, + {0xA75E,0xA75E,0x003F}, + {0xA75F,0xA75F,0x003F}, + {0xA760,0xA760,0x003F}, /* A760 */ + {0xA761,0xA761,0xCB2A}, + {0xA762,0xA762,0xCB2B}, + {0xA763,0xA763,0xCB2C}, + {0xA764,0xA764,0xCB2D}, + {0xA765,0xA765,0xCB2E}, + {0xA766,0xA766,0xCB2F}, + {0xA767,0xA767,0xCB30}, + {0xA768,0xA768,0xCB31}, + {0xA769,0xA769,0xCB32}, + {0xA76A,0xA76A,0xCB33}, + {0xA76B,0xA76B,0xCB34}, + {0xA76C,0xA76C,0xCB35}, + {0xA76D,0xA76D,0xCB36}, + {0xA76E,0xA76E,0xCB37}, + {0xA76F,0xA76F,0xCB38}, + {0xA770,0xA770,0xCB39}, /* A770 */ + {0xA771,0xA771,0xCB3A}, + {0xA772,0xA772,0xCB3B}, + {0xA773,0xA773,0xCB3C}, + {0xA774,0xA774,0xCB3D}, + {0xA775,0xA775,0xCB3E}, + {0xA776,0xA776,0xCB3F}, + {0xA777,0xA777,0xCB40}, + {0xA778,0xA778,0xCB42}, + {0xA779,0xA779,0xCB43}, + {0xA77A,0xA77A,0xCB44}, + {0xA77B,0xA77B,0x003F}, + {0xA77C,0xA77C,0x003F}, + {0xA77D,0xA77D,0x003F}, + {0xA77E,0xA77E,0x003F}, + {0xA77F,0xA77F,0x003F}, + {0xA780,0xA780,0x003F}, /* A780 */ + {0xA781,0xA781,0xCB45}, + {0xA782,0xA782,0xCB46}, + {0xA783,0xA783,0xCB47}, + {0xA784,0xA784,0xCB4A}, + {0xA785,0xA785,0xCB4B}, + {0xA786,0xA786,0xCB4D}, + {0xA787,0xA787,0xCB4E}, + {0xA788,0xA788,0xCB4F}, + {0xA789,0xA789,0xCB51}, + {0xA78A,0xA78A,0xCB52}, + {0xA78B,0xA78B,0xCB53}, + {0xA78C,0xA78C,0xCB54}, + {0xA78D,0xA78D,0xCB55}, + {0xA78E,0xA78E,0xCB56}, + {0xA78F,0xA78F,0xCB57}, + {0xA790,0xA790,0xCB5A}, /* A790 */ + {0xA791,0xA791,0xCB5B}, + {0xA792,0xA792,0xCB5C}, + {0xA793,0xA793,0xCB5E}, + {0xA794,0xA794,0xCB5F}, + {0xA795,0xA795,0xCB60}, + {0xA796,0xA796,0xCB61}, + {0xA797,0xA797,0xCB62}, + {0xA798,0xA798,0xCB63}, + {0xA799,0xA799,0xCB65}, + {0xA79A,0xA79A,0xCB66}, + {0xA79B,0xA79B,0xCB67}, + {0xA79C,0xA79C,0xCB68}, + {0xA79D,0xA79D,0xCB69}, + {0xA79E,0xA79E,0xCB6A}, + {0xA79F,0xA79F,0xCB6B}, + {0xA7A0,0xA7A0,0xCB6C}, /* A7A0 */ + {0xA7A1,0xA7A1,0x3395}, + {0xA7A2,0xA7A2,0x3396}, + {0xA7A3,0xA7A3,0x3397}, + {0xA7A4,0xA7A4,0x2113}, + {0xA7A5,0xA7A5,0x3398}, + {0xA7A6,0xA7A6,0x33C4}, + {0xA7A7,0xA7A7,0x33A3}, + {0xA7A8,0xA7A8,0x33A4}, + {0xA7A9,0xA7A9,0x33A5}, + {0xA7AA,0xA7AA,0x33A6}, + {0xA7AB,0xA7AB,0x3399}, + {0xA7AC,0xA7AC,0x339A}, + {0xA7AD,0xA7AD,0x339B}, + {0xA7AE,0xA7AE,0x339C}, + {0xA7AF,0xA7AF,0x339D}, + {0xA7B0,0xA7B0,0x339E}, /* A7B0 */ + {0xA7B1,0xA7B1,0x339F}, + {0xA7B2,0xA7B2,0x33A0}, + {0xA7B3,0xA7B3,0x33A1}, + {0xA7B4,0xA7B4,0x33A2}, + {0xA7B5,0xA7B5,0x33CA}, + {0xA7B6,0xA7B6,0x338D}, + {0xA7B7,0xA7B7,0x338E}, + {0xA7B8,0xA7B8,0x338F}, + {0xA7B9,0xA7B9,0x33CF}, + {0xA7BA,0xA7BA,0x3388}, + {0xA7BB,0xA7BB,0x3389}, + {0xA7BC,0xA7BC,0x33C8}, + {0xA7BD,0xA7BD,0x33A7}, + {0xA7BE,0xA7BE,0x33A8}, + {0xA7BF,0xA7BF,0x33B0}, + {0xA7C0,0xA7C0,0x33B1}, /* A7C0 */ + {0xA7C1,0xA7C1,0x33B2}, + {0xA7C2,0xA7C2,0x33B3}, + {0xA7C3,0xA7C3,0x33B4}, + {0xA7C4,0xA7C4,0x33B5}, + {0xA7C5,0xA7C5,0x33B6}, + {0xA7C6,0xA7C6,0x33B7}, + {0xA7C7,0xA7C7,0x33B8}, + {0xA7C8,0xA7C8,0x33B9}, + {0xA7C9,0xA7C9,0x3380}, + {0xA7CA,0xA7CA,0x3381}, + {0xA7CB,0xA7CB,0x3382}, + {0xA7CC,0xA7CC,0x3383}, + {0xA7CD,0xA7CD,0x3384}, + {0xA7CE,0xA7CE,0x33BA}, + {0xA7CF,0xA7CF,0x33BB}, + {0xA7D0,0xA7D0,0x33BC}, /* A7D0 */ + {0xA7D1,0xA7D1,0x33BD}, + {0xA7D2,0xA7D2,0x33BE}, + {0xA7D3,0xA7D3,0x33BF}, + {0xA7D4,0xA7D4,0x3390}, + {0xA7D5,0xA7D5,0x3391}, + {0xA7D6,0xA7D6,0x3392}, + {0xA7D7,0xA7D7,0x3393}, + {0xA7D8,0xA7D8,0x3394}, + {0xA7D9,0xA5F8,0x2126}, + {0xA7DA,0xA7DA,0x33C0}, + {0xA7DB,0xA7DB,0x33C1}, + {0xA7DC,0xA7DC,0x338A}, + {0xA7DD,0xA7DD,0x338B}, + {0xA7DE,0xA7DE,0x338C}, + {0xA7DF,0xA7DF,0x33D6}, + {0xA7E0,0xA7E0,0x33C5}, /* A7E0 */ + {0xA7E1,0xA7E1,0x33AD}, + {0xA7E2,0xA7E2,0x33AE}, + {0xA7E3,0xA7E3,0x33AF}, + {0xA7E4,0xA7E4,0x33DB}, + {0xA7E5,0xA7E5,0x33A9}, + {0xA7E6,0xA7E6,0x33AA}, + {0xA7E7,0xA7E7,0x33AB}, + {0xA7E8,0xA7E8,0x33AC}, + {0xA7E9,0xA7E9,0x33DD}, + {0xA7EA,0xA7EA,0x33D0}, + {0xA7EB,0xA7EB,0x33D3}, + {0xA7EC,0xA7EC,0x33C3}, + {0xA7ED,0xA7ED,0x33C9}, + {0xA7EE,0xA7EE,0x33DC}, + {0xA7EF,0xA7EF,0x33C6}, + {0xA7F0,0xA7F0,0x003F}, /* A7F0 */ + {0xA7F1,0xA7F1,0x003F}, + {0xA7F2,0xA7F2,0x003F}, + {0xA7F3,0xA7F3,0x003F}, + {0xA7F4,0xA7F4,0x003F}, + {0xA7F5,0xA7F5,0x003F}, + {0xA7F6,0xA7F6,0x003F}, + {0xA7F7,0xA7F7,0x003F}, + {0xA7F8,0xA7F8,0x003F}, + {0xA7F9,0xA7F9,0x003F}, + {0xA7FA,0xA7FA,0x003F}, + {0xA7FB,0xA7FB,0x003F}, + {0xA7FC,0xA7FC,0x003F}, + {0xA7FD,0xA7FD,0x003F}, + {0xA7FE,0xA7FE,0x003F}, + {0xA7FF,0xA7FF,0x003F} +}; + + +static MY_UNICASE_INFO cA8[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA840,0xA840,0x003F}, /* A840 */ + {0xA841,0xA841,0xCB6D}, + {0xA842,0xA842,0xCB6E}, + {0xA843,0xA843,0xCB6F}, + {0xA844,0xA844,0xCB70}, + {0xA845,0xA845,0xCB71}, + {0xA846,0xA846,0xCB72}, + {0xA847,0xA847,0xCB73}, + {0xA848,0xA848,0xCB74}, + {0xA849,0xA849,0xCB75}, + {0xA84A,0xA84A,0xCB76}, + {0xA84B,0xA84B,0xCB77}, + {0xA84C,0xA84C,0xCB7A}, + {0xA84D,0xA84D,0xCB7B}, + {0xA84E,0xA84E,0xCB7C}, + {0xA84F,0xA84F,0xCB7D}, + {0xA850,0xA850,0xCB7E}, /* A850 */ + {0xA851,0xA851,0xCB7F}, + {0xA852,0xA852,0xCB80}, + {0xA853,0xA853,0xCB81}, + {0xA854,0xA854,0xCB82}, + {0xA855,0xA855,0xCB83}, + {0xA856,0xA856,0xCB84}, + {0xA857,0xA857,0xCB85}, + {0xA858,0xA858,0xCB86}, + {0xA859,0xA859,0xCB87}, + {0xA85A,0xA85A,0xCB88}, + {0xA85B,0xA85B,0x003F}, + {0xA85C,0xA85C,0x003F}, + {0xA85D,0xA85D,0x003F}, + {0xA85E,0xA85E,0x003F}, + {0xA85F,0xA85F,0x003F}, + {0xA860,0xA860,0x003F}, /* A860 */ + {0xA861,0xA861,0xCB89}, + {0xA862,0xA862,0xCB8A}, + {0xA863,0xA863,0xCB8B}, + {0xA864,0xA864,0xCB8C}, + {0xA865,0xA865,0xCB8D}, + {0xA866,0xA866,0xCB8E}, + {0xA867,0xA867,0xCB8F}, + {0xA868,0xA868,0xCB90}, + {0xA869,0xA869,0xCB91}, + {0xA86A,0xA86A,0xCB92}, + {0xA86B,0xA86B,0xCB93}, + {0xA86C,0xA86C,0xCB94}, + {0xA86D,0xA86D,0xCB95}, + {0xA86E,0xA86E,0xCB96}, + {0xA86F,0xA86F,0xCB97}, + {0xA870,0xA870,0xCB98}, /* A870 */ + {0xA871,0xA871,0xCB99}, + {0xA872,0xA872,0xCB9A}, + {0xA873,0xA873,0xCB9B}, + {0xA874,0xA874,0xCB9D}, + {0xA875,0xA875,0xCB9E}, + {0xA876,0xA876,0xCB9F}, + {0xA877,0xA877,0xCBA0}, + {0xA878,0xA878,0xCBA1}, + {0xA879,0xA879,0xCBA2}, + {0xA87A,0xA87A,0xCBA3}, + {0xA87B,0xA87B,0x003F}, + {0xA87C,0xA87C,0x003F}, + {0xA87D,0xA87D,0x003F}, + {0xA87E,0xA87E,0x003F}, + {0xA87F,0xA87F,0x003F}, + {0xA880,0xA880,0x003F}, /* A880 */ + {0xA881,0xA881,0xCBA4}, + {0xA882,0xA882,0xCBA5}, + {0xA883,0xA883,0xCBA6}, + {0xA884,0xA884,0xCBA7}, + {0xA885,0xA885,0xCBA8}, + {0xA886,0xA886,0xCBA9}, + {0xA887,0xA887,0xCBAA}, + {0xA888,0xA888,0xCBAB}, + {0xA889,0xA889,0xCBAC}, + {0xA88A,0xA88A,0xCBAD}, + {0xA88B,0xA88B,0xCBAE}, + {0xA88C,0xA88C,0xCBAF}, + {0xA88D,0xA88D,0xCBB0}, + {0xA88E,0xA88E,0xCBB1}, + {0xA88F,0xA88F,0xCBB2}, + {0xA890,0xA890,0xCBB3}, /* A890 */ + {0xA891,0xA891,0xCBB4}, + {0xA892,0xA892,0xCBB5}, + {0xA893,0xA893,0xCBB6}, + {0xA894,0xA894,0xCBB7}, + {0xA895,0xA895,0xCBB9}, + {0xA896,0xA896,0xCBBA}, + {0xA897,0xA897,0xCBBB}, + {0xA898,0xA898,0xCBBC}, + {0xA899,0xA899,0xCBBD}, + {0xA89A,0xA89A,0xCBBE}, + {0xA89B,0xA89B,0xCBBF}, + {0xA89C,0xA89C,0xCBC0}, + {0xA89D,0xA89D,0xCBC1}, + {0xA89E,0xA89E,0xCBC2}, + {0xA89F,0xA89F,0xCBC3}, + {0xA8A0,0xA8A0,0xCBC4}, /* A8A0 */ + {0xA8A1,0xA9A1,0x00C6}, + {0xA8A2,0xA9A3,0x00D0}, + {0xA8A3,0xA8A3,0x00AA}, + {0xA8A4,0xA9A4,0x0126}, + {0xA8A5,0xA8A5,0x003F}, + {0xA8A6,0xA9A6,0x0132}, + {0xA8A7,0xA8A7,0x003F}, + {0xA8A8,0xA9A8,0x013F}, + {0xA8A9,0xA9A9,0x0141}, + {0xA8AA,0xA9AA,0x00D8}, + {0xA8AB,0xA9AB,0x0152}, + {0xA8AC,0xA8AC,0x00BA}, + {0xA8AD,0xA9AD,0x00DE}, + {0xA8AE,0xA9AE,0x0166}, + {0xA8AF,0xA9AF,0x014A}, + {0xA8B0,0xA8B0,0x003F}, /* A8B0 */ + {0xA8B1,0xA8B1,0x3260}, + {0xA8B2,0xA8B2,0x3261}, + {0xA8B3,0xA8B3,0x3262}, + {0xA8B4,0xA8B4,0x3263}, + {0xA8B5,0xA8B5,0x3264}, + {0xA8B6,0xA8B6,0x3265}, + {0xA8B7,0xA8B7,0x3266}, + {0xA8B8,0xA8B8,0x3267}, + {0xA8B9,0xA8B9,0x3268}, + {0xA8BA,0xA8BA,0x3269}, + {0xA8BB,0xA8BB,0x326A}, + {0xA8BC,0xA8BC,0x326B}, + {0xA8BD,0xA8BD,0x326C}, + {0xA8BE,0xA8BE,0x326D}, + {0xA8BF,0xA8BF,0x326E}, + {0xA8C0,0xA8C0,0x326F}, /* A8C0 */ + {0xA8C1,0xA8C1,0x3270}, + {0xA8C2,0xA8C2,0x3271}, + {0xA8C3,0xA8C3,0x3272}, + {0xA8C4,0xA8C4,0x3273}, + {0xA8C5,0xA8C5,0x3274}, + {0xA8C6,0xA8C6,0x3275}, + {0xA8C7,0xA8C7,0x3276}, + {0xA8C8,0xA8C8,0x3277}, + {0xA8C9,0xA8C9,0x3278}, + {0xA8CA,0xA8CA,0x3279}, + {0xA8CB,0xA8CB,0x327A}, + {0xA8CC,0xA8CC,0x327B}, + {0xA8CD,0xA8CD,0x24D0}, + {0xA8CE,0xA8CE,0x24D1}, + {0xA8CF,0xA8CF,0x24D2}, + {0xA8D0,0xA8D0,0x24D3}, /* A8D0 */ + {0xA8D1,0xA8D1,0x24D4}, + {0xA8D2,0xA8D2,0x24D5}, + {0xA8D3,0xA8D3,0x24D6}, + {0xA8D4,0xA8D4,0x24D7}, + {0xA8D5,0xA8D5,0x24D8}, + {0xA8D6,0xA8D6,0x24D9}, + {0xA8D7,0xA8D7,0x24DA}, + {0xA8D8,0xA8D8,0x24DB}, + {0xA8D9,0xA8D9,0x24DC}, + {0xA8DA,0xA8DA,0x24DD}, + {0xA8DB,0xA8DB,0x24DE}, + {0xA8DC,0xA8DC,0x24DF}, + {0xA8DD,0xA8DD,0x24E0}, + {0xA8DE,0xA8DE,0x24E1}, + {0xA8DF,0xA8DF,0x24E2}, + {0xA8E0,0xA8E0,0x24E3}, /* A8E0 */ + {0xA8E1,0xA8E1,0x24E4}, + {0xA8E2,0xA8E2,0x24E5}, + {0xA8E3,0xA8E3,0x24E6}, + {0xA8E4,0xA8E4,0x24E7}, + {0xA8E5,0xA8E5,0x24E8}, + {0xA8E6,0xA8E6,0x24E9}, + {0xA8E7,0xA8E7,0x2460}, + {0xA8E8,0xA8E8,0x2461}, + {0xA8E9,0xA8E9,0x2462}, + {0xA8EA,0xA8EA,0x2463}, + {0xA8EB,0xA8EB,0x2464}, + {0xA8EC,0xA8EC,0x2465}, + {0xA8ED,0xA8ED,0x2466}, + {0xA8EE,0xA8EE,0x2467}, + {0xA8EF,0xA8EF,0x2468}, + {0xA8F0,0xA8F0,0x2469}, /* A8F0 */ + {0xA8F1,0xA8F1,0x246A}, + {0xA8F2,0xA8F2,0x246B}, + {0xA8F3,0xA8F3,0x246C}, + {0xA8F4,0xA8F4,0x246D}, + {0xA8F5,0xA8F5,0x246E}, + {0xA8F6,0xA8F6,0x00BD}, + {0xA8F7,0xA8F7,0x2153}, + {0xA8F8,0xA8F8,0x2154}, + {0xA8F9,0xA8F9,0x00BC}, + {0xA8FA,0xA8FA,0x00BE}, + {0xA8FB,0xA8FB,0x215B}, + {0xA8FC,0xA8FC,0x215C}, + {0xA8FD,0xA8FD,0x215D}, + {0xA8FE,0xA8FE,0x215E}, + {0xA8FF,0xA8FF,0x003F} +}; + + +static MY_UNICASE_INFO cA9[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA940,0xA940,0x003F}, /* A940 */ + {0xA941,0xA941,0xCBC5}, + {0xA942,0xA942,0xCBC6}, + {0xA943,0xA943,0xCBC7}, + {0xA944,0xA944,0xCBC8}, + {0xA945,0xA945,0xCBC9}, + {0xA946,0xA946,0xCBCA}, + {0xA947,0xA947,0xCBCB}, + {0xA948,0xA948,0xCBCC}, + {0xA949,0xA949,0xCBCD}, + {0xA94A,0xA94A,0xCBCE}, + {0xA94B,0xA94B,0xCBCF}, + {0xA94C,0xA94C,0xCBD0}, + {0xA94D,0xA94D,0xCBD1}, + {0xA94E,0xA94E,0xCBD2}, + {0xA94F,0xA94F,0xCBD3}, + {0xA950,0xA950,0xCBD5}, /* A950 */ + {0xA951,0xA951,0xCBD6}, + {0xA952,0xA952,0xCBD7}, + {0xA953,0xA953,0xCBD8}, + {0xA954,0xA954,0xCBD9}, + {0xA955,0xA955,0xCBDA}, + {0xA956,0xA956,0xCBDB}, + {0xA957,0xA957,0xCBDC}, + {0xA958,0xA958,0xCBDD}, + {0xA959,0xA959,0xCBDE}, + {0xA95A,0xA95A,0xCBDF}, + {0xA95B,0xA95B,0x003F}, + {0xA95C,0xA95C,0x003F}, + {0xA95D,0xA95D,0x003F}, + {0xA95E,0xA95E,0x003F}, + {0xA95F,0xA95F,0x003F}, + {0xA960,0xA960,0x003F}, /* A960 */ + {0xA961,0xA961,0xCBE0}, + {0xA962,0xA962,0xCBE1}, + {0xA963,0xA963,0xCBE2}, + {0xA964,0xA964,0xCBE3}, + {0xA965,0xA965,0xCBE5}, + {0xA966,0xA966,0xCBE6}, + {0xA967,0xA967,0xCBE8}, + {0xA968,0xA968,0xCBEA}, + {0xA969,0xA969,0xCBEB}, + {0xA96A,0xA96A,0xCBEC}, + {0xA96B,0xA96B,0xCBED}, + {0xA96C,0xA96C,0xCBEE}, + {0xA96D,0xA96D,0xCBEF}, + {0xA96E,0xA96E,0xCBF0}, + {0xA96F,0xA96F,0xCBF1}, + {0xA970,0xA970,0xCBF2}, /* A970 */ + {0xA971,0xA971,0xCBF3}, + {0xA972,0xA972,0xCBF4}, + {0xA973,0xA973,0xCBF5}, + {0xA974,0xA974,0xCBF6}, + {0xA975,0xA975,0xCBF7}, + {0xA976,0xA976,0xCBF8}, + {0xA977,0xA977,0xCBF9}, + {0xA978,0xA978,0xCBFA}, + {0xA979,0xA979,0xCBFB}, + {0xA97A,0xA97A,0xCBFC}, + {0xA97B,0xA97B,0x003F}, + {0xA97C,0xA97C,0x003F}, + {0xA97D,0xA97D,0x003F}, + {0xA97E,0xA97E,0x003F}, + {0xA97F,0xA97F,0x003F}, + {0xA980,0xA980,0x003F}, /* A980 */ + {0xA981,0xA981,0xCBFD}, + {0xA982,0xA982,0xCBFE}, + {0xA983,0xA983,0xCBFF}, + {0xA984,0xA984,0xCC00}, + {0xA985,0xA985,0xCC01}, + {0xA986,0xA986,0xCC02}, + {0xA987,0xA987,0xCC03}, + {0xA988,0xA988,0xCC04}, + {0xA989,0xA989,0xCC05}, + {0xA98A,0xA98A,0xCC06}, + {0xA98B,0xA98B,0xCC07}, + {0xA98C,0xA98C,0xCC08}, + {0xA98D,0xA98D,0xCC09}, + {0xA98E,0xA98E,0xCC0A}, + {0xA98F,0xA98F,0xCC0B}, + {0xA990,0xA990,0xCC0E}, /* A990 */ + {0xA991,0xA991,0xCC0F}, + {0xA992,0xA992,0xCC11}, + {0xA993,0xA993,0xCC12}, + {0xA994,0xA994,0xCC13}, + {0xA995,0xA995,0xCC15}, + {0xA996,0xA996,0xCC16}, + {0xA997,0xA997,0xCC17}, + {0xA998,0xA998,0xCC18}, + {0xA999,0xA999,0xCC19}, + {0xA99A,0xA99A,0xCC1A}, + {0xA99B,0xA99B,0xCC1B}, + {0xA99C,0xA99C,0xCC1E}, + {0xA99D,0xA99D,0xCC1F}, + {0xA99E,0xA99E,0xCC20}, + {0xA99F,0xA99F,0xCC23}, + {0xA9A0,0xA9A0,0xCC24}, /* A9A0 */ + {0xA8A1,0xA9A1,0x00E6}, + {0xA9A2,0xA9A2,0x0111}, + {0xA8A2,0xA9A3,0x00F0}, + {0xA8A4,0xA9A4,0x0127}, + { 0x49,0xA9A5,0x0131}, /* Turkish i */ + {0xA8A6,0xA9A6,0x0133}, + {0xA9A7,0xA9A7,0x0138}, + {0xA8A8,0xA9A8,0x0140}, + {0xA8A9,0xA9A9,0x0142}, + {0xA8AA,0xA9AA,0x00F8}, + {0xA8AB,0xA9AB,0x0153}, + {0xA9AC,0xA9AC,0x00DF}, + {0xA8AD,0xA9AD,0x00FE}, + {0xA8AE,0xA9AE,0x0167}, + {0xA8AF,0xA9AF,0x014B}, + {0xA9B0,0xA9B0,0x0149}, /* A9B0 */ + {0xA9B1,0xA9B1,0x3200}, + {0xA9B2,0xA9B2,0x3201}, + {0xA9B3,0xA9B3,0x3202}, + {0xA9B4,0xA9B4,0x3203}, + {0xA9B5,0xA9B5,0x3204}, + {0xA9B6,0xA9B6,0x3205}, + {0xA9B7,0xA9B7,0x3206}, + {0xA9B8,0xA9B8,0x3207}, + {0xA9B9,0xA9B9,0x3208}, + {0xA9BA,0xA9BA,0x3209}, + {0xA9BB,0xA9BB,0x320A}, + {0xA9BC,0xA9BC,0x320B}, + {0xA9BD,0xA9BD,0x320C}, + {0xA9BE,0xA9BE,0x320D}, + {0xA9BF,0xA9BF,0x320E}, + {0xA9C0,0xA9C0,0x320F}, /* A9C0 */ + {0xA9C1,0xA9C1,0x3210}, + {0xA9C2,0xA9C2,0x3211}, + {0xA9C3,0xA9C3,0x3212}, + {0xA9C4,0xA9C4,0x3213}, + {0xA9C5,0xA9C5,0x3214}, + {0xA9C6,0xA9C6,0x3215}, + {0xA9C7,0xA9C7,0x3216}, + {0xA9C8,0xA9C8,0x3217}, + {0xA9C9,0xA9C9,0x3218}, + {0xA9CA,0xA9CA,0x3219}, + {0xA9CB,0xA9CB,0x321A}, + {0xA9CC,0xA9CC,0x321B}, + {0xA9CD,0xA9CD,0x249C}, + {0xA9CE,0xA9CE,0x249D}, + {0xA9CF,0xA9CF,0x249E}, + {0xA9D0,0xA9D0,0x249F}, /* A9D0 */ + {0xA9D1,0xA9D1,0x24A0}, + {0xA9D2,0xA9D2,0x24A1}, + {0xA9D3,0xA9D3,0x24A2}, + {0xA9D4,0xA9D4,0x24A3}, + {0xA9D5,0xA9D5,0x24A4}, + {0xA9D6,0xA9D6,0x24A5}, + {0xA9D7,0xA9D7,0x24A6}, + {0xA9D8,0xA9D8,0x24A7}, + {0xA9D9,0xA9D9,0x24A8}, + {0xA9DA,0xA9DA,0x24A9}, + {0xA9DB,0xA9DB,0x24AA}, + {0xA9DC,0xA9DC,0x24AB}, + {0xA9DD,0xA9DD,0x24AC}, + {0xA9DE,0xA9DE,0x24AD}, + {0xA9DF,0xA9DF,0x24AE}, + {0xA9E0,0xA9E0,0x24AF}, /* A9E0 */ + {0xA9E1,0xA9E1,0x24B0}, + {0xA9E2,0xA9E2,0x24B1}, + {0xA9E3,0xA9E3,0x24B2}, + {0xA9E4,0xA9E4,0x24B3}, + {0xA9E5,0xA9E5,0x24B4}, + {0xA9E6,0xA9E6,0x24B5}, + {0xA9E7,0xA9E7,0x2474}, + {0xA9E8,0xA9E8,0x2475}, + {0xA9E9,0xA9E9,0x2476}, + {0xA9EA,0xA9EA,0x2477}, + {0xA9EB,0xA9EB,0x2478}, + {0xA9EC,0xA9EC,0x2479}, + {0xA9ED,0xA9ED,0x247A}, + {0xA9EE,0xA9EE,0x247B}, + {0xA9EF,0xA9EF,0x247C}, + {0xA9F0,0xA9F0,0x247D}, /* A9F0 */ + {0xA9F1,0xA9F1,0x247E}, + {0xA9F2,0xA9F2,0x247F}, + {0xA9F3,0xA9F3,0x2480}, + {0xA9F4,0xA9F4,0x2481}, + {0xA9F5,0xA9F5,0x2482}, + {0xA9F6,0xA9F6,0x00B9}, + {0xA9F7,0xA9F7,0x00B2}, + {0xA9F8,0xA9F8,0x00B3}, + {0xA9F9,0xA9F9,0x2074}, + {0xA9FA,0xA9FA,0x207F}, + {0xA9FB,0xA9FB,0x2081}, + {0xA9FC,0xA9FC,0x2082}, + {0xA9FD,0xA9FD,0x2083}, + {0xA9FE,0xA9FE,0x2084}, + {0xA9FF,0xA9FF,0x003F} +}; + + +static MY_UNICASE_INFO cAC[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xAC40,0xAC40,0x003F}, /* AC40 */ + {0xAC41,0xAC41,0xCCFE}, + {0xAC42,0xAC42,0xCCFF}, + {0xAC43,0xAC43,0xCD00}, + {0xAC44,0xAC44,0xCD02}, + {0xAC45,0xAC45,0xCD03}, + {0xAC46,0xAC46,0xCD04}, + {0xAC47,0xAC47,0xCD05}, + {0xAC48,0xAC48,0xCD06}, + {0xAC49,0xAC49,0xCD07}, + {0xAC4A,0xAC4A,0xCD0A}, + {0xAC4B,0xAC4B,0xCD0B}, + {0xAC4C,0xAC4C,0xCD0D}, + {0xAC4D,0xAC4D,0xCD0E}, + {0xAC4E,0xAC4E,0xCD0F}, + {0xAC4F,0xAC4F,0xCD11}, + {0xAC50,0xAC50,0xCD12}, /* AC50 */ + {0xAC51,0xAC51,0xCD13}, + {0xAC52,0xAC52,0xCD14}, + {0xAC53,0xAC53,0xCD15}, + {0xAC54,0xAC54,0xCD16}, + {0xAC55,0xAC55,0xCD17}, + {0xAC56,0xAC56,0xCD1A}, + {0xAC57,0xAC57,0xCD1C}, + {0xAC58,0xAC58,0xCD1E}, + {0xAC59,0xAC59,0xCD1F}, + {0xAC5A,0xAC5A,0xCD20}, + {0xAC5B,0xAC5B,0x003F}, + {0xAC5C,0xAC5C,0x003F}, + {0xAC5D,0xAC5D,0x003F}, + {0xAC5E,0xAC5E,0x003F}, + {0xAC5F,0xAC5F,0x003F}, + {0xAC60,0xAC60,0x003F}, /* AC60 */ + {0xAC61,0xAC61,0xCD21}, + {0xAC62,0xAC62,0xCD22}, + {0xAC63,0xAC63,0xCD23}, + {0xAC64,0xAC64,0xCD25}, + {0xAC65,0xAC65,0xCD26}, + {0xAC66,0xAC66,0xCD27}, + {0xAC67,0xAC67,0xCD29}, + {0xAC68,0xAC68,0xCD2A}, + {0xAC69,0xAC69,0xCD2B}, + {0xAC6A,0xAC6A,0xCD2D}, + {0xAC6B,0xAC6B,0xCD2E}, + {0xAC6C,0xAC6C,0xCD2F}, + {0xAC6D,0xAC6D,0xCD30}, + {0xAC6E,0xAC6E,0xCD31}, + {0xAC6F,0xAC6F,0xCD32}, + {0xAC70,0xAC70,0xCD33}, /* AC70 */ + {0xAC71,0xAC71,0xCD34}, + {0xAC72,0xAC72,0xCD35}, + {0xAC73,0xAC73,0xCD36}, + {0xAC74,0xAC74,0xCD37}, + {0xAC75,0xAC75,0xCD38}, + {0xAC76,0xAC76,0xCD3A}, + {0xAC77,0xAC77,0xCD3B}, + {0xAC78,0xAC78,0xCD3C}, + {0xAC79,0xAC79,0xCD3D}, + {0xAC7A,0xAC7A,0xCD3E}, + {0xAC7B,0xAC7B,0x003F}, + {0xAC7C,0xAC7C,0x003F}, + {0xAC7D,0xAC7D,0x003F}, + {0xAC7E,0xAC7E,0x003F}, + {0xAC7F,0xAC7F,0x003F}, + {0xAC80,0xAC80,0x003F}, /* AC80 */ + {0xAC81,0xAC81,0xCD3F}, + {0xAC82,0xAC82,0xCD40}, + {0xAC83,0xAC83,0xCD41}, + {0xAC84,0xAC84,0xCD42}, + {0xAC85,0xAC85,0xCD43}, + {0xAC86,0xAC86,0xCD44}, + {0xAC87,0xAC87,0xCD45}, + {0xAC88,0xAC88,0xCD46}, + {0xAC89,0xAC89,0xCD47}, + {0xAC8A,0xAC8A,0xCD48}, + {0xAC8B,0xAC8B,0xCD49}, + {0xAC8C,0xAC8C,0xCD4A}, + {0xAC8D,0xAC8D,0xCD4B}, + {0xAC8E,0xAC8E,0xCD4C}, + {0xAC8F,0xAC8F,0xCD4D}, + {0xAC90,0xAC90,0xCD4E}, /* AC90 */ + {0xAC91,0xAC91,0xCD4F}, + {0xAC92,0xAC92,0xCD50}, + {0xAC93,0xAC93,0xCD51}, + {0xAC94,0xAC94,0xCD52}, + {0xAC95,0xAC95,0xCD53}, + {0xAC96,0xAC96,0xCD54}, + {0xAC97,0xAC97,0xCD55}, + {0xAC98,0xAC98,0xCD56}, + {0xAC99,0xAC99,0xCD57}, + {0xAC9A,0xAC9A,0xCD58}, + {0xAC9B,0xAC9B,0xCD59}, + {0xAC9C,0xAC9C,0xCD5A}, + {0xAC9D,0xAC9D,0xCD5B}, + {0xAC9E,0xAC9E,0xCD5D}, + {0xAC9F,0xAC9F,0xCD5E}, + {0xACA0,0xACA0,0xCD5F}, /* ACA0 */ + {0xACA1,0xACD1,0x0410}, + {0xACA2,0xACD2,0x0411}, + {0xACA3,0xACD3,0x0412}, + {0xACA4,0xACD4,0x0413}, + {0xACA5,0xACD5,0x0414}, + {0xACA6,0xACD6,0x0415}, + {0xACA7,0xACD7,0x0401}, + {0xACA8,0xACD8,0x0416}, + {0xACA9,0xACD9,0x0417}, + {0xACAA,0xACDA,0x0418}, + {0xACAB,0xACDB,0x0419}, + {0xACAC,0xACDC,0x041A}, + {0xACAD,0xACDD,0x041B}, + {0xACAE,0xACDE,0x041C}, + {0xACAF,0xACDF,0x041D}, + {0xACB0,0xACE0,0x041E}, /* ACB0 */ + {0xACB1,0xACE1,0x041F}, + {0xACB2,0xACE2,0x0420}, + {0xACB3,0xACE3,0x0421}, + {0xACB4,0xACE4,0x0422}, + {0xACB5,0xACE5,0x0423}, + {0xACB6,0xACE6,0x0424}, + {0xACB7,0xACE7,0x0425}, + {0xACB8,0xACE8,0x0426}, + {0xACB9,0xACE9,0x0427}, + {0xACBA,0xACEA,0x0428}, + {0xACBB,0xACEB,0x0429}, + {0xACBC,0xACEC,0x042A}, + {0xACBD,0xACED,0x042B}, + {0xACBE,0xACEE,0x042C}, + {0xACBF,0xACEF,0x042D}, + {0xACC0,0xACF0,0x042E}, /* ACC0 */ + {0xACC1,0xACF1,0x042F}, + {0xACC2,0xACC2,0x003F}, + {0xACC3,0xACC3,0x003F}, + {0xACC4,0xACC4,0x003F}, + {0xACC5,0xACC5,0x003F}, + {0xACC6,0xACC6,0x003F}, + {0xACC7,0xACC7,0x003F}, + {0xACC8,0xACC8,0x003F}, + {0xACC9,0xACC9,0x003F}, + {0xACCA,0xACCA,0x003F}, + {0xACCB,0xACCB,0x003F}, + {0xACCC,0xACCC,0x003F}, + {0xACCD,0xACCD,0x003F}, + {0xACCE,0xACCE,0x003F}, + {0xACCF,0xACCF,0x003F}, + {0xACD0,0xACD0,0x003F}, /* ACD0 */ + {0xACA1,0xACD1,0x0430}, + {0xACA2,0xACD2,0x0431}, + {0xACA3,0xACD3,0x0432}, + {0xACA4,0xACD4,0x0433}, + {0xACA5,0xACD5,0x0434}, + {0xACA6,0xACD6,0x0435}, + {0xACA7,0xACD7,0x0451}, + {0xACA8,0xACD8,0x0436}, + {0xACA9,0xACD9,0x0437}, + {0xACAA,0xACDA,0x0438}, + {0xACAB,0xACDB,0x0439}, + {0xACAC,0xACDC,0x043A}, + {0xACAD,0xACDD,0x043B}, + {0xACAE,0xACDE,0x043C}, + {0xACAF,0xACDF,0x043D}, + {0xACB0,0xACE0,0x043E}, /* ACE0 */ + {0xACB1,0xACE1,0x043F}, + {0xACB2,0xACE2,0x0440}, + {0xACB3,0xACE3,0x0441}, + {0xACB4,0xACE4,0x0442}, + {0xACB5,0xACE5,0x0443}, + {0xACB6,0xACE6,0x0444}, + {0xACB7,0xACE7,0x0445}, + {0xACB8,0xACE8,0x0446}, + {0xACB9,0xACE9,0x0447}, + {0xACBA,0xACEA,0x0448}, + {0xACBB,0xACEB,0x0449}, + {0xACBC,0xACEC,0x044A}, + {0xACBD,0xACED,0x044B}, + {0xACBE,0xACEE,0x044C}, + {0xACBF,0xACEF,0x044D}, + {0xACC0,0xACF0,0x044E}, /* ACF0 */ + {0xACC1,0xACF1,0x044F}, + {0xACF2,0xACF2,0x003F}, + {0xACF3,0xACF3,0x003F}, + {0xACF4,0xACF4,0x003F}, + {0xACF5,0xACF5,0x003F}, + {0xACF6,0xACF6,0x003F}, + {0xACF7,0xACF7,0x003F}, + {0xACF8,0xACF8,0x003F}, + {0xACF9,0xACF9,0x003F}, + {0xACFA,0xACFA,0x003F}, + {0xACFB,0xACFB,0x003F}, + {0xACFC,0xACFC,0x003F}, + {0xACFD,0xACFD,0x003F}, + {0xACFE,0xACFE,0x003F}, + {0xACFF,0xACFF,0x003F} +}; + + +static MY_UNICASE_INFO *my_caseinfo_euckr[256]= +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, cA3, NULL, cA5, NULL, cA7, /* A */ + cA8, cA9, NULL, NULL, cAC, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + + /* page 0 0x8141-0xC8FE */ static uint16 tab_ksc5601_uni0[]={ 0xAC02,0xAC03,0xAC05,0xAC06,0xAC0B,0xAC0C,0xAC0D,0xAC0E, @@ -8720,8 +9987,8 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, - my_caseup_mb, - my_casedn_mb, + my_caseup_mb_varlen, /* UPPER() can reduce length: Turkish DOTLESS i -> I */ + my_casedn_mb, /* LOWER() does not change length, use simple version*/ my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, @@ -8753,7 +10020,7 @@ CHARSET_INFO my_charset_euckr_korean_ci= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_euckr, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ @@ -8786,7 +10053,7 @@ CHARSET_INFO my_charset_euckr_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_euckr, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index b8b04dfca6b..77e6a0f4e0f 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -201,6 +201,1535 @@ static uint mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) } + +/* Case info pages for JIS-X-0208 range */ + +static MY_UNICASE_INFO cA2[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA2A0,0xA2A0,0x003F}, /* A2A0 */ + {0xA2A1,0xA2A1,0x25C6}, + {0xA2A2,0xA2A2,0x25A1}, + {0xA2A3,0xA2A3,0x25A0}, + {0xA2A4,0xA2A4,0x25B3}, + {0xA2A5,0xA2A5,0x25B2}, + {0xA2A6,0xA2A6,0x25BD}, + {0xA2A7,0xA2A7,0x25BC}, + {0xA2A8,0xA2A8,0x203B}, + {0xA2A9,0xA2A9,0x3012}, + {0xA2AA,0xA2AA,0x2192}, + {0xA2AB,0xA2AB,0x2190}, + {0xA2AC,0xA2AC,0x2191}, + {0xA2AD,0xA2AD,0x2193}, + {0xA2AE,0xA2AE,0x3013}, + {0xA2AF,0xA2AF,0x003F}, + {0xA2B0,0xA2B0,0x003F}, /* A2B0 */ + {0xA2B1,0xA2B1,0x003F}, + {0xA2B2,0xA2B2,0x003F}, + {0xA2B3,0xA2B3,0x003F}, + {0xA2B4,0xA2B4,0x003F}, + {0xA2B5,0xA2B5,0x003F}, + {0xA2B6,0xA2B6,0x003F}, + {0xA2B7,0xA2B7,0x003F}, + {0xA2B8,0xA2B8,0x003F}, + {0xA2B9,0xA2B9,0x003F}, + {0xA2BA,0xA2BA,0x2208}, + {0xA2BB,0xA2BB,0x220B}, + {0xA2BC,0xA2BC,0x2286}, + {0xA2BD,0xA2BD,0x2287}, + {0xA2BE,0xA2BE,0x2282}, + {0xA2BF,0xA2BF,0x2283}, + {0xA2C0,0xA2C0,0x222A}, /* A2C0 */ + {0xA2C1,0xA2C1,0x2229}, + {0xA2C2,0xA2C2,0x003F}, + {0xA2C3,0xA2C3,0x003F}, + {0xA2C4,0xA2C4,0x003F}, + {0xA2C5,0xA2C5,0x003F}, + {0xA2C6,0xA2C6,0x003F}, + {0xA2C7,0xA2C7,0x003F}, + {0xA2C8,0xA2C8,0x003F}, + {0xA2C9,0xA2C9,0x003F}, + {0xA2CA,0xA2CA,0x2227}, + {0xA2CB,0xA2CB,0x2228}, + {0xA2CC,0xA2CC,0xFFE2}, + {0xA2CD,0xA2CD,0x21D2}, + {0xA2CE,0xA2CE,0x21D4}, + {0xA2CF,0xA2CF,0x2200}, + {0xA2D0,0xA2D0,0x2203}, /* A2D0 */ + {0xA2D1,0xA2D1,0x003F}, + {0xA2D2,0xA2D2,0x003F}, + {0xA2D3,0xA2D3,0x003F}, + {0xA2D4,0xA2D4,0x003F}, + {0xA2D5,0xA2D5,0x003F}, + {0xA2D6,0xA2D6,0x003F}, + {0xA2D7,0xA2D7,0x003F}, + {0xA2D8,0xA2D8,0x003F}, + {0xA2D9,0xA2D9,0x003F}, + {0xA2DA,0xA2DA,0x003F}, + {0xA2DB,0xA2DB,0x003F}, + {0xA2DC,0xA2DC,0x2220}, + {0xA2DD,0xA2DD,0x22A5}, + {0xA2DE,0xA2DE,0x2312}, + {0xA2DF,0xA2DF,0x2202}, + {0xA2E0,0xA2E0,0x2207}, /* A2E0 */ + {0xA2E1,0xA2E1,0x2261}, + {0xA2E2,0xA2E2,0x2252}, + {0xA2E3,0xA2E3,0x226A}, + {0xA2E4,0xA2E4,0x226B}, + {0xA2E5,0xA2E5,0x221A}, + {0xA2E6,0xA2E6,0x223D}, + {0xA2E7,0xA2E7,0x221D}, + {0xA2E8,0xA2E8,0x2235}, + {0xA2E9,0xA2E9,0x222B}, + {0xA2EA,0xA2EA,0x222C}, + {0xA2EB,0xA2EB,0x003F}, + {0xA2EC,0xA2EC,0x003F}, + {0xA2ED,0xA2ED,0x003F}, + {0xA2EE,0xA2EE,0x003F}, + {0xA2EF,0xA2EF,0x003F}, + {0xA2F0,0xA2F0,0x003F}, /* A2F0 */ + {0xA2F1,0xA2F1,0x003F}, + {0xA2F2,0x8FABA9,0x212B}, + {0xA2F3,0xA2F3,0x2030}, + {0xA2F4,0xA2F4,0x266F}, + {0xA2F5,0xA2F5,0x266D}, + {0xA2F6,0xA2F6,0x266A}, + {0xA2F7,0xA2F7,0x2020}, + {0xA2F8,0xA2F8,0x2021}, + {0xA2F9,0xA2F9,0x00B6}, + {0xA2FA,0xA2FA,0x003F}, + {0xA2FB,0xA2FB,0x003F}, + {0xA2FC,0xA2FC,0x003F}, + {0xA2FD,0xA2FD,0x003F}, + {0xA2FE,0xA2FE,0x25EF}, + {0xA2FF,0xA2FF,0x003F}, +}; + + +static MY_UNICASE_INFO cA3[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA3A0,0xA3A0,0x003F}, /* A3A0 */ + {0xA3A1,0xA3A1,0x003F}, + {0xA3A2,0xA3A2,0x003F}, + {0xA3A3,0xA3A3,0x003F}, + {0xA3A4,0xA3A4,0x003F}, + {0xA3A5,0xA3A5,0x003F}, + {0xA3A6,0xA3A6,0x003F}, + {0xA3A7,0xA3A7,0x003F}, + {0xA3A8,0xA3A8,0x003F}, + {0xA3A9,0xA3A9,0x003F}, + {0xA3AA,0xA3AA,0x003F}, + {0xA3AB,0xA3AB,0x003F}, + {0xA3AC,0xA3AC,0x003F}, + {0xA3AD,0xA3AD,0x003F}, + {0xA3AE,0xA3AE,0x003F}, + {0xA3AF,0xA3AF,0x003F}, + {0xA3B0,0xA3B0,0xFF10}, /* A3B0 */ + {0xA3B1,0xA3B1,0xFF11}, + {0xA3B2,0xA3B2,0xFF12}, + {0xA3B3,0xA3B3,0xFF13}, + {0xA3B4,0xA3B4,0xFF14}, + {0xA3B5,0xA3B5,0xFF15}, + {0xA3B6,0xA3B6,0xFF16}, + {0xA3B7,0xA3B7,0xFF17}, + {0xA3B8,0xA3B8,0xFF18}, + {0xA3B9,0xA3B9,0xFF19}, + {0xA3BA,0xA3BA,0x003F}, + {0xA3BB,0xA3BB,0x003F}, + {0xA3BC,0xA3BC,0x003F}, + {0xA3BD,0xA3BD,0x003F}, + {0xA3BE,0xA3BE,0x003F}, + {0xA3BF,0xA3BF,0x003F}, + {0xA3C0,0xA3C0,0x003F}, /* A3C0 */ + {0xA3C1,0xA3E1,0xFF21}, + {0xA3C2,0xA3E2,0xFF22}, + {0xA3C3,0xA3E3,0xFF23}, + {0xA3C4,0xA3E4,0xFF24}, + {0xA3C5,0xA3E5,0xFF25}, + {0xA3C6,0xA3E6,0xFF26}, + {0xA3C7,0xA3E7,0xFF27}, + {0xA3C8,0xA3E8,0xFF28}, + {0xA3C9,0xA3E9,0xFF29}, + {0xA3CA,0xA3EA,0xFF2A}, + {0xA3CB,0xA3EB,0xFF2B}, + {0xA3CC,0xA3EC,0xFF2C}, + {0xA3CD,0xA3ED,0xFF2D}, + {0xA3CE,0xA3EE,0xFF2E}, + {0xA3CF,0xA3EF,0xFF2F}, + {0xA3D0,0xA3F0,0xFF30}, /* A3D0 */ + {0xA3D1,0xA3F1,0xFF31}, + {0xA3D2,0xA3F2,0xFF32}, + {0xA3D3,0xA3F3,0xFF33}, + {0xA3D4,0xA3F4,0xFF34}, + {0xA3D5,0xA3F5,0xFF35}, + {0xA3D6,0xA3F6,0xFF36}, + {0xA3D7,0xA3F7,0xFF37}, + {0xA3D8,0xA3F8,0xFF38}, + {0xA3D9,0xA3F9,0xFF39}, + {0xA3DA,0xA3FA,0xFF3A}, + {0xA3DB,0xA3DB,0x003F}, + {0xA3DC,0xA3DC,0x003F}, + {0xA3DD,0xA3DD,0x003F}, + {0xA3DE,0xA3DE,0x003F}, + {0xA3DF,0xA3DF,0x003F}, + {0xA3E0,0xA3E0,0x003F}, /* A3E0 */ + {0xA3C1,0xA3E1,0xFF41}, + {0xA3C2,0xA3E2,0xFF42}, + {0xA3C3,0xA3E3,0xFF43}, + {0xA3C4,0xA3E4,0xFF44}, + {0xA3C5,0xA3E5,0xFF45}, + {0xA3C6,0xA3E6,0xFF46}, + {0xA3C7,0xA3E7,0xFF47}, + {0xA3C8,0xA3E8,0xFF48}, + {0xA3C9,0xA3E9,0xFF49}, + {0xA3CA,0xA3EA,0xFF4A}, + {0xA3CB,0xA3EB,0xFF4B}, + {0xA3CC,0xA3EC,0xFF4C}, + {0xA3CD,0xA3ED,0xFF4D}, + {0xA3CE,0xA3EE,0xFF4E}, + {0xA3CF,0xA3EF,0xFF4F}, + {0xA3D0,0xA3F0,0xFF50}, /* A3F0 */ + {0xA3D1,0xA3F1,0xFF51}, + {0xA3D2,0xA3F2,0xFF52}, + {0xA3D3,0xA3F3,0xFF53}, + {0xA3D4,0xA3F4,0xFF54}, + {0xA3D5,0xA3F5,0xFF55}, + {0xA3D6,0xA3F6,0xFF56}, + {0xA3D7,0xA3F7,0xFF57}, + {0xA3D8,0xA3F8,0xFF58}, + {0xA3D9,0xA3F9,0xFF59}, + {0xA3DA,0xA3FA,0xFF5A}, + {0xA3FB,0xA3FB,0x003F}, + {0xA3FC,0xA3FC,0x003F}, + {0xA3FD,0xA3FD,0x003F}, + {0xA3FE,0xA3FE,0x003F}, + {0xA3FF,0xA3FF,0x003F}, +}; + + +static MY_UNICASE_INFO cA6[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA6A0,0xA6A0,0x003F}, /* A6A0 */ + {0xA6A1,0xA6C1,0x0391}, + {0xA6A2,0xA6C2,0x0392}, + {0xA6A3,0xA6C3,0x0393}, + {0xA6A4,0xA6C4,0x0394}, + {0xA6A5,0xA6C5,0x0395}, + {0xA6A6,0xA6C6,0x0396}, + {0xA6A7,0xA6C7,0x0397}, + {0xA6A8,0xA6C8,0x0398}, + {0xA6A9,0xA6C9,0x0399}, + {0xA6AA,0xA6CA,0x039A}, + {0xA6AB,0xA6CB,0x039B}, + {0xA6AC,0xA6CC,0x039C}, + {0xA6AD,0xA6CD,0x039D}, + {0xA6AE,0xA6CE,0x039E}, + {0xA6AF,0xA6CF,0x039F}, + {0xA6B0,0xA6D0,0x03A0}, /* A6B0 */ + {0xA6B1,0xA6D1,0x03A1}, + {0xA6B2,0xA6D2,0x03A3}, + {0xA6B3,0xA6D3,0x03A4}, + {0xA6B4,0xA6D4,0x03A5}, + {0xA6B5,0xA6D5,0x03A6}, + {0xA6B6,0xA6D6,0x03A7}, + {0xA6B7,0xA6D7,0x03A8}, + {0xA6B8,0xA6D8,0x03A9}, + {0xA6B9,0xA6B9,0x003F}, + {0xA6BA,0xA6BA,0x003F}, + {0xA6BB,0xA6BB,0x003F}, + {0xA6BC,0xA6BC,0x003F}, + {0xA6BD,0xA6BD,0x003F}, + {0xA6BE,0xA6BE,0x003F}, + {0xA6BF,0xA6BF,0x003F}, + {0xA6C0,0xA6C0,0x003F}, /* A6C0 */ + {0xA6A1,0xA6C1,0x03B1}, + {0xA6A2,0xA6C2,0x03B2}, + {0xA6A3,0xA6C3,0x03B3}, + {0xA6A4,0xA6C4,0x03B4}, + {0xA6A5,0xA6C5,0x03B5}, + {0xA6A6,0xA6C6,0x03B6}, + {0xA6A7,0xA6C7,0x03B7}, + {0xA6A8,0xA6C8,0x03B8}, + {0xA6A9,0xA6C9,0x03B9}, + {0xA6AA,0xA6CA,0x03BA}, + {0xA6AB,0xA6CB,0x03BB}, + {0xA6AC,0xA6CC,0x03BC}, + {0xA6AD,0xA6CD,0x03BD}, + {0xA6AE,0xA6CE,0x03BE}, + {0xA6AF,0xA6CF,0x03BF}, + {0xA6B0,0xA6D0,0x03C0}, /* A6D0 */ + {0xA6B1,0xA6D1,0x03C1}, + {0xA6B2,0xA6D2,0x03C3}, + {0xA6B3,0xA6D3,0x03C4}, + {0xA6B4,0xA6D4,0x03C5}, + {0xA6B5,0xA6D5,0x03C6}, + {0xA6B6,0xA6D6,0x03C7}, + {0xA6B7,0xA6D7,0x03C8}, + {0xA6B8,0xA6D8,0x03C9}, + {0xA6D9,0xA6D9,0x003F}, + {0xA6DA,0xA6DA,0x003F}, + {0xA6DB,0xA6DB,0x003F}, + {0xA6DC,0xA6DC,0x003F}, + {0xA6DD,0xA6DD,0x003F}, + {0xA6DE,0xA6DE,0x003F}, + {0xA6DF,0xA6DF,0x003F}, + {0xA6E0,0xA6E0,0x003F}, /* A6E0 */ + {0xA6E1,0xA6E1,0x003F}, + {0xA6E2,0xA6E2,0x003F}, + {0xA6E3,0xA6E3,0x003F}, + {0xA6E4,0xA6E4,0x003F}, + {0xA6E5,0xA6E5,0x003F}, + {0xA6E6,0xA6E6,0x003F}, + {0xA6E7,0xA6E7,0x003F}, + {0xA6E8,0xA6E8,0x003F}, + {0xA6E9,0xA6E9,0x003F}, + {0xA6EA,0xA6EA,0x003F}, + {0xA6EB,0xA6EB,0x003F}, + {0xA6EC,0xA6EC,0x003F}, + {0xA6ED,0xA6ED,0x003F}, + {0xA6EE,0xA6EE,0x003F}, + {0xA6EF,0xA6EF,0x003F}, + {0xA6F0,0xA6F0,0x003F}, /* A6F0 */ + {0xA6F1,0xA6F1,0x003F}, + {0xA6F2,0xA6F2,0x003F}, + {0xA6F3,0xA6F3,0x003F}, + {0xA6F4,0xA6F4,0x003F}, + {0xA6F5,0xA6F5,0x003F}, + {0xA6F6,0xA6F6,0x003F}, + {0xA6F7,0xA6F7,0x003F}, + {0xA6F8,0xA6F8,0x003F}, + {0xA6F9,0xA6F9,0x003F}, + {0xA6FA,0xA6FA,0x003F}, + {0xA6FB,0xA6FB,0x003F}, + {0xA6FC,0xA6FC,0x003F}, + {0xA6FD,0xA6FD,0x003F}, + {0xA6FE,0xA6FE,0x003F}, + {0xA6FF,0xA6FF,0x003F}, +}; + + +static MY_UNICASE_INFO cA7[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA7A0,0xA7A0,0x003F}, /* A7A0 */ + {0xA7A1,0xA7D1,0x0410}, + {0xA7A2,0xA7D2,0x0411}, + {0xA7A3,0xA7D3,0x0412}, + {0xA7A4,0xA7D4,0x0413}, + {0xA7A5,0xA7D5,0x0414}, + {0xA7A6,0xA7D6,0x0415}, + {0xA7A7,0xA7D7,0x0401}, + {0xA7A8,0xA7D8,0x0416}, + {0xA7A9,0xA7D9,0x0417}, + {0xA7AA,0xA7DA,0x0418}, + {0xA7AB,0xA7DB,0x0419}, + {0xA7AC,0xA7DC,0x041A}, + {0xA7AD,0xA7DD,0x041B}, + {0xA7AE,0xA7DE,0x041C}, + {0xA7AF,0xA7DF,0x041D}, + {0xA7B0,0xA7E0,0x041E}, /* A7B0 */ + {0xA7B1,0xA7E1,0x041F}, + {0xA7B2,0xA7E2,0x0420}, + {0xA7B3,0xA7E3,0x0421}, + {0xA7B4,0xA7E4,0x0422}, + {0xA7B5,0xA7E5,0x0423}, + {0xA7B6,0xA7E6,0x0424}, + {0xA7B7,0xA7E7,0x0425}, + {0xA7B8,0xA7E8,0x0426}, + {0xA7B9,0xA7E9,0x0427}, + {0xA7BA,0xA7EA,0x0428}, + {0xA7BB,0xA7EB,0x0429}, + {0xA7BC,0xA7EC,0x042A}, + {0xA7BD,0xA7ED,0x042B}, + {0xA7BE,0xA7EE,0x042C}, + {0xA7BF,0xA7EF,0x042D}, + {0xA7C0,0xA7F0,0x042E}, /* A7C0 */ + {0xA7C1,0xA7F1,0x042F}, + {0xA7C2,0xA7C2,0x003F}, + {0xA7C3,0xA7C3,0x003F}, + {0xA7C4,0xA7C4,0x003F}, + {0xA7C5,0xA7C5,0x003F}, + {0xA7C6,0xA7C6,0x003F}, + {0xA7C7,0xA7C7,0x003F}, + {0xA7C8,0xA7C8,0x003F}, + {0xA7C9,0xA7C9,0x003F}, + {0xA7CA,0xA7CA,0x003F}, + {0xA7CB,0xA7CB,0x003F}, + {0xA7CC,0xA7CC,0x003F}, + {0xA7CD,0xA7CD,0x003F}, + {0xA7CE,0xA7CE,0x003F}, + {0xA7CF,0xA7CF,0x003F}, + {0xA7D0,0xA7D0,0x003F}, /* A7D0 */ + {0xA7A1,0xA7D1,0x0430}, + {0xA7A2,0xA7D2,0x0431}, + {0xA7A3,0xA7D3,0x0432}, + {0xA7A4,0xA7D4,0x0433}, + {0xA7A5,0xA7D5,0x0434}, + {0xA7A6,0xA7D6,0x0435}, + {0xA7A7,0xA7D7,0x0451}, + {0xA7A8,0xA7D8,0x0436}, + {0xA7A9,0xA7D9,0x0437}, + {0xA7AA,0xA7DA,0x0438}, + {0xA7AB,0xA7DB,0x0439}, + {0xA7AC,0xA7DC,0x043A}, + {0xA7AD,0xA7DD,0x043B}, + {0xA7AE,0xA7DE,0x043C}, + {0xA7AF,0xA7DF,0x043D}, + {0xA7B0,0xA7E0,0x043E}, /* A7E0 */ + {0xA7B1,0xA7E1,0x043F}, + {0xA7B2,0xA7E2,0x0440}, + {0xA7B3,0xA7E3,0x0441}, + {0xA7B4,0xA7E4,0x0442}, + {0xA7B5,0xA7E5,0x0443}, + {0xA7B6,0xA7E6,0x0444}, + {0xA7B7,0xA7E7,0x0445}, + {0xA7B8,0xA7E8,0x0446}, + {0xA7B9,0xA7E9,0x0447}, + {0xA7BA,0xA7EA,0x0448}, + {0xA7BB,0xA7EB,0x0449}, + {0xA7BC,0xA7EC,0x044A}, + {0xA7BD,0xA7ED,0x044B}, + {0xA7BE,0xA7EE,0x044C}, + {0xA7BF,0xA7EF,0x044D}, + {0xA7C0,0xA7F0,0x044E}, /* A7F0 */ + {0xA7C1,0xA7F1,0x044F}, + {0xA7F2,0xA7F2,0x003F}, + {0xA7F3,0xA7F3,0x003F}, + {0xA7F4,0xA7F4,0x003F}, + {0xA7F5,0xA7F5,0x003F}, + {0xA7F6,0xA7F6,0x003F}, + {0xA7F7,0xA7F7,0x003F}, + {0xA7F8,0xA7F8,0x003F}, + {0xA7F9,0xA7F9,0x003F}, + {0xA7FA,0xA7FA,0x003F}, + {0xA7FB,0xA7FB,0x003F}, + {0xA7FC,0xA7FC,0x003F}, + {0xA7FD,0xA7FD,0x003F}, + {0xA7FE,0xA7FE,0x003F}, + {0xA7FF,0xA7FF,0x003F}, +}; + + +static MY_UNICASE_INFO cAD[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xADA0,0xADA0,0x003F}, /* ADA0 */ + {0xADA1,0xADA1,0x2460}, + {0xADA2,0xADA2,0x2461}, + {0xADA3,0xADA3,0x2462}, + {0xADA4,0xADA4,0x2463}, + {0xADA5,0xADA5,0x2464}, + {0xADA6,0xADA6,0x2465}, + {0xADA7,0xADA7,0x2466}, + {0xADA8,0xADA8,0x2467}, + {0xADA9,0xADA9,0x2468}, + {0xADAA,0xADAA,0x2469}, + {0xADAB,0xADAB,0x246A}, + {0xADAC,0xADAC,0x246B}, + {0xADAD,0xADAD,0x246C}, + {0xADAE,0xADAE,0x246D}, + {0xADAF,0xADAF,0x246E}, + {0xADB0,0xADB0,0x246F}, /* ADB0 */ + {0xADB1,0xADB1,0x2470}, + {0xADB2,0xADB2,0x2471}, + {0xADB3,0xADB3,0x2472}, + {0xADB4,0xADB4,0x2473}, + {0xADB5,0x8FF3F3,0x2160}, + {0xADB6,0x8FF3F4,0x2161}, + {0xADB7,0x8FF3F5,0x2162}, + {0xADB8,0x8FF3F6,0x2163}, + {0xADB9,0x8FF3F7,0x2164}, + {0xADBA,0x8FF3F8,0x2165}, + {0xADBB,0x8FF3F9,0x2166}, + {0xADBC,0x8FF3FA,0x2167}, + {0xADBD,0x8FF3FB,0x2168}, + {0xADBE,0x8FF3FC,0x2169}, + {0xADBF,0xADBF,0x003F}, + {0xADC0,0xADC0,0x3349}, /* ADC0 */ + {0xADC1,0xADC1,0x3314}, + {0xADC2,0xADC2,0x3322}, + {0xADC3,0xADC3,0x334D}, + {0xADC4,0xADC4,0x3318}, + {0xADC5,0xADC5,0x3327}, + {0xADC6,0xADC6,0x3303}, + {0xADC7,0xADC7,0x3336}, + {0xADC8,0xADC8,0x3351}, + {0xADC9,0xADC9,0x3357}, + {0xADCA,0xADCA,0x330D}, + {0xADCB,0xADCB,0x3326}, + {0xADCC,0xADCC,0x3323}, + {0xADCD,0xADCD,0x332B}, + {0xADCE,0xADCE,0x334A}, + {0xADCF,0xADCF,0x333B}, + {0xADD0,0xADD0,0x339C}, /* ADD0 */ + {0xADD1,0xADD1,0x339D}, + {0xADD2,0xADD2,0x339E}, + {0xADD3,0xADD3,0x338E}, + {0xADD4,0xADD4,0x338F}, + {0xADD5,0xADD5,0x33C4}, + {0xADD6,0xADD6,0x33A1}, + {0xADD7,0xADD7,0x003F}, + {0xADD8,0xADD8,0x003F}, + {0xADD9,0xADD9,0x003F}, + {0xADDA,0xADDA,0x003F}, + {0xADDB,0xADDB,0x003F}, + {0xADDC,0xADDC,0x003F}, + {0xADDD,0xADDD,0x003F}, + {0xADDE,0xADDE,0x003F}, + {0xADDF,0xADDF,0x337B}, + {0xADE0,0xADE0,0x301D}, /* ADE0 */ + {0xADE1,0xADE1,0x301F}, + {0xADE2,0xADE2,0x2116}, + {0xADE3,0xADE3,0x33CD}, + {0xADE4,0xADE4,0x2121}, + {0xADE5,0xADE5,0x32A4}, + {0xADE6,0xADE6,0x32A5}, + {0xADE7,0xADE7,0x32A6}, + {0xADE8,0xADE8,0x32A7}, + {0xADE9,0xADE9,0x32A8}, + {0xADEA,0xADEA,0x3231}, + {0xADEB,0xADEB,0x3232}, + {0xADEC,0xADEC,0x3239}, + {0xADED,0xADED,0x337E}, + {0xADEE,0xADEE,0x337D}, + {0xADEF,0xADEF,0x337C}, + {0xADF0,0xADF0,0x2252}, /* ADF0 */ + {0xADF1,0xADF1,0x2261}, + {0xADF2,0xADF2,0x222B}, + {0xADF3,0xADF3,0x222E}, + {0xADF4,0xADF4,0x2211}, + {0xADF5,0xADF5,0x221A}, + {0xADF6,0xADF6,0x22A5}, + {0xADF7,0xADF7,0x2220}, + {0xADF8,0xADF8,0x221F}, + {0xADF9,0xADF9,0x22BF}, + {0xADFA,0xADFA,0x2235}, + {0xADFB,0xADFB,0x2229}, + {0xADFC,0xADFC,0x222A}, + {0xADFD,0xADFD,0x003F}, + {0xADFE,0xADFE,0x003F}, + {0xADFF,0xADFF,0x003F}, +}; + + +/* Case info pages for JIS-X-0212 range */ + +static MY_UNICASE_INFO c8FA6[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FA6A0,0x8FA6A0,0x003F}, /* 8FA6A0 */ + {0x8FA6A1,0x8FA6A1,0x003F}, + {0x8FA6A2,0x8FA6A2,0x003F}, + {0x8FA6A3,0x8FA6A3,0x003F}, + {0x8FA6A4,0x8FA6A4,0x003F}, + {0x8FA6A5,0x8FA6A5,0x003F}, + {0x8FA6A6,0x8FA6A6,0x003F}, + {0x8FA6A7,0x8FA6A7,0x003F}, + {0x8FA6A8,0x8FA6A8,0x003F}, + {0x8FA6A9,0x8FA6A9,0x003F}, + {0x8FA6AA,0x8FA6AA,0x003F}, + {0x8FA6AB,0x8FA6AB,0x003F}, + {0x8FA6AC,0x8FA6AC,0x003F}, + {0x8FA6AD,0x8FA6AD,0x003F}, + {0x8FA6AE,0x8FA6AE,0x003F}, + {0x8FA6AF,0x8FA6AF,0x003F}, + {0x8FA6B0,0x8FA6B0,0x003F}, /* 8FA6B0 */ + {0x8FA6B1,0x8FA6B1,0x003F}, + {0x8FA6B2,0x8FA6B2,0x003F}, + {0x8FA6B3,0x8FA6B3,0x003F}, + {0x8FA6B4,0x8FA6B4,0x003F}, + {0x8FA6B5,0x8FA6B5,0x003F}, + {0x8FA6B6,0x8FA6B6,0x003F}, + {0x8FA6B7,0x8FA6B7,0x003F}, + {0x8FA6B8,0x8FA6B8,0x003F}, + {0x8FA6B9,0x8FA6B9,0x003F}, + {0x8FA6BA,0x8FA6BA,0x003F}, + {0x8FA6BB,0x8FA6BB,0x003F}, + {0x8FA6BC,0x8FA6BC,0x003F}, + {0x8FA6BD,0x8FA6BD,0x003F}, + {0x8FA6BE,0x8FA6BE,0x003F}, + {0x8FA6BF,0x8FA6BF,0x003F}, + {0x8FA6C0,0x8FA6C0,0x003F}, /* 8FA6C0 */ + {0x8FA6C1,0x8FA6C1,0x003F}, + {0x8FA6C2,0x8FA6C2,0x003F}, + {0x8FA6C3,0x8FA6C3,0x003F}, + {0x8FA6C4,0x8FA6C4,0x003F}, + {0x8FA6C5,0x8FA6C5,0x003F}, + {0x8FA6C6,0x8FA6C6,0x003F}, + {0x8FA6C7,0x8FA6C7,0x003F}, + {0x8FA6C8,0x8FA6C8,0x003F}, + {0x8FA6C9,0x8FA6C9,0x003F}, + {0x8FA6CA,0x8FA6CA,0x003F}, + {0x8FA6CB,0x8FA6CB,0x003F}, + {0x8FA6CC,0x8FA6CC,0x003F}, + {0x8FA6CD,0x8FA6CD,0x003F}, + {0x8FA6CE,0x8FA6CE,0x003F}, + {0x8FA6CF,0x8FA6CF,0x003F}, + {0x8FA6D0,0x8FA6D0,0x003F}, /* 8FA6D0 */ + {0x8FA6D1,0x8FA6D1,0x003F}, + {0x8FA6D2,0x8FA6D2,0x003F}, + {0x8FA6D3,0x8FA6D3,0x003F}, + {0x8FA6D4,0x8FA6D4,0x003F}, + {0x8FA6D5,0x8FA6D5,0x003F}, + {0x8FA6D6,0x8FA6D6,0x003F}, + {0x8FA6D7,0x8FA6D7,0x003F}, + {0x8FA6D8,0x8FA6D8,0x003F}, + {0x8FA6D9,0x8FA6D9,0x003F}, + {0x8FA6DA,0x8FA6DA,0x003F}, + {0x8FA6DB,0x8FA6DB,0x003F}, + {0x8FA6DC,0x8FA6DC,0x003F}, + {0x8FA6DD,0x8FA6DD,0x003F}, + {0x8FA6DE,0x8FA6DE,0x003F}, + {0x8FA6DF,0x8FA6DF,0x003F}, + {0x8FA6E0,0x8FA6E0,0x003F}, /* 8FA6E0 */ + {0x8FA6E1,0x8FA6F1,0x0386}, + {0x8FA6E2,0x8FA6F2,0x0388}, + {0x8FA6E3,0x8FA6F3,0x0389}, + {0x8FA6E4,0x8FA6F4,0x038A}, + {0x8FA6E5,0x8FA6F5,0x03AA}, + {0x8FA6E6,0x8FA6E6,0x003F}, + {0x8FA6E7,0x8FA6F7,0x038C}, + {0x8FA6E8,0x8FA6E8,0x003F}, + {0x8FA6E9,0x8FA6F9,0x038E}, + {0x8FA6EA,0x8FA6FA,0x03AB}, + {0x8FA6EB,0x8FA6EB,0x003F}, + {0x8FA6EC,0x8FA6FC,0x038F}, + {0x8FA6ED,0x8FA6ED,0x003F}, + {0x8FA6EE,0x8FA6EE,0x003F}, + {0x8FA6EF,0x8FA6EF,0x003F}, + {0x8FA6F0,0x8FA6F0,0x003F}, /* 8FA6F0 */ + {0x8FA6E1,0x8FA6F1,0x03AC}, + {0x8FA6E2,0x8FA6F2,0x03AD}, + {0x8FA6E3,0x8FA6F3,0x03AE}, + {0x8FA6E4,0x8FA6F4,0x03AF}, + {0x8FA6E5,0x8FA6F5,0x03CA}, + {0x8FA6F6,0x8FA6F6,0x0390}, + {0x8FA6E7,0x8FA6F7,0x03CC}, + {0xA6B2,0x8FA6F8,0x03C2}, + {0x8FA6E9,0x8FA6F9,0x03CD}, + {0x8FA6EA,0x8FA6FA,0x03CB}, + {0x8FA6FB,0x8FA6FB,0x03B0}, + {0x8FA6EC,0x8FA6FC,0x03CE}, + {0x8FA6FD,0x8FA6FD,0x003F}, + {0x8FA6FE,0x8FA6FE,0x003F}, + {0x8FA6FF,0x8FA6FF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FA7[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FA7A0,0x8FA7A0,0x003F}, /* 8FA7A0 */ + {0x8FA7A1,0x8FA7A1,0x003F}, + {0x8FA7A2,0x8FA7A2,0x003F}, + {0x8FA7A3,0x8FA7A3,0x003F}, + {0x8FA7A4,0x8FA7A4,0x003F}, + {0x8FA7A5,0x8FA7A5,0x003F}, + {0x8FA7A6,0x8FA7A6,0x003F}, + {0x8FA7A7,0x8FA7A7,0x003F}, + {0x8FA7A8,0x8FA7A8,0x003F}, + {0x8FA7A9,0x8FA7A9,0x003F}, + {0x8FA7AA,0x8FA7AA,0x003F}, + {0x8FA7AB,0x8FA7AB,0x003F}, + {0x8FA7AC,0x8FA7AC,0x003F}, + {0x8FA7AD,0x8FA7AD,0x003F}, + {0x8FA7AE,0x8FA7AE,0x003F}, + {0x8FA7AF,0x8FA7AF,0x003F}, + {0x8FA7B0,0x8FA7B0,0x003F}, /* 8FA7B0 */ + {0x8FA7B1,0x8FA7B1,0x003F}, + {0x8FA7B2,0x8FA7B2,0x003F}, + {0x8FA7B3,0x8FA7B3,0x003F}, + {0x8FA7B4,0x8FA7B4,0x003F}, + {0x8FA7B5,0x8FA7B5,0x003F}, + {0x8FA7B6,0x8FA7B6,0x003F}, + {0x8FA7B7,0x8FA7B7,0x003F}, + {0x8FA7B8,0x8FA7B8,0x003F}, + {0x8FA7B9,0x8FA7B9,0x003F}, + {0x8FA7BA,0x8FA7BA,0x003F}, + {0x8FA7BB,0x8FA7BB,0x003F}, + {0x8FA7BC,0x8FA7BC,0x003F}, + {0x8FA7BD,0x8FA7BD,0x003F}, + {0x8FA7BE,0x8FA7BE,0x003F}, + {0x8FA7BF,0x8FA7BF,0x003F}, + {0x8FA7C0,0x8FA7C0,0x003F}, /* 8FA7C0 */ + {0x8FA7C1,0x8FA7C1,0x003F}, + {0x8FA7C2,0x8FA7F2,0x0402}, + {0x8FA7C3,0x8FA7F3,0x0403}, + {0x8FA7C4,0x8FA7F4,0x0404}, + {0x8FA7C5,0x8FA7F5,0x0405}, + {0x8FA7C6,0x8FA7F6,0x0406}, + {0x8FA7C7,0x8FA7F7,0x0407}, + {0x8FA7C8,0x8FA7F8,0x0408}, + {0x8FA7C9,0x8FA7F9,0x0409}, + {0x8FA7CA,0x8FA7FA,0x040A}, + {0x8FA7CB,0x8FA7FB,0x040B}, + {0x8FA7CC,0x8FA7FC,0x040C}, + {0x8FA7CD,0x8FA7FD,0x040E}, + {0x8FA7CE,0x8FA7FE,0x040F}, + {0x8FA7CF,0x8FA7CF,0x003F}, + {0x8FA7D0,0x8FA7D0,0x003F}, /* 8FA7D0 */ + {0x8FA7D1,0x8FA7D1,0x003F}, + {0x8FA7D2,0x8FA7D2,0x003F}, + {0x8FA7D3,0x8FA7D3,0x003F}, + {0x8FA7D4,0x8FA7D4,0x003F}, + {0x8FA7D5,0x8FA7D5,0x003F}, + {0x8FA7D6,0x8FA7D6,0x003F}, + {0x8FA7D7,0x8FA7D7,0x003F}, + {0x8FA7D8,0x8FA7D8,0x003F}, + {0x8FA7D9,0x8FA7D9,0x003F}, + {0x8FA7DA,0x8FA7DA,0x003F}, + {0x8FA7DB,0x8FA7DB,0x003F}, + {0x8FA7DC,0x8FA7DC,0x003F}, + {0x8FA7DD,0x8FA7DD,0x003F}, + {0x8FA7DE,0x8FA7DE,0x003F}, + {0x8FA7DF,0x8FA7DF,0x003F}, + {0x8FA7E0,0x8FA7E0,0x003F}, /* 8FA7E0 */ + {0x8FA7E1,0x8FA7E1,0x003F}, + {0x8FA7E2,0x8FA7E2,0x003F}, + {0x8FA7E3,0x8FA7E3,0x003F}, + {0x8FA7E4,0x8FA7E4,0x003F}, + {0x8FA7E5,0x8FA7E5,0x003F}, + {0x8FA7E6,0x8FA7E6,0x003F}, + {0x8FA7E7,0x8FA7E7,0x003F}, + {0x8FA7E8,0x8FA7E8,0x003F}, + {0x8FA7E9,0x8FA7E9,0x003F}, + {0x8FA7EA,0x8FA7EA,0x003F}, + {0x8FA7EB,0x8FA7EB,0x003F}, + {0x8FA7EC,0x8FA7EC,0x003F}, + {0x8FA7ED,0x8FA7ED,0x003F}, + {0x8FA7EE,0x8FA7EE,0x003F}, + {0x8FA7EF,0x8FA7EF,0x003F}, + {0x8FA7F0,0x8FA7F0,0x003F}, /* 8FA7F0 */ + {0x8FA7F1,0x8FA7F1,0x003F}, + {0x8FA7C2,0x8FA7F2,0x0452}, + {0x8FA7C3,0x8FA7F3,0x0453}, + {0x8FA7C4,0x8FA7F4,0x0454}, + {0x8FA7C5,0x8FA7F5,0x0455}, + {0x8FA7C6,0x8FA7F6,0x0456}, + {0x8FA7C7,0x8FA7F7,0x0457}, + {0x8FA7C8,0x8FA7F8,0x0458}, + {0x8FA7C9,0x8FA7F9,0x0459}, + {0x8FA7CA,0x8FA7FA,0x045A}, + {0x8FA7CB,0x8FA7FB,0x045B}, + {0x8FA7CC,0x8FA7FC,0x045C}, + {0x8FA7CD,0x8FA7FD,0x045E}, + {0x8FA7CE,0x8FA7FE,0x045F}, + {0x8FA7FF,0x8FA7FF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FA9[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FA9A0,0x8FA9A0,0x003F}, /* 8FA9A0 */ + {0x8FA9A1,0x8FA9C1,0x00C6}, + {0x8FA9A2,0x8FA9C2,0x0110}, + {0x8FA9A3,0x8FA9A3,0x003F}, + {0x8FA9A4,0x8FA9C4,0x0126}, + {0x8FA9A5,0x8FA9A5,0x003F}, + {0x8FA9A6,0x8FA9C6,0x0132}, + {0x8FA9A7,0x8FA9A7,0x003F}, + {0x8FA9A8,0x8FA9C8,0x0141}, + {0x8FA9A9,0x8FA9C9,0x013F}, + {0x8FA9AA,0x8FA9AA,0x003F}, + {0x8FA9AB,0x8FA9CB,0x014A}, + {0x8FA9AC,0x8FA9CC,0x00D8}, + {0x8FA9AD,0x8FA9CD,0x0152}, + {0x8FA9AE,0x8FA9AE,0x003F}, + {0x8FA9AF,0x8FA9CF,0x0166}, + {0x8FA9B0,0x8FA9D0,0x00DE}, /* 8FA9B0 */ + {0x8FA9B1,0x8FA9B1,0x003F}, + {0x8FA9B2,0x8FA9B2,0x003F}, + {0x8FA9B3,0x8FA9B3,0x003F}, + {0x8FA9B4,0x8FA9B4,0x003F}, + {0x8FA9B5,0x8FA9B5,0x003F}, + {0x8FA9B6,0x8FA9B6,0x003F}, + {0x8FA9B7,0x8FA9B7,0x003F}, + {0x8FA9B8,0x8FA9B8,0x003F}, + {0x8FA9B9,0x8FA9B9,0x003F}, + {0x8FA9BA,0x8FA9BA,0x003F}, + {0x8FA9BB,0x8FA9BB,0x003F}, + {0x8FA9BC,0x8FA9BC,0x003F}, + {0x8FA9BD,0x8FA9BD,0x003F}, + {0x8FA9BE,0x8FA9BE,0x003F}, + {0x8FA9BF,0x8FA9BF,0x003F}, + {0x8FA9C0,0x8FA9C0,0x003F}, /* 8FA9C0 */ + {0x8FA9A1,0x8FA9C1,0x00E6}, + {0x8FA9A2,0x8FA9C2,0x0111}, + {0x8FA9C3,0x8FA9C3,0x00F0}, + {0x8FA9A4,0x8FA9C4,0x0127}, + {0x49,0x8FA9C5,0x0131}, + {0x8FA9A6,0x8FA9C6,0x0133}, + {0x8FA9C7,0x8FA9C7,0x0138}, + {0x8FA9A8,0x8FA9C8,0x0142}, + {0x8FA9A9,0x8FA9C9,0x0140}, + {0x8FA9CA,0x8FA9CA,0x0149}, + {0x8FA9AB,0x8FA9CB,0x014B}, + {0x8FA9AC,0x8FA9CC,0x00F8}, + {0x8FA9AD,0x8FA9CD,0x0153}, + {0x8FA9CE,0x8FA9CE,0x00DF}, + {0x8FA9AF,0x8FA9CF,0x0167}, + {0x8FA9B0,0x8FA9D0,0x00FE}, /* 8FA9D0 */ + {0x8FA9D1,0x8FA9D1,0x003F}, + {0x8FA9D2,0x8FA9D2,0x003F}, + {0x8FA9D3,0x8FA9D3,0x003F}, + {0x8FA9D4,0x8FA9D4,0x003F}, + {0x8FA9D5,0x8FA9D5,0x003F}, + {0x8FA9D6,0x8FA9D6,0x003F}, + {0x8FA9D7,0x8FA9D7,0x003F}, + {0x8FA9D8,0x8FA9D8,0x003F}, + {0x8FA9D9,0x8FA9D9,0x003F}, + {0x8FA9DA,0x8FA9DA,0x003F}, + {0x8FA9DB,0x8FA9DB,0x003F}, + {0x8FA9DC,0x8FA9DC,0x003F}, + {0x8FA9DD,0x8FA9DD,0x003F}, + {0x8FA9DE,0x8FA9DE,0x003F}, + {0x8FA9DF,0x8FA9DF,0x003F}, + {0x8FA9E0,0x8FA9E0,0x003F}, /* 8FA9E0 */ + {0x8FA9E1,0x8FA9E1,0x003F}, + {0x8FA9E2,0x8FA9E2,0x003F}, + {0x8FA9E3,0x8FA9E3,0x003F}, + {0x8FA9E4,0x8FA9E4,0x003F}, + {0x8FA9E5,0x8FA9E5,0x003F}, + {0x8FA9E6,0x8FA9E6,0x003F}, + {0x8FA9E7,0x8FA9E7,0x003F}, + {0x8FA9E8,0x8FA9E8,0x003F}, + {0x8FA9E9,0x8FA9E9,0x003F}, + {0x8FA9EA,0x8FA9EA,0x003F}, + {0x8FA9EB,0x8FA9EB,0x003F}, + {0x8FA9EC,0x8FA9EC,0x003F}, + {0x8FA9ED,0x8FA9ED,0x003F}, + {0x8FA9EE,0x8FA9EE,0x003F}, + {0x8FA9EF,0x8FA9EF,0x003F}, + {0x8FA9F0,0x8FA9F0,0x003F}, /* 8FA9F0 */ + {0x8FA9F1,0x8FA9F1,0x003F}, + {0x8FA9F2,0x8FA9F2,0x003F}, + {0x8FA9F3,0x8FA9F3,0x003F}, + {0x8FA9F4,0x8FA9F4,0x003F}, + {0x8FA9F5,0x8FA9F5,0x003F}, + {0x8FA9F6,0x8FA9F6,0x003F}, + {0x8FA9F7,0x8FA9F7,0x003F}, + {0x8FA9F8,0x8FA9F8,0x003F}, + {0x8FA9F9,0x8FA9F9,0x003F}, + {0x8FA9FA,0x8FA9FA,0x003F}, + {0x8FA9FB,0x8FA9FB,0x003F}, + {0x8FA9FC,0x8FA9FC,0x003F}, + {0x8FA9FD,0x8FA9FD,0x003F}, + {0x8FA9FE,0x8FA9FE,0x003F}, + {0x8FA9FF,0x8FA9FF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FAA[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FAAA0,0x8FAAA0,0x003F}, /* 8FAAA0 */ + {0x8FAAA1,0x8FABA1,0x00C1}, + {0x8FAAA2,0x8FABA2,0x00C0}, + {0x8FAAA3,0x8FABA3,0x00C4}, + {0x8FAAA4,0x8FABA4,0x00C2}, + {0x8FAAA5,0x8FABA5,0x0102}, + {0x8FAAA6,0x8FABA6,0x01CD}, + {0x8FAAA7,0x8FABA7,0x0100}, + {0x8FAAA8,0x8FABA8,0x0104}, + {0x8FAAA9,0x8FABA9,0x00C5}, + {0x8FAAAA,0x8FABAA,0x00C3}, + {0x8FAAAB,0x8FABAB,0x0106}, + {0x8FAAAC,0x8FABAC,0x0108}, + {0x8FAAAD,0x8FABAD,0x010C}, + {0x8FAAAE,0x8FABAE,0x00C7}, + {0x8FAAAF,0x8FABAF,0x010A}, + {0x8FAAB0,0x8FABB0,0x010E}, /* 8FAAB0 */ + {0x8FAAB1,0x8FABB1,0x00C9}, + {0x8FAAB2,0x8FABB2,0x00C8}, + {0x8FAAB3,0x8FABB3,0x00CB}, + {0x8FAAB4,0x8FABB4,0x00CA}, + {0x8FAAB5,0x8FABB5,0x011A}, + {0x8FAAB6,0x8FABB6,0x0116}, + {0x8FAAB7,0x8FABB7,0x0112}, + {0x8FAAB8,0x8FABB8,0x0118}, + {0x8FAAB9,0x8FAAB9,0x003F}, + {0x8FAABA,0x8FABBA,0x011C}, + {0x8FAABB,0x8FABBB,0x011E}, + {0x8FAABC,0x8FAABC,0x0122}, + {0x8FAABD,0x8FABBD,0x0120}, + {0x8FAABE,0x8FABBE,0x0124}, + {0x8FAABF,0x8FABBF,0x00CD}, + {0x8FAAC0,0x8FABC0,0x00CC}, /* 8FAAC0 */ + {0x8FAAC1,0x8FABC1,0x00CF}, + {0x8FAAC2,0x8FABC2,0x00CE}, + {0x8FAAC3,0x8FABC3,0x01CF}, + {0x8FAAC4,0x69,0x0130}, + {0x8FAAC5,0x8FABC5,0x012A}, + {0x8FAAC6,0x8FABC6,0x012E}, + {0x8FAAC7,0x8FABC7,0x0128}, + {0x8FAAC8,0x8FABC8,0x0134}, + {0x8FAAC9,0x8FABC9,0x0136}, + {0x8FAACA,0x8FABCA,0x0139}, + {0x8FAACB,0x8FABCB,0x013D}, + {0x8FAACC,0x8FABCC,0x013B}, + {0x8FAACD,0x8FABCD,0x0143}, + {0x8FAACE,0x8FABCE,0x0147}, + {0x8FAACF,0x8FABCF,0x0145}, + {0x8FAAD0,0x8FABD0,0x00D1}, /* 8FAAD0 */ + {0x8FAAD1,0x8FABD1,0x00D3}, + {0x8FAAD2,0x8FABD2,0x00D2}, + {0x8FAAD3,0x8FABD3,0x00D6}, + {0x8FAAD4,0x8FABD4,0x00D4}, + {0x8FAAD5,0x8FABD5,0x01D1}, + {0x8FAAD6,0x8FABD6,0x0150}, + {0x8FAAD7,0x8FABD7,0x014C}, + {0x8FAAD8,0x8FABD8,0x00D5}, + {0x8FAAD9,0x8FABD9,0x0154}, + {0x8FAADA,0x8FABDA,0x0158}, + {0x8FAADB,0x8FABDB,0x0156}, + {0x8FAADC,0x8FABDC,0x015A}, + {0x8FAADD,0x8FABDD,0x015C}, + {0x8FAADE,0x8FABDE,0x0160}, + {0x8FAADF,0x8FABDF,0x015E}, + {0x8FAAE0,0x8FABE0,0x0164}, /* 8FAAE0 */ + {0x8FAAE1,0x8FABE1,0x0162}, + {0x8FAAE2,0x8FABE2,0x00DA}, + {0x8FAAE3,0x8FABE3,0x00D9}, + {0x8FAAE4,0x8FABE4,0x00DC}, + {0x8FAAE5,0x8FABE5,0x00DB}, + {0x8FAAE6,0x8FABE6,0x016C}, + {0x8FAAE7,0x8FABE7,0x01D3}, + {0x8FAAE8,0x8FABE8,0x0170}, + {0x8FAAE9,0x8FABE9,0x016A}, + {0x8FAAEA,0x8FABEA,0x0172}, + {0x8FAAEB,0x8FABEB,0x016E}, + {0x8FAAEC,0x8FABEC,0x0168}, + {0x8FAAED,0x8FABED,0x01D7}, + {0x8FAAEE,0x8FABEE,0x01DB}, + {0x8FAAEF,0x8FABEF,0x01D9}, + {0x8FAAF0,0x8FABF0,0x01D5}, /* 8FAAF0 */ + {0x8FAAF1,0x8FABF1,0x0174}, + {0x8FAAF2,0x8FABF2,0x00DD}, + {0x8FAAF3,0x8FABF3,0x0178}, + {0x8FAAF4,0x8FABF4,0x0176}, + {0x8FAAF5,0x8FABF5,0x0179}, + {0x8FAAF6,0x8FABF6,0x017D}, + {0x8FAAF7,0x8FABF7,0x017B}, + {0x8FAAF8,0x8FAAF8,0x003F}, + {0x8FAAF9,0x8FAAF9,0x003F}, + {0x8FAAFA,0x8FAAFA,0x003F}, + {0x8FAAFB,0x8FAAFB,0x003F}, + {0x8FAAFC,0x8FAAFC,0x003F}, + {0x8FAAFD,0x8FAAFD,0x003F}, + {0x8FAAFE,0x8FAAFE,0x003F}, + {0x8FAAFF,0x8FAAFF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FAB[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FABA0,0x8FABA0,0x003F}, /* 8FABA0 */ + {0x8FAAA1,0x8FABA1,0x00E1}, + {0x8FAAA2,0x8FABA2,0x00E0}, + {0x8FAAA3,0x8FABA3,0x00E4}, + {0x8FAAA4,0x8FABA4,0x00E2}, + {0x8FAAA5,0x8FABA5,0x0103}, + {0x8FAAA6,0x8FABA6,0x01CE}, + {0x8FAAA7,0x8FABA7,0x0101}, + {0x8FAAA8,0x8FABA8,0x0105}, + {0x8FAAA9,0x8FABA9,0x00E5}, + {0x8FAAAA,0x8FABAA,0x00E3}, + {0x8FAAAB,0x8FABAB,0x0107}, + {0x8FAAAC,0x8FABAC,0x0109}, + {0x8FAAAD,0x8FABAD,0x010D}, + {0x8FAAAE,0x8FABAE,0x00E7}, + {0x8FAAAF,0x8FABAF,0x010B}, + {0x8FAAB0,0x8FABB0,0x010F}, /* 8FABB0 */ + {0x8FAAB1,0x8FABB1,0x00E9}, + {0x8FAAB2,0x8FABB2,0x00E8}, + {0x8FAAB3,0x8FABB3,0x00EB}, + {0x8FAAB4,0x8FABB4,0x00EA}, + {0x8FAAB5,0x8FABB5,0x011B}, + {0x8FAAB6,0x8FABB6,0x0117}, + {0x8FAAB7,0x8FABB7,0x0113}, + {0x8FAAB8,0x8FABB8,0x0119}, + {0x8FABB9,0x8FABB9,0x01F5}, + {0x8FAABA,0x8FABBA,0x011D}, + {0x8FAABB,0x8FABBB,0x011F}, + {0x8FABBC,0x8FABBC,0x003F}, + {0x8FAABD,0x8FABBD,0x0121}, + {0x8FAABE,0x8FABBE,0x0125}, + {0x8FAABF,0x8FABBF,0x00ED}, + {0x8FAAC0,0x8FABC0,0x00EC}, /* 8FABC0 */ + {0x8FAAC1,0x8FABC1,0x00EF}, + {0x8FAAC2,0x8FABC2,0x00EE}, + {0x8FAAC3,0x8FABC3,0x01D0}, + {0x8FABC4,0x8FABC4,0x003F}, + {0x8FAAC5,0x8FABC5,0x012B}, + {0x8FAAC6,0x8FABC6,0x012F}, + {0x8FAAC7,0x8FABC7,0x0129}, + {0x8FAAC8,0x8FABC8,0x0135}, + {0x8FAAC9,0x8FABC9,0x0137}, + {0x8FAACA,0x8FABCA,0x013A}, + {0x8FAACB,0x8FABCB,0x013E}, + {0x8FAACC,0x8FABCC,0x013C}, + {0x8FAACD,0x8FABCD,0x0144}, + {0x8FAACE,0x8FABCE,0x0148}, + {0x8FAACF,0x8FABCF,0x0146}, + {0x8FAAD0,0x8FABD0,0x00F1}, /* 8FABD0 */ + {0x8FAAD1,0x8FABD1,0x00F3}, + {0x8FAAD2,0x8FABD2,0x00F2}, + {0x8FAAD3,0x8FABD3,0x00F6}, + {0x8FAAD4,0x8FABD4,0x00F4}, + {0x8FAAD5,0x8FABD5,0x01D2}, + {0x8FAAD6,0x8FABD6,0x0151}, + {0x8FAAD7,0x8FABD7,0x014D}, + {0x8FAAD8,0x8FABD8,0x00F5}, + {0x8FAAD9,0x8FABD9,0x0155}, + {0x8FAADA,0x8FABDA,0x0159}, + {0x8FAADB,0x8FABDB,0x0157}, + {0x8FAADC,0x8FABDC,0x015B}, + {0x8FAADD,0x8FABDD,0x015D}, + {0x8FAADE,0x8FABDE,0x0161}, + {0x8FAADF,0x8FABDF,0x015F}, + {0x8FAAE0,0x8FABE0,0x0165}, /* 8FABE0 */ + {0x8FAAE1,0x8FABE1,0x0163}, + {0x8FAAE2,0x8FABE2,0x00FA}, + {0x8FAAE3,0x8FABE3,0x00F9}, + {0x8FAAE4,0x8FABE4,0x00FC}, + {0x8FAAE5,0x8FABE5,0x00FB}, + {0x8FAAE6,0x8FABE6,0x016D}, + {0x8FAAE7,0x8FABE7,0x01D4}, + {0x8FAAE8,0x8FABE8,0x0171}, + {0x8FAAE9,0x8FABE9,0x016B}, + {0x8FAAEA,0x8FABEA,0x0173}, + {0x8FAAEB,0x8FABEB,0x016F}, + {0x8FAAEC,0x8FABEC,0x0169}, + {0x8FAAED,0x8FABED,0x01D8}, + {0x8FAAEE,0x8FABEE,0x01DC}, + {0x8FAAEF,0x8FABEF,0x01DA}, + {0x8FAAF0,0x8FABF0,0x01D6}, /* 8FABF0 */ + {0x8FAAF1,0x8FABF1,0x0175}, + {0x8FAAF2,0x8FABF2,0x00FD}, + {0x8FAAF3,0x8FABF3,0x00FF}, + {0x8FAAF4,0x8FABF4,0x0177}, + {0x8FAAF5,0x8FABF5,0x017A}, + {0x8FAAF6,0x8FABF6,0x017E}, + {0x8FAAF7,0x8FABF7,0x017C}, + {0x8FABF8,0x8FABF8,0x003F}, + {0x8FABF9,0x8FABF9,0x003F}, + {0x8FABFA,0x8FABFA,0x003F}, + {0x8FABFB,0x8FABFB,0x003F}, + {0x8FABFC,0x8FABFC,0x003F}, + {0x8FABFD,0x8FABFD,0x003F}, + {0x8FABFE,0x8FABFE,0x003F}, + {0x8FABFF,0x8FABFF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FF3[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FF3A0,0x8FF3A0,0x003F}, /* 8FF3F0 */ + {0x8FF3A1,0x8FF3A1,0x003F}, + {0x8FF3A2,0x8FF3A2,0x003F}, + {0x8FF3A3,0x8FF3A3,0x003F}, + {0x8FF3A4,0x8FF3A4,0x003F}, + {0x8FF3A5,0x8FF3A5,0x003F}, + {0x8FF3A6,0x8FF3A6,0x003F}, + {0x8FF3A7,0x8FF3A7,0x003F}, + {0x8FF3A8,0x8FF3A8,0x003F}, + {0x8FF3A9,0x8FF3A9,0x003F}, + {0x8FF3AA,0x8FF3AA,0x003F}, + {0x8FF3AB,0x8FF3AB,0x003F}, + {0x8FF3AC,0x8FF3AC,0x003F}, + {0x8FF3AD,0x8FF3AD,0x003F}, + {0x8FF3AE,0x8FF3AE,0x003F}, + {0x8FF3AF,0x8FF3AF,0x003F}, + {0x8FF3B0,0x8FF3B0,0x003F}, /* 8FF3B0 */ + {0x8FF3B1,0x8FF3B1,0x003F}, + {0x8FF3B2,0x8FF3B2,0x003F}, + {0x8FF3B3,0x8FF3B3,0x003F}, + {0x8FF3B4,0x8FF3B4,0x003F}, + {0x8FF3B5,0x8FF3B5,0x003F}, + {0x8FF3B6,0x8FF3B6,0x003F}, + {0x8FF3B7,0x8FF3B7,0x003F}, + {0x8FF3B8,0x8FF3B8,0x003F}, + {0x8FF3B9,0x8FF3B9,0x003F}, + {0x8FF3BA,0x8FF3BA,0x003F}, + {0x8FF3BB,0x8FF3BB,0x003F}, + {0x8FF3BC,0x8FF3BC,0x003F}, + {0x8FF3BD,0x8FF3BD,0x003F}, + {0x8FF3BE,0x8FF3BE,0x003F}, + {0x8FF3BF,0x8FF3BF,0x003F}, + {0x8FF3C0,0x8FF3C0,0x003F}, /* 8FF3C0 */ + {0x8FF3C1,0x8FF3C1,0x003F}, + {0x8FF3C2,0x8FF3C2,0x003F}, + {0x8FF3C3,0x8FF3C3,0x003F}, + {0x8FF3C4,0x8FF3C4,0x003F}, + {0x8FF3C5,0x8FF3C5,0x003F}, + {0x8FF3C6,0x8FF3C6,0x003F}, + {0x8FF3C7,0x8FF3C7,0x003F}, + {0x8FF3C8,0x8FF3C8,0x003F}, + {0x8FF3C9,0x8FF3C9,0x003F}, + {0x8FF3CA,0x8FF3CA,0x003F}, + {0x8FF3CB,0x8FF3CB,0x003F}, + {0x8FF3CC,0x8FF3CC,0x003F}, + {0x8FF3CD,0x8FF3CD,0x003F}, + {0x8FF3CE,0x8FF3CE,0x003F}, + {0x8FF3CF,0x8FF3CF,0x003F}, + {0x8FF3D0,0x8FF3D0,0x003F}, /* 8FF3D0 */ + {0x8FF3D1,0x8FF3D1,0x003F}, + {0x8FF3D2,0x8FF3D2,0x003F}, + {0x8FF3D3,0x8FF3D3,0x003F}, + {0x8FF3D4,0x8FF3D4,0x003F}, + {0x8FF3D5,0x8FF3D5,0x003F}, + {0x8FF3D6,0x8FF3D6,0x003F}, + {0x8FF3D7,0x8FF3D7,0x003F}, + {0x8FF3D8,0x8FF3D8,0x003F}, + {0x8FF3D9,0x8FF3D9,0x003F}, + {0x8FF3DA,0x8FF3DA,0x003F}, + {0x8FF3DB,0x8FF3DB,0x003F}, + {0x8FF3DC,0x8FF3DC,0x003F}, + {0x8FF3DD,0x8FF3DD,0x003F}, + {0x8FF3DE,0x8FF3DE,0x003F}, + {0x8FF3DF,0x8FF3DF,0x003F}, + {0x8FF3E0,0x8FF3E0,0x003F}, /* 8FF3E0 */ + {0x8FF3E1,0x8FF3E1,0x003F}, + {0x8FF3E2,0x8FF3E2,0x003F}, + {0x8FF3E3,0x8FF3E3,0x003F}, + {0x8FF3E4,0x8FF3E4,0x003F}, + {0x8FF3E5,0x8FF3E5,0x003F}, + {0x8FF3E6,0x8FF3E6,0x003F}, + {0x8FF3E7,0x8FF3E7,0x003F}, + {0x8FF3E8,0x8FF3E8,0x003F}, + {0x8FF3E9,0x8FF3E9,0x003F}, + {0x8FF3EA,0x8FF3EA,0x003F}, + {0x8FF3EB,0x8FF3EB,0x003F}, + {0x8FF3EC,0x8FF3EC,0x003F}, + {0x8FF3ED,0x8FF3ED,0x003F}, + {0x8FF3EE,0x8FF3EE,0x003F}, + {0x8FF3EF,0x8FF3EF,0x003F}, + {0x8FF3F0,0x8FF3F0,0x003F}, /* 8FF3F0 */ + {0x8FF3F1,0x8FF3F1,0x003F}, + {0x8FF3F2,0x8FF3F2,0x003F}, + {0x8FF3FD,0x8FF3F3,0x2170}, + {0x8FF3FE,0x8FF3F4,0x2171}, + {0x8FF4A1,0x8FF3F5,0x2172}, + {0x8FF4A2,0x8FF3F6,0x2173}, + {0x8FF4A3,0x8FF3F7,0x2174}, + {0x8FF4A4,0x8FF3F8,0x2175}, + {0x8FF4A5,0x8FF3F9,0x2176}, + {0x8FF4A6,0x8FF3FA,0x2177}, + {0x8FF4A7,0x8FF3FB,0x2178}, + {0x8FF4A8,0x8FF3FC,0x2179}, + {0x8FF3FD,0x8FF3F3,0x2160}, + {0x8FF3FE,0x8FF3F4,0x2161}, + {0x8FF3FF,0x8FF3FF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FF4[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FF4A0,0x8FF4A0,0x003F}, /* 8FF4A0 */ + {0x8FF4A1,0x8FF3F5,0x2162}, + {0x8FF4A2,0x8FF3F6,0x2163}, + {0x8FF4A3,0x8FF3F7,0x2164}, + {0x8FF4A4,0x8FF3F8,0x2165}, + {0x8FF4A5,0x8FF3F9,0x2166}, + {0x8FF4A6,0x8FF3FA,0x2167}, + {0x8FF4A7,0x8FF3FB,0x2168}, + {0x8FF4A8,0x8FF3FC,0x2169}, + {0x8FF4A9,0x8FF4A9,0xFF07}, + {0x8FF4AA,0x8FF4AA,0xFF02}, + {0x8FF4AB,0x8FF4AB,0x3231}, + {0x8FF4AC,0x8FF4AC,0x2116}, + {0x8FF4AD,0x8FF4AD,0x2121}, + {0x8FF4AE,0x8FF4AE,0x70BB}, + {0x8FF4AF,0x8FF4AF,0x4EFC}, + {0x8FF4B0,0x8FF4B0,0x50F4}, /* 8FF4B0 */ + {0x8FF4B1,0x8FF4B1,0x51EC}, + {0x8FF4B2,0x8FF4B2,0x5307}, + {0x8FF4B3,0x8FF4B3,0x5324}, + {0x8FF4B4,0x8FF4B4,0xFA0E}, + {0x8FF4B5,0x8FF4B5,0x548A}, + {0x8FF4B6,0x8FF4B6,0x5759}, + {0x8FF4B7,0x8FF4B7,0xFA0F}, + {0x8FF4B8,0x8FF4B8,0xFA10}, + {0x8FF4B9,0x8FF4B9,0x589E}, + {0x8FF4BA,0x8FF4BA,0x5BEC}, + {0x8FF4BB,0x8FF4BB,0x5CF5}, + {0x8FF4BC,0x8FF4BC,0x5D53}, + {0x8FF4BD,0x8FF4BD,0xFA11}, + {0x8FF4BE,0x8FF4BE,0x5FB7}, + {0x8FF4BF,0x8FF4BF,0x6085}, + {0x8FF4C0,0x8FF4C0,0x6120}, /* 8FF4C0 */ + {0x8FF4C1,0x8FF4C1,0x654E}, + {0x8FF4C2,0x8FF4C2,0x663B}, + {0x8FF4C3,0x8FF4C3,0x6665}, + {0x8FF4C4,0x8FF4C4,0xFA12}, + {0x8FF4C5,0x8FF4C5,0xF929}, + {0x8FF4C6,0x8FF4C6,0x6801}, + {0x8FF4C7,0x8FF4C7,0xFA13}, + {0x8FF4C8,0x8FF4C8,0xFA14}, + {0x8FF4C9,0x8FF4C9,0x6A6B}, + {0x8FF4CA,0x8FF4CA,0x6AE2}, + {0x8FF4CB,0x8FF4CB,0x6DF8}, + {0x8FF4CC,0x8FF4CC,0x6DF2}, + {0x8FF4CD,0x8FF4CD,0x7028}, + {0x8FF4CE,0x8FF4CE,0xFA15}, + {0x8FF4CF,0x8FF4CF,0xFA16}, + {0x8FF4D0,0x8FF4D0,0x7501}, /* 8FF4D0 */ + {0x8FF4D1,0x8FF4D1,0x7682}, + {0x8FF4D2,0x8FF4D2,0x769E}, + {0x8FF4D3,0x8FF4D3,0xFA17}, + {0x8FF4D4,0x8FF4D4,0x7930}, + {0x8FF4D5,0x8FF4D5,0xFA18}, + {0x8FF4D6,0x8FF4D6,0xFA19}, + {0x8FF4D7,0x8FF4D7,0xFA1A}, + {0x8FF4D8,0x8FF4D8,0xFA1B}, + {0x8FF4D9,0x8FF4D9,0x7AE7}, + {0x8FF4DA,0x8FF4DA,0xFA1C}, + {0x8FF4DB,0x8FF4DB,0xFA1D}, + {0x8FF4DC,0x8FF4DC,0x7DA0}, + {0x8FF4DD,0x8FF4DD,0x7DD6}, + {0x8FF4DE,0x8FF4DE,0xFA1E}, + {0x8FF4DF,0x8FF4DF,0x8362}, + {0x8FF4E0,0x8FF4E0,0xFA1F}, /* 8FF4E0 */ + {0x8FF4E1,0x8FF4E1,0x85B0}, + {0x8FF4E2,0x8FF4E2,0xFA20}, + {0x8FF4E3,0x8FF4E3,0xFA21}, + {0x8FF4E4,0x8FF4E4,0x8807}, + {0x8FF4E5,0x8FF4E5,0xFA22}, + {0x8FF4E6,0x8FF4E6,0x8B7F}, + {0x8FF4E7,0x8FF4E7,0x8CF4}, + {0x8FF4E8,0x8FF4E8,0x8D76}, + {0x8FF4E9,0x8FF4E9,0xFA23}, + {0x8FF4EA,0x8FF4EA,0xFA24}, + {0x8FF4EB,0x8FF4EB,0xFA25}, + {0x8FF4EC,0x8FF4EC,0x90DE}, + {0x8FF4ED,0x8FF4ED,0xFA26}, + {0x8FF4EE,0x8FF4EE,0x9115}, + {0x8FF4EF,0x8FF4EF,0xFA27}, + {0x8FF4F0,0x8FF4F0,0xFA28}, /* 8FF4F0 */ + {0x8FF4F1,0x8FF4F1,0x9592}, + {0x8FF4F2,0x8FF4F2,0xF9DC}, + {0x8FF4F3,0x8FF4F3,0xFA29}, + {0x8FF4F4,0x8FF4F4,0x973B}, + {0x8FF4F5,0x8FF4F5,0x974D}, + {0x8FF4F6,0x8FF4F6,0x9751}, + {0x8FF4F7,0x8FF4F7,0xFA2A}, + {0x8FF4F8,0x8FF4F8,0xFA2B}, + {0x8FF4F9,0x8FF4F9,0xFA2C}, + {0x8FF4FA,0x8FF4FA,0x999E}, + {0x8FF4FB,0x8FF4FB,0x9AD9}, + {0x8FF4FC,0x8FF4FC,0x9B72}, + {0x8FF4FD,0x8FF4FD,0xFA2D}, + {0x8FF4FE,0x8FF4FE,0x9ED1}, + {0x8FF4FF,0x8FF4FF,0x003F}, +}; + + +static MY_UNICASE_INFO *my_caseinfo_eucjpms[512]= +{ + /* JIS-X-0208 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, cA2, cA3, NULL, NULL, cA6, cA7, /* A */ + NULL, NULL, NULL, NULL, NULL, cAD, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + + /* JIS-X-0212 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL,c8FA6,c8FA7, /* A */ + NULL, c8FA9,c8FAA,c8FAB,NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL,c8FF3,c8FF4, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + + static uint16 tab_jisx0201_uni[256]={ 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, @@ -8667,8 +10196,8 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, - my_caseup_mb, - my_casedn_mb, + my_caseup_ujis, + my_casedn_ujis, my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, @@ -8701,12 +10230,12 @@ CHARSET_INFO my_charset_eucjpms_japanese_ci= NULL, /* contractions */ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_eucjpms,/* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ @@ -8734,12 +10263,12 @@ CHARSET_INFO my_charset_eucjpms_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_eucjpms,/* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index 0267f35ff5c..c3a52047977 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -177,6 +177,648 @@ static uint mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) } +static MY_UNICASE_INFO cA2[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA2A0,0xA2A0,0xA2A0}, /* A2A0 */ + {0xA2A1,0xA2A1,0x003F}, + {0xA2A2,0xA2A2,0x003F}, + {0xA2A3,0xA2A3,0x003F}, + {0xA2A4,0xA2A4,0x003F}, + {0xA2A5,0xA2A5,0x003F}, + {0xA2A6,0xA2A6,0x003F}, + {0xA2A7,0xA2A7,0x003F}, + {0xA2A8,0xA2A8,0x003F}, + {0xA2A9,0xA2A9,0x003F}, + {0xA2AA,0xA2AA,0x003F}, + {0xA2AB,0xA2AB,0x003F}, + {0xA2AC,0xA2AC,0x003F}, + {0xA2AD,0xA2AD,0x003F}, + {0xA2AE,0xA2AE,0x003F}, + {0xA2AF,0xA2AF,0x003F}, + {0xA2B0,0xA2B0,0x003F}, /* A2B0 */ + {0xA2B1,0xA2B1,0x2488}, + {0xA2B2,0xA2B2,0x2489}, + {0xA2B3,0xA2B3,0x248A}, + {0xA2B4,0xA2B4,0x248B}, + {0xA2B5,0xA2B5,0x248C}, + {0xA2B6,0xA2B6,0x248D}, + {0xA2B7,0xA2B7,0x248E}, + {0xA2B8,0xA2B8,0x248F}, + {0xA2B9,0xA2B9,0x2490}, + {0xA2BA,0xA2BA,0x2491}, + {0xA2BB,0xA2BB,0x2492}, + {0xA2BC,0xA2BC,0x2493}, + {0xA2BD,0xA2BD,0x2494}, + {0xA2BE,0xA2BE,0x2495}, + {0xA2BF,0xA2BF,0x2496}, + {0xA2C0,0xA2C0,0x2497}, /* A2C0 */ + {0xA2C1,0xA2C1,0x2498}, + {0xA2C2,0xA2C2,0x2499}, + {0xA2C3,0xA2C3,0x249A}, + {0xA2C4,0xA2C4,0x249B}, + {0xA2C5,0xA2C5,0x2474}, + {0xA2C6,0xA2C6,0x2475}, + {0xA2C7,0xA2C7,0x2476}, + {0xA2C8,0xA2C8,0x2477}, + {0xA2C9,0xA2C9,0x2478}, + {0xA2CA,0xA2CA,0x2479}, + {0xA2CB,0xA2CB,0x247A}, + {0xA2CC,0xA2CC,0x247B}, + {0xA2CD,0xA2CD,0x247C}, + {0xA2CE,0xA2CE,0x247D}, + {0xA2CF,0xA2CF,0x247E}, + {0xA2D0,0xA2D0,0x247F}, /* A2D0 */ + {0xA2D1,0xA2D1,0x2480}, + {0xA2D2,0xA2D2,0x2481}, + {0xA2D3,0xA2D3,0x2482}, + {0xA2D4,0xA2D4,0x2483}, + {0xA2D5,0xA2D5,0x2484}, + {0xA2D6,0xA2D6,0x2485}, + {0xA2D7,0xA2D7,0x2486}, + {0xA2D8,0xA2D8,0x2487}, + {0xA2D9,0xA2D9,0x2460}, + {0xA2DA,0xA2DA,0x2461}, + {0xA2DB,0xA2DB,0x2462}, + {0xA2DC,0xA2DC,0x2463}, + {0xA2DD,0xA2DD,0x2464}, + {0xA2DE,0xA2DE,0x2465}, + {0xA2DF,0xA2DF,0x2466}, + {0xA2E0,0xA2E0,0x2467}, /* A2E0 */ + {0xA2E1,0xA2E1,0x2468}, + {0xA2E2,0xA2E2,0x2469}, + {0xA2E3,0xA2E3,0x003F}, + {0xA2E4,0xA2E4,0x003F}, + {0xA2E5,0xA2E5,0x3220}, + {0xA2E6,0xA2E6,0x3221}, + {0xA2E7,0xA2E7,0x3222}, + {0xA2E8,0xA2E8,0x3223}, + {0xA2E9,0xA2E9,0x3224}, + {0xA2EA,0xA2EA,0x3225}, + {0xA2EB,0xA2EB,0x3226}, + {0xA2EC,0xA2EC,0x3227}, + {0xA2ED,0xA2ED,0x3228}, + {0xA2EE,0xA2EE,0x3229}, + {0xA2EF,0xA2EF,0x003F}, + {0xA2F0,0xA2F0,0x003F}, /* A2F0 */ + {0xA2F1,0xA2F1,0x2160}, + {0xA2F2,0xA2F2,0x2161}, + {0xA2F3,0xA2F3,0x2162}, + {0xA2F4,0xA2F4,0x2163}, + {0xA2F5,0xA2F5,0x2164}, + {0xA2F6,0xA2F6,0x2165}, + {0xA2F7,0xA2F7,0x2166}, + {0xA2F8,0xA2F8,0x2167}, + {0xA2F9,0xA2F9,0x2168}, + {0xA2FA,0xA2FA,0x2169}, + {0xA2FB,0xA2FB,0x216A}, + {0xA2FC,0xA2FC,0x216B}, + {0xA2FD,0xA2FD,0x003F}, + {0xA2FE,0xA2FE,0x003F}, + {0xA2FF,0xA2FF,0xA2FF} +}; + + +static MY_UNICASE_INFO cA3[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA3A0,0xA3A0,0xA3A0}, /* A3A0 */ + {0xA3A1,0xA3A1,0xFF01}, + {0xA3A2,0xA3A2,0xFF02}, + {0xA3A3,0xA3A3,0xFF03}, + {0xA3A4,0xA3A4,0xFFE5}, + {0xA3A5,0xA3A5,0xFF05}, + {0xA3A6,0xA3A6,0xFF06}, + {0xA3A7,0xA3A7,0xFF07}, + {0xA3A8,0xA3A8,0xFF08}, + {0xA3A9,0xA3A9,0xFF09}, + {0xA3AA,0xA3AA,0xFF0A}, + {0xA3AB,0xA3AB,0xFF0B}, + {0xA3AC,0xA3AC,0xFF0C}, + {0xA3AD,0xA3AD,0xFF0D}, + {0xA3AE,0xA3AE,0xFF0E}, + {0xA3AF,0xA3AF,0xFF0F}, + {0xA3B0,0xA3B0,0xFF10}, /* A3B0 */ + {0xA3B1,0xA3B1,0xFF11}, + {0xA3B2,0xA3B2,0xFF12}, + {0xA3B3,0xA3B3,0xFF13}, + {0xA3B4,0xA3B4,0xFF14}, + {0xA3B5,0xA3B5,0xFF15}, + {0xA3B6,0xA3B6,0xFF16}, + {0xA3B7,0xA3B7,0xFF17}, + {0xA3B8,0xA3B8,0xFF18}, + {0xA3B9,0xA3B9,0xFF19}, + {0xA3BA,0xA3BA,0xFF1A}, + {0xA3BB,0xA3BB,0xFF1B}, + {0xA3BC,0xA3BC,0xFF1C}, + {0xA3BD,0xA3BD,0xFF1D}, + {0xA3BE,0xA3BE,0xFF1E}, + {0xA3BF,0xA3BF,0xFF1F}, + {0xA3C0,0xA3C0,0xFF20}, /* A3C0 */ + {0xA3C1,0xA3E1,0xFF21}, + {0xA3C2,0xA3E2,0xFF22}, + {0xA3C3,0xA3E3,0xFF23}, + {0xA3C4,0xA3E4,0xFF24}, + {0xA3C5,0xA3E5,0xFF25}, + {0xA3C6,0xA3E6,0xFF26}, + {0xA3C7,0xA3E7,0xFF27}, + {0xA3C8,0xA3E8,0xFF28}, + {0xA3C9,0xA3E9,0xFF29}, + {0xA3CA,0xA3EA,0xFF2A}, + {0xA3CB,0xA3EB,0xFF2B}, + {0xA3CC,0xA3EC,0xFF2C}, + {0xA3CD,0xA3ED,0xFF2D}, + {0xA3CE,0xA3EE,0xFF2E}, + {0xA3CF,0xA3EF,0xFF2F}, + {0xA3D0,0xA3F0,0xFF30}, /* A3D0 */ + {0xA3D1,0xA3F1,0xFF31}, + {0xA3D2,0xA3F2,0xFF32}, + {0xA3D3,0xA3F3,0xFF33}, + {0xA3D4,0xA3F4,0xFF34}, + {0xA3D5,0xA3F5,0xFF35}, + {0xA3D6,0xA3F6,0xFF36}, + {0xA3D7,0xA3F7,0xFF37}, + {0xA3D8,0xA3F8,0xFF38}, + {0xA3D9,0xA3F9,0xFF39}, + {0xA3DA,0xA3FA,0xFF3A}, + {0xA3DB,0xA3DB,0xFF3B}, + {0xA3DC,0xA3DC,0xFF3C}, + {0xA3DD,0xA3DD,0xFF3D}, + {0xA3DE,0xA3DE,0xFF3E}, + {0xA3DF,0xA3DF,0xFF3F}, + {0xA3E0,0xA3E0,0xFF40}, /* A3E0 */ + {0xA3C1,0xA3E1,0xFF41}, + {0xA3C2,0xA3E2,0xFF42}, + {0xA3C3,0xA3E3,0xFF43}, + {0xA3C4,0xA3E4,0xFF44}, + {0xA3C5,0xA3E5,0xFF45}, + {0xA3C6,0xA3E6,0xFF46}, + {0xA3C7,0xA3E7,0xFF47}, + {0xA3C8,0xA3E8,0xFF48}, + {0xA3C9,0xA3E9,0xFF49}, + {0xA3CA,0xA3EA,0xFF4A}, + {0xA3CB,0xA3EB,0xFF4B}, + {0xA3CC,0xA3EC,0xFF4C}, + {0xA3CD,0xA3ED,0xFF4D}, + {0xA3CE,0xA3EE,0xFF4E}, + {0xA3CF,0xA3EF,0xFF4F}, + {0xA3D0,0xA3F0,0xFF50}, /* A3F0 */ + {0xA3D1,0xA3F1,0xFF51}, + {0xA3D2,0xA3F2,0xFF52}, + {0xA3D3,0xA3F3,0xFF53}, + {0xA3D4,0xA3F4,0xFF54}, + {0xA3D5,0xA3F5,0xFF55}, + {0xA3D6,0xA3F6,0xFF56}, + {0xA3D7,0xA3F7,0xFF57}, + {0xA3D8,0xA3F8,0xFF58}, + {0xA3D9,0xA3F9,0xFF59}, + {0xA3DA,0xA3FA,0xFF5A}, + {0xA3FB,0xA3FB,0xFF5B}, + {0xA3FC,0xA3FC,0xFF5C}, + {0xA3FD,0xA3FD,0xFF5D}, + {0xA3FE,0xA3FE,0xFFE3}, + {0xA3FF,0xA3FF,0xA3FF} +}; + + +static MY_UNICASE_INFO cA6[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA6A0,0xA6A0,0xA6A0}, /* A6A0 */ + {0xA6A1,0xA6C1,0x0391}, + {0xA6A2,0xA6C2,0x0392}, + {0xA6A3,0xA6C3,0x0393}, + {0xA6A4,0xA6C4,0x0394}, + {0xA6A5,0xA6C5,0x0395}, + {0xA6A6,0xA6C6,0x0396}, + {0xA6A7,0xA6C7,0x0397}, + {0xA6A8,0xA6C8,0x0398}, + {0xA6A9,0xA6C9,0x0399}, + {0xA6AA,0xA6CA,0x039A}, + {0xA6AB,0xA6CB,0x039B}, + {0xA6AC,0xA6CC,0x039C}, + {0xA6AD,0xA6CD,0x039D}, + {0xA6AE,0xA6CE,0x039E}, + {0xA6AF,0xA6CF,0x039F}, + {0xA6B0,0xA6D0,0x03A0}, /* A6B0 */ + {0xA6B1,0xA6D1,0x03A1}, + {0xA6B2,0xA6D2,0x03A3}, + {0xA6B3,0xA6D3,0x03A4}, + {0xA6B4,0xA6D4,0x03A5}, + {0xA6B5,0xA6D5,0x03A6}, + {0xA6B6,0xA6D6,0x03A7}, + {0xA6B7,0xA6D7,0x03A8}, + {0xA6B8,0xA6D8,0x03A9}, + {0xA6B9,0xA6B9,0x003F}, + {0xA6BA,0xA6BA,0x003F}, + {0xA6BB,0xA6BB,0x003F}, + {0xA6BC,0xA6BC,0x003F}, + {0xA6BD,0xA6BD,0x003F}, + {0xA6BE,0xA6BE,0x003F}, + {0xA6BF,0xA6BF,0x003F}, + {0xA6C0,0xA6C0,0x003F}, /* A6C0 */ + {0xA6A1,0xA6C1,0x03B1}, + {0xA6A2,0xA6C2,0x03B2}, + {0xA6A3,0xA6C3,0x03B3}, + {0xA6A4,0xA6C4,0x03B4}, + {0xA6A5,0xA6C5,0x03B5}, + {0xA6A6,0xA6C6,0x03B6}, + {0xA6A7,0xA6C7,0x03B7}, + {0xA6A8,0xA6C8,0x03B8}, + {0xA6A9,0xA6C9,0x03B9}, + {0xA6AA,0xA6CA,0x03BA}, + {0xA6AB,0xA6CB,0x03BB}, + {0xA6AC,0xA6CC,0x03BC}, + {0xA6AD,0xA6CD,0x03BD}, + {0xA6AE,0xA6CE,0x03BE}, + {0xA6AF,0xA6CF,0x03BF}, + {0xA6B0,0xA6D0,0x03C0}, /* A6D0 */ + {0xA6B1,0xA6D1,0x03C1}, + {0xA6B2,0xA6D2,0x03C3}, + {0xA6B3,0xA6D3,0x03C4}, + {0xA6B4,0xA6D4,0x03C5}, + {0xA6B5,0xA6D5,0x03C6}, + {0xA6B6,0xA6D6,0x03C7}, + {0xA6B7,0xA6D7,0x03C8}, + {0xA6B8,0xA6D8,0x03C9}, + {0xA6D9,0xA6D9,0x003F}, + {0xA6DA,0xA6DA,0x003F}, + {0xA6DB,0xA6DB,0x003F}, + {0xA6DC,0xA6DC,0x003F}, + {0xA6DD,0xA6DD,0x003F}, + {0xA6DE,0xA6DE,0x003F}, + {0xA6DF,0xA6DF,0x003F}, + {0xA6E0,0xA6E0,0x003F}, /* A6E0 */ + {0xA6E1,0xA6E1,0x003F}, + {0xA6E2,0xA6E2,0x003F}, + {0xA6E3,0xA6E3,0x003F}, + {0xA6E4,0xA6E4,0x003F}, + {0xA6E5,0xA6E5,0x003F}, + {0xA6E6,0xA6E6,0x003F}, + {0xA6E7,0xA6E7,0x003F}, + {0xA6E8,0xA6E8,0x003F}, + {0xA6E9,0xA6E9,0x003F}, + {0xA6EA,0xA6EA,0x003F}, + {0xA6EB,0xA6EB,0x003F}, + {0xA6EC,0xA6EC,0x003F}, + {0xA6ED,0xA6ED,0x003F}, + {0xA6EE,0xA6EE,0x003F}, + {0xA6EF,0xA6EF,0x003F}, + {0xA6F0,0xA6F0,0x003F}, /* A6F0 */ + {0xA6F1,0xA6F1,0x003F}, + {0xA6F2,0xA6F2,0x003F}, + {0xA6F3,0xA6F3,0x003F}, + {0xA6F4,0xA6F4,0x003F}, + {0xA6F5,0xA6F5,0x003F}, + {0xA6F6,0xA6F6,0x003F}, + {0xA6F7,0xA6F7,0x003F}, + {0xA6F8,0xA6F8,0x003F}, + {0xA6F9,0xA6F9,0x003F}, + {0xA6FA,0xA6FA,0x003F}, + {0xA6FB,0xA6FB,0x003F}, + {0xA6FC,0xA6FC,0x003F}, + {0xA6FD,0xA6FD,0x003F}, + {0xA6FE,0xA6FE,0x003F}, + {0xA6FF,0xA6FF,0xA6FF} +}; + + +static MY_UNICASE_INFO cA7[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA7A0,0xA7A0,0xA7A0}, /* A7A0 */ + {0xA7A1,0xA7D1,0x0410}, + {0xA7A2,0xA7D2,0x0411}, + {0xA7A3,0xA7D3,0x0412}, + {0xA7A4,0xA7D4,0x0413}, + {0xA7A5,0xA7D5,0x0414}, + {0xA7A6,0xA7D6,0x0415}, + {0xA7A7,0xA7D7,0x0401}, + {0xA7A8,0xA7D8,0x0416}, + {0xA7A9,0xA7D9,0x0417}, + {0xA7AA,0xA7DA,0x0418}, + {0xA7AB,0xA7DB,0x0419}, + {0xA7AC,0xA7DC,0x041A}, + {0xA7AD,0xA7DD,0x041B}, + {0xA7AE,0xA7DE,0x041C}, + {0xA7AF,0xA7DF,0x041D}, + {0xA7B0,0xA7E0,0x041E}, /* A7B0 */ + {0xA7B1,0xA7E1,0x041F}, + {0xA7B2,0xA7E2,0x0420}, + {0xA7B3,0xA7E3,0x0421}, + {0xA7B4,0xA7E4,0x0422}, + {0xA7B5,0xA7E5,0x0423}, + {0xA7B6,0xA7E6,0x0424}, + {0xA7B7,0xA7E7,0x0425}, + {0xA7B8,0xA7E8,0x0426}, + {0xA7B9,0xA7E9,0x0427}, + {0xA7BA,0xA7EA,0x0428}, + {0xA7BB,0xA7EB,0x0429}, + {0xA7BC,0xA7EC,0x042A}, + {0xA7BD,0xA7ED,0x042B}, + {0xA7BE,0xA7EE,0x042C}, + {0xA7BF,0xA7EF,0x042D}, + {0xA7C0,0xA7F0,0x042E}, /* A7C0 */ + {0xA7C1,0xA7F1,0x042F}, + {0xA7C2,0xA7C2,0x003F}, + {0xA7C3,0xA7C3,0x003F}, + {0xA7C4,0xA7C4,0x003F}, + {0xA7C5,0xA7C5,0x003F}, + {0xA7C6,0xA7C6,0x003F}, + {0xA7C7,0xA7C7,0x003F}, + {0xA7C8,0xA7C8,0x003F}, + {0xA7C9,0xA7C9,0x003F}, + {0xA7CA,0xA7CA,0x003F}, + {0xA7CB,0xA7CB,0x003F}, + {0xA7CC,0xA7CC,0x003F}, + {0xA7CD,0xA7CD,0x003F}, + {0xA7CE,0xA7CE,0x003F}, + {0xA7CF,0xA7CF,0x003F}, + {0xA7D0,0xA7D0,0x003F}, /* A7D0 */ + {0xA7A1,0xA7D1,0x0430}, + {0xA7A2,0xA7D2,0x0431}, + {0xA7A3,0xA7D3,0x0432}, + {0xA7A4,0xA7D4,0x0433}, + {0xA7A5,0xA7D5,0x0434}, + {0xA7A6,0xA7D6,0x0435}, + {0xA7A7,0xA7D7,0x0451}, + {0xA7A8,0xA7D8,0x0436}, + {0xA7A9,0xA7D9,0x0437}, + {0xA7AA,0xA7DA,0x0438}, + {0xA7AB,0xA7DB,0x0439}, + {0xA7AC,0xA7DC,0x043A}, + {0xA7AD,0xA7DD,0x043B}, + {0xA7AE,0xA7DE,0x043C}, + {0xA7AF,0xA7DF,0x043D}, + {0xA7B0,0xA7E0,0x043E}, /* A7E0 */ + {0xA7B1,0xA7E1,0x043F}, + {0xA7B2,0xA7E2,0x0440}, + {0xA7B3,0xA7E3,0x0441}, + {0xA7B4,0xA7E4,0x0442}, + {0xA7B5,0xA7E5,0x0443}, + {0xA7B6,0xA7E6,0x0444}, + {0xA7B7,0xA7E7,0x0445}, + {0xA7B8,0xA7E8,0x0446}, + {0xA7B9,0xA7E9,0x0447}, + {0xA7BA,0xA7EA,0x0448}, + {0xA7BB,0xA7EB,0x0449}, + {0xA7BC,0xA7EC,0x044A}, + {0xA7BD,0xA7ED,0x044B}, + {0xA7BE,0xA7EE,0x044C}, + {0xA7BF,0xA7EF,0x044D}, + {0xA7C0,0xA7F0,0x044E}, /* A7F0 */ + {0xA7C1,0xA7F1,0x044F}, + {0xA7F2,0xA7F2,0x003F}, + {0xA7F3,0xA7F3,0x003F}, + {0xA7F4,0xA7F4,0x003F}, + {0xA7F5,0xA7F5,0x003F}, + {0xA7F6,0xA7F6,0x003F}, + {0xA7F7,0xA7F7,0x003F}, + {0xA7F8,0xA7F8,0x003F}, + {0xA7F9,0xA7F9,0x003F}, + {0xA7FA,0xA7FA,0x003F}, + {0xA7FB,0xA7FB,0x003F}, + {0xA7FC,0xA7FC,0x003F}, + {0xA7FD,0xA7FD,0x003F}, + {0xA7FE,0xA7FE,0x003F}, + {0xA7FF,0xA7FF,0xA7FF} +}; + + +static MY_UNICASE_INFO cA8[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA8A0,0xA8A0,0xA8A0}, /* A8A0 */ + {0xA8A1,0xA8A1,0x0101}, + {0xA8A2,0xA8A2,0x00E1}, + {0xA8A3,0xA8A3,0x01CE}, + {0xA8A4,0xA8A4,0x00E0}, + {0xA8A5,0xA8A5,0x0113}, + {0xA8A6,0xA8A6,0x00E9}, + {0xA8A7,0xA8A7,0x011B}, + {0xA8A8,0xA8A8,0x00E8}, + {0xA8A9,0xA8A9,0x012B}, + {0xA8AA,0xA8AA,0x00ED}, + {0xA8AB,0xA8AB,0x01D0}, + {0xA8AC,0xA8AC,0x00EC}, + {0xA8AD,0xA8AD,0x014D}, + {0xA8AE,0xA8AE,0x00F3}, + {0xA8AF,0xA8AF,0x01D2}, + {0xA8B0,0xA8B0,0x00F2}, /* A8B0 */ + {0xA8B1,0xA8B1,0x016B}, + {0xA8B2,0xA8B2,0x00FA}, + {0xA8B3,0xA8B3,0x01D4}, + {0xA8B4,0xA8B4,0x00F9}, + {0xA8B5,0xA8B5,0x01D6}, + {0xA8B6,0xA8B6,0x01D8}, + {0xA8B7,0xA8B7,0x01DA}, + {0xA8B8,0xA8B8,0x01DC}, + {0xA8B9,0xA8B9,0x00FC}, + {0xA8BA,0xA8BA,0x00EA}, + {0xA8BB,0xA8BB,0x003F}, + {0xA8BC,0xA8BC,0x003F}, + {0xA8BD,0xA8BD,0x003F}, + {0xA8BE,0xA8BE,0x003F}, + {0xA8BF,0xA8BF,0x003F}, + {0xA8C0,0xA8C0,0x003F}, /* A8C0 */ + {0xA8C1,0xA8C1,0x003F}, + {0xA8C2,0xA8C2,0x003F}, + {0xA8C3,0xA8C3,0x003F}, + {0xA8C4,0xA8C4,0x003F}, + {0xA8C5,0xA8C5,0x3105}, + {0xA8C6,0xA8C6,0x3106}, + {0xA8C7,0xA8C7,0x3107}, + {0xA8C8,0xA8C8,0x3108}, + {0xA8C9,0xA8C9,0x3109}, + {0xA8CA,0xA8CA,0x310A}, + {0xA8CB,0xA8CB,0x310B}, + {0xA8CC,0xA8CC,0x310C}, + {0xA8CD,0xA8CD,0x310D}, + {0xA8CE,0xA8CE,0x310E}, + {0xA8CF,0xA8CF,0x310F}, + {0xA8D0,0xA8D0,0x3110}, /* A8D0 */ + {0xA8D1,0xA8D1,0x3111}, + {0xA8D2,0xA8D2,0x3112}, + {0xA8D3,0xA8D3,0x3113}, + {0xA8D4,0xA8D4,0x3114}, + {0xA8D5,0xA8D5,0x3115}, + {0xA8D6,0xA8D6,0x3116}, + {0xA8D7,0xA8D7,0x3117}, + {0xA8D8,0xA8D8,0x3118}, + {0xA8D9,0xA8D9,0x3119}, + {0xA8DA,0xA8DA,0x311A}, + {0xA8DB,0xA8DB,0x311B}, + {0xA8DC,0xA8DC,0x311C}, + {0xA8DD,0xA8DD,0x311D}, + {0xA8DE,0xA8DE,0x311E}, + {0xA8DF,0xA8DF,0x311F}, + {0xA8E0,0xA8E0,0x3120}, /* A8E0 */ + {0xA8E1,0xA8E1,0x3121}, + {0xA8E2,0xA8E2,0x3122}, + {0xA8E3,0xA8E3,0x3123}, + {0xA8E4,0xA8E4,0x3124}, + {0xA8E5,0xA8E5,0x3125}, + {0xA8E6,0xA8E6,0x3126}, + {0xA8E7,0xA8E7,0x3127}, + {0xA8E8,0xA8E8,0x3128}, + {0xA8E9,0xA8E9,0x3129}, + {0xA8EA,0xA8EA,0x003F}, + {0xA8EB,0xA8EB,0x003F}, + {0xA8EC,0xA8EC,0x003F}, + {0xA8ED,0xA8ED,0x003F}, + {0xA8EE,0xA8EE,0x003F}, + {0xA8EF,0xA8EF,0x003F}, + {0xA8F0,0xA8F0,0x003F}, /* A8F0 */ + {0xA8F1,0xA8F1,0x003F}, + {0xA8F2,0xA8F2,0x003F}, + {0xA8F3,0xA8F3,0x003F}, + {0xA8F4,0xA8F4,0x003F}, + {0xA8F5,0xA8F5,0x003F}, + {0xA8F6,0xA8F6,0x003F}, + {0xA8F7,0xA8F7,0x003F}, + {0xA8F8,0xA8F8,0x003F}, + {0xA8F9,0xA8F9,0x003F}, + {0xA8FA,0xA8FA,0x003F}, + {0xA8FB,0xA8FB,0x003F}, + {0xA8FC,0xA8FC,0x003F}, + {0xA8FD,0xA8FD,0x003F}, + {0xA8FE,0xA8FE,0x003F}, + {0xA8FF,0xA8FF,0xA8FF} +}; + + +static MY_UNICASE_INFO *my_caseinfo_gb2312[256]= +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, cA2, cA3, NULL, NULL, cA6, cA7, /* A */ + cA8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + + /* page 0 0x2121-0x2658 */ static uint16 tab_gb2312_uni0[]={ 0x3000,0x3001,0x3002,0x30FB,0x02C9,0x02C7,0x00A8,0x3003, @@ -5781,7 +6423,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_gb2312, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ @@ -5813,7 +6455,7 @@ CHARSET_INFO my_charset_gb2312_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_gb2312, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 7b8bb85652b..52a8d994fa4 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -137,6 +137,864 @@ static uchar NEAR to_upper_gbk[]= (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', }; + +static MY_UNICASE_INFO cA2[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA240,0xA240,0x003F}, /* A240 */ + {0xA241,0xA241,0x003F}, + {0xA242,0xA242,0x003F}, + {0xA243,0xA243,0x003F}, + {0xA244,0xA244,0x003F}, + {0xA245,0xA245,0x003F}, + {0xA246,0xA246,0x003F}, + {0xA247,0xA247,0x003F}, + {0xA248,0xA248,0x003F}, + {0xA249,0xA249,0x003F}, + {0xA24A,0xA24A,0x003F}, + {0xA24B,0xA24B,0x003F}, + {0xA24C,0xA24C,0x003F}, + {0xA24D,0xA24D,0x003F}, + {0xA24E,0xA24E,0x003F}, + {0xA24F,0xA24F,0x003F}, + {0xA250,0xA250,0x003F}, /* A250 */ + {0xA251,0xA251,0x003F}, + {0xA252,0xA252,0x003F}, + {0xA253,0xA253,0x003F}, + {0xA254,0xA254,0x003F}, + {0xA255,0xA255,0x003F}, + {0xA256,0xA256,0x003F}, + {0xA257,0xA257,0x003F}, + {0xA258,0xA258,0x003F}, + {0xA259,0xA259,0x003F}, + {0xA25A,0xA25A,0x003F}, + {0xA25B,0xA25B,0x003F}, + {0xA25C,0xA25C,0x003F}, + {0xA25D,0xA25D,0x003F}, + {0xA25E,0xA25E,0x003F}, + {0xA25F,0xA25F,0x003F}, + {0xA260,0xA260,0x003F}, /* A260 */ + {0xA261,0xA261,0x003F}, + {0xA262,0xA262,0x003F}, + {0xA263,0xA263,0x003F}, + {0xA264,0xA264,0x003F}, + {0xA265,0xA265,0x003F}, + {0xA266,0xA266,0x003F}, + {0xA267,0xA267,0x003F}, + {0xA268,0xA268,0x003F}, + {0xA269,0xA269,0x003F}, + {0xA26A,0xA26A,0x003F}, + {0xA26B,0xA26B,0x003F}, + {0xA26C,0xA26C,0x003F}, + {0xA26D,0xA26D,0x003F}, + {0xA26E,0xA26E,0x003F}, + {0xA26F,0xA26F,0x003F}, + {0xA270,0xA270,0x003F}, /* A270 */ + {0xA271,0xA271,0x003F}, + {0xA272,0xA272,0x003F}, + {0xA273,0xA273,0x003F}, + {0xA274,0xA274,0x003F}, + {0xA275,0xA275,0x003F}, + {0xA276,0xA276,0x003F}, + {0xA277,0xA277,0x003F}, + {0xA278,0xA278,0x003F}, + {0xA279,0xA279,0x003F}, + {0xA27A,0xA27A,0x003F}, + {0xA27B,0xA27B,0x003F}, + {0xA27C,0xA27C,0x003F}, + {0xA27D,0xA27D,0x003F}, + {0xA27E,0xA27E,0x003F}, + {0xA27F,0xA27F,0xA27F}, + {0xA280,0xA280,0x003F}, /* A280 */ + {0xA281,0xA281,0x003F}, + {0xA282,0xA282,0x003F}, + {0xA283,0xA283,0x003F}, + {0xA284,0xA284,0x003F}, + {0xA285,0xA285,0x003F}, + {0xA286,0xA286,0x003F}, + {0xA287,0xA287,0x003F}, + {0xA288,0xA288,0x003F}, + {0xA289,0xA289,0x003F}, + {0xA28A,0xA28A,0x003F}, + {0xA28B,0xA28B,0x003F}, + {0xA28C,0xA28C,0x003F}, + {0xA28D,0xA28D,0x003F}, + {0xA28E,0xA28E,0x003F}, + {0xA28F,0xA28F,0x003F}, + {0xA290,0xA290,0x003F}, /* A290 */ + {0xA291,0xA291,0x003F}, + {0xA292,0xA292,0x003F}, + {0xA293,0xA293,0x003F}, + {0xA294,0xA294,0x003F}, + {0xA295,0xA295,0x003F}, + {0xA296,0xA296,0x003F}, + {0xA297,0xA297,0x003F}, + {0xA298,0xA298,0x003F}, + {0xA299,0xA299,0x003F}, + {0xA29A,0xA29A,0x003F}, + {0xA29B,0xA29B,0x003F}, + {0xA29C,0xA29C,0x003F}, + {0xA29D,0xA29D,0x003F}, + {0xA29E,0xA29E,0x003F}, + {0xA29F,0xA29F,0x003F}, + {0xA2A0,0xA2A0,0x003F}, /* A2A0 */ + {0xA2F1,0xA2A1,0x2170}, + {0xA2F2,0xA2A2,0x2171}, + {0xA2F3,0xA2A3,0x2172}, + {0xA2F4,0xA2A4,0x2173}, + {0xA2F5,0xA2A5,0x2174}, + {0xA2F6,0xA2A6,0x2175}, + {0xA2F7,0xA2A7,0x2176}, + {0xA2F8,0xA2A8,0x2177}, + {0xA2F9,0xA2A9,0x2178}, + {0xA2FA,0xA2AA,0x2179}, + {0xA2AB,0xA2AB,0x003F}, + {0xA2AC,0xA2AC,0x003F}, + {0xA2AD,0xA2AD,0x003F}, + {0xA2AE,0xA2AE,0x003F}, + {0xA2AF,0xA2AF,0x003F}, + {0xA2B0,0xA2B0,0x003F}, /* A2B0 */ + {0xA2B1,0xA2B1,0x2488}, + {0xA2B2,0xA2B2,0x2489}, + {0xA2B3,0xA2B3,0x248A}, + {0xA2B4,0xA2B4,0x248B}, + {0xA2B5,0xA2B5,0x248C}, + {0xA2B6,0xA2B6,0x248D}, + {0xA2B7,0xA2B7,0x248E}, + {0xA2B8,0xA2B8,0x248F}, + {0xA2B9,0xA2B9,0x2490}, + {0xA2BA,0xA2BA,0x2491}, + {0xA2BB,0xA2BB,0x2492}, + {0xA2BC,0xA2BC,0x2493}, + {0xA2BD,0xA2BD,0x2494}, + {0xA2BE,0xA2BE,0x2495}, + {0xA2BF,0xA2BF,0x2496}, + {0xA2C0,0xA2C0,0x2497}, /* A2C0 */ + {0xA2C1,0xA2C1,0x2498}, + {0xA2C2,0xA2C2,0x2499}, + {0xA2C3,0xA2C3,0x249A}, + {0xA2C4,0xA2C4,0x249B}, + {0xA2C5,0xA2C5,0x2474}, + {0xA2C6,0xA2C6,0x2475}, + {0xA2C7,0xA2C7,0x2476}, + {0xA2C8,0xA2C8,0x2477}, + {0xA2C9,0xA2C9,0x2478}, + {0xA2CA,0xA2CA,0x2479}, + {0xA2CB,0xA2CB,0x247A}, + {0xA2CC,0xA2CC,0x247B}, + {0xA2CD,0xA2CD,0x247C}, + {0xA2CE,0xA2CE,0x247D}, + {0xA2CF,0xA2CF,0x247E}, + {0xA2D0,0xA2D0,0x247F}, /* A2D0 */ + {0xA2D1,0xA2D1,0x2480}, + {0xA2D2,0xA2D2,0x2481}, + {0xA2D3,0xA2D3,0x2482}, + {0xA2D4,0xA2D4,0x2483}, + {0xA2D5,0xA2D5,0x2484}, + {0xA2D6,0xA2D6,0x2485}, + {0xA2D7,0xA2D7,0x2486}, + {0xA2D8,0xA2D8,0x2487}, + {0xA2D9,0xA2D9,0x2460}, + {0xA2DA,0xA2DA,0x2461}, + {0xA2DB,0xA2DB,0x2462}, + {0xA2DC,0xA2DC,0x2463}, + {0xA2DD,0xA2DD,0x2464}, + {0xA2DE,0xA2DE,0x2465}, + {0xA2DF,0xA2DF,0x2466}, + {0xA2E0,0xA2E0,0x2467}, /* A2E0 */ + {0xA2E1,0xA2E1,0x2468}, + {0xA2E2,0xA2E2,0x2469}, + {0xA2E3,0xA2E3,0x003F}, + {0xA2E4,0xA2E4,0x003F}, + {0xA2E5,0xA2E5,0x3220}, + {0xA2E6,0xA2E6,0x3221}, + {0xA2E7,0xA2E7,0x3222}, + {0xA2E8,0xA2E8,0x3223}, + {0xA2E9,0xA2E9,0x3224}, + {0xA2EA,0xA2EA,0x3225}, + {0xA2EB,0xA2EB,0x3226}, + {0xA2EC,0xA2EC,0x3227}, + {0xA2ED,0xA2ED,0x3228}, + {0xA2EE,0xA2EE,0x3229}, + {0xA2EF,0xA2EF,0x003F}, + {0xA2F0,0xA2F0,0x003F}, /* A2F0 */ + {0xA2F1,0xA2A1,0x2160}, + {0xA2F2,0xA2A2,0x2161}, + {0xA2F3,0xA2A3,0x2162}, + {0xA2F4,0xA2A4,0x2163}, + {0xA2F5,0xA2A5,0x2164}, + {0xA2F6,0xA2A6,0x2165}, + {0xA2F7,0xA2A7,0x2166}, + {0xA2F8,0xA2A8,0x2167}, + {0xA2F9,0xA2A9,0x2168}, + {0xA2FA,0xA2AA,0x2169}, + {0xA2FB,0xA2FB,0x216A}, + {0xA2FC,0xA2FC,0x216B}, + {0xA2FD,0xA2FD,0x003F}, + {0xA2FE,0xA2FE,0x003F}, + {0xA2FF,0xA2FF,0xA2FF} +}; + +static MY_UNICASE_INFO cA3[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA340,0xA340,0x003F}, /* A340 */ + {0xA341,0xA341,0x003F}, + {0xA342,0xA342,0x003F}, + {0xA343,0xA343,0x003F}, + {0xA344,0xA344,0x003F}, + {0xA345,0xA345,0x003F}, + {0xA346,0xA346,0x003F}, + {0xA347,0xA347,0x003F}, + {0xA348,0xA348,0x003F}, + {0xA349,0xA349,0x003F}, + {0xA34A,0xA34A,0x003F}, + {0xA34B,0xA34B,0x003F}, + {0xA34C,0xA34C,0x003F}, + {0xA34D,0xA34D,0x003F}, + {0xA34E,0xA34E,0x003F}, + {0xA34F,0xA34F,0x003F}, + {0xA350,0xA350,0x003F}, /* A350 */ + {0xA351,0xA351,0x003F}, + {0xA352,0xA352,0x003F}, + {0xA353,0xA353,0x003F}, + {0xA354,0xA354,0x003F}, + {0xA355,0xA355,0x003F}, + {0xA356,0xA356,0x003F}, + {0xA357,0xA357,0x003F}, + {0xA358,0xA358,0x003F}, + {0xA359,0xA359,0x003F}, + {0xA35A,0xA35A,0x003F}, + {0xA35B,0xA35B,0x003F}, + {0xA35C,0xA35C,0x003F}, + {0xA35D,0xA35D,0x003F}, + {0xA35E,0xA35E,0x003F}, + {0xA35F,0xA35F,0x003F}, + {0xA360,0xA360,0x003F}, /* A360 */ + {0xA361,0xA361,0x003F}, + {0xA362,0xA362,0x003F}, + {0xA363,0xA363,0x003F}, + {0xA364,0xA364,0x003F}, + {0xA365,0xA365,0x003F}, + {0xA366,0xA366,0x003F}, + {0xA367,0xA367,0x003F}, + {0xA368,0xA368,0x003F}, + {0xA369,0xA369,0x003F}, + {0xA36A,0xA36A,0x003F}, + {0xA36B,0xA36B,0x003F}, + {0xA36C,0xA36C,0x003F}, + {0xA36D,0xA36D,0x003F}, + {0xA36E,0xA36E,0x003F}, + {0xA36F,0xA36F,0x003F}, + {0xA370,0xA370,0x003F}, /* A370 */ + {0xA371,0xA371,0x003F}, + {0xA372,0xA372,0x003F}, + {0xA373,0xA373,0x003F}, + {0xA374,0xA374,0x003F}, + {0xA375,0xA375,0x003F}, + {0xA376,0xA376,0x003F}, + {0xA377,0xA377,0x003F}, + {0xA378,0xA378,0x003F}, + {0xA379,0xA379,0x003F}, + {0xA37A,0xA37A,0x003F}, + {0xA37B,0xA37B,0x003F}, + {0xA37C,0xA37C,0x003F}, + {0xA37D,0xA37D,0x003F}, + {0xA37E,0xA37E,0x003F}, + {0xA37F,0xA37F,0xA37F}, + {0xA380,0xA380,0x003F}, /* A380 */ + {0xA381,0xA381,0x003F}, + {0xA382,0xA382,0x003F}, + {0xA383,0xA383,0x003F}, + {0xA384,0xA384,0x003F}, + {0xA385,0xA385,0x003F}, + {0xA386,0xA386,0x003F}, + {0xA387,0xA387,0x003F}, + {0xA388,0xA388,0x003F}, + {0xA389,0xA389,0x003F}, + {0xA38A,0xA38A,0x003F}, + {0xA38B,0xA38B,0x003F}, + {0xA38C,0xA38C,0x003F}, + {0xA38D,0xA38D,0x003F}, + {0xA38E,0xA38E,0x003F}, + {0xA38F,0xA38F,0x003F}, + {0xA390,0xA390,0x003F}, /* A390 */ + {0xA391,0xA391,0x003F}, + {0xA392,0xA392,0x003F}, + {0xA393,0xA393,0x003F}, + {0xA394,0xA394,0x003F}, + {0xA395,0xA395,0x003F}, + {0xA396,0xA396,0x003F}, + {0xA397,0xA397,0x003F}, + {0xA398,0xA398,0x003F}, + {0xA399,0xA399,0x003F}, + {0xA39A,0xA39A,0x003F}, + {0xA39B,0xA39B,0x003F}, + {0xA39C,0xA39C,0x003F}, + {0xA39D,0xA39D,0x003F}, + {0xA39E,0xA39E,0x003F}, + {0xA39F,0xA39F,0x003F}, + {0xA3A0,0xA3A0,0x003F}, /* A3A0 */ + {0xA3A1,0xA3A1,0xFF01}, + {0xA3A2,0xA3A2,0xFF02}, + {0xA3A3,0xA3A3,0xFF03}, + {0xA3A4,0xA3A4,0xFFE5}, + {0xA3A5,0xA3A5,0xFF05}, + {0xA3A6,0xA3A6,0xFF06}, + {0xA3A7,0xA3A7,0xFF07}, + {0xA3A8,0xA3A8,0xFF08}, + {0xA3A9,0xA3A9,0xFF09}, + {0xA3AA,0xA3AA,0xFF0A}, + {0xA3AB,0xA3AB,0xFF0B}, + {0xA3AC,0xA3AC,0xFF0C}, + {0xA3AD,0xA3AD,0xFF0D}, + {0xA3AE,0xA3AE,0xFF0E}, + {0xA3AF,0xA3AF,0xFF0F}, + {0xA3B0,0xA3B0,0xFF10}, /* A3B0 */ + {0xA3B1,0xA3B1,0xFF11}, + {0xA3B2,0xA3B2,0xFF12}, + {0xA3B3,0xA3B3,0xFF13}, + {0xA3B4,0xA3B4,0xFF14}, + {0xA3B5,0xA3B5,0xFF15}, + {0xA3B6,0xA3B6,0xFF16}, + {0xA3B7,0xA3B7,0xFF17}, + {0xA3B8,0xA3B8,0xFF18}, + {0xA3B9,0xA3B9,0xFF19}, + {0xA3BA,0xA3BA,0xFF1A}, + {0xA3BB,0xA3BB,0xFF1B}, + {0xA3BC,0xA3BC,0xFF1C}, + {0xA3BD,0xA3BD,0xFF1D}, + {0xA3BE,0xA3BE,0xFF1E}, + {0xA3BF,0xA3BF,0xFF1F}, + {0xA3C0,0xA3C0,0xFF20}, /* A3C0 */ + {0xA3C1,0xA3E1,0xFF21}, + {0xA3C2,0xA3E2,0xFF22}, + {0xA3C3,0xA3E3,0xFF23}, + {0xA3C4,0xA3E4,0xFF24}, + {0xA3C5,0xA3E5,0xFF25}, + {0xA3C6,0xA3E6,0xFF26}, + {0xA3C7,0xA3E7,0xFF27}, + {0xA3C8,0xA3E8,0xFF28}, + {0xA3C9,0xA3E9,0xFF29}, + {0xA3CA,0xA3EA,0xFF2A}, + {0xA3CB,0xA3EB,0xFF2B}, + {0xA3CC,0xA3EC,0xFF2C}, + {0xA3CD,0xA3ED,0xFF2D}, + {0xA3CE,0xA3EE,0xFF2E}, + {0xA3CF,0xA3EF,0xFF2F}, + {0xA3D0,0xA3F0,0xFF30}, /* A3D0 */ + {0xA3D1,0xA3F1,0xFF31}, + {0xA3D2,0xA3F2,0xFF32}, + {0xA3D3,0xA3F3,0xFF33}, + {0xA3D4,0xA3F4,0xFF34}, + {0xA3D5,0xA3F5,0xFF35}, + {0xA3D6,0xA3F6,0xFF36}, + {0xA3D7,0xA3F7,0xFF37}, + {0xA3D8,0xA3F8,0xFF38}, + {0xA3D9,0xA3F9,0xFF39}, + {0xA3DA,0xA3FA,0xFF3A}, + {0xA3DB,0xA3DB,0xFF3B}, + {0xA3DC,0xA3DC,0xFF3C}, + {0xA3DD,0xA3DD,0xFF3D}, + {0xA3DE,0xA3DE,0xFF3E}, + {0xA3DF,0xA3DF,0xFF3F}, + {0xA3E0,0xA3E0,0xFF40}, /* A3E0 */ + {0xA3C1,0xA3E1,0xFF41}, + {0xA3C2,0xA3E2,0xFF42}, + {0xA3C3,0xA3E3,0xFF43}, + {0xA3C4,0xA3E4,0xFF44}, + {0xA3C5,0xA3E5,0xFF45}, + {0xA3C6,0xA3E6,0xFF46}, + {0xA3C7,0xA3E7,0xFF47}, + {0xA3C8,0xA3E8,0xFF48}, + {0xA3C9,0xA3E9,0xFF49}, + {0xA3CA,0xA3EA,0xFF4A}, + {0xA3CB,0xA3EB,0xFF4B}, + {0xA3CC,0xA3EC,0xFF4C}, + {0xA3CD,0xA3ED,0xFF4D}, + {0xA3CE,0xA3EE,0xFF4E}, + {0xA3CF,0xA3EF,0xFF4F}, + {0xA3D0,0xA3F0,0xFF50}, /* A3F0 */ + {0xA3D1,0xA3F1,0xFF51}, + {0xA3D2,0xA3F2,0xFF52}, + {0xA3D3,0xA3F3,0xFF53}, + {0xA3D4,0xA3F4,0xFF54}, + {0xA3D5,0xA3F5,0xFF55}, + {0xA3D6,0xA3F6,0xFF56}, + {0xA3D7,0xA3F7,0xFF57}, + {0xA3D8,0xA3F8,0xFF58}, + {0xA3D9,0xA3F9,0xFF59}, + {0xA3DA,0xA3FA,0xFF5A}, + {0xA3FB,0xA3FB,0xFF5B}, + {0xA3FC,0xA3FC,0xFF5C}, + {0xA3FD,0xA3FD,0xFF5D}, + {0xA3FE,0xA3FE,0xFFE3}, + {0xA3FF,0xA3FF,0xA3FF} +}; + + +static MY_UNICASE_INFO cA6[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA640,0xA640,0x003F}, /* A640 */ + {0xA641,0xA641,0x003F}, + {0xA642,0xA642,0x003F}, + {0xA643,0xA643,0x003F}, + {0xA644,0xA644,0x003F}, + {0xA645,0xA645,0x003F}, + {0xA646,0xA646,0x003F}, + {0xA647,0xA647,0x003F}, + {0xA648,0xA648,0x003F}, + {0xA649,0xA649,0x003F}, + {0xA64A,0xA64A,0x003F}, + {0xA64B,0xA64B,0x003F}, + {0xA64C,0xA64C,0x003F}, + {0xA64D,0xA64D,0x003F}, + {0xA64E,0xA64E,0x003F}, + {0xA64F,0xA64F,0x003F}, + {0xA650,0xA650,0x003F}, /* A650 */ + {0xA651,0xA651,0x003F}, + {0xA652,0xA652,0x003F}, + {0xA653,0xA653,0x003F}, + {0xA654,0xA654,0x003F}, + {0xA655,0xA655,0x003F}, + {0xA656,0xA656,0x003F}, + {0xA657,0xA657,0x003F}, + {0xA658,0xA658,0x003F}, + {0xA659,0xA659,0x003F}, + {0xA65A,0xA65A,0x003F}, + {0xA65B,0xA65B,0x003F}, + {0xA65C,0xA65C,0x003F}, + {0xA65D,0xA65D,0x003F}, + {0xA65E,0xA65E,0x003F}, + {0xA65F,0xA65F,0x003F}, + {0xA660,0xA660,0x003F}, /* A660 */ + {0xA661,0xA661,0x003F}, + {0xA662,0xA662,0x003F}, + {0xA663,0xA663,0x003F}, + {0xA664,0xA664,0x003F}, + {0xA665,0xA665,0x003F}, + {0xA666,0xA666,0x003F}, + {0xA667,0xA667,0x003F}, + {0xA668,0xA668,0x003F}, + {0xA669,0xA669,0x003F}, + {0xA66A,0xA66A,0x003F}, + {0xA66B,0xA66B,0x003F}, + {0xA66C,0xA66C,0x003F}, + {0xA66D,0xA66D,0x003F}, + {0xA66E,0xA66E,0x003F}, + {0xA66F,0xA66F,0x003F}, + {0xA670,0xA670,0x003F}, /* A670 */ + {0xA671,0xA671,0x003F}, + {0xA672,0xA672,0x003F}, + {0xA673,0xA673,0x003F}, + {0xA674,0xA674,0x003F}, + {0xA675,0xA675,0x003F}, + {0xA676,0xA676,0x003F}, + {0xA677,0xA677,0x003F}, + {0xA678,0xA678,0x003F}, + {0xA679,0xA679,0x003F}, + {0xA67A,0xA67A,0x003F}, + {0xA67B,0xA67B,0x003F}, + {0xA67C,0xA67C,0x003F}, + {0xA67D,0xA67D,0x003F}, + {0xA67E,0xA67E,0x003F}, + {0xA67F,0xA67F,0xA67F}, + {0xA680,0xA680,0x003F}, /* A680 */ + {0xA681,0xA681,0x003F}, + {0xA682,0xA682,0x003F}, + {0xA683,0xA683,0x003F}, + {0xA684,0xA684,0x003F}, + {0xA685,0xA685,0x003F}, + {0xA686,0xA686,0x003F}, + {0xA687,0xA687,0x003F}, + {0xA688,0xA688,0x003F}, + {0xA689,0xA689,0x003F}, + {0xA68A,0xA68A,0x003F}, + {0xA68B,0xA68B,0x003F}, + {0xA68C,0xA68C,0x003F}, + {0xA68D,0xA68D,0x003F}, + {0xA68E,0xA68E,0x003F}, + {0xA68F,0xA68F,0x003F}, + {0xA690,0xA690,0x003F}, /* A690 */ + {0xA691,0xA691,0x003F}, + {0xA692,0xA692,0x003F}, + {0xA693,0xA693,0x003F}, + {0xA694,0xA694,0x003F}, + {0xA695,0xA695,0x003F}, + {0xA696,0xA696,0x003F}, + {0xA697,0xA697,0x003F}, + {0xA698,0xA698,0x003F}, + {0xA699,0xA699,0x003F}, + {0xA69A,0xA69A,0x003F}, + {0xA69B,0xA69B,0x003F}, + {0xA69C,0xA69C,0x003F}, + {0xA69D,0xA69D,0x003F}, + {0xA69E,0xA69E,0x003F}, + {0xA69F,0xA69F,0x003F}, + {0xA6A0,0xA6A0,0x003F}, /* A6A0 */ + {0xA6A1,0xA6C1,0x0391}, + {0xA6A2,0xA6C2,0x0392}, + {0xA6A3,0xA6C3,0x0393}, + {0xA6A4,0xA6C4,0x0394}, + {0xA6A5,0xA6C5,0x0395}, + {0xA6A6,0xA6C6,0x0396}, + {0xA6A7,0xA6C7,0x0397}, + {0xA6A8,0xA6C8,0x0398}, + {0xA6A9,0xA6C9,0x0399}, + {0xA6AA,0xA6CA,0x039A}, + {0xA6AB,0xA6CB,0x039B}, + {0xA6AC,0xA6CC,0x039C}, + {0xA6AD,0xA6CD,0x039D}, + {0xA6AE,0xA6CE,0x039E}, + {0xA6AF,0xA6CF,0x039F}, + {0xA6B0,0xA6D0,0x03A0}, /* A6B0 */ + {0xA6B1,0xA6D1,0x03A1}, + {0xA6B2,0xA6D2,0x03A3}, + {0xA6B3,0xA6D3,0x03A4}, + {0xA6B4,0xA6D4,0x03A5}, + {0xA6B5,0xA6D5,0x03A6}, + {0xA6B6,0xA6D6,0x03A7}, + {0xA6B7,0xA6D7,0x03A8}, + {0xA6B8,0xA6D8,0x03A9}, + {0xA6B9,0xA6B9,0x003F}, + {0xA6BA,0xA6BA,0x003F}, + {0xA6BB,0xA6BB,0x003F}, + {0xA6BC,0xA6BC,0x003F}, + {0xA6BD,0xA6BD,0x003F}, + {0xA6BE,0xA6BE,0x003F}, + {0xA6BF,0xA6BF,0x003F}, + {0xA6C0,0xA6C0,0x003F}, /* A6C0 */ + {0xA6A1,0xA6C1,0x03B1}, + {0xA6A2,0xA6C2,0x03B2}, + {0xA6A3,0xA6C3,0x03B3}, + {0xA6A4,0xA6C4,0x03B4}, + {0xA6A5,0xA6C5,0x03B5}, + {0xA6A6,0xA6C6,0x03B6}, + {0xA6A7,0xA6C7,0x03B7}, + {0xA6A8,0xA6C8,0x03B8}, + {0xA6A9,0xA6C9,0x03B9}, + {0xA6AA,0xA6CA,0x03BA}, + {0xA6AB,0xA6CB,0x03BB}, + {0xA6AC,0xA6CC,0x03BC}, + {0xA6AD,0xA6CD,0x03BD}, + {0xA6AE,0xA6CE,0x03BE}, + {0xA6AF,0xA6CF,0x03BF}, + {0xA6B0,0xA6D0,0x03C0}, /* A6D0 */ + {0xA6B1,0xA6D1,0x03C1}, + {0xA6B2,0xA6D2,0x03C3}, + {0xA6B3,0xA6D3,0x03C4}, + {0xA6B4,0xA6D4,0x03C5}, + {0xA6B5,0xA6D5,0x03C6}, + {0xA6B6,0xA6D6,0x03C7}, + {0xA6B7,0xA6D7,0x03C8}, + {0xA6B8,0xA6D8,0x03C9}, + {0xA6D9,0xA6D9,0x003F}, + {0xA6DA,0xA6DA,0x003F}, + {0xA6DB,0xA6DB,0x003F}, + {0xA6DC,0xA6DC,0x003F}, + {0xA6DD,0xA6DD,0x003F}, + {0xA6DE,0xA6DE,0x003F}, + {0xA6DF,0xA6DF,0x003F}, + {0xA6E0,0xA6E0,0xFE35}, /* A6E0 */ + {0xA6E1,0xA6E1,0xFE36}, + {0xA6E2,0xA6E2,0xFE39}, + {0xA6E3,0xA6E3,0xFE3A}, + {0xA6E4,0xA6E4,0xFE3F}, + {0xA6E5,0xA6E5,0xFE40}, + {0xA6E6,0xA6E6,0xFE3D}, + {0xA6E7,0xA6E7,0xFE3E}, + {0xA6E8,0xA6E8,0xFE41}, + {0xA6E9,0xA6E9,0xFE42}, + {0xA6EA,0xA6EA,0xFE43}, + {0xA6EB,0xA6EB,0xFE44}, + {0xA6EC,0xA6EC,0x003F}, + {0xA6ED,0xA6ED,0x003F}, + {0xA6EE,0xA6EE,0xFE3B}, + {0xA6EF,0xA6EF,0xFE3C}, + {0xA6F0,0xA6F0,0xFE37}, /* A6F0 */ + {0xA6F1,0xA6F1,0xFE38}, + {0xA6F2,0xA6F2,0xFE31}, + {0xA6F3,0xA6F3,0x003F}, + {0xA6F4,0xA6F4,0xFE33}, + {0xA6F5,0xA6F5,0xFE34}, + {0xA6F6,0xA6F6,0x003F}, + {0xA6F7,0xA6F7,0x003F}, + {0xA6F8,0xA6F8,0x003F}, + {0xA6F9,0xA6F9,0x003F}, + {0xA6FA,0xA6FA,0x003F}, + {0xA6FB,0xA6FB,0x003F}, + {0xA6FC,0xA6FC,0x003F}, + {0xA6FD,0xA6FD,0x003F}, + {0xA6FE,0xA6FE,0x003F}, + {0xA6FF,0xA6FF,0xA6FF} +}; + + +static MY_UNICASE_INFO cA7[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA740,0xA740,0x003F}, /* A740 */ + {0xA741,0xA741,0x003F}, + {0xA742,0xA742,0x003F}, + {0xA743,0xA743,0x003F}, + {0xA744,0xA744,0x003F}, + {0xA745,0xA745,0x003F}, + {0xA746,0xA746,0x003F}, + {0xA747,0xA747,0x003F}, + {0xA748,0xA748,0x003F}, + {0xA749,0xA749,0x003F}, + {0xA74A,0xA74A,0x003F}, + {0xA74B,0xA74B,0x003F}, + {0xA74C,0xA74C,0x003F}, + {0xA74D,0xA74D,0x003F}, + {0xA74E,0xA74E,0x003F}, + {0xA74F,0xA74F,0x003F}, + {0xA750,0xA750,0x003F}, /* A750 */ + {0xA751,0xA751,0x003F}, + {0xA752,0xA752,0x003F}, + {0xA753,0xA753,0x003F}, + {0xA754,0xA754,0x003F}, + {0xA755,0xA755,0x003F}, + {0xA756,0xA756,0x003F}, + {0xA757,0xA757,0x003F}, + {0xA758,0xA758,0x003F}, + {0xA759,0xA759,0x003F}, + {0xA75A,0xA75A,0x003F}, + {0xA75B,0xA75B,0x003F}, + {0xA75C,0xA75C,0x003F}, + {0xA75D,0xA75D,0x003F}, + {0xA75E,0xA75E,0x003F}, + {0xA75F,0xA75F,0x003F}, + {0xA760,0xA760,0x003F}, /* A760 */ + {0xA761,0xA761,0x003F}, + {0xA762,0xA762,0x003F}, + {0xA763,0xA763,0x003F}, + {0xA764,0xA764,0x003F}, + {0xA765,0xA765,0x003F}, + {0xA766,0xA766,0x003F}, + {0xA767,0xA767,0x003F}, + {0xA768,0xA768,0x003F}, + {0xA769,0xA769,0x003F}, + {0xA76A,0xA76A,0x003F}, + {0xA76B,0xA76B,0x003F}, + {0xA76C,0xA76C,0x003F}, + {0xA76D,0xA76D,0x003F}, + {0xA76E,0xA76E,0x003F}, + {0xA76F,0xA76F,0x003F}, + {0xA770,0xA770,0x003F}, /* A770 */ + {0xA771,0xA771,0x003F}, + {0xA772,0xA772,0x003F}, + {0xA773,0xA773,0x003F}, + {0xA774,0xA774,0x003F}, + {0xA775,0xA775,0x003F}, + {0xA776,0xA776,0x003F}, + {0xA777,0xA777,0x003F}, + {0xA778,0xA778,0x003F}, + {0xA779,0xA779,0x003F}, + {0xA77A,0xA77A,0x003F}, + {0xA77B,0xA77B,0x003F}, + {0xA77C,0xA77C,0x003F}, + {0xA77D,0xA77D,0x003F}, + {0xA77E,0xA77E,0x003F}, + {0xA77F,0xA77F,0xA77F}, + {0xA780,0xA780,0x003F}, /* A780 */ + {0xA781,0xA781,0x003F}, + {0xA782,0xA782,0x003F}, + {0xA783,0xA783,0x003F}, + {0xA784,0xA784,0x003F}, + {0xA785,0xA785,0x003F}, + {0xA786,0xA786,0x003F}, + {0xA787,0xA787,0x003F}, + {0xA788,0xA788,0x003F}, + {0xA789,0xA789,0x003F}, + {0xA78A,0xA78A,0x003F}, + {0xA78B,0xA78B,0x003F}, + {0xA78C,0xA78C,0x003F}, + {0xA78D,0xA78D,0x003F}, + {0xA78E,0xA78E,0x003F}, + {0xA78F,0xA78F,0x003F}, + {0xA790,0xA790,0x003F}, /* A790 */ + {0xA791,0xA791,0x003F}, + {0xA792,0xA792,0x003F}, + {0xA793,0xA793,0x003F}, + {0xA794,0xA794,0x003F}, + {0xA795,0xA795,0x003F}, + {0xA796,0xA796,0x003F}, + {0xA797,0xA797,0x003F}, + {0xA798,0xA798,0x003F}, + {0xA799,0xA799,0x003F}, + {0xA79A,0xA79A,0x003F}, + {0xA79B,0xA79B,0x003F}, + {0xA79C,0xA79C,0x003F}, + {0xA79D,0xA79D,0x003F}, + {0xA79E,0xA79E,0x003F}, + {0xA79F,0xA79F,0x003F}, + {0xA7A0,0xA7A0,0x003F}, /* A7A0 */ + {0xA7A1,0xA7D1,0x0410}, + {0xA7A2,0xA7D2,0x0411}, + {0xA7A3,0xA7D3,0x0412}, + {0xA7A4,0xA7D4,0x0413}, + {0xA7A5,0xA7D5,0x0414}, + {0xA7A6,0xA7D6,0x0415}, + {0xA7A7,0xA7D7,0x0401}, + {0xA7A8,0xA7D8,0x0416}, + {0xA7A9,0xA7D9,0x0417}, + {0xA7AA,0xA7DA,0x0418}, + {0xA7AB,0xA7DB,0x0419}, + {0xA7AC,0xA7DC,0x041A}, + {0xA7AD,0xA7DD,0x041B}, + {0xA7AE,0xA7DE,0x041C}, + {0xA7AF,0xA7DF,0x041D}, + {0xA7B0,0xA7E0,0x041E}, /* A7B0 */ + {0xA7B1,0xA7E1,0x041F}, + {0xA7B2,0xA7E2,0x0420}, + {0xA7B3,0xA7E3,0x0421}, + {0xA7B4,0xA7E4,0x0422}, + {0xA7B5,0xA7E5,0x0423}, + {0xA7B6,0xA7E6,0x0424}, + {0xA7B7,0xA7E7,0x0425}, + {0xA7B8,0xA7E8,0x0426}, + {0xA7B9,0xA7E9,0x0427}, + {0xA7BA,0xA7EA,0x0428}, + {0xA7BB,0xA7EB,0x0429}, + {0xA7BC,0xA7EC,0x042A}, + {0xA7BD,0xA7ED,0x042B}, + {0xA7BE,0xA7EE,0x042C}, + {0xA7BF,0xA7EF,0x042D}, + {0xA7C0,0xA7F0,0x042E}, /* A7C0 */ + {0xA7C1,0xA7F1,0x042F}, + {0xA7C2,0xA7C2,0x003F}, + {0xA7C3,0xA7C3,0x003F}, + {0xA7C4,0xA7C4,0x003F}, + {0xA7C5,0xA7C5,0x003F}, + {0xA7C6,0xA7C6,0x003F}, + {0xA7C7,0xA7C7,0x003F}, + {0xA7C8,0xA7C8,0x003F}, + {0xA7C9,0xA7C9,0x003F}, + {0xA7CA,0xA7CA,0x003F}, + {0xA7CB,0xA7CB,0x003F}, + {0xA7CC,0xA7CC,0x003F}, + {0xA7CD,0xA7CD,0x003F}, + {0xA7CE,0xA7CE,0x003F}, + {0xA7CF,0xA7CF,0x003F}, + {0xA7D0,0xA7D0,0x003F}, /* A7D0 */ + {0xA7A1,0xA7D1,0x0430}, + {0xA7A2,0xA7D2,0x0431}, + {0xA7A3,0xA7D3,0x0432}, + {0xA7A4,0xA7D4,0x0433}, + {0xA7A5,0xA7D5,0x0434}, + {0xA7A6,0xA7D6,0x0435}, + {0xA7A7,0xA7D7,0x0451}, + {0xA7A8,0xA7D8,0x0436}, + {0xA7A9,0xA7D9,0x0437}, + {0xA7AA,0xA7DA,0x0438}, + {0xA7AB,0xA7DB,0x0439}, + {0xA7AC,0xA7DC,0x043A}, + {0xA7AD,0xA7DD,0x043B}, + {0xA7AE,0xA7DE,0x043C}, + {0xA7AF,0xA7DF,0x043D}, + {0xA7B0,0xA7E0,0x043E}, /* A7E0 */ + {0xA7B1,0xA7E1,0x043F}, + {0xA7B2,0xA7E2,0x0440}, + {0xA7B3,0xA7E3,0x0441}, + {0xA7B4,0xA7E4,0x0442}, + {0xA7B5,0xA7E5,0x0443}, + {0xA7B6,0xA7E6,0x0444}, + {0xA7B7,0xA7E7,0x0445}, + {0xA7B8,0xA7E8,0x0446}, + {0xA7B9,0xA7E9,0x0447}, + {0xA7BA,0xA7EA,0x0448}, + {0xA7BB,0xA7EB,0x0449}, + {0xA7BC,0xA7EC,0x044A}, + {0xA7BD,0xA7ED,0x044B}, + {0xA7BE,0xA7EE,0x044C}, + {0xA7BF,0xA7EF,0x044D}, + {0xA7C0,0xA7F0,0x044E}, /* A7F0 */ + {0xA7C1,0xA7F1,0x044F}, + {0xA7F2,0xA7F2,0x003F}, + {0xA7F3,0xA7F3,0x003F}, + {0xA7F4,0xA7F4,0x003F}, + {0xA7F5,0xA7F5,0x003F}, + {0xA7F6,0xA7F6,0x003F}, + {0xA7F7,0xA7F7,0x003F}, + {0xA7F8,0xA7F8,0x003F}, + {0xA7F9,0xA7F9,0x003F}, + {0xA7FA,0xA7FA,0x003F}, + {0xA7FB,0xA7FB,0x003F}, + {0xA7FC,0xA7FC,0x003F}, + {0xA7FD,0xA7FD,0x003F}, + {0xA7FE,0xA7FE,0x003F}, + {0xA7FF,0xA7FF,0xA7FF} +}; + + +static MY_UNICASE_INFO *my_caseinfo_gbk[256]= +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, cA2, cA3, NULL, NULL, cA6, cA7, /* A */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + + + static uchar NEAR sort_order_gbk[]= { '\000','\001','\002','\003','\004','\005','\006','\007', @@ -10039,7 +10897,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_gbk, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ @@ -10071,7 +10929,7 @@ CHARSET_INFO my_charset_gbk_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_gbk, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index b0f7c297260..252c5a08b8c 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -62,6 +62,17 @@ size_t my_casedn_str_mb(CHARSET_INFO * cs, char *str) } +static inline MY_UNICASE_INFO* +get_case_info_for_ch(CHARSET_INFO *cs, uint page, uint offs) +{ + MY_UNICASE_INFO *p; + return cs->caseinfo ? ((p= cs->caseinfo[page]) ? &p[offs] : NULL) : NULL; +} + + +/* + For character sets which don't change octet length in case conversion. +*/ size_t my_caseup_mb(CHARSET_INFO * cs, char *src, size_t srclen, char *dst __attribute__((unused)), size_t dstlen __attribute__((unused))) @@ -70,11 +81,23 @@ size_t my_caseup_mb(CHARSET_INFO * cs, char *src, size_t srclen, register char *srcend= src + srclen; register uchar *map= cs->to_upper; + DBUG_ASSERT(cs->caseup_multiply == 1); DBUG_ASSERT(src == dst && srclen == dstlen); + DBUG_ASSERT(cs->mbmaxlen == 2); + while (src < srcend) { if ((l=my_ismbchar(cs, src, srcend))) - src+= l; + { + MY_UNICASE_INFO *ch; + if ((ch= get_case_info_for_ch(cs, (uchar) src[0], (uchar) src[1]))) + { + *src++= ch->toupper >> 8; + *src++= ch->toupper & 0xFF; + } + else + src+= l; + } else { *src=(char) map[(uchar) *src]; @@ -93,11 +116,23 @@ size_t my_casedn_mb(CHARSET_INFO * cs, char *src, size_t srclen, register char *srcend= src + srclen; register uchar *map=cs->to_lower; + DBUG_ASSERT(cs->casedn_multiply == 1); DBUG_ASSERT(src == dst && srclen == dstlen); + DBUG_ASSERT(cs->mbmaxlen == 2); + while (src < srcend) { if ((l= my_ismbchar(cs, src, srcend))) - src+= l; + { + MY_UNICASE_INFO *ch; + if ((ch= get_case_info_for_ch(cs, (uchar) src[0], (uchar) src[1]))) + { + *src++= ch->tolower >> 8; + *src++= ch->tolower & 0xFF; + } + else + src+= l; + } else { *src= (char) map[(uchar)*src]; @@ -109,6 +144,75 @@ size_t my_casedn_mb(CHARSET_INFO * cs, char *src, size_t srclen, /* + Case folding functions for character set + where case conversion can change string octet length. + For example, in EUCKR, + _euckr 0xA9A5 == "LATIN LETTER DOTLESS I" (Turkish letter) + is upper-cased to to + _euckr 0x49 "LATIN CAPITAL LETTER I" ('usual' letter I) + Length is reduced in this example from two bytes to one byte. +*/ +static size_t +my_casefold_mb_varlen(CHARSET_INFO *cs, + char *src, size_t srclen, + char *dst, size_t dstlen __attribute__((unused)), + uchar *map, + size_t is_upper) +{ + char *srcend= src + srclen, *dst0= dst; + + DBUG_ASSERT(cs->mbmaxlen == 2); + + while (src < srcend) + { + size_t mblen= my_ismbchar(cs, src, srcend); + if (mblen) + { + MY_UNICASE_INFO *ch; + if ((ch= get_case_info_for_ch(cs, (uchar) src[0], (uchar) src[1]))) + { + int code= is_upper ? ch->toupper : ch->tolower; + src+= 2; + if (code > 0xFF) + *dst++= code >> 8; + *dst++= code & 0xFF; + } + else + { + *dst++= *src++; + *dst++= *src++; + } + } + else + { + *dst++= (char) map[(uchar) *src++]; + } + } + return (size_t) (dst - dst0); +} + + +size_t +my_casedn_mb_varlen(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + DBUG_ASSERT(dstlen >= srclen * cs->casedn_multiply); + DBUG_ASSERT(src != dst || cs->casedn_multiply == 1); + return my_casefold_mb_varlen(cs, src, srclen, dst, dstlen, cs->to_lower, 0); +} + + +size_t +my_caseup_mb_varlen(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + DBUG_ASSERT(dstlen >= srclen * cs->caseup_multiply); + DBUG_ASSERT(src != dst || cs->caseup_multiply == 1); + return my_casefold_mb_varlen(cs, src, srclen, dst, dstlen, cs->to_upper, 1); +} + + +/* my_strcasecmp_mb() returns 0 if strings are equal, non-zero otherwise. */ diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 60280efe087..cdf5e75f16f 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -197,6 +197,881 @@ static uint mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) #define sjiscode(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d)) +static MY_UNICASE_INFO c81[256]= +{ + /* 8100-810F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8110-811F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8120-812F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8130-813F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8140,0x8140,0x3000}, /* 8140-814F */ + {0x8141,0x8141,0x3001}, + {0x8142,0x8142,0x3002}, + {0x8143,0x8143,0xFF0C}, + {0x8144,0x8144,0xFF0E}, + {0x8145,0x8145,0x30FB}, + {0x8146,0x8146,0xFF1A}, + {0x8147,0x8147,0xFF1B}, + {0x8148,0x8148,0xFF1F}, + {0x8149,0x8149,0xFF01}, + {0x814A,0x814A,0x309B}, + {0x814B,0x814B,0x309C}, + {0x814C,0x814C,0x00B4}, + {0x814D,0x814D,0xFF40}, + {0x814E,0x814E,0x00A8}, + {0x814F,0x814F,0xFF3E}, + {0x8150,0x8150,0xFFE3}, /* 8150-815F */ + {0x8151,0x8151,0xFF3F}, + {0x8152,0x8152,0x30FD}, + {0x8153,0x8153,0x30FE}, + {0x8154,0x8154,0x309D}, + {0x8155,0x8155,0x309E}, + {0x8156,0x8156,0x3003}, + {0x8157,0x8157,0x4EDD}, + {0x8158,0x8158,0x3005}, + {0x8159,0x8159,0x3006}, + {0x815A,0x815A,0x3007}, + {0x815B,0x815B,0x30FC}, + {0x815C,0x815C,0x2015}, + {0x815D,0x815D,0x2010}, + {0x815E,0x815E,0xFF0F}, + {0x815F,0x815F,0xFF3C}, + {0x8160,0x8160,0xFF5E}, /* 8160-816F */ + {0x8161,0x8161,0x2225}, + {0x8162,0x8162,0xFF5C}, + {0x8163,0x8163,0x2026}, + {0x8164,0x8164,0x2025}, + {0x8165,0x8165,0x2018}, + {0x8166,0x8166,0x2019}, + {0x8167,0x8167,0x201C}, + {0x8168,0x8168,0x201D}, + {0x8169,0x8169,0xFF08}, + {0x816A,0x816A,0xFF09}, + {0x816B,0x816B,0x3014}, + {0x816C,0x816C,0x3015}, + {0x816D,0x816D,0xFF3B}, + {0x816E,0x816E,0xFF3D}, + {0x816F,0x816F,0xFF5B}, + {0x8170,0x8170,0xFF5D}, /* 8170-817F */ + {0x8171,0x8171,0x3008}, + {0x8172,0x8172,0x3009}, + {0x8173,0x8173,0x300A}, + {0x8174,0x8174,0x300B}, + {0x8175,0x8175,0x300C}, + {0x8176,0x8176,0x300D}, + {0x8177,0x8177,0x300E}, + {0x8178,0x8178,0x300F}, + {0x8179,0x8179,0x3010}, + {0x817A,0x817A,0x3011}, + {0x817B,0x817B,0xFF0B}, + {0x817C,0x817C,0xFF0D}, + {0x817D,0x817D,0x00B1}, + {0x817E,0x817E,0x00D7}, + {0,0,0}, + {0x8180,0x8180,0x00F7}, /* 8180-818F */ + {0x8181,0x8181,0xFF1D}, + {0x8182,0x8182,0x2260}, + {0x8183,0x8183,0xFF1C}, + {0x8184,0x8184,0xFF1E}, + {0x8185,0x8185,0x2266}, + {0x8186,0x8186,0x2267}, + {0x8187,0x8187,0x221E}, + {0x8188,0x8188,0x2234}, + {0x8189,0x8189,0x2642}, + {0x818A,0x818A,0x2640}, + {0x818B,0x818B,0x00B0}, + {0x818C,0x818C,0x2032}, + {0x818D,0x818D,0x2033}, + {0x818E,0x818E,0x2103}, + {0x818F,0x818F,0xFFE5}, + {0x8190,0x8190,0xFF04}, /* 8190-819F*/ + {0x8191,0x8191,0xFFE0}, + {0x8192,0x8192,0xFFE1}, + {0x8193,0x8193,0xFF05}, + {0x8194,0x8194,0xFF03}, + {0x8195,0x8195,0xFF06}, + {0x8196,0x8196,0xFF0A}, + {0x8197,0x8197,0xFF20}, + {0x8198,0x8198,0x00A7}, + {0x8199,0x8199,0x2606}, + {0x819A,0x819A,0x2605}, + {0x819B,0x819B,0x25CB}, + {0x819C,0x819C,0x25CF}, + {0x819D,0x819D,0x25CE}, + {0x819E,0x819E,0x25C7}, + {0x819F,0x819F,0x25C6}, + {0x81A0,0x81A0,0x25A1}, /* 81A0-81AF */ + {0x81A1,0x81A1,0x25A0}, + {0x81A2,0x81A2,0x25B3}, + {0x81A3,0x81A3,0x25B2}, + {0x81A4,0x81A4,0x25BD}, + {0x81A5,0x81A5,0x25BC}, + {0x81A6,0x81A6,0x203B}, + {0x81A7,0x81A7,0x3012}, + {0x81A8,0x81A8,0x2192}, + {0x81A9,0x81A9,0x2190}, + {0x81AA,0x81AA,0x2191}, + {0x81AB,0x81AB,0x2193}, + {0x81AC,0x81AC,0x3013}, + {0x81AD,0x81AD,0x003F}, + {0x81AE,0x81AE,0x003F}, + {0x81AF,0x81AF,0x003F}, + {0x81B0,0x81B0,0x003F}, /* 81B0-81BF */ + {0x81B1,0x81B1,0x003F}, + {0x81B2,0x81B2,0x003F}, + {0x81B3,0x81B3,0x003F}, + {0x81B4,0x81B4,0x003F}, + {0x81B5,0x81B5,0x003F}, + {0x81B6,0x81B6,0x003F}, + {0x81B7,0x81B7,0x003F}, + {0x81B8,0x81B8,0x2208}, + {0x81B9,0x81B9,0x220B}, + {0x81BA,0x81BA,0x2286}, + {0x81BB,0x81BB,0x2287}, + {0x81BC,0x81BC,0x2282}, + {0x81BD,0x81BD,0x2283}, + {0x81BE,0x81BE,0x222A}, + {0x81BF,0x81BF,0x2229}, + {0x81C0,0x81C0,0x003F}, /* 81C0-81CF */ + {0x81C1,0x81C1,0x003F}, + {0x81C2,0x81C2,0x003F}, + {0x81C3,0x81C3,0x003F}, + {0x81C4,0x81C4,0x003F}, + {0x81C5,0x81C5,0x003F}, + {0x81C6,0x81C6,0x003F}, + {0x81C7,0x81C7,0x003F}, + {0x81C8,0x81C8,0x2227}, + {0x81C9,0x81C9,0x2228}, + {0x81CA,0x81CA,0xFFE2}, + {0x81CB,0x81CB,0x21D2}, + {0x81CC,0x81CC,0x21D4}, + {0x81CD,0x81CD,0x2200}, + {0x81CE,0x81CE,0x2203}, + {0x81CF,0x81CF,0x003F}, + {0x81D0,0x81D0,0x003F}, /* 81D0-81DF */ + {0x81D1,0x81D1,0x003F}, + {0x81D2,0x81D2,0x003F}, + {0x81D3,0x81D3,0x003F}, + {0x81D4,0x81D4,0x003F}, + {0x81D5,0x81D5,0x003F}, + {0x81D6,0x81D6,0x003F}, + {0x81D7,0x81D7,0x003F}, + {0x81D8,0x81D8,0x003F}, + {0x81D9,0x81D9,0x003F}, + {0x81DA,0x81DA,0x2220}, + {0x81DB,0x81DB,0x22A5}, + {0x81DC,0x81DC,0x2312}, + {0x81DD,0x81DD,0x2202}, + {0x81DE,0x81DE,0x2207}, + {0x81DF,0x81DF,0x2261}, + {0x81E0,0x81E0,0x2252}, /* 81E0-81EF */ + {0x81E1,0x81E1,0x226A}, + {0x81E2,0x81E2,0x226B}, + {0x81E3,0x81E3,0x221A}, + {0x81E4,0x81E4,0x223D}, + {0x81E5,0x81E5,0x221D}, + {0x81E6,0x81E6,0x2235}, + {0x81E7,0x81E7,0x222B}, + {0x81E8,0x81E8,0x222C}, + {0x81E9,0x81E9,0x003F}, + {0x81EA,0x81EA,0x003F}, + {0x81EB,0x81EB,0x003F}, + {0x81EC,0x81EC,0x003F}, + {0x81ED,0x81ED,0x003F}, + {0x81EE,0x81EE,0x003F}, + {0x81EF,0x81EF,0x003F}, + {0x81F0,0x81F0,0x212B}, /* 81F0-81FF */ + {0x81F1,0x81F1,0x2030}, + {0x81F2,0x81F2,0x266F}, + {0x81F3,0x81F3,0x266D}, + {0x81F4,0x81F4,0x266A}, + {0x81F5,0x81F5,0x2020}, + {0x81F6,0x81F6,0x2021}, + {0x81F7,0x81F7,0x00B6}, + {0x81F8,0x81F8,0x003F}, + {0x81F9,0x81F9,0x003F}, + {0x81FA,0x81FA,0x003F}, + {0x81FB,0x81FB,0x003F}, + {0x81FC,0x81FC,0x25EF}, + {0,0,0}, + {0,0,0}, + {0,0,0}, +}; + + +static MY_UNICASE_INFO c82[256]= +{ + /* 8200-820F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8210-821F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8220-822F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8230-823F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8240,0x8240,0x003F}, /* 8240-824F */ + {0x8241,0x8241,0x003F}, + {0x8242,0x8242,0x003F}, + {0x8243,0x8243,0x003F}, + {0x8244,0x8244,0x003F}, + {0x8245,0x8245,0x003F}, + {0x8246,0x8246,0x003F}, + {0x8247,0x8247,0x003F}, + {0x8248,0x8248,0x003F}, + {0x8249,0x8249,0x003F}, + {0x824A,0x824A,0x003F}, + {0x824B,0x824B,0x003F}, + {0x824C,0x824C,0x003F}, + {0x824D,0x824D,0x003F}, + {0x824E,0x824E,0x003F}, + {0x824F,0x824F,0xFF10}, + {0x8250,0x8250,0xFF11}, /* 8250-825F */ + {0x8251,0x8251,0xFF12}, + {0x8252,0x8252,0xFF13}, + {0x8253,0x8253,0xFF14}, + {0x8254,0x8254,0xFF15}, + {0x8255,0x8255,0xFF16}, + {0x8256,0x8256,0xFF17}, + {0x8257,0x8257,0xFF18}, + {0x8258,0x8258,0xFF19}, + {0x8259,0x8259,0x003F}, + {0x825A,0x825A,0x003F}, + {0x825B,0x825B,0x003F}, + {0x825C,0x825C,0x003F}, + {0x825D,0x825D,0x003F}, + {0x825E,0x825E,0x003F}, + {0x825F,0x825F,0x003F}, + {0x8260,0x8281,0xFF21}, /* 8260-826F */ + {0x8261,0x8282,0xFF22}, + {0x8262,0x8283,0xFF23}, + {0x8263,0x8284,0xFF24}, + {0x8264,0x8285,0xFF25}, + {0x8265,0x8286,0xFF26}, + {0x8266,0x8287,0xFF27}, + {0x8267,0x8288,0xFF28}, + {0x8268,0x8289,0xFF29}, + {0x8269,0x828A,0xFF2A}, + {0x826A,0x828B,0xFF2B}, + {0x826B,0x828C,0xFF2C}, + {0x826C,0x828D,0xFF2D}, + {0x826D,0x828E,0xFF2E}, + {0x826E,0x828F,0xFF2F}, + {0x826F,0x8290,0xFF30}, + {0x8270,0x8291,0xFF31}, /* 8270-827F */ + {0x8271,0x8292,0xFF32}, + {0x8272,0x8293,0xFF33}, + {0x8273,0x8294,0xFF34}, + {0x8274,0x8295,0xFF35}, + {0x8275,0x8296,0xFF36}, + {0x8276,0x8297,0xFF37}, + {0x8277,0x8298,0xFF38}, + {0x8278,0x8299,0xFF39}, + {0x8279,0x829A,0xFF3A}, + {0x827A,0x827A,0x003F}, + {0x827B,0x827B,0x003F}, + {0x827C,0x827C,0x003F}, + {0x827D,0x827D,0x003F}, + {0x827E,0x827E,0x003F}, + {0,0,0}, + {0x8280,0x8280,0x003F}, /* 8280-828F */ + {0x8260,0x8281,0xFF41}, + {0x8261,0x8282,0xFF42}, + {0x8262,0x8283,0xFF43}, + {0x8263,0x8284,0xFF44}, + {0x8264,0x8285,0xFF45}, + {0x8265,0x8286,0xFF46}, + {0x8266,0x8287,0xFF47}, + {0x8267,0x8288,0xFF48}, + {0x8268,0x8289,0xFF49}, + {0x8269,0x828A,0xFF4A}, + {0x826A,0x828B,0xFF4B}, + {0x826B,0x828C,0xFF4C}, + {0x826C,0x828D,0xFF4D}, + {0x826D,0x828E,0xFF4E}, + {0x826E,0x828F,0xFF4F}, + {0x826F,0x8290,0xFF50}, /* 8290-829F */ + {0x8270,0x8291,0xFF51}, + {0x8271,0x8292,0xFF52}, + {0x8272,0x8293,0xFF53}, + {0x8273,0x8294,0xFF54}, + {0x8274,0x8295,0xFF55}, + {0x8275,0x8296,0xFF56}, + {0x8276,0x8297,0xFF57}, + {0x8277,0x8298,0xFF58}, + {0x8278,0x8299,0xFF59}, + {0x8279,0x829A,0xFF5A}, + {0x829B,0x829B,0x003F}, + {0x829C,0x829C,0x003F}, + {0x829D,0x829D,0x003F}, + {0x829E,0x829E,0x003F}, + {0x829F,0x829F,0x3041}, + {0x82A0,0x82A0,0x3042}, /* 82A0-82AF */ + {0x82A1,0x82A1,0x3043}, + {0x82A2,0x82A2,0x3044}, + {0x82A3,0x82A3,0x3045}, + {0x82A4,0x82A4,0x3046}, + {0x82A5,0x82A5,0x3047}, + {0x82A6,0x82A6,0x3048}, + {0x82A7,0x82A7,0x3049}, + {0x82A8,0x82A8,0x304A}, + {0x82A9,0x82A9,0x304B}, + {0x82AA,0x82AA,0x304C}, + {0x82AB,0x82AB,0x304D}, + {0x82AC,0x82AC,0x304E}, + {0x82AD,0x82AD,0x304F}, + {0x82AE,0x82AE,0x3050}, + {0x82AF,0x82AF,0x3051}, + {0x82B0,0x82B0,0x3052}, /* 82B0-82BF */ + {0x82B1,0x82B1,0x3053}, + {0x82B2,0x82B2,0x3054}, + {0x82B3,0x82B3,0x3055}, + {0x82B4,0x82B4,0x3056}, + {0x82B5,0x82B5,0x3057}, + {0x82B6,0x82B6,0x3058}, + {0x82B7,0x82B7,0x3059}, + {0x82B8,0x82B8,0x305A}, + {0x82B9,0x82B9,0x305B}, + {0x82BA,0x82BA,0x305C}, + {0x82BB,0x82BB,0x305D}, + {0x82BC,0x82BC,0x305E}, + {0x82BD,0x82BD,0x305F}, + {0x82BE,0x82BE,0x3060}, + {0x82BF,0x82BF,0x3061}, + {0x82C0,0x82C0,0x3062}, /* 82C0-82CF */ + {0x82C1,0x82C1,0x3063}, + {0x82C2,0x82C2,0x3064}, + {0x82C3,0x82C3,0x3065}, + {0x82C4,0x82C4,0x3066}, + {0x82C5,0x82C5,0x3067}, + {0x82C6,0x82C6,0x3068}, + {0x82C7,0x82C7,0x3069}, + {0x82C8,0x82C8,0x306A}, + {0x82C9,0x82C9,0x306B}, + {0x82CA,0x82CA,0x306C}, + {0x82CB,0x82CB,0x306D}, + {0x82CC,0x82CC,0x306E}, + {0x82CD,0x82CD,0x306F}, + {0x82CE,0x82CE,0x3070}, + {0x82CF,0x82CF,0x3071}, + {0x82D0,0x82D0,0x3072}, /* 82D0-82DF */ + {0x82D1,0x82D1,0x3073}, + {0x82D2,0x82D2,0x3074}, + {0x82D3,0x82D3,0x3075}, + {0x82D4,0x82D4,0x3076}, + {0x82D5,0x82D5,0x3077}, + {0x82D6,0x82D6,0x3078}, + {0x82D7,0x82D7,0x3079}, + {0x82D8,0x82D8,0x307A}, + {0x82D9,0x82D9,0x307B}, + {0x82DA,0x82DA,0x307C}, + {0x82DB,0x82DB,0x307D}, + {0x82DC,0x82DC,0x307E}, + {0x82DD,0x82DD,0x307F}, + {0x82DE,0x82DE,0x3080}, + {0x82DF,0x82DF,0x3081}, + {0x82E0,0x82E0,0x3082}, /* 82E0-82EF */ + {0x82E1,0x82E1,0x3083}, + {0x82E2,0x82E2,0x3084}, + {0x82E3,0x82E3,0x3085}, + {0x82E4,0x82E4,0x3086}, + {0x82E5,0x82E5,0x3087}, + {0x82E6,0x82E6,0x3088}, + {0x82E7,0x82E7,0x3089}, + {0x82E8,0x82E8,0x308A}, + {0x82E9,0x82E9,0x308B}, + {0x82EA,0x82EA,0x308C}, + {0x82EB,0x82EB,0x308D}, + {0x82EC,0x82EC,0x308E}, + {0x82ED,0x82ED,0x308F}, + {0x82EE,0x82EE,0x3090}, + {0x82EF,0x82EF,0x3091}, + {0x82F0,0x82F0,0x3092}, /* 82F0-82FF */ + {0x82F1,0x82F1,0x3093}, + {0x82F2,0x82F2,0x003F}, + {0x82F3,0x82F3,0x003F}, + {0x82F4,0x82F4,0x003F}, + {0x82F5,0x82F5,0x003F}, + {0x82F6,0x82F6,0x003F}, + {0x82F7,0x82F7,0x003F}, + {0x82F8,0x82F8,0x003F}, + {0x82F9,0x82F9,0x003F}, + {0x82FA,0x82FA,0x003F}, + {0x82FB,0x82FB,0x003F}, + {0x82FC,0x82FC,0x003F}, + {0,0,0} +}; + + +static MY_UNICASE_INFO c83[256]= +{ + /* 8300-830F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8310-831F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8320-832F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8330-833F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8340,0x8340,0x30A1}, /* 8340 */ + {0x8341,0x8341,0x30A2}, + {0x8342,0x8342,0x30A3}, + {0x8343,0x8343,0x30A4}, + {0x8344,0x8344,0x30A5}, + {0x8345,0x8345,0x30A6}, + {0x8346,0x8346,0x30A7}, + {0x8347,0x8347,0x30A8}, + {0x8348,0x8348,0x30A9}, + {0x8349,0x8349,0x30AA}, + {0x834A,0x834A,0x30AB}, + {0x834B,0x834B,0x30AC}, + {0x834C,0x834C,0x30AD}, + {0x834D,0x834D,0x30AE}, + {0x834E,0x834E,0x30AF}, + {0x834F,0x834F,0x30B0}, + {0x8350,0x8350,0x30B1}, /* 8350 */ + {0x8351,0x8351,0x30B2}, + {0x8352,0x8352,0x30B3}, + {0x8353,0x8353,0x30B4}, + {0x8354,0x8354,0x30B5}, + {0x8355,0x8355,0x30B6}, + {0x8356,0x8356,0x30B7}, + {0x8357,0x8357,0x30B8}, + {0x8358,0x8358,0x30B9}, + {0x8359,0x8359,0x30BA}, + {0x835A,0x835A,0x30BB}, + {0x835B,0x835B,0x30BC}, + {0x835C,0x835C,0x30BD}, + {0x835D,0x835D,0x30BE}, + {0x835E,0x835E,0x30BF}, + {0x835F,0x835F,0x30C0}, + {0x8360,0x8360,0x30C1}, /* 8360 */ + {0x8361,0x8361,0x30C2}, + {0x8362,0x8362,0x30C3}, + {0x8363,0x8363,0x30C4}, + {0x8364,0x8364,0x30C5}, + {0x8365,0x8365,0x30C6}, + {0x8366,0x8366,0x30C7}, + {0x8367,0x8367,0x30C8}, + {0x8368,0x8368,0x30C9}, + {0x8369,0x8369,0x30CA}, + {0x836A,0x836A,0x30CB}, + {0x836B,0x836B,0x30CC}, + {0x836C,0x836C,0x30CD}, + {0x836D,0x836D,0x30CE}, + {0x836E,0x836E,0x30CF}, + {0x836F,0x836F,0x30D0}, + {0x8370,0x8370,0x30D1}, /* 8370 */ + {0x8371,0x8371,0x30D2}, + {0x8372,0x8372,0x30D3}, + {0x8373,0x8373,0x30D4}, + {0x8374,0x8374,0x30D5}, + {0x8375,0x8375,0x30D6}, + {0x8376,0x8376,0x30D7}, + {0x8377,0x8377,0x30D8}, + {0x8378,0x8378,0x30D9}, + {0x8379,0x8379,0x30DA}, + {0x837A,0x837A,0x30DB}, + {0x837B,0x837B,0x30DC}, + {0x837C,0x837C,0x30DD}, + {0x837D,0x837D,0x30DE}, + {0x837E,0x837E,0x30DF}, + {0,0,0}, + {0x8380,0x8380,0x30E0}, /* 8380 */ + {0x8381,0x8381,0x30E1}, + {0x8382,0x8382,0x30E2}, + {0x8383,0x8383,0x30E3}, + {0x8384,0x8384,0x30E4}, + {0x8385,0x8385,0x30E5}, + {0x8386,0x8386,0x30E6}, + {0x8387,0x8387,0x30E7}, + {0x8388,0x8388,0x30E8}, + {0x8389,0x8389,0x30E9}, + {0x838A,0x838A,0x30EA}, + {0x838B,0x838B,0x30EB}, + {0x838C,0x838C,0x30EC}, + {0x838D,0x838D,0x30ED}, + {0x838E,0x838E,0x30EE}, + {0x838F,0x838F,0x30EF}, + {0x8390,0x8390,0x30F0}, /* 8390 */ + {0x8391,0x8391,0x30F1}, + {0x8392,0x8392,0x30F2}, + {0x8393,0x8393,0x30F3}, + {0x8394,0x8394,0x30F4}, + {0x8395,0x8395,0x30F5}, + {0x8396,0x8396,0x30F6}, + {0x8397,0x8397,0x003F}, + {0x8398,0x8398,0x003F}, + {0x8399,0x8399,0x003F}, + {0x839A,0x839A,0x003F}, + {0x839B,0x839B,0x003F}, + {0x839C,0x839C,0x003F}, + {0x839D,0x839D,0x003F}, + {0x839E,0x839E,0x003F}, + {0x839F,0x83BF,0x0391}, + {0x83A0,0x83C0,0x0392}, /* 83A0 */ + {0x83A1,0x83C1,0x0393}, + {0x83A2,0x83C2,0x0394}, + {0x83A3,0x83C3,0x0395}, + {0x83A4,0x83C4,0x0396}, + {0x83A5,0x83C5,0x0397}, + {0x83A6,0x83C6,0x0398}, + {0x83A7,0x83C7,0x0399}, + {0x83A8,0x83C8,0x039A}, + {0x83A9,0x83C9,0x039B}, + {0x83AA,0x83CA,0x039C}, + {0x83AB,0x83CB,0x039D}, + {0x83AC,0x83CC,0x039E}, + {0x83AD,0x83CD,0x039F}, + {0x83AE,0x83CE,0x03A0}, + {0x83AF,0x83CF,0x03A1}, + {0x83B0,0x83D0,0x03A3}, /* 83B0 */ + {0x83B1,0x83D1,0x03A4}, + {0x83B2,0x83D2,0x03A5}, + {0x83B3,0x83D3,0x03A6}, + {0x83B4,0x83D4,0x03A7}, + {0x83B5,0x83D5,0x03A8}, + {0x83B6,0x83D6,0x03A9}, + {0x83B7,0x83B7,0x003F}, + {0x83B8,0x83B8,0x003F}, + {0x83B9,0x83B9,0x003F}, + {0x83BA,0x83BA,0x003F}, + {0x83BB,0x83BB,0x003F}, + {0x83BC,0x83BC,0x003F}, + {0x83BD,0x83BD,0x003F}, + {0x83BE,0x83BE,0x003F}, + {0x839F,0x83BF,0x03B1}, + {0x83A0,0x83C0,0x03B2}, /* 83C0 */ + {0x83A1,0x83C1,0x03B3}, + {0x83A2,0x83C2,0x03B4}, + {0x83A3,0x83C3,0x03B5}, + {0x83A4,0x83C4,0x03B6}, + {0x83A5,0x83C5,0x03B7}, + {0x83A6,0x83C6,0x03B8}, + {0x83A7,0x83C7,0x03B9}, + {0x83A8,0x83C8,0x03BA}, + {0x83A9,0x83C9,0x03BB}, + {0x83AA,0x83CA,0x03BC}, + {0x83AB,0x83CB,0x03BD}, + {0x83AC,0x83CC,0x03BE}, + {0x83AD,0x83CD,0x03BF}, + {0x83AE,0x83CE,0x03C0}, + {0x83AF,0x83CF,0x03C1}, + {0x83B0,0x83D0,0x03C3}, /* 83D0 */ + {0x83B1,0x83D1,0x03C4}, + {0x83B2,0x83D2,0x03C5}, + {0x83B3,0x83D3,0x03C6}, + {0x83B4,0x83D4,0x03C7}, + {0x83B5,0x83D5,0x03C8}, + {0x83B6,0x83D6,0x03C9}, + {0x83D7,0x83D7,0x003F}, + {0x83D8,0x83D8,0x003F}, + {0x83D9,0x83D9,0x003F}, + {0x83DA,0x83DA,0x003F}, + {0x83DB,0x83DB,0x003F}, + {0x83DC,0x83DC,0x003F}, + {0x83DD,0x83DD,0x003F}, + {0x83DE,0x83DE,0x003F}, + {0x83DF,0x83DF,0x003F}, + {0x83E0,0x83E0,0x003F}, /* 83E0 */ + {0x83E1,0x83E1,0x003F}, + {0x83E2,0x83E2,0x003F}, + {0x83E3,0x83E3,0x003F}, + {0x83E4,0x83E4,0x003F}, + {0x83E5,0x83E5,0x003F}, + {0x83E6,0x83E6,0x003F}, + {0x83E7,0x83E7,0x003F}, + {0x83E8,0x83E8,0x003F}, + {0x83E9,0x83E9,0x003F}, + {0x83EA,0x83EA,0x003F}, + {0x83EB,0x83EB,0x003F}, + {0x83EC,0x83EC,0x003F}, + {0x83ED,0x83ED,0x003F}, + {0x83EE,0x83EE,0x003F}, + {0x83EF,0x83EF,0x003F}, + {0x83F0,0x83F0,0x003F}, /* 83F0 */ + {0x83F1,0x83F1,0x003F}, + {0x83F2,0x83F2,0x003F}, + {0x83F3,0x83F3,0x003F}, + {0x83F4,0x83F4,0x003F}, + {0x83F5,0x83F5,0x003F}, + {0x83F6,0x83F6,0x003F}, + {0x83F7,0x83F7,0x003F}, + {0x83F8,0x83F8,0x003F}, + {0x83F9,0x83F9,0x003F}, + {0x83FA,0x83FA,0x003F}, + {0x83FB,0x83FB,0x003F}, + {0x83FC,0x83FC,0x003F}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO c84[256]= +{ + /* 8400-840F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8410-841F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8420-842F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + /* 8430-843F */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + + {0x8440,0x8470,0x0410}, /* 8440 */ + {0x8441,0x8471,0x0411}, + {0x8442,0x8472,0x0412}, + {0x8443,0x8473,0x0413}, + {0x8444,0x8474,0x0414}, + {0x8445,0x8475,0x0415}, + {0x8446,0x8476,0x0401}, + {0x8447,0x8477,0x0416}, + {0x8448,0x8478,0x0417}, + {0x8449,0x8479,0x0418}, + {0x844A,0x847A,0x0419}, + {0x844B,0x847B,0x041A}, + {0x844C,0x847C,0x041B}, + {0x844D,0x847D,0x041C}, + {0x844E,0x847E,0x041D}, + {0x844F,0x8480,0x041E}, + {0x8450,0x8481,0x041F}, /* 8450 */ + {0x8451,0x8482,0x0420}, + {0x8452,0x8483,0x0421}, + {0x8453,0x8484,0x0422}, + {0x8454,0x8485,0x0423}, + {0x8455,0x8486,0x0424}, + {0x8456,0x8487,0x0425}, + {0x8457,0x8488,0x0426}, + {0x8458,0x8489,0x0427}, + {0x8459,0x848A,0x0428}, + {0x845A,0x848B,0x0429}, + {0x845B,0x848C,0x042A}, + {0x845C,0x848D,0x042B}, + {0x845D,0x848E,0x042C}, + {0x845E,0x848F,0x042D}, + {0x845F,0x8490,0x042E}, + {0x8460,0x8491,0x042F}, /* 8460 */ + {0x8461,0x8461,0x003F}, + {0x8462,0x8462,0x003F}, + {0x8463,0x8463,0x003F}, + {0x8464,0x8464,0x003F}, + {0x8465,0x8465,0x003F}, + {0x8466,0x8466,0x003F}, + {0x8467,0x8467,0x003F}, + {0x8468,0x8468,0x003F}, + {0x8469,0x8469,0x003F}, + {0x846A,0x846A,0x003F}, + {0x846B,0x846B,0x003F}, + {0x846C,0x846C,0x003F}, + {0x846D,0x846D,0x003F}, + {0x846E,0x846E,0x003F}, + {0x846F,0x846F,0x003F}, + {0x8440,0x8470,0x0430}, /* 8470 */ + {0x8441,0x8471,0x0431}, + {0x8442,0x8472,0x0432}, + {0x8443,0x8473,0x0433}, + {0x8444,0x8474,0x0434}, + {0x8445,0x8475,0x0435}, + {0x8446,0x8476,0x0451}, + {0x8447,0x8477,0x0436}, + {0x8448,0x8478,0x0437}, + {0x8449,0x8479,0x0438}, + {0x844A,0x847A,0x0439}, + {0x844B,0x847B,0x043A}, + {0x844C,0x847C,0x043B}, + {0x844D,0x847D,0x043C}, + {0x844E,0x847E,0x043D}, + {0,0,0}, + {0x844F,0x8480,0x043E}, /* 8480 */ + {0x8450,0x8481,0x043F}, + {0x8451,0x8482,0x0440}, + {0x8452,0x8483,0x0441}, + {0x8453,0x8484,0x0442}, + {0x8454,0x8485,0x0443}, + {0x8455,0x8486,0x0444}, + {0x8456,0x8487,0x0445}, + {0x8457,0x8488,0x0446}, + {0x8458,0x8489,0x0447}, + {0x8459,0x848A,0x0448}, + {0x845A,0x848B,0x0449}, + {0x845B,0x848C,0x044A}, + {0x845C,0x848D,0x044B}, + {0x845D,0x848E,0x044C}, + {0x845E,0x848F,0x044D}, + {0x845F,0x8490,0x044E}, /* 8490 */ + {0x8460,0x8491,0x044F}, + {0x8492,0x8492,0x003F}, + {0x8493,0x8493,0x003F}, + {0x8494,0x8494,0x003F}, + {0x8495,0x8495,0x003F}, + {0x8496,0x8496,0x003F}, + {0x8497,0x8497,0x003F}, + {0x8498,0x8498,0x003F}, + {0x8499,0x8499,0x003F}, + {0x849A,0x849A,0x003F}, + {0x849B,0x849B,0x003F}, + {0x849C,0x849C,0x003F}, + {0x849D,0x849D,0x003F}, + {0x849E,0x849E,0x003F}, + {0x849F,0x849F,0x2500}, + {0x84A0,0x84A0,0x2502}, /* 84A0 */ + {0x84A1,0x84A1,0x250C}, + {0x84A2,0x84A2,0x2510}, + {0x84A3,0x84A3,0x2518}, + {0x84A4,0x84A4,0x2514}, + {0x84A5,0x84A5,0x251C}, + {0x84A6,0x84A6,0x252C}, + {0x84A7,0x84A7,0x2524}, + {0x84A8,0x84A8,0x2534}, + {0x84A9,0x84A9,0x253C}, + {0x84AA,0x84AA,0x2501}, + {0x84AB,0x84AB,0x2503}, + {0x84AC,0x84AC,0x250F}, + {0x84AD,0x84AD,0x2513}, + {0x84AE,0x84AE,0x251B}, + {0x84AF,0x84AF,0x2517}, + {0x84B0,0x84B0,0x2523}, /* 84B0 */ + {0x84B1,0x84B1,0x2533}, + {0x84B2,0x84B2,0x252B}, + {0x84B3,0x84B3,0x253B}, + {0x84B4,0x84B4,0x254B}, + {0x84B5,0x84B5,0x2520}, + {0x84B6,0x84B6,0x252F}, + {0x84B7,0x84B7,0x2528}, + {0x84B8,0x84B8,0x2537}, + {0x84B9,0x84B9,0x253F}, + {0x84BA,0x84BA,0x251D}, + {0x84BB,0x84BB,0x2530}, + {0x84BC,0x84BC,0x2525}, + {0x84BD,0x84BD,0x2538}, + {0x84BE,0x84BE,0x2542}, + {0x84BF,0x84BF,0x003F}, + {0x84C0,0x84C0,0x003F}, /* 84C0 */ + {0x84C1,0x84C1,0x003F}, + {0x84C2,0x84C2,0x003F}, + {0x84C3,0x84C3,0x003F}, + {0x84C4,0x84C4,0x003F}, + {0x84C5,0x84C5,0x003F}, + {0x84C6,0x84C6,0x003F}, + {0x84C7,0x84C7,0x003F}, + {0x84C8,0x84C8,0x003F}, + {0x84C9,0x84C9,0x003F}, + {0x84CA,0x84CA,0x003F}, + {0x84CB,0x84CB,0x003F}, + {0x84CC,0x84CC,0x003F}, + {0x84CD,0x84CD,0x003F}, + {0x84CE,0x84CE,0x003F}, + {0x84CF,0x84CF,0x003F}, + {0x84D0,0x84D0,0x003F}, /* 84D0 */ + {0x84D1,0x84D1,0x003F}, + {0x84D2,0x84D2,0x003F}, + {0x84D3,0x84D3,0x003F}, + {0x84D4,0x84D4,0x003F}, + {0x84D5,0x84D5,0x003F}, + {0x84D6,0x84D6,0x003F}, + {0x84D7,0x84D7,0x003F}, + {0x84D8,0x84D8,0x003F}, + {0x84D9,0x84D9,0x003F}, + {0x84DA,0x84DA,0x003F}, + {0x84DB,0x84DB,0x003F}, + {0x84DC,0x84DC,0x003F}, + {0x84DD,0x84DD,0x003F}, + {0x84DE,0x84DE,0x003F}, + {0x84DF,0x84DF,0x003F}, + {0x84E0,0x84E0,0x003F}, /* 84E0 */ + {0x84E1,0x84E1,0x003F}, + {0x84E2,0x84E2,0x003F}, + {0x84E3,0x84E3,0x003F}, + {0x84E4,0x84E4,0x003F}, + {0x84E5,0x84E5,0x003F}, + {0x84E6,0x84E6,0x003F}, + {0x84E7,0x84E7,0x003F}, + {0x84E8,0x84E8,0x003F}, + {0x84E9,0x84E9,0x003F}, + {0x84EA,0x84EA,0x003F}, + {0x84EB,0x84EB,0x003F}, + {0x84EC,0x84EC,0x003F}, + {0x84ED,0x84ED,0x003F}, + {0x84EE,0x84EE,0x003F}, + {0x84EF,0x84EF,0x003F}, + {0x84F0,0x84F0,0x003F}, /* 84F0 */ + {0x84F1,0x84F1,0x003F}, + {0x84F2,0x84F2,0x003F}, + {0x84F3,0x84F3,0x003F}, + {0x84F4,0x84F4,0x003F}, + {0x84F5,0x84F5,0x003F}, + {0x84F6,0x84F6,0x003F}, + {0x84F7,0x84F7,0x003F}, + {0x84F8,0x84F8,0x003F}, + {0x84F9,0x84F9,0x003F}, + {0x84FA,0x84FA,0x003F}, + {0x84FB,0x84FB,0x003F}, + {0x84FC,0x84FC,0x003F}, + {0,0,0}, + {0,0,0}, + {0,0,0} +}; + + +static MY_UNICASE_INFO *my_caseinfo_sjis[256]= +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, c81, c82, c83, c84, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* A */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + + static int my_strnncoll_sjis_internal(CHARSET_INFO *cs, const uchar **a_res, size_t a_length, const uchar **b_res, size_t b_length) @@ -4685,7 +5560,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_sjis, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ @@ -4717,7 +5592,7 @@ CHARSET_INFO my_charset_sjis_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_sjis, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 1a872a92595..bec566c7782 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8494,6 +8494,1263 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) } +/* Case info pages for JIS-X-0208 range */ +static MY_UNICASE_INFO cA2[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA2A0,0xA2A0,0x003F}, /* A2A0 */ + {0xA2A1,0xA2A1,0x25C6}, + {0xA2A2,0xA2A2,0x25A1}, + {0xA2A3,0xA2A3,0x25A0}, + {0xA2A4,0xA2A4,0x25B3}, + {0xA2A5,0xA2A5,0x25B2}, + {0xA2A6,0xA2A6,0x25BD}, + {0xA2A7,0xA2A7,0x25BC}, + {0xA2A8,0xA2A8,0x203B}, + {0xA2A9,0xA2A9,0x3012}, + {0xA2AA,0xA2AA,0x2192}, + {0xA2AB,0xA2AB,0x2190}, + {0xA2AC,0xA2AC,0x2191}, + {0xA2AD,0xA2AD,0x2193}, + {0xA2AE,0xA2AE,0x3013}, + {0xA2AF,0xA2AF,0x003F}, + {0xA2B0,0xA2B0,0x003F}, /* A2B0 */ + {0xA2B1,0xA2B1,0x003F}, + {0xA2B2,0xA2B2,0x003F}, + {0xA2B3,0xA2B3,0x003F}, + {0xA2B4,0xA2B4,0x003F}, + {0xA2B5,0xA2B5,0x003F}, + {0xA2B6,0xA2B6,0x003F}, + {0xA2B7,0xA2B7,0x003F}, + {0xA2B8,0xA2B8,0x003F}, + {0xA2B9,0xA2B9,0x003F}, + {0xA2BA,0xA2BA,0x2208}, + {0xA2BB,0xA2BB,0x220B}, + {0xA2BC,0xA2BC,0x2286}, + {0xA2BD,0xA2BD,0x2287}, + {0xA2BE,0xA2BE,0x2282}, + {0xA2BF,0xA2BF,0x2283}, + {0xA2C0,0xA2C0,0x222A}, /* A2C0 */ + {0xA2C1,0xA2C1,0x2229}, + {0xA2C2,0xA2C2,0x003F}, + {0xA2C3,0xA2C3,0x003F}, + {0xA2C4,0xA2C4,0x003F}, + {0xA2C5,0xA2C5,0x003F}, + {0xA2C6,0xA2C6,0x003F}, + {0xA2C7,0xA2C7,0x003F}, + {0xA2C8,0xA2C8,0x003F}, + {0xA2C9,0xA2C9,0x003F}, + {0xA2CA,0xA2CA,0x2227}, + {0xA2CB,0xA2CB,0x2228}, + {0xA2CC,0xA2CC,0x00AC}, + {0xA2CD,0xA2CD,0x21D2}, + {0xA2CE,0xA2CE,0x21D4}, + {0xA2CF,0xA2CF,0x2200}, + {0xA2D0,0xA2D0,0x2203}, /* A2D0 */ + {0xA2D1,0xA2D1,0x003F}, + {0xA2D2,0xA2D2,0x003F}, + {0xA2D3,0xA2D3,0x003F}, + {0xA2D4,0xA2D4,0x003F}, + {0xA2D5,0xA2D5,0x003F}, + {0xA2D6,0xA2D6,0x003F}, + {0xA2D7,0xA2D7,0x003F}, + {0xA2D8,0xA2D8,0x003F}, + {0xA2D9,0xA2D9,0x003F}, + {0xA2DA,0xA2DA,0x003F}, + {0xA2DB,0xA2DB,0x003F}, + {0xA2DC,0xA2DC,0x2220}, + {0xA2DD,0xA2DD,0x22A5}, + {0xA2DE,0xA2DE,0x2312}, + {0xA2DF,0xA2DF,0x2202}, + {0xA2E0,0xA2E0,0x2207}, /* A2E0 */ + {0xA2E1,0xA2E1,0x2261}, + {0xA2E2,0xA2E2,0x2252}, + {0xA2E3,0xA2E3,0x226A}, + {0xA2E4,0xA2E4,0x226B}, + {0xA2E5,0xA2E5,0x221A}, + {0xA2E6,0xA2E6,0x223D}, + {0xA2E7,0xA2E7,0x221D}, + {0xA2E8,0xA2E8,0x2235}, + {0xA2E9,0xA2E9,0x222B}, + {0xA2EA,0xA2EA,0x222C}, + {0xA2EB,0xA2EB,0x003F}, + {0xA2EC,0xA2EC,0x003F}, + {0xA2ED,0xA2ED,0x003F}, + {0xA2EE,0xA2EE,0x003F}, + {0xA2EF,0xA2EF,0x003F}, + {0xA2F0,0xA2F0,0x003F}, /* A2F0 */ + {0xA2F1,0xA2F1,0x003F}, + {0xA2F2,0x8FABA9,0x212B}, + {0xA2F3,0xA2F3,0x2030}, + {0xA2F4,0xA2F4,0x266F}, + {0xA2F5,0xA2F5,0x266D}, + {0xA2F6,0xA2F6,0x266A}, + {0xA2F7,0xA2F7,0x2020}, + {0xA2F8,0xA2F8,0x2021}, + {0xA2F9,0xA2F9,0x00B6}, + {0xA2FA,0xA2FA,0x003F}, + {0xA2FB,0xA2FB,0x003F}, + {0xA2FC,0xA2FC,0x003F}, + {0xA2FD,0xA2FD,0x003F}, + {0xA2FE,0xA2FE,0x25EF}, + {0xA2FF,0xA2FF,0x003F} +}; + + +static MY_UNICASE_INFO cA3[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA3A0,0xA3A0,0x003F}, /* A3A0 */ + {0xA3A1,0xA3A1,0x003F}, + {0xA3A2,0xA3A2,0x003F}, + {0xA3A3,0xA3A3,0x003F}, + {0xA3A4,0xA3A4,0x003F}, + {0xA3A5,0xA3A5,0x003F}, + {0xA3A6,0xA3A6,0x003F}, + {0xA3A7,0xA3A7,0x003F}, + {0xA3A8,0xA3A8,0x003F}, + {0xA3A9,0xA3A9,0x003F}, + {0xA3AA,0xA3AA,0x003F}, + {0xA3AB,0xA3AB,0x003F}, + {0xA3AC,0xA3AC,0x003F}, + {0xA3AD,0xA3AD,0x003F}, + {0xA3AE,0xA3AE,0x003F}, + {0xA3AF,0xA3AF,0x003F}, + {0xA3B0,0xA3B0,0xFF10}, /* A3B0 */ + {0xA3B1,0xA3B1,0xFF11}, + {0xA3B2,0xA3B2,0xFF12}, + {0xA3B3,0xA3B3,0xFF13}, + {0xA3B4,0xA3B4,0xFF14}, + {0xA3B5,0xA3B5,0xFF15}, + {0xA3B6,0xA3B6,0xFF16}, + {0xA3B7,0xA3B7,0xFF17}, + {0xA3B8,0xA3B8,0xFF18}, + {0xA3B9,0xA3B9,0xFF19}, + {0xA3BA,0xA3BA,0x003F}, + {0xA3BB,0xA3BB,0x003F}, + {0xA3BC,0xA3BC,0x003F}, + {0xA3BD,0xA3BD,0x003F}, + {0xA3BE,0xA3BE,0x003F}, + {0xA3BF,0xA3BF,0x003F}, + {0xA3C0,0xA3C0,0x003F}, /* A3C0 */ + {0xA3C1,0xA3E1,0xFF21}, + {0xA3C2,0xA3E2,0xFF22}, + {0xA3C3,0xA3E3,0xFF23}, + {0xA3C4,0xA3E4,0xFF24}, + {0xA3C5,0xA3E5,0xFF25}, + {0xA3C6,0xA3E6,0xFF26}, + {0xA3C7,0xA3E7,0xFF27}, + {0xA3C8,0xA3E8,0xFF28}, + {0xA3C9,0xA3E9,0xFF29}, + {0xA3CA,0xA3EA,0xFF2A}, + {0xA3CB,0xA3EB,0xFF2B}, + {0xA3CC,0xA3EC,0xFF2C}, + {0xA3CD,0xA3ED,0xFF2D}, + {0xA3CE,0xA3EE,0xFF2E}, + {0xA3CF,0xA3EF,0xFF2F}, + {0xA3D0,0xA3F0,0xFF30}, /* A3D0 */ + {0xA3D1,0xA3F1,0xFF31}, + {0xA3D2,0xA3F2,0xFF32}, + {0xA3D3,0xA3F3,0xFF33}, + {0xA3D4,0xA3F4,0xFF34}, + {0xA3D5,0xA3F5,0xFF35}, + {0xA3D6,0xA3F6,0xFF36}, + {0xA3D7,0xA3F7,0xFF37}, + {0xA3D8,0xA3F8,0xFF38}, + {0xA3D9,0xA3F9,0xFF39}, + {0xA3DA,0xA3FA,0xFF3A}, + {0xA3DB,0xA3DB,0x003F}, + {0xA3DC,0xA3DC,0x003F}, + {0xA3DD,0xA3DD,0x003F}, + {0xA3DE,0xA3DE,0x003F}, + {0xA3DF,0xA3DF,0x003F}, + {0xA3E0,0xA3E0,0x003F}, /* A3E0 */ + {0xA3C1,0xA3E1,0xFF41}, + {0xA3C2,0xA3E2,0xFF42}, + {0xA3C3,0xA3E3,0xFF43}, + {0xA3C4,0xA3E4,0xFF44}, + {0xA3C5,0xA3E5,0xFF45}, + {0xA3C6,0xA3E6,0xFF46}, + {0xA3C7,0xA3E7,0xFF47}, + {0xA3C8,0xA3E8,0xFF48}, + {0xA3C9,0xA3E9,0xFF49}, + {0xA3CA,0xA3EA,0xFF4A}, + {0xA3CB,0xA3EB,0xFF4B}, + {0xA3CC,0xA3EC,0xFF4C}, + {0xA3CD,0xA3ED,0xFF4D}, + {0xA3CE,0xA3EE,0xFF4E}, + {0xA3CF,0xA3EF,0xFF4F}, + {0xA3D0,0xA3F0,0xFF50}, /* A3F0 */ + {0xA3D1,0xA3F1,0xFF51}, + {0xA3D2,0xA3F2,0xFF52}, + {0xA3D3,0xA3F3,0xFF53}, + {0xA3D4,0xA3F4,0xFF54}, + {0xA3D5,0xA3F5,0xFF55}, + {0xA3D6,0xA3F6,0xFF56}, + {0xA3D7,0xA3F7,0xFF57}, + {0xA3D8,0xA3F8,0xFF58}, + {0xA3D9,0xA3F9,0xFF59}, + {0xA3DA,0xA3FA,0xFF5A}, + {0xA3FB,0xA3FB,0x003F}, + {0xA3FC,0xA3FC,0x003F}, + {0xA3FD,0xA3FD,0x003F}, + {0xA3FE,0xA3FE,0x003F}, + {0xA3FF,0xA3FF,0x003F} +}; + + +static MY_UNICASE_INFO cA6[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA6A0,0xA6A0,0x003F}, /* A6A0 */ + {0xA6A1,0xA6C1,0x0391}, + {0xA6A2,0xA6C2,0x0392}, + {0xA6A3,0xA6C3,0x0393}, + {0xA6A4,0xA6C4,0x0394}, + {0xA6A5,0xA6C5,0x0395}, + {0xA6A6,0xA6C6,0x0396}, + {0xA6A7,0xA6C7,0x0397}, + {0xA6A8,0xA6C8,0x0398}, + {0xA6A9,0xA6C9,0x0399}, + {0xA6AA,0xA6CA,0x039A}, + {0xA6AB,0xA6CB,0x039B}, + {0xA6AC,0xA6CC,0x039C}, + {0xA6AD,0xA6CD,0x039D}, + {0xA6AE,0xA6CE,0x039E}, + {0xA6AF,0xA6CF,0x039F}, + {0xA6B0,0xA6D0,0x03A0}, /* A6B0 */ + {0xA6B1,0xA6D1,0x03A1}, + {0xA6B2,0xA6D2,0x03A3}, + {0xA6B3,0xA6D3,0x03A4}, + {0xA6B4,0xA6D4,0x03A5}, + {0xA6B5,0xA6D5,0x03A6}, + {0xA6B6,0xA6D6,0x03A7}, + {0xA6B7,0xA6D7,0x03A8}, + {0xA6B8,0xA6D8,0x03A9}, + {0xA6B9,0xA6B9,0x003F}, + {0xA6BA,0xA6BA,0x003F}, + {0xA6BB,0xA6BB,0x003F}, + {0xA6BC,0xA6BC,0x003F}, + {0xA6BD,0xA6BD,0x003F}, + {0xA6BE,0xA6BE,0x003F}, + {0xA6BF,0xA6BF,0x003F}, + {0xA6C0,0xA6C0,0x003F}, /* A6C0 */ + {0xA6A1,0xA6C1,0x03B1}, + {0xA6A2,0xA6C2,0x03B2}, + {0xA6A3,0xA6C3,0x03B3}, + {0xA6A4,0xA6C4,0x03B4}, + {0xA6A5,0xA6C5,0x03B5}, + {0xA6A6,0xA6C6,0x03B6}, + {0xA6A7,0xA6C7,0x03B7}, + {0xA6A8,0xA6C8,0x03B8}, + {0xA6A9,0xA6C9,0x03B9}, + {0xA6AA,0xA6CA,0x03BA}, + {0xA6AB,0xA6CB,0x03BB}, + {0xA6AC,0xA6CC,0x03BC}, + {0xA6AD,0xA6CD,0x03BD}, + {0xA6AE,0xA6CE,0x03BE}, + {0xA6AF,0xA6CF,0x03BF}, + {0xA6B0,0xA6D0,0x03C0}, /* A6D0 */ + {0xA6B1,0xA6D1,0x03C1}, + {0xA6B2,0xA6D2,0x03C3}, + {0xA6B3,0xA6D3,0x03C4}, + {0xA6B4,0xA6D4,0x03C5}, + {0xA6B5,0xA6D5,0x03C6}, + {0xA6B6,0xA6D6,0x03C7}, + {0xA6B7,0xA6D7,0x03C8}, + {0xA6B8,0xA6D8,0x03C9}, + {0xA6D9,0xA6D9,0x003F}, + {0xA6DA,0xA6DA,0x003F}, + {0xA6DB,0xA6DB,0x003F}, + {0xA6DC,0xA6DC,0x003F}, + {0xA6DD,0xA6DD,0x003F}, + {0xA6DE,0xA6DE,0x003F}, + {0xA6DF,0xA6DF,0x003F}, + {0xA6E0,0xA6E0,0x003F}, /* A6E0 */ + {0xA6E1,0xA6E1,0x003F}, + {0xA6E2,0xA6E2,0x003F}, + {0xA6E3,0xA6E3,0x003F}, + {0xA6E4,0xA6E4,0x003F}, + {0xA6E5,0xA6E5,0x003F}, + {0xA6E6,0xA6E6,0x003F}, + {0xA6E7,0xA6E7,0x003F}, + {0xA6E8,0xA6E8,0x003F}, + {0xA6E9,0xA6E9,0x003F}, + {0xA6EA,0xA6EA,0x003F}, + {0xA6EB,0xA6EB,0x003F}, + {0xA6EC,0xA6EC,0x003F}, + {0xA6ED,0xA6ED,0x003F}, + {0xA6EE,0xA6EE,0x003F}, + {0xA6EF,0xA6EF,0x003F}, + {0xA6F0,0xA6F0,0x003F}, /* A6F0 */ + {0xA6F1,0xA6F1,0x003F}, + {0xA6F2,0xA6F2,0x003F}, + {0xA6F3,0xA6F3,0x003F}, + {0xA6F4,0xA6F4,0x003F}, + {0xA6F5,0xA6F5,0x003F}, + {0xA6F6,0xA6F6,0x003F}, + {0xA6F7,0xA6F7,0x003F}, + {0xA6F8,0xA6F8,0x003F}, + {0xA6F9,0xA6F9,0x003F}, + {0xA6FA,0xA6FA,0x003F}, + {0xA6FB,0xA6FB,0x003F}, + {0xA6FC,0xA6FC,0x003F}, + {0xA6FD,0xA6FD,0x003F}, + {0xA6FE,0xA6FE,0x003F}, + {0xA6FF,0xA6FF,0x003F} +}; + + +static MY_UNICASE_INFO cA7[256]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0xA7A0,0xA7A0,0x003F}, + {0xA7A1,0xA7D1,0x0410}, + {0xA7A2,0xA7D2,0x0411}, + {0xA7A3,0xA7D3,0x0412}, + {0xA7A4,0xA7D4,0x0413}, + {0xA7A5,0xA7D5,0x0414}, + {0xA7A6,0xA7D6,0x0415}, + {0xA7A7,0xA7D7,0x0401}, + {0xA7A8,0xA7D8,0x0416}, + {0xA7A9,0xA7D9,0x0417}, + {0xA7AA,0xA7DA,0x0418}, + {0xA7AB,0xA7DB,0x0419}, + {0xA7AC,0xA7DC,0x041A}, + {0xA7AD,0xA7DD,0x041B}, + {0xA7AE,0xA7DE,0x041C}, + {0xA7AF,0xA7DF,0x041D}, + {0xA7B0,0xA7E0,0x041E}, /* A7B0 */ + {0xA7B1,0xA7E1,0x041F}, + {0xA7B2,0xA7E2,0x0420}, + {0xA7B3,0xA7E3,0x0421}, + {0xA7B4,0xA7E4,0x0422}, + {0xA7B5,0xA7E5,0x0423}, + {0xA7B6,0xA7E6,0x0424}, + {0xA7B7,0xA7E7,0x0425}, + {0xA7B8,0xA7E8,0x0426}, + {0xA7B9,0xA7E9,0x0427}, + {0xA7BA,0xA7EA,0x0428}, + {0xA7BB,0xA7EB,0x0429}, + {0xA7BC,0xA7EC,0x042A}, + {0xA7BD,0xA7ED,0x042B}, + {0xA7BE,0xA7EE,0x042C}, + {0xA7BF,0xA7EF,0x042D}, + {0xA7C0,0xA7F0,0x042E}, /* A7C0 */ + {0xA7C1,0xA7F1,0x042F}, + {0xA7C2,0xA7C2,0x003F}, + {0xA7C3,0xA7C3,0x003F}, + {0xA7C4,0xA7C4,0x003F}, + {0xA7C5,0xA7C5,0x003F}, + {0xA7C6,0xA7C6,0x003F}, + {0xA7C7,0xA7C7,0x003F}, + {0xA7C8,0xA7C8,0x003F}, + {0xA7C9,0xA7C9,0x003F}, + {0xA7CA,0xA7CA,0x003F}, + {0xA7CB,0xA7CB,0x003F}, + {0xA7CC,0xA7CC,0x003F}, + {0xA7CD,0xA7CD,0x003F}, + {0xA7CE,0xA7CE,0x003F}, + {0xA7CF,0xA7CF,0x003F}, + {0xA7D0,0xA7D0,0x003F}, /* A7D0 */ + {0xA7A1,0xA7D1,0x0430}, + {0xA7A2,0xA7D2,0x0431}, + {0xA7A3,0xA7D3,0x0432}, + {0xA7A4,0xA7D4,0x0433}, + {0xA7A5,0xA7D5,0x0434}, + {0xA7A6,0xA7D6,0x0435}, + {0xA7A7,0xA7D7,0x0451}, + {0xA7A8,0xA7D8,0x0436}, + {0xA7A9,0xA7D9,0x0437}, + {0xA7AA,0xA7DA,0x0438}, + {0xA7AB,0xA7DB,0x0439}, + {0xA7AC,0xA7DC,0x043A}, + {0xA7AD,0xA7DD,0x043B}, + {0xA7AE,0xA7DE,0x043C}, + {0xA7AF,0xA7DF,0x043D}, + {0xA7B0,0xA7E0,0x043E}, /* A7E0 */ + {0xA7B1,0xA7E1,0x043F}, + {0xA7B2,0xA7E2,0x0440}, + {0xA7B3,0xA7E3,0x0441}, + {0xA7B4,0xA7E4,0x0442}, + {0xA7B5,0xA7E5,0x0443}, + {0xA7B6,0xA7E6,0x0444}, + {0xA7B7,0xA7E7,0x0445}, + {0xA7B8,0xA7E8,0x0446}, + {0xA7B9,0xA7E9,0x0447}, + {0xA7BA,0xA7EA,0x0448}, + {0xA7BB,0xA7EB,0x0449}, + {0xA7BC,0xA7EC,0x044A}, + {0xA7BD,0xA7ED,0x044B}, + {0xA7BE,0xA7EE,0x044C}, + {0xA7BF,0xA7EF,0x044D}, + {0xA7C0,0xA7F0,0x044E}, /* A7F0 */ + {0xA7C1,0xA7F1,0x044F}, + {0xA7F2,0xA7F2,0x003F}, + {0xA7F3,0xA7F3,0x003F}, + {0xA7F4,0xA7F4,0x003F}, + {0xA7F5,0xA7F5,0x003F}, + {0xA7F6,0xA7F6,0x003F}, + {0xA7F7,0xA7F7,0x003F}, + {0xA7F8,0xA7F8,0x003F}, + {0xA7F9,0xA7F9,0x003F}, + {0xA7FA,0xA7FA,0x003F}, + {0xA7FB,0xA7FB,0x003F}, + {0xA7FC,0xA7FC,0x003F}, + {0xA7FD,0xA7FD,0x003F}, + {0xA7FE,0xA7FE,0x003F}, + {0xA7FF,0xA7FF,0x003F}, +}; + + +/* Case info pages for JIS-X-0212 range */ +static MY_UNICASE_INFO c8FA6[]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FA6A0,0x8FA6A0,0x003F}, /* 8FA6A0 */ + {0x8FA6A1,0x8FA6A1,0x003F}, + {0x8FA6A2,0x8FA6A2,0x003F}, + {0x8FA6A3,0x8FA6A3,0x003F}, + {0x8FA6A4,0x8FA6A4,0x003F}, + {0x8FA6A5,0x8FA6A5,0x003F}, + {0x8FA6A6,0x8FA6A6,0x003F}, + {0x8FA6A7,0x8FA6A7,0x003F}, + {0x8FA6A8,0x8FA6A8,0x003F}, + {0x8FA6A9,0x8FA6A9,0x003F}, + {0x8FA6AA,0x8FA6AA,0x003F}, + {0x8FA6AB,0x8FA6AB,0x003F}, + {0x8FA6AC,0x8FA6AC,0x003F}, + {0x8FA6AD,0x8FA6AD,0x003F}, + {0x8FA6AE,0x8FA6AE,0x003F}, + {0x8FA6AF,0x8FA6AF,0x003F}, + {0x8FA6B0,0x8FA6B0,0x003F}, /* 8FA6B0 */ + {0x8FA6B1,0x8FA6B1,0x003F}, + {0x8FA6B2,0x8FA6B2,0x003F}, + {0x8FA6B3,0x8FA6B3,0x003F}, + {0x8FA6B4,0x8FA6B4,0x003F}, + {0x8FA6B5,0x8FA6B5,0x003F}, + {0x8FA6B6,0x8FA6B6,0x003F}, + {0x8FA6B7,0x8FA6B7,0x003F}, + {0x8FA6B8,0x8FA6B8,0x003F}, + {0x8FA6B9,0x8FA6B9,0x003F}, + {0x8FA6BA,0x8FA6BA,0x003F}, + {0x8FA6BB,0x8FA6BB,0x003F}, + {0x8FA6BC,0x8FA6BC,0x003F}, + {0x8FA6BD,0x8FA6BD,0x003F}, + {0x8FA6BE,0x8FA6BE,0x003F}, + {0x8FA6BF,0x8FA6BF,0x003F}, + {0x8FA6C0,0x8FA6C0,0x003F}, /* 8FA6C0 */ + {0x8FA6C1,0x8FA6C1,0x003F}, + {0x8FA6C2,0x8FA6C2,0x003F}, + {0x8FA6C3,0x8FA6C3,0x003F}, + {0x8FA6C4,0x8FA6C4,0x003F}, + {0x8FA6C5,0x8FA6C5,0x003F}, + {0x8FA6C6,0x8FA6C6,0x003F}, + {0x8FA6C7,0x8FA6C7,0x003F}, + {0x8FA6C8,0x8FA6C8,0x003F}, + {0x8FA6C9,0x8FA6C9,0x003F}, + {0x8FA6CA,0x8FA6CA,0x003F}, + {0x8FA6CB,0x8FA6CB,0x003F}, + {0x8FA6CC,0x8FA6CC,0x003F}, + {0x8FA6CD,0x8FA6CD,0x003F}, + {0x8FA6CE,0x8FA6CE,0x003F}, + {0x8FA6CF,0x8FA6CF,0x003F}, + {0x8FA6D0,0x8FA6D0,0x003F}, /* 8FA6D0 */ + {0x8FA6D1,0x8FA6D1,0x003F}, + {0x8FA6D2,0x8FA6D2,0x003F}, + {0x8FA6D3,0x8FA6D3,0x003F}, + {0x8FA6D4,0x8FA6D4,0x003F}, + {0x8FA6D5,0x8FA6D5,0x003F}, + {0x8FA6D6,0x8FA6D6,0x003F}, + {0x8FA6D7,0x8FA6D7,0x003F}, + {0x8FA6D8,0x8FA6D8,0x003F}, + {0x8FA6D9,0x8FA6D9,0x003F}, + {0x8FA6DA,0x8FA6DA,0x003F}, + {0x8FA6DB,0x8FA6DB,0x003F}, + {0x8FA6DC,0x8FA6DC,0x003F}, + {0x8FA6DD,0x8FA6DD,0x003F}, + {0x8FA6DE,0x8FA6DE,0x003F}, + {0x8FA6DF,0x8FA6DF,0x003F}, + {0x8FA6E0,0x8FA6E0,0x003F}, /* 8FA6E0 */ + {0x8FA6E1,0x8FA6F1,0x0386}, + {0x8FA6E2,0x8FA6F2,0x0388}, + {0x8FA6E3,0x8FA6F3,0x0389}, + {0x8FA6E4,0x8FA6F4,0x038A}, + {0x8FA6E5,0x8FA6F5,0x03AA}, + {0x8FA6E6,0x8FA6E6,0x003F}, + {0x8FA6E7,0x8FA6F7,0x038C}, + {0x8FA6E8,0x8FA6E8,0x003F}, + {0x8FA6E9,0x8FA6F9,0x038E}, + {0x8FA6EA,0x8FA6FA,0x03AB}, + {0x8FA6EB,0x8FA6EB,0x003F}, + {0x8FA6EC,0x8FA6FC,0x038F}, + {0x8FA6ED,0x8FA6ED,0x003F}, + {0x8FA6EE,0x8FA6EE,0x003F}, + {0x8FA6EF,0x8FA6EF,0x003F}, + {0x8FA6F0,0x8FA6F0,0x003F}, /* 8FA6F0 */ + {0x8FA6E1,0x8FA6F1,0x03AC}, + {0x8FA6E2,0x8FA6F2,0x03AD}, + {0x8FA6E3,0x8FA6F3,0x03AE}, + {0x8FA6E4,0x8FA6F4,0x03AF}, + {0x8FA6E5,0x8FA6F5,0x03CA}, + {0x8FA6F6,0x8FA6F6,0x0390}, + {0x8FA6E7,0x8FA6F7,0x03CC}, + { 0xA6B2,0x8FA6F8,0x03C2}, + {0x8FA6E9,0x8FA6F9,0x03CD}, + {0x8FA6EA,0x8FA6FA,0x03CB}, + {0x8FA6FB,0x8FA6FB,0x03B0}, + {0x8FA6EC,0x8FA6FC,0x03CE}, + {0x8FA6FD,0x8FA6FD,0x003F}, + {0x8FA6FE,0x8FA6FE,0x003F}, + {0x8FA6FF,0x8FA6FF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FA7[]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FA7A0,0x8FA7A0,0x003F}, /* 8FA7A0 */ + {0x8FA7A1,0x8FA7A1,0x003F}, + {0x8FA7A2,0x8FA7A2,0x003F}, + {0x8FA7A3,0x8FA7A3,0x003F}, + {0x8FA7A4,0x8FA7A4,0x003F}, + {0x8FA7A5,0x8FA7A5,0x003F}, + {0x8FA7A6,0x8FA7A6,0x003F}, + {0x8FA7A7,0x8FA7A7,0x003F}, + {0x8FA7A8,0x8FA7A8,0x003F}, + {0x8FA7A9,0x8FA7A9,0x003F}, + {0x8FA7AA,0x8FA7AA,0x003F}, + {0x8FA7AB,0x8FA7AB,0x003F}, + {0x8FA7AC,0x8FA7AC,0x003F}, + {0x8FA7AD,0x8FA7AD,0x003F}, + {0x8FA7AE,0x8FA7AE,0x003F}, + {0x8FA7AF,0x8FA7AF,0x003F}, + {0x8FA7B0,0x8FA7B0,0x003F}, /* 8FA7B0 */ + {0x8FA7B1,0x8FA7B1,0x003F}, + {0x8FA7B2,0x8FA7B2,0x003F}, + {0x8FA7B3,0x8FA7B3,0x003F}, + {0x8FA7B4,0x8FA7B4,0x003F}, + {0x8FA7B5,0x8FA7B5,0x003F}, + {0x8FA7B6,0x8FA7B6,0x003F}, + {0x8FA7B7,0x8FA7B7,0x003F}, + {0x8FA7B8,0x8FA7B8,0x003F}, + {0x8FA7B9,0x8FA7B9,0x003F}, + {0x8FA7BA,0x8FA7BA,0x003F}, + {0x8FA7BB,0x8FA7BB,0x003F}, + {0x8FA7BC,0x8FA7BC,0x003F}, + {0x8FA7BD,0x8FA7BD,0x003F}, + {0x8FA7BE,0x8FA7BE,0x003F}, + {0x8FA7BF,0x8FA7BF,0x003F}, + {0x8FA7C0,0x8FA7C0,0x003F}, /* 8FA7C0 */ + {0x8FA7C1,0x8FA7C1,0x003F}, + {0x8FA7C2,0x8FA7F2,0x0402}, + {0x8FA7C3,0x8FA7F3,0x0403}, + {0x8FA7C4,0x8FA7F4,0x0404}, + {0x8FA7C5,0x8FA7F5,0x0405}, + {0x8FA7C6,0x8FA7F6,0x0406}, + {0x8FA7C7,0x8FA7F7,0x0407}, + {0x8FA7C8,0x8FA7F8,0x0408}, + {0x8FA7C9,0x8FA7F9,0x0409}, + {0x8FA7CA,0x8FA7FA,0x040A}, + {0x8FA7CB,0x8FA7FB,0x040B}, + {0x8FA7CC,0x8FA7FC,0x040C}, + {0x8FA7CD,0x8FA7FD,0x040E}, + {0x8FA7CE,0x8FA7FE,0x040F}, + {0x8FA7CF,0x8FA7CF,0x003F}, + {0x8FA7D0,0x8FA7D0,0x003F}, /* 8FA7D0 */ + {0x8FA7D1,0x8FA7D1,0x003F}, + {0x8FA7D2,0x8FA7D2,0x003F}, + {0x8FA7D3,0x8FA7D3,0x003F}, + {0x8FA7D4,0x8FA7D4,0x003F}, + {0x8FA7D5,0x8FA7D5,0x003F}, + {0x8FA7D6,0x8FA7D6,0x003F}, + {0x8FA7D7,0x8FA7D7,0x003F}, + {0x8FA7D8,0x8FA7D8,0x003F}, + {0x8FA7D9,0x8FA7D9,0x003F}, + {0x8FA7DA,0x8FA7DA,0x003F}, + {0x8FA7DB,0x8FA7DB,0x003F}, + {0x8FA7DC,0x8FA7DC,0x003F}, + {0x8FA7DD,0x8FA7DD,0x003F}, + {0x8FA7DE,0x8FA7DE,0x003F}, + {0x8FA7DF,0x8FA7DF,0x003F}, + {0x8FA7E0,0x8FA7E0,0x003F}, /* 8FA7E0 */ + {0x8FA7E1,0x8FA7E1,0x003F}, + {0x8FA7E2,0x8FA7E2,0x003F}, + {0x8FA7E3,0x8FA7E3,0x003F}, + {0x8FA7E4,0x8FA7E4,0x003F}, + {0x8FA7E5,0x8FA7E5,0x003F}, + {0x8FA7E6,0x8FA7E6,0x003F}, + {0x8FA7E7,0x8FA7E7,0x003F}, + {0x8FA7E8,0x8FA7E8,0x003F}, + {0x8FA7E9,0x8FA7E9,0x003F}, + {0x8FA7EA,0x8FA7EA,0x003F}, + {0x8FA7EB,0x8FA7EB,0x003F}, + {0x8FA7EC,0x8FA7EC,0x003F}, + {0x8FA7ED,0x8FA7ED,0x003F}, + {0x8FA7EE,0x8FA7EE,0x003F}, + {0x8FA7EF,0x8FA7EF,0x003F}, + {0x8FA7F0,0x8FA7F0,0x003F}, /* 8FA7F0 */ + {0x8FA7F1,0x8FA7F1,0x003F}, + {0x8FA7C2,0x8FA7F2,0x0452}, + {0x8FA7C3,0x8FA7F3,0x0453}, + {0x8FA7C4,0x8FA7F4,0x0454}, + {0x8FA7C5,0x8FA7F5,0x0455}, + {0x8FA7C6,0x8FA7F6,0x0456}, + {0x8FA7C7,0x8FA7F7,0x0457}, + {0x8FA7C8,0x8FA7F8,0x0458}, + {0x8FA7C9,0x8FA7F9,0x0459}, + {0x8FA7CA,0x8FA7FA,0x045A}, + {0x8FA7CB,0x8FA7FB,0x045B}, + {0x8FA7CC,0x8FA7FC,0x045C}, + {0x8FA7CD,0x8FA7FD,0x045E}, + {0x8FA7CE,0x8FA7FE,0x045F}, + {0x8FA7FF,0x8FA7FF,0x003F} +}; + + +static MY_UNICASE_INFO c8FA9[]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FA9A0,0x8FA9A0,0x003F}, /* 8FA9A0 */ + {0x8FA9A1,0x8FA9C1,0x00C6}, + {0x8FA9A2,0x8FA9C2,0x0110}, + {0x8FA9A3,0x8FA9A3,0x003F}, + {0x8FA9A4,0x8FA9C4,0x0126}, + {0x8FA9A5,0x8FA9A5,0x003F}, + {0x8FA9A6,0x8FA9C6,0x0132}, + {0x8FA9A7,0x8FA9A7,0x003F}, + {0x8FA9A8,0x8FA9C8,0x0141}, + {0x8FA9A9,0x8FA9C9,0x013F}, + {0x8FA9AA,0x8FA9AA,0x003F}, + {0x8FA9AB,0x8FA9CB,0x014A}, + {0x8FA9AC,0x8FA9CC,0x00D8}, + {0x8FA9AD,0x8FA9CD,0x0152}, + {0x8FA9AE,0x8FA9AE,0x003F}, + {0x8FA9AF,0x8FA9CF,0x0166}, + {0x8FA9B0,0x8FA9D0,0x00DE}, /* 8FA9B0 */ + {0x8FA9B1,0x8FA9B1,0x003F}, + {0x8FA9B2,0x8FA9B2,0x003F}, + {0x8FA9B3,0x8FA9B3,0x003F}, + {0x8FA9B4,0x8FA9B4,0x003F}, + {0x8FA9B5,0x8FA9B5,0x003F}, + {0x8FA9B6,0x8FA9B6,0x003F}, + {0x8FA9B7,0x8FA9B7,0x003F}, + {0x8FA9B8,0x8FA9B8,0x003F}, + {0x8FA9B9,0x8FA9B9,0x003F}, + {0x8FA9BA,0x8FA9BA,0x003F}, + {0x8FA9BB,0x8FA9BB,0x003F}, + {0x8FA9BC,0x8FA9BC,0x003F}, + {0x8FA9BD,0x8FA9BD,0x003F}, + {0x8FA9BE,0x8FA9BE,0x003F}, + {0x8FA9BF,0x8FA9BF,0x003F}, + {0x8FA9C0,0x8FA9C0,0x003F}, /* 8FA9C0 */ + {0x8FA9A1,0x8FA9C1,0x00E6}, + {0x8FA9A2,0x8FA9C2,0x0111}, + {0x8FA9C3,0x8FA9C3,0x00F0}, + {0x8FA9A4,0x8FA9C4,0x0127}, + { 0x49,0x8FA9C5,0x0131}, + {0x8FA9A6,0x8FA9C6,0x0133}, + {0x8FA9C7,0x8FA9C7,0x0138}, + {0x8FA9A8,0x8FA9C8,0x0142}, + {0x8FA9A9,0x8FA9C9,0x0140}, + {0x8FA9CA,0x8FA9CA,0x0149}, + {0x8FA9AB,0x8FA9CB,0x014B}, + {0x8FA9AC,0x8FA9CC,0x00F8}, + {0x8FA9AD,0x8FA9CD,0x0153}, + {0x8FA9CE,0x8FA9CE,0x00DF}, + {0x8FA9AF,0x8FA9CF,0x0167}, + {0x8FA9B0,0x8FA9D0,0x00FE}, /* 8FA9D0 */ + {0x8FA9D1,0x8FA9D1,0x003F}, + {0x8FA9D2,0x8FA9D2,0x003F}, + {0x8FA9D3,0x8FA9D3,0x003F}, + {0x8FA9D4,0x8FA9D4,0x003F}, + {0x8FA9D5,0x8FA9D5,0x003F}, + {0x8FA9D6,0x8FA9D6,0x003F}, + {0x8FA9D7,0x8FA9D7,0x003F}, + {0x8FA9D8,0x8FA9D8,0x003F}, + {0x8FA9D9,0x8FA9D9,0x003F}, + {0x8FA9DA,0x8FA9DA,0x003F}, + {0x8FA9DB,0x8FA9DB,0x003F}, + {0x8FA9DC,0x8FA9DC,0x003F}, + {0x8FA9DD,0x8FA9DD,0x003F}, + {0x8FA9DE,0x8FA9DE,0x003F}, + {0x8FA9DF,0x8FA9DF,0x003F}, + {0x8FA9E0,0x8FA9E0,0x003F}, /* 8FA9E0 */ + {0x8FA9E1,0x8FA9E1,0x003F}, + {0x8FA9E2,0x8FA9E2,0x003F}, + {0x8FA9E3,0x8FA9E3,0x003F}, + {0x8FA9E4,0x8FA9E4,0x003F}, + {0x8FA9E5,0x8FA9E5,0x003F}, + {0x8FA9E6,0x8FA9E6,0x003F}, + {0x8FA9E7,0x8FA9E7,0x003F}, + {0x8FA9E8,0x8FA9E8,0x003F}, + {0x8FA9E9,0x8FA9E9,0x003F}, + {0x8FA9EA,0x8FA9EA,0x003F}, + {0x8FA9EB,0x8FA9EB,0x003F}, + {0x8FA9EC,0x8FA9EC,0x003F}, + {0x8FA9ED,0x8FA9ED,0x003F}, + {0x8FA9EE,0x8FA9EE,0x003F}, + {0x8FA9EF,0x8FA9EF,0x003F}, + {0x8FA9F0,0x8FA9F0,0x003F}, /* 8FA9F0 */ + {0x8FA9F1,0x8FA9F1,0x003F}, + {0x8FA9F2,0x8FA9F2,0x003F}, + {0x8FA9F3,0x8FA9F3,0x003F}, + {0x8FA9F4,0x8FA9F4,0x003F}, + {0x8FA9F5,0x8FA9F5,0x003F}, + {0x8FA9F6,0x8FA9F6,0x003F}, + {0x8FA9F7,0x8FA9F7,0x003F}, + {0x8FA9F8,0x8FA9F8,0x003F}, + {0x8FA9F9,0x8FA9F9,0x003F}, + {0x8FA9FA,0x8FA9FA,0x003F}, + {0x8FA9FB,0x8FA9FB,0x003F}, + {0x8FA9FC,0x8FA9FC,0x003F}, + {0x8FA9FD,0x8FA9FD,0x003F}, + {0x8FA9FE,0x8FA9FE,0x003F}, + {0x8FA9FF,0x8FA9FF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FAA[]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FAAA0,0x8FAAA0,0x003F}, /* 8FAAA0 */ + {0x8FAAA1,0x8FABA1,0x00C1}, + {0x8FAAA2,0x8FABA2,0x00C0}, + {0x8FAAA3,0x8FABA3,0x00C4}, + {0x8FAAA4,0x8FABA4,0x00C2}, + {0x8FAAA5,0x8FABA5,0x0102}, + {0x8FAAA6,0x8FABA6,0x01CD}, + {0x8FAAA7,0x8FABA7,0x0100}, + {0x8FAAA8,0x8FABA8,0x0104}, + {0x8FAAA9,0x8FABA9,0x00C5}, + {0x8FAAAA,0x8FABAA,0x00C3}, + {0x8FAAAB,0x8FABAB,0x0106}, + {0x8FAAAC,0x8FABAC,0x0108}, + {0x8FAAAD,0x8FABAD,0x010C}, + {0x8FAAAE,0x8FABAE,0x00C7}, + {0x8FAAAF,0x8FABAF,0x010A}, + {0x8FAAB0,0x8FABB0,0x010E}, /* 8FAAB0 */ + {0x8FAAB1,0x8FABB1,0x00C9}, + {0x8FAAB2,0x8FABB2,0x00C8}, + {0x8FAAB3,0x8FABB3,0x00CB}, + {0x8FAAB4,0x8FABB4,0x00CA}, + {0x8FAAB5,0x8FABB5,0x011A}, + {0x8FAAB6,0x8FABB6,0x0116}, + {0x8FAAB7,0x8FABB7,0x0112}, + {0x8FAAB8,0x8FABB8,0x0118}, + {0x8FAAB9,0x8FAAB9,0x003F}, + {0x8FAABA,0x8FABBA,0x011C}, + {0x8FAABB,0x8FABBB,0x011E}, + {0x8FAABC,0x8FAABC,0x0122}, + {0x8FAABD,0x8FABBD,0x0120}, + {0x8FAABE,0x8FABBE,0x0124}, + {0x8FAABF,0x8FABBF,0x00CD}, + {0x8FAAC0,0x8FABC0,0x00CC}, /* 8FAAC0 */ + {0x8FAAC1,0x8FABC1,0x00CF}, + {0x8FAAC2,0x8FABC2,0x00CE}, + {0x8FAAC3,0x8FABC3,0x01CF}, + {0x8FAAC4, 0x69,0x0130}, + {0x8FAAC5,0x8FABC5,0x012A}, + {0x8FAAC6,0x8FABC6,0x012E}, + {0x8FAAC7,0x8FABC7,0x0128}, + {0x8FAAC8,0x8FABC8,0x0134}, + {0x8FAAC9,0x8FABC9,0x0136}, + {0x8FAACA,0x8FABCA,0x0139}, + {0x8FAACB,0x8FABCB,0x013D}, + {0x8FAACC,0x8FABCC,0x013B}, + {0x8FAACD,0x8FABCD,0x0143}, + {0x8FAACE,0x8FABCE,0x0147}, + {0x8FAACF,0x8FABCF,0x0145}, + {0x8FAAD0,0x8FABD0,0x00D1}, /* 8FAAD0 */ + {0x8FAAD1,0x8FABD1,0x00D3}, + {0x8FAAD2,0x8FABD2,0x00D2}, + {0x8FAAD3,0x8FABD3,0x00D6}, + {0x8FAAD4,0x8FABD4,0x00D4}, + {0x8FAAD5,0x8FABD5,0x01D1}, + {0x8FAAD6,0x8FABD6,0x0150}, + {0x8FAAD7,0x8FABD7,0x014C}, + {0x8FAAD8,0x8FABD8,0x00D5}, + {0x8FAAD9,0x8FABD9,0x0154}, + {0x8FAADA,0x8FABDA,0x0158}, + {0x8FAADB,0x8FABDB,0x0156}, + {0x8FAADC,0x8FABDC,0x015A}, + {0x8FAADD,0x8FABDD,0x015C}, + {0x8FAADE,0x8FABDE,0x0160}, + {0x8FAADF,0x8FABDF,0x015E}, + {0x8FAAE0,0x8FABE0,0x0164}, /* 8FAAE0 */ + {0x8FAAE1,0x8FABE1,0x0162}, + {0x8FAAE2,0x8FABE2,0x00DA}, + {0x8FAAE3,0x8FABE3,0x00D9}, + {0x8FAAE4,0x8FABE4,0x00DC}, + {0x8FAAE5,0x8FABE5,0x00DB}, + {0x8FAAE6,0x8FABE6,0x016C}, + {0x8FAAE7,0x8FABE7,0x01D3}, + {0x8FAAE8,0x8FABE8,0x0170}, + {0x8FAAE9,0x8FABE9,0x016A}, + {0x8FAAEA,0x8FABEA,0x0172}, + {0x8FAAEB,0x8FABEB,0x016E}, + {0x8FAAEC,0x8FABEC,0x0168}, + {0x8FAAED,0x8FABED,0x01D7}, + {0x8FAAEE,0x8FABEE,0x01DB}, + {0x8FAAEF,0x8FABEF,0x01D9}, + {0x8FAAF0,0x8FABF0,0x01D5}, /* 8FAAF0 */ + {0x8FAAF1,0x8FABF1,0x0174}, + {0x8FAAF2,0x8FABF2,0x00DD}, + {0x8FAAF3,0x8FABF3,0x0178}, + {0x8FAAF4,0x8FABF4,0x0176}, + {0x8FAAF5,0x8FABF5,0x0179}, + {0x8FAAF6,0x8FABF6,0x017D}, + {0x8FAAF7,0x8FABF7,0x017B}, + {0x8FAAF8,0x8FAAF8,0x003F}, + {0x8FAAF9,0x8FAAF9,0x003F}, + {0x8FAAFA,0x8FAAFA,0x003F}, + {0x8FAAFB,0x8FAAFB,0x003F}, + {0x8FAAFC,0x8FAAFC,0x003F}, + {0x8FAAFD,0x8FAAFD,0x003F}, + {0x8FAAFE,0x8FAAFE,0x003F}, + {0x8FAAFF,0x8FAAFF,0x003F}, +}; + + +static MY_UNICASE_INFO c8FAB[]= +{ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx00 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx10 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx20 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx30 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx40 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx50 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx60 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx70 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx80 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, /* xx90 */ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0x8FABA0,0x8FABA0,0x003F}, /* 8FABA0 */ + {0x8FAAA1,0x8FABA1,0x00E1}, + {0x8FAAA2,0x8FABA2,0x00E0}, + {0x8FAAA3,0x8FABA3,0x00E4}, + {0x8FAAA4,0x8FABA4,0x00E2}, + {0x8FAAA5,0x8FABA5,0x0103}, + {0x8FAAA6,0x8FABA6,0x01CE}, + {0x8FAAA7,0x8FABA7,0x0101}, + {0x8FAAA8,0x8FABA8,0x0105}, + {0x8FAAA9,0x8FABA9,0x00E5}, + {0x8FAAAA,0x8FABAA,0x00E3}, + {0x8FAAAB,0x8FABAB,0x0107}, + {0x8FAAAC,0x8FABAC,0x0109}, + {0x8FAAAD,0x8FABAD,0x010D}, + {0x8FAAAE,0x8FABAE,0x00E7}, + {0x8FAAAF,0x8FABAF,0x010B}, + {0x8FAAB0,0x8FABB0,0x010F}, /* 8FABB0 */ + {0x8FAAB1,0x8FABB1,0x00E9}, + {0x8FAAB2,0x8FABB2,0x00E8}, + {0x8FAAB3,0x8FABB3,0x00EB}, + {0x8FAAB4,0x8FABB4,0x00EA}, + {0x8FAAB5,0x8FABB5,0x011B}, + {0x8FAAB6,0x8FABB6,0x0117}, + {0x8FAAB7,0x8FABB7,0x0113}, + {0x8FAAB8,0x8FABB8,0x0119}, + {0x8FABB9,0x8FABB9,0x01F5}, + {0x8FAABA,0x8FABBA,0x011D}, + {0x8FAABB,0x8FABBB,0x011F}, + {0x8FABBC,0x8FABBC,0x003F}, + {0x8FAABD,0x8FABBD,0x0121}, + {0x8FAABE,0x8FABBE,0x0125}, + {0x8FAABF,0x8FABBF,0x00ED}, + {0x8FAAC0,0x8FABC0,0x00EC}, /* 8FABC0 */ + {0x8FAAC1,0x8FABC1,0x00EF}, + {0x8FAAC2,0x8FABC2,0x00EE}, + {0x8FAAC3,0x8FABC3,0x01D0}, + {0x8FABC4,0x8FABC4,0x003F}, + {0x8FAAC5,0x8FABC5,0x012B}, + {0x8FAAC6,0x8FABC6,0x012F}, + {0x8FAAC7,0x8FABC7,0x0129}, + {0x8FAAC8,0x8FABC8,0x0135}, + {0x8FAAC9,0x8FABC9,0x0137}, + {0x8FAACA,0x8FABCA,0x013A}, + {0x8FAACB,0x8FABCB,0x013E}, + {0x8FAACC,0x8FABCC,0x013C}, + {0x8FAACD,0x8FABCD,0x0144}, + {0x8FAACE,0x8FABCE,0x0148}, + {0x8FAACF,0x8FABCF,0x0146}, + {0x8FAAD0,0x8FABD0,0x00F1}, /* 8FABD0 */ + {0x8FAAD1,0x8FABD1,0x00F3}, + {0x8FAAD2,0x8FABD2,0x00F2}, + {0x8FAAD3,0x8FABD3,0x00F6}, + {0x8FAAD4,0x8FABD4,0x00F4}, + {0x8FAAD5,0x8FABD5,0x01D2}, + {0x8FAAD6,0x8FABD6,0x0151}, + {0x8FAAD7,0x8FABD7,0x014D}, + {0x8FAAD8,0x8FABD8,0x00F5}, + {0x8FAAD9,0x8FABD9,0x0155}, + {0x8FAADA,0x8FABDA,0x0159}, + {0x8FAADB,0x8FABDB,0x0157}, + {0x8FAADC,0x8FABDC,0x015B}, + {0x8FAADD,0x8FABDD,0x015D}, + {0x8FAADE,0x8FABDE,0x0161}, + {0x8FAADF,0x8FABDF,0x015F}, + {0x8FAAE0,0x8FABE0,0x0165}, /* 8FABE0 */ + {0x8FAAE1,0x8FABE1,0x0163}, + {0x8FAAE2,0x8FABE2,0x00FA}, + {0x8FAAE3,0x8FABE3,0x00F9}, + {0x8FAAE4,0x8FABE4,0x00FC}, + {0x8FAAE5,0x8FABE5,0x00FB}, + {0x8FAAE6,0x8FABE6,0x016D}, + {0x8FAAE7,0x8FABE7,0x01D4}, + {0x8FAAE8,0x8FABE8,0x0171}, + {0x8FAAE9,0x8FABE9,0x016B}, + {0x8FAAEA,0x8FABEA,0x0173}, + {0x8FAAEB,0x8FABEB,0x016F}, + {0x8FAAEC,0x8FABEC,0x0169}, + {0x8FAAED,0x8FABED,0x01D8}, + {0x8FAAEE,0x8FABEE,0x01DC}, + {0x8FAAEF,0x8FABEF,0x01DA}, + {0x8FAAF0,0x8FABF0,0x01D6}, /* 8FABF0 */ + {0x8FAAF1,0x8FABF1,0x0175}, + {0x8FAAF2,0x8FABF2,0x00FD}, + {0x8FAAF3,0x8FABF3,0x00FF}, + {0x8FAAF4,0x8FABF4,0x0177}, + {0x8FAAF5,0x8FABF5,0x017A}, + {0x8FAAF6,0x8FABF6,0x017E}, + {0x8FAAF7,0x8FABF7,0x017C}, + {0x8FABF8,0x8FABF8,0x003F}, + {0x8FABF9,0x8FABF9,0x003F}, + {0x8FABFA,0x8FABFA,0x003F}, + {0x8FABFB,0x8FABFB,0x003F}, + {0x8FABFC,0x8FABFC,0x003F}, + {0x8FABFD,0x8FABFD,0x003F}, + {0x8FABFE,0x8FABFE,0x003F}, + {0x8FABFF,0x8FABFF,0x003F} +}; + + +static MY_UNICASE_INFO *my_caseinfo_ujis[512]= +{ + /* JIS-X-0208 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, cA2, cA3, NULL, NULL, cA6, cA7, /* A */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + + /* JIS-X-0212 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 1 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 2 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 3 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 4 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 5 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 6 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 7 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 9 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL,c8FA6,c8FA7, /* A */ + NULL, c8FA9,c8FAA,c8FAB,NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* B */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* C */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* D */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* E */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* F */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; +#endif /* HAVE_CHARSET_ujis */ + + + +#if defined(HAVE_CHARSET_ujis) || defined(HAVE_CHARSET_eucjpms) + +/* + UJIS and EUCJPMS share the same UPPER/LOWER functions. +*/ + +static MY_UNICASE_INFO* +get_case_info_for_ch(CHARSET_INFO *cs, uint plane, uint page, uint offs) +{ + MY_UNICASE_INFO *p; + return (p= cs->caseinfo[page + plane * 256]) ? &p[offs & 0xFF] : NULL; +} + + +/* + Generic function to handle UPPER and LOWER translation +*/ +static size_t +my_casefold_ujis(CHARSET_INFO *cs, + char *src, size_t srclen, + char *dst, size_t dstlen __attribute__((unused)), + uchar *map, + size_t is_upper) +{ + char *srcend= src + srclen, *dst0= dst; + + while (src < srcend) + { + size_t mblen= my_ismbchar(cs, src, srcend); + if (mblen) + { + MY_UNICASE_INFO *ch; + ch= (mblen == 2) ? + get_case_info_for_ch(cs, 0, (uchar) src[0], (uchar) src[1]) : + get_case_info_for_ch(cs, 1, (uchar) src[1], (uchar) src[2]); + if (ch) + { + int code= is_upper ? ch->toupper : ch->tolower; + src+= mblen; + if (code > 0xFFFF) + *dst++= (char) (uchar) ((code >> 16) & 0xFF); + if (code > 0xFF) + *dst++= (char) (uchar) ((code >> 8) & 0xFF); + *dst++= (char) (uchar) (code & 0xFF); + } + else + { + if (mblen == 3) + *dst++= *src++; + *dst++= *src++; + *dst++= *src++; + } + } + else + { + *dst++= (char) map[(uchar) *src++]; + } + } + return (size_t) (dst - dst0); +} + + +/* + LOWER() +*/ +size_t +my_casedn_ujis(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + DBUG_ASSERT(dstlen >= srclen * cs->casedn_multiply); + DBUG_ASSERT(src != dst || cs->casedn_multiply == 1); + return my_casefold_ujis(cs, src, srclen, dst, dstlen, cs->to_lower, 0); +} + + +/* + UPPER() +*/ +size_t +my_caseup_ujis(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + DBUG_ASSERT(dstlen >= srclen * cs->caseup_multiply); + DBUG_ASSERT(src != dst || cs->caseup_multiply == 1); + return my_casefold_ujis(cs, src, srclen, dst, dstlen, cs->to_upper, 1); +} +#endif /* defined(HAVE_CHARSET_ujis) || defined(HAVE_CHARSET_eucjpms) */ + + + +#ifdef HAVE_CHARSET_ujis + static MY_COLLATION_HANDLER my_collation_ci_handler = { NULL, /* init */ @@ -8524,8 +9781,8 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mb_ctype_mb, my_caseup_str_mb, my_casedn_str_mb, - my_caseup_mb, - my_casedn_mb, + my_caseup_ujis, + my_casedn_ujis, my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, @@ -8558,12 +9815,12 @@ CHARSET_INFO my_charset_ujis_japanese_ci= NULL, /* contractions */ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_ujis, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ @@ -8591,12 +9848,12 @@ CHARSET_INFO my_charset_ujis_bin= NULL, /* sort_order_big*/ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - my_unicase_default, /* caseinfo */ + my_caseinfo_ujis, /* caseinfo */ NULL, /* state_map */ NULL, /* ident_map */ 1, /* strxfrm_multiply */ 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ @@ -8608,4 +9865,4 @@ CHARSET_INFO my_charset_ujis_bin= }; -#endif +#endif /* HAVE_CHARSET_ujis */ |