| 1 | /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; version 2 of the License. |
| 6 | |
| 7 | This program is distributed in the hope that it will be useful, |
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | GNU General Public License for more details. |
| 11 | |
| 12 | You should have received a copy of the GNU General Public License |
| 13 | along with this program; if not, write to the Free Software Foundation, |
| 14 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ |
| 15 | |
| 16 | /** |
| 17 | @file storage/perfschema/pfs_defaults.cc |
| 18 | Default setup (implementation). |
| 19 | */ |
| 20 | |
| 21 | #include <my_global.h> |
| 22 | #include "pfs.h" |
| 23 | #include "pfs_defaults.h" |
| 24 | #include "pfs_instr.h" |
| 25 | #include "pfs_setup_actor.h" |
| 26 | #include "pfs_setup_object.h" |
| 27 | |
| 28 | static PSI_thread_key key; |
| 29 | static PSI_thread_info info= { &key, "setup" , PSI_FLAG_GLOBAL }; |
| 30 | |
| 31 | void install_default_setup(PSI_bootstrap *boot) |
| 32 | { |
| 33 | PSI *psi= (PSI*) boot->get_interface(PSI_CURRENT_VERSION); |
| 34 | if (psi == NULL) |
| 35 | return; |
| 36 | |
| 37 | psi->register_thread("performance_schema" , &info, 1); |
| 38 | PSI_thread *psi_thread= psi->new_thread(key, NULL, 0); |
| 39 | if (psi_thread == NULL) |
| 40 | return; |
| 41 | |
| 42 | /* LF_HASH needs a thread, for PINS */ |
| 43 | psi->set_thread(psi_thread); |
| 44 | |
| 45 | String percent("%" , 1, &my_charset_utf8_bin); |
| 46 | /* Enable all users on all hosts by default */ |
| 47 | insert_setup_actor(&percent, &percent, &percent); |
| 48 | |
| 49 | /* Disable system tables by default */ |
| 50 | String mysql_db("mysql" , 5, &my_charset_utf8_bin); |
| 51 | insert_setup_object(OBJECT_TYPE_TABLE, &mysql_db, &percent, false, false); |
| 52 | |
| 53 | /* Disable performance/information schema tables. */ |
| 54 | String PS_db("performance_schema" , 18, &my_charset_utf8_bin); |
| 55 | String IS_db("information_schema" , 18, &my_charset_utf8_bin); |
| 56 | insert_setup_object(OBJECT_TYPE_TABLE, &PS_db, &percent, false, false); |
| 57 | insert_setup_object(OBJECT_TYPE_TABLE, &IS_db, &percent, false, false); |
| 58 | |
| 59 | /* Enable every other tables */ |
| 60 | insert_setup_object(OBJECT_TYPE_TABLE, &percent, &percent, true, true); |
| 61 | |
| 62 | psi->delete_current_thread(); |
| 63 | } |
| 64 | |
| 65 | |