403Webshell
Server IP : 112.74.42.100  /  Your IP : 216.73.216.142
Web Server : nginx/1.20.2
System : Linux iZwz96lx4pjqiy84w4hni7Z 5.10.134-17.3.al8.x86_64 #1 SMP Thu Oct 31 14:29:57 CST 2024 x86_64
User : www ( 1000)
PHP Version : 8.0.26
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/mysql-test/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/mysql-test/include/mtr_check.sql
-- Copyright (c) 2008, 2021, Oracle and/or its affiliates.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License, version 2.0,
-- as published by the Free Software Foundation.
--
-- This program is also distributed with certain software (including
-- but not limited to OpenSSL) that is licensed under separate terms,
-- as designated in a particular file or component or in included license
-- documentation.  The authors of MySQL hereby grant you an additional
-- permission to link the program and your derivative works with the
-- separately licensed software that they have included with MySQL.
--
-- 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, version 2.0, 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

delimiter ;

use mtr;

DELIMITER $$

CREATE DEFINER=root@localhost PROCEDURE check_testcase_perfschema()
BEGIN
  IF ((SELECT count(*) from information_schema.engines
       where engine='PERFORMANCE_SCHEMA' and support='YES') = 1) THEN
  BEGIN

    BEGIN
      -- For tests tampering with performance_schema table structure
      DECLARE CONTINUE HANDLER for SQLEXCEPTION
      BEGIN
      END;

      -- Leave the instruments in the same state
      SELECT * from performance_schema.setup_instruments
        where enabled='NO' order by NAME;
    END;

    -- Leave the consumers in the same state
    SELECT * from performance_schema.setup_consumers
      order by NAME;

    -- Leave the actors setup in the same state
    SELECT * from performance_schema.setup_actors
      order by USER, HOST;

    -- Leave the objects setup in the same state
    SELECT * from performance_schema.setup_objects
      order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME;

    -- Leave the prepared statement instances in the same state
    SELECT * from performance_schema.prepared_statements_instances;

    -- Leave the user defined functions in the same state
    SELECT * from performance_schema.user_defined_functions
      ORDER BY UDF_NAME;
  END;
  END IF;
END$$

CREATE DEFINER=root@localhost PROCEDURE check_testcase_ndb()
BEGIN
  -- Check NDB only if the ndbcluster plugin is enabled
  IF ((SELECT count(*) FROM information_schema.engines
       WHERE engine='ndbcluster' AND support IN ('YES', 'DEFAULT')) = 1) THEN

    -- Check only if connection information is available
    IF (SELECT LENGTH(VARIABLE_VALUE) > 0
          FROM performance_schema.global_variables
             WHERE VARIABLE_NAME='ndb_connectstring') THEN

      -- List dict objects in NDB, skip objects created by ndbcluster plugin
      -- and HashMap's since those can't be dropped after having been
      -- created by test
      SELECT id, indented_name FROM ndbinfo.dict_obj_tree
        WHERE root_type != 24 AND  -- HashMap
              root_name NOT IN ( 'mysql/def/ndb_schema',
                                 'mysql/def/ndb_schema_result',
                                 'mysql/def/ndb_index_stat_head',
                                 'mysql/def/ndb_index_stat_sample',
                                 'mysql/def/ndb_apply_status',
                                 'mysql/def/ndb_sql_metadata')
        ORDER BY path;

    END IF;
  END IF;
END$$

-- Procedure used to check if server has been properly
-- restored after testcase has been run

