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