18 #include "Ndbinfo.hpp"
21 #define DECLARE_NDBINFO_TABLE(var, num) \
22 static const struct { \
23 Ndbinfo::Table::Members m; \
24 Ndbinfo::Column col[num]; \
28 DECLARE_NDBINFO_TABLE(TABLES,3) =
29 { {
"tables", 3, 0,
"metadata for tables available through ndbinfo" },
31 {
"table_id", Ndbinfo::Number,
""},
33 {
"table_name",Ndbinfo::String,
""},
34 {
"comment", Ndbinfo::String,
""}
38 DECLARE_NDBINFO_TABLE(COLUMNS,5) =
39 { {
"columns", 5, 0,
"metadata for columns available through ndbinfo " },
41 {
"table_id", Ndbinfo::Number,
""},
42 {
"column_id", Ndbinfo::Number,
""},
44 {
"column_name", Ndbinfo::String,
""},
45 {
"column_type", Ndbinfo::Number,
""},
46 {
"comment", Ndbinfo::String,
""}
50 DECLARE_NDBINFO_TABLE(TEST,5) =
51 { {
"test", 5, 0,
"for testing" },
53 {
"node_id", Ndbinfo::Number,
""},
54 {
"block_number", Ndbinfo::Number,
""},
55 {
"block_instance", Ndbinfo::Number,
""},
57 {
"counter", Ndbinfo::Number,
""},
58 {
"counter2", Ndbinfo::Number64,
""}
62 DECLARE_NDBINFO_TABLE(POOLS,12) =
63 { {
"pools", 12, 0,
"pool usage" },
65 {
"node_id", Ndbinfo::Number,
""},
66 {
"block_number", Ndbinfo::Number,
""},
67 {
"block_instance", Ndbinfo::Number,
""},
68 {
"pool_name", Ndbinfo::String,
""},
70 {
"used", Ndbinfo::Number64,
"currently in use"},
71 {
"total", Ndbinfo::Number64,
"total allocated"},
72 {
"high", Ndbinfo::Number64,
"in use high water mark"},
73 {
"entry_size", Ndbinfo::Number64,
"size in bytes of each object"},
74 {
"config_param1", Ndbinfo::Number,
"config param 1 affecting pool"},
75 {
"config_param2", Ndbinfo::Number,
"config param 2 affecting pool"},
76 {
"config_param3", Ndbinfo::Number,
"config param 3 affecting pool"},
77 {
"config_param4", Ndbinfo::Number,
"config param 4 affecting pool"}
81 DECLARE_NDBINFO_TABLE(TRANSPORTERS, 3) =
82 { {
"transporters", 3, 0,
"transporter status" },
84 {
"node_id", Ndbinfo::Number,
""},
85 {
"remote_node_id", Ndbinfo::Number,
""},
87 {
"connection_status", Ndbinfo::Number,
""}
91 DECLARE_NDBINFO_TABLE(LOGSPACES, 7) =
92 { {
"logspaces", 7, 0,
"logspace usage" },
94 {
"node_id", Ndbinfo::Number,
""},
95 {
"log_type", Ndbinfo::Number,
"0 = REDO, 1 = DD-UNDO"},
96 {
"log_id", Ndbinfo::Number,
""},
97 {
"log_part", Ndbinfo::Number,
""},
99 {
"total", Ndbinfo::Number64,
"total allocated"},
100 {
"used", Ndbinfo::Number64,
"currently in use"},
101 {
"high", Ndbinfo::Number64,
"in use high water mark"}
105 DECLARE_NDBINFO_TABLE(LOGBUFFERS, 7) =
106 { {
"logbuffers", 7, 0,
"logbuffer usage" },
108 {
"node_id", Ndbinfo::Number,
""},
109 {
"log_type", Ndbinfo::Number,
"0 = REDO, 1 = DD-UNDO"},
110 {
"log_id", Ndbinfo::Number,
""},
111 {
"log_part", Ndbinfo::Number,
""},
113 {
"total", Ndbinfo::Number64,
"total allocated"},
114 {
"used", Ndbinfo::Number64,
"currently in use"},
115 {
"high", Ndbinfo::Number64,
"in use high water mark"}
119 DECLARE_NDBINFO_TABLE(RESOURCES,6) =
120 { {
"resources", 6, 0,
"resources usage (a.k.a superpool)" },
122 {
"node_id", Ndbinfo::Number,
""},
123 {
"resource_id", Ndbinfo::Number,
""},
125 {
"reserved", Ndbinfo::Number,
"reserved for this resource"},
126 {
"used", Ndbinfo::Number,
"currently in use"},
127 {
"max", Ndbinfo::Number,
"max available"},
128 {
"high", Ndbinfo::Number,
"in use high water mark"}
132 DECLARE_NDBINFO_TABLE(COUNTERS,5) =
133 { {
"counters", 5, 0,
"monotonic counters" },
135 {
"node_id", Ndbinfo::Number,
""},
136 {
"block_number", Ndbinfo::Number,
""},
137 {
"block_instance", Ndbinfo::Number,
""},
138 {
"counter_id", Ndbinfo::Number,
""},
140 {
"val", Ndbinfo::Number64,
"monotonically increasing since process start"}
144 DECLARE_NDBINFO_TABLE(NODES,5) =
145 { {
"nodes", 5, 0,
"node status" },
147 {
"node_id", Ndbinfo::Number,
""},
149 {
"uptime", Ndbinfo::Number64,
"time in seconds that node has been running"},
150 {
"status", Ndbinfo::Number,
"starting/started/stopped etc."},
151 {
"start_phase", Ndbinfo::Number,
"start phase if node is starting"},
152 {
"config_generation", Ndbinfo::Number,
"configuration generation number"}
156 DECLARE_NDBINFO_TABLE(DISKPAGEBUFFER, 9) =
157 { {
"diskpagebuffer", 9, 0,
"disk page buffer info" },
159 {
"node_id", Ndbinfo::Number,
""},
160 {
"block_instance", Ndbinfo::Number,
""},
162 {
"pages_written", Ndbinfo::Number64,
"Pages written to disk"},
163 {
"pages_written_lcp", Ndbinfo::Number64,
"Pages written by local checkpoint"},
164 {
"pages_read", Ndbinfo::Number64,
"Pages read from disk"},
165 {
"log_waits", Ndbinfo::Number64,
"Page writes waiting for log to be written to disk"},
166 {
"page_requests_direct_return", Ndbinfo::Number64,
"Page in buffer and no requests waiting for it"},
167 {
"page_requests_wait_queue", Ndbinfo::Number64,
"Page in buffer, but some requests are already waiting for it"},
168 {
"page_requests_wait_io", Ndbinfo::Number64,
"Page not in buffer, waiting to be read from disk"},
172 #define DBINFOTBL(x) { Ndbinfo::x##_TABLEID, (Ndbinfo::Table*)&ndbinfo_##x }
175 struct ndbinfo_table_list_entry {
178 } ndbinfo_tables[] = {
185 DBINFOTBL(TRANSPORTERS),
186 DBINFOTBL(LOGSPACES),
187 DBINFOTBL(LOGBUFFERS),
188 DBINFOTBL(RESOURCES),
191 DBINFOTBL(DISKPAGEBUFFER)
194 static int no_ndbinfo_tables =
195 sizeof(ndbinfo_tables) /
sizeof(ndbinfo_tables[0]);
198 int Ndbinfo::getNumTables(){
199 return no_ndbinfo_tables;
204 assert(i >= 0 && i < no_ndbinfo_tables);
205 ndbinfo_table_list_entry&
entry = ndbinfo_tables[
i];
206 assert(entry.id == i);
212 return getTable((
int)i);