CREATE DEFINER=root@localhost PROCEDURE check_testcase()
BEGIN

  CALL check_testcase_perfschema();

  CALL check_testcase_ndb();

  -- Dump all global variables except those that may change.
  -- timestamp changes if time passes. server_uuid changes if server restarts.
  SELECT * FROM performance_schema.global_variables
    WHERE variable_name NOT IN ('timestamp', 'server_uuid',
                                'gtid_executed', 'gtid_purged',
                                'group_replication_group_name',
                                'keyring_file_data',
                                'innodb_thread_sleep_delay')
  ORDER BY VARIABLE_NAME;

  -- Dump all persisted variables, those that may change.
  SELECT * FROM performance_schema.persisted_variables
    ORDER BY VARIABLE_NAME;

  -- Dump all databases, there should be none
  -- except those that was created during bootstrap
  SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY SCHEMA_NAME;

  -- Dump all tablespaces, there should be none
  SELECT FILE_NAME, FILE_TYPE, TABLESPACE_NAME, ENGINE FROM INFORMATION_SCHEMA.FILES
    WHERE FILE_TYPE !='TEMPORARY' ORDER BY FILE_NAME;

  -- The test database should not contain any tables
  SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES
    WHERE table_schema='test'
      ORDER BY TABLE_NAME;

  -- Show "mysql" database, tables and columns
  SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql
    FROM INFORMATION_SCHEMA.TABLES
      WHERE table_schema='mysql' AND table_name != 'ndb_apply_status'
        ORDER BY tables_in_mysql;
  SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,
       column_name, ordinal_position, column_default, is_nullable,
       data_type, character_maximum_length, character_octet_length,
       numeric_precision, numeric_scale, character_set_name,
       collation_name, column_type, column_key, extra, column_comment
    FROM INFORMATION_SCHEMA.COLUMNS
      WHERE table_schema='mysql' AND table_name != 'ndb_apply_status'
        ORDER BY columns_in_mysql, column_name;

  -- Dump all events, there should be none
  SELECT * FROM INFORMATION_SCHEMA.EVENTS;

  -- Dump all triggers except mtr internals, only those in the sys schema should exist
  -- do not select the CREATED column however, as tests like mysqldump.test / mysql_ugprade.test update this
  SELECT TRIGGER_CATALOG, TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION,
         EVENT_OBJECT_CATALOG, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, ACTION_ORDER, ACTION_CONDITION,
         ACTION_STATEMENT, ACTION_ORIENTATION, ACTION_TIMING ACTION_REFERENCE_OLD_TABLE, ACTION_REFERENCE_NEW_TABLE,
         ACTION_REFERENCE_OLD_ROW, ACTION_REFERENCE_NEW_ROW, SQL_MODE, DEFINER CHARACTER_SET_CLIENT,
         COLLATION_CONNECTION, DATABASE_COLLATION
    FROM INFORMATION_SCHEMA.TRIGGERS
      WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert')
      ORDER BY TRIGGER_CATALOG, TRIGGER_SCHEMA, TRIGGER_NAME;

  -- Dump all created procedures, only those in the sys schema should exist
  -- do not select the CREATED or LAST_ALTERED columns however, as tests like mysqldump.test / mysql_ugprade.test update this
  SELECT SPECIFIC_NAME,ROUTINE_CATALOG,ROUTINE_SCHEMA,ROUTINE_NAME,ROUTINE_TYPE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,
         CHARACTER_OCTET_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,
         DTD_IDENTIFIER,ROUTINE_BODY,ROUTINE_DEFINITION,EXTERNAL_NAME,EXTERNAL_LANGUAGE,PARAMETER_STYLE,
         IS_DETERMINISTIC,SQL_DATA_ACCESS,SQL_PATH,SECURITY_TYPE,SQL_MODE,ROUTINE_COMMENT,DEFINER,
         CHARACTER_SET_CLIENT,COLLATION_CONNECTION,DATABASE_COLLATION
    FROM INFORMATION_SCHEMA.ROUTINES ORDER BY ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE;

  -- Dump all views, only those in the sys schema should exist
  SELECT * FROM INFORMATION_SCHEMA.VIEWS
    ORDER BY TABLE_SCHEMA, TABLE_NAME;

  -- Dump all plugins, loaded with plugin-loading options or through
  -- INSTALL/UNINSTALL command
  SELECT * FROM INFORMATION_SCHEMA.PLUGINS;

  -- Leave InnoDB metrics in the same state
  SELECT name, status FROM INFORMATION_SCHEMA.INNODB_METRICS
    ORDER BY name;

  SHOW GLOBAL STATUS LIKE 'slave_open_temp_tables';

  -- Check for number of active connections before & after the test run.

  -- mysql.session is used internally by plugins to access the server. We may
  -- not find consistent result in information_schema.processlist, hence
  -- excluding it from check-testcase. Similar reasoning applies to the event
  -- scheduler.
  --
  -- For "unauthenticated user", see Bug#30035699 "UNAUTHENTICATED USER" SHOWS UP IN CHECK-TESTCASE
  --
  SELECT USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST
    WHERE COMMAND NOT IN ('Sleep')
      AND USER NOT IN ('unauthenticated user','mysql.session', 'event_scheduler')
        ORDER BY COMMAND;

  -- Checksum system tables to make sure they have been properly
  -- restored after test.
  -- skip mysql.proc however, as created timestamps may have been updated by
  -- mysqldump.test / mysql_ugprade.test the above SELECT on I_S.ROUTINES
  -- ensures consistency across runs instead
  -- We are skipping mysql.plugin from the checksum table list, as it does not
  -- register plugin-loading options like (--plugin-load,--plugin-load-add ..)
  -- instead we will use I_S.PLUGINS to ensure consistency across runs.
  checksum table
    mysql.columns_priv,
    mysql.component,
    mysql.default_roles,
    mysql.db,
    mysql.func,
    mysql.global_grants,
    mysql.help_category,
    mysql.help_keyword,
    mysql.help_relation,
    mysql.help_topic,
    mysql.procs_priv,
    mysql.proxies_priv,
    mysql.replication_asynchronous_connection_failover,
    mysql.replication_asynchronous_connection_failover_managed,
    mysql.role_edges,
    mysql.tables_priv,
    mysql.time_zone,
    mysql.time_zone_leap_second,
    mysql.time_zone_name,
    mysql.time_zone_transition,
    mysql.time_zone_transition_type,
    mysql.user;

  -- Check that Replica IO Monitor thread state is the same before
  -- and after the test run, which is not running.
  SELECT * FROM performance_schema.threads WHERE NAME="thread/sql/replica_monitor";

END$$

-- Procedure used by test case used to force all
-- servers to restart after testcase and thus skipping
-- check test case after test
CREATE DEFINER=root@localhost PROCEDURE force_restart()
BEGIN
  SELECT 1 INTO OUTFILE 'force_restart';
END$$

DELIMITER ;


Youez - 2016 - github.com/yon3zu
LinuXploit