# ###################################################################### # * General information * # Instruments in the ndbcluster plugin uses the "ndbcluster" # identifier plus a name which normally is the name of the # object in the code. The prefix is decided by performance_schema and # depends on the objects type. # ie. /ndbcluster/. # All available instruments, their doc string etc are listed in the # setup_instruments table. # The system variables are prefixed with "ndb" and can be # queried to see either global or session variables SELECT COUNT(*) > 10 FROM performance_schema.global_variables WHERE VARIABLE_NAME LIKE 'ndb%'; COUNT(*) > 10 1 SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME = 'ndb_use_copying_alter_table'; VARIABLE_NAME VARIABLE_VALUE ndb_use_copying_alter_table OFF # It's possible to see values of session variable for each thread SELECT * FROM performance_schema.variables_by_thread WHERE VARIABLE_NAME = 'ndb_use_transactions'; THREAD_ID VARIABLE_NAME VARIABLE_VALUE ndb_use_transactions ON # It's possible to query information about each variable SELECT VARIABLE_NAME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'ndb_version'; VARIABLE_NAME ndb_version # The status variables are prefixed with "Ndb" and can be # queried to see either global or session status SELECT COUNT(*) > 10 FROM performance_schema.global_status WHERE VARIABLE_NAME LIKE 'Ndb%'; COUNT(*) > 10 1 SELECT * FROM performance_schema.session_status WHERE VARIABLE_NAME = 'Ndb_replica_max_replicated_epoch'; VARIABLE_NAME VARIABLE_VALUE Ndb_replica_max_replicated_epoch 0 # The threads created by the ndbcluster plugin can be queried, this # provide a mapping to OS thread id SELECT THREAD_ID, NAME, TYPE, THREAD_OS_ID FROM performance_schema.threads WHERE NAME LIKE "thread/ndbcluster/%" ORDER BY NAME; THREAD_ID NAME TYPE THREAD_OS_ID thread/ndbcluster/ndb_binlog BACKGROUND thread/ndbcluster/ndb_index_stat BACKGROUND thread/ndbcluster/ndb_metadata BACKGROUND thread/ndbcluster/ndb_purger BACKGROUND # The threads created by the ndbcluster plugin can be used to query # the amount of memory allocated by those from the mem_root arena SELECT IF(PFS_MEM.SUM_NUMBER_OF_BYTES_ALLOC > 0, "true", "false") AS has_alloc_mem FROM performance_schema.memory_summary_by_thread_by_event_name PFS_MEM JOIN performance_schema.threads PFS_THR ON PFS_MEM.THREAD_ID = PFS_THR.THREAD_ID WHERE PFS_THR.name LIKE '%ndb_binlog%' AND EVENT_NAME LIKE '%THD::main_mem_root%'; has_alloc_mem true # The amount of memory used when accessing DD from ndbcluster plugin # threads can be queried SELECT IF(PFS_MEM.SUM_NUMBER_OF_BYTES_ALLOC > 0, "true", "false") AS has_alloc_mem FROM performance_schema.memory_summary_by_thread_by_event_name PFS_MEM JOIN performance_schema.threads PFS_THR ON PFS_MEM.THREAD_ID = PFS_THR.THREAD_ID WHERE PFS_THR.name LIKE '%ndb_binlog%' AND EVENT_NAME LIKE '%Ndb_dd_client::dd_mem_root%'; has_alloc_mem true # The instrumented memory roots can be queried SELECT EVENT_NAME FROM performance_schema.memory_summary_by_thread_by_event_name WHERE THREAD_ID = PS_CURRENT_THREAD_ID() AND EVENT_NAME LIKE 'memory/ndbcluster/%'; EVENT_NAME memory/ndbcluster/Thd_ndb::batch_mem_root memory/ndbcluster/Ndb_dd_client::dd_mem_root # Log messages written by ndbcluster plugin can be queried # using the error_log table where the SUBSYSTEM column is # set to "NDB" SELECT THREAD_ID, PRIO, ERROR_CODE, SUBSYSTEM, DATA FROM performance_schema.error_log WHERE SUBSYSTEM = "NDB" AND DATA LIKE "%all storage nodes connected%"; THREAD_ID 0 PRIO System ERROR_CODE MY-010865 SUBSYSTEM NDB DATA connection[0], NodeID: 49, all storage nodes connected # Log messages written by ndbcluster plugin components that call into # MySQL (need a THD) must have a thread_id (THD id) assigned SELECT LEFT(DATA,LOCATE(':',DATA)-1) as component, IF(THREAD_ID > 0, "true", "false") AS has_thread_id FROM performance_schema.error_log WHERE SUBSYSTEM = "NDB" AND DATA LIKE "%: Started%" ORDER BY DATA; component Binlog has_thread_id true component Index Stat has_thread_id false component Metadata has_thread_id true component Purger has_thread_id true