Skip to content

Commit 98aed4b

Browse files
committed
wl#9819 patch #4: Define ndbinfo.processes view and ndb$processes base table
1 parent 718244e commit 98aed4b

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

scripts/mysql_system_tables.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,6 +2768,11 @@ PREPARE stmt FROM @str;
27682768
EXECUTE stmt;
27692769
DROP PREPARE stmt;
27702770

2771+
SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`processes`','SET @dummy = 0');
2772+
PREPARE stmt FROM @str;
2773+
EXECUTE stmt;
2774+
DROP PREPARE stmt;
2775+
27712776
SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`resources`','SET @dummy = 0');
27722777
PREPARE stmt FROM @str;
27732778
EXECUTE stmt;
@@ -3096,6 +3101,17 @@ PREPARE stmt FROM @str;
30963101
EXECUTE stmt;
30973102
DROP PREPARE stmt;
30983103

3104+
# ndbinfo.ndb$processes
3105+
SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$processes`','SET @dummy = 0');
3106+
PREPARE stmt FROM @str;
3107+
EXECUTE stmt;
3108+
DROP PREPARE stmt;
3109+
3110+
SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$processes` (`reporting_node_id` INT UNSIGNED COMMENT "Reporting data node ID",`node_id` INT UNSIGNED COMMENT "Connected node ID",`node_type` INT UNSIGNED COMMENT "Type of node",`host_addr` VARCHAR(512) COMMENT "IPv4 address of connected node",`node_version` VARCHAR(512) COMMENT "Node MySQL Cluster version string",`process_id` INT UNSIGNED COMMENT "PID of node process on host",`angel_process_id` INT UNSIGNED COMMENT "PID of node\'s angel process, if any",`process_name` VARCHAR(512) COMMENT "Node\'s executable process name",`connection_name` VARCHAR(512) COMMENT "Connection name of API node",`application_port` INT UNSIGNED COMMENT "Node\'s declared application port number") COMMENT="Process ID and Name information for connected nodes" ENGINE=NDBINFO','SET @dummy = 0');
3111+
PREPARE stmt FROM @str;
3112+
EXECUTE stmt;
3113+
DROP PREPARE stmt;
3114+
30993115
# ndbinfo.ndb$resources
31003116
SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$resources`','SET @dummy = 0');
31013117
PREPARE stmt FROM @str;
@@ -3502,6 +3518,12 @@ PREPARE stmt FROM @str;
35023518
EXECUTE stmt;
35033519
DROP PREPARE stmt;
35043520

3521+
# ndbinfo.processes
3522+
SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`processes` AS SELECT DISTINCT node_id, CASE node_type WHEN 0 THEN "NDB" WHEN 1 THEN "API" WHEN 2 THEN "MGM" ELSE NULL END AS node_type, host_addr, node_version, NULLIF(process_id, 0) AS process_id, NULLIF(angel_process_id, 0) AS angel_process_id, process_name, connection_name, NULLIF(application_port, 0) AS application_port FROM `ndbinfo`.`ndb$processes`','SET @dummy = 0');
3523+
PREPARE stmt FROM @str;
3524+
EXECUTE stmt;
3525+
DROP PREPARE stmt;
3526+
35053527
# ndbinfo.resources
35063528
SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`resources` AS SELECT node_id, CASE resource_id WHEN 0 THEN "RESERVED" WHEN 1 THEN "DISK_OPERATIONS" WHEN 2 THEN "DISK_RECORDS" WHEN 3 THEN "DATA_MEMORY" WHEN 4 THEN "JOBBUFFER" WHEN 5 THEN "FILE_BUFFERS" WHEN 6 THEN "TRANSPORTER_BUFFERS" WHEN 7 THEN "DISK_PAGE_BUFFER" WHEN 8 THEN "QUERY_MEMORY" WHEN 9 THEN "SCHEMA_TRANS_MEMORY" ELSE "<unknown>" END AS resource_name, reserved, used, max FROM `ndbinfo`.`ndb$resources`','SET @dummy = 0');
35073529
PREPARE stmt FROM @str;

storage/ndb/src/kernel/vm/Ndbinfo.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ class Ndbinfo {
7676
TABLE_DIST_STATUS_ALL_TABLEID =34,
7777
TABLE_FRAGMENTS_ALL_TABLEID =35,
7878
TABLE_REPLICAS_ALL_TABLEID = 36,
79-
STORED_TABLES_TABLEID = 37
79+
STORED_TABLES_TABLEID = 37,
80+
PROCESSES_TABLEID = 38
8081
};
8182

8283
struct Table {

storage/ndb/src/kernel/vm/NdbinfoTables.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,21 @@ DECLARE_NDBINFO_TABLE(STORED_TABLES, 20) =
872872
}
873873
};
874874

875+
DECLARE_NDBINFO_TABLE(PROCESSES, 10) =
876+
{ { "processes", 10, 0, "Process ID and Name information for connected nodes" },
877+
{
878+
{ "reporting_node_id", Ndbinfo::Number, "Reporting data node ID"},
879+
{ "node_id", Ndbinfo::Number, "Connected node ID"},
880+
{ "node_type", Ndbinfo::Number, "Type of node"},
881+
{ "host_addr", Ndbinfo::String, "IPv4 address of connected node"},
882+
{ "node_version", Ndbinfo::String, "Node MySQL Cluster version string"},
883+
{ "process_id", Ndbinfo::Number, "PID of node process on host"},
884+
{ "angel_process_id", Ndbinfo::Number, "PID of node\\\'s angel process, if any"},
885+
{ "process_name", Ndbinfo::String, "Node\\\'s executable process name"},
886+
{ "connection_name", Ndbinfo::String, "Connection name of API node"},
887+
{ "application_port", Ndbinfo::Number, "Node\\\'s declared application port number"}
888+
}
889+
};
875890
#define DBINFOTBL(x) { Ndbinfo::x##_TABLEID, (Ndbinfo::Table*)&ndbinfo_##x }
876891

877892
static
@@ -918,7 +933,8 @@ struct ndbinfo_table_list_entry {
918933
DBINFOTBL(TABLE_DIST_STATUS_ALL),
919934
DBINFOTBL(TABLE_FRAGMENTS_ALL),
920935
DBINFOTBL(TABLE_REPLICAS_ALL),
921-
DBINFOTBL(STORED_TABLES)
936+
DBINFOTBL(STORED_TABLES),
937+
DBINFOTBL(PROCESSES)
922938
};
923939

924940
static int no_ndbinfo_tables =

storage/ndb/tools/ndbinfo_sql.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,21 @@ struct view {
430430
"LEFT JOIN `<NDBINFO_DB>`.config_params cp4 ON p.config_param4 = cp4.param_number"
431431
},
432432
#endif
433+
{ "processes",
434+
"SELECT DISTINCT node_id, "
435+
"CASE node_type"
436+
" WHEN 0 THEN \"NDB\""
437+
" WHEN 1 THEN \"API\""
438+
" WHEN 2 THEN \"MGM\""
439+
" ELSE NULL "
440+
" END AS node_type, "
441+
" host_addr, node_version, "
442+
" NULLIF(process_id, 0) AS process_id, "
443+
" NULLIF(angel_process_id, 0) AS angel_process_id, "
444+
" process_name, connection_name, "
445+
" NULLIF(application_port, 0) AS application_port "
446+
"FROM `<NDBINFO_DB>`.`<TABLE_PREFIX>processes`"
447+
},
433448
{ "resources",
434449
"SELECT node_id, "
435450
" CASE resource_id"

0 commit comments

Comments
 (0)