| 1 |
# ###################################################################### |
| 2 |
# * General information * |
| 3 |
# Instruments in the ndbcluster plugin uses the "ndbcluster" |
| 4 |
# identifier plus a name which normally is the name of the |
| 5 |
# object in the code. The prefix is decided by performance_schema and |
| 6 |
# depends on the objects type. |
| 7 |
# ie. <prefix>/ndbcluster/<variable_name>. |
| 8 |
# All available instruments, their doc string etc are listed in the |
| 9 |
# setup_instruments table. |
| 10 |
# The system variables are prefixed with "ndb" and can be |
| 11 |
# queried to see either global or session variables |
| 12 |
SELECT COUNT(*) > 10 FROM performance_schema.global_variables |
| 13 |
WHERE VARIABLE_NAME LIKE 'ndb%'; |
| 14 |
COUNT(*) > 10 |
| 15 |
1 |
| 16 |
SELECT * FROM performance_schema.session_variables |
| 17 |
WHERE VARIABLE_NAME = 'ndb_use_copying_alter_table'; |
| 18 |
VARIABLE_NAME VARIABLE_VALUE |
| 19 |
ndb_use_copying_alter_table OFF |
| 20 |
# It's possible to see values of session variable for each thread |
| 21 |
SELECT * FROM performance_schema.variables_by_thread |
| 22 |
WHERE VARIABLE_NAME = 'ndb_use_transactions'; |
| 23 |
THREAD_ID VARIABLE_NAME VARIABLE_VALUE |
| 24 |
<thread_id> ndb_use_transactions ON |
| 25 |
# It's possible to query information about each variable |
| 26 |
SELECT VARIABLE_NAME FROM performance_schema.variables_info |
| 27 |
WHERE VARIABLE_NAME = 'ndb_version'; |
| 28 |
VARIABLE_NAME |
| 29 |
ndb_version |
| 30 |
# The status variables are prefixed with "Ndb" and can be |
| 31 |
# queried to see either global or session status |
| 32 |
SELECT COUNT(*) > 10 FROM performance_schema.global_status |
| 33 |
WHERE VARIABLE_NAME LIKE 'Ndb%'; |
| 34 |
COUNT(*) > 10 |
| 35 |
1 |
| 36 |
SELECT * FROM performance_schema.session_status |
| 37 |
WHERE VARIABLE_NAME = 'Ndb_replica_max_replicated_epoch'; |
| 38 |
VARIABLE_NAME VARIABLE_VALUE |
| 39 |
Ndb_replica_max_replicated_epoch 0 |
| 40 |
# The threads created by the ndbcluster plugin can be queried, this |
| 41 |
# provide a mapping to OS thread id |
| 42 |
SELECT THREAD_ID, NAME, TYPE, THREAD_OS_ID FROM performance_schema.threads |
| 43 |
WHERE NAME LIKE "thread/ndbcluster/%" ORDER BY NAME; |
| 44 |
THREAD_ID NAME TYPE THREAD_OS_ID |
| 45 |
<thread_id> thread/ndbcluster/ndb_binlog BACKGROUND <thread_os_id> |
| 46 |
<thread_id> thread/ndbcluster/ndb_index_stat BACKGROUND <thread_os_id> |
| 47 |
<thread_id> thread/ndbcluster/ndb_metadata BACKGROUND <thread_os_id> |
| 48 |
<thread_id> thread/ndbcluster/ndb_purger BACKGROUND <thread_os_id> |
| 49 |
# The threads created by the ndbcluster plugin can be used to query |
| 50 |
# the amount of memory allocated by those from the mem_root arena |
| 51 |
SELECT IF(PFS_MEM.SUM_NUMBER_OF_BYTES_ALLOC > 0, "true", "false") AS has_alloc_mem |
| 52 |
FROM performance_schema.memory_summary_by_thread_by_event_name PFS_MEM |
| 53 |
JOIN performance_schema.threads PFS_THR |
| 54 |
ON PFS_MEM.THREAD_ID = PFS_THR.THREAD_ID |
| 55 |
WHERE PFS_THR.name LIKE '%ndb_binlog%' AND EVENT_NAME LIKE '%THD::main_mem_root%'; |
| 56 |
has_alloc_mem |
| 57 |
true |
| 58 |
# The amount of memory used when accessing DD from ndbcluster plugin |
| 59 |
# threads can be queried |
| 60 |
SELECT IF(PFS_MEM.SUM_NUMBER_OF_BYTES_ALLOC > 0, "true", "false") AS has_alloc_mem |
| 61 |
FROM performance_schema.memory_summary_by_thread_by_event_name PFS_MEM |
| 62 |
JOIN performance_schema.threads PFS_THR |
| 63 |
ON PFS_MEM.THREAD_ID = PFS_THR.THREAD_ID |
| 64 |
WHERE PFS_THR.name LIKE '%ndb_binlog%' AND |
| 65 |
EVENT_NAME LIKE '%Ndb_dd_client::dd_mem_root%'; |
| 66 |
has_alloc_mem |
| 67 |
true |
| 68 |
# The instrumented memory roots can be queried |
| 69 |
SELECT EVENT_NAME |
| 70 |
FROM performance_schema.memory_summary_by_thread_by_event_name |
| 71 |
WHERE THREAD_ID = PS_CURRENT_THREAD_ID() AND |
| 72 |
EVENT_NAME LIKE 'memory/ndbcluster/%'; |
| 73 |
EVENT_NAME |
| 74 |
memory/ndbcluster/Thd_ndb::batch_mem_root |
| 75 |
memory/ndbcluster/Ndb_dd_client::dd_mem_root |
| 76 |
# Log messages written by ndbcluster plugin can be queried |
| 77 |
# using the error_log table where the SUBSYSTEM column is |
| 78 |
# set to "NDB" |
| 79 |
SELECT THREAD_ID, PRIO, ERROR_CODE, SUBSYSTEM, DATA |
| 80 |
FROM performance_schema.error_log |
| 81 |
WHERE SUBSYSTEM = "NDB" AND |
| 82 |
DATA LIKE "%all storage nodes connected%"; |
| 83 |
THREAD_ID 0 |
| 84 |
PRIO System |
| 85 |
ERROR_CODE MY-010865 |
| 86 |
SUBSYSTEM NDB |
| 87 |
DATA connection[0], NodeID: 49, all storage nodes connected |
| 88 |
# Log messages written by ndbcluster plugin components that call into |
| 89 |
# MySQL (need a THD) must have a thread_id (THD id) assigned |
| 90 |
SELECT LEFT(DATA,LOCATE(':',DATA)-1) as component, IF(THREAD_ID > 0, "true", "false") AS has_thread_id |
| 91 |
FROM performance_schema.error_log |
| 92 |
WHERE SUBSYSTEM = "NDB" AND |
| 93 |
DATA LIKE "%: Started%" ORDER BY DATA; |
| 94 |
component Binlog |
| 95 |
has_thread_id true |
| 96 |
component Index Stat |
| 97 |
has_thread_id false |
| 98 |
component Metadata |
| 99 |
has_thread_id true |
| 100 |
component Purger |
| 101 |
has_thread_id true |