Skip to content

Commit 16e1cc0

Browse files
committed
wl#10321 new mysqld status variable Ndb_system_name
1 parent f5c874f commit 16e1cc0

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

mysql-test/suite/ndb/r/ndb_basic.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Ndb_scan_count #
110110
Ndb_schema_locks_count #
111111
Ndb_slave_max_replicated_epoch #
112112
Ndb_sorted_scan_count #
113+
Ndb_system_name #
113114
SHOW GLOBAL VARIABLES WHERE Variable_name LIKE 'ndb\_%' and
114115
Variable_name NOT LIKE 'ndb_dbg\_%';
115116
Variable_name Value

sql/ha_ndbcluster.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ static int update_status_variables(Thd_ndb *thd_ndb,
660660
}
661661
ns->number_of_data_nodes= c->no_db_nodes();
662662
ns->connect_count= c->get_connect_count();
663+
ns->system_name = c->get_system_name();
663664
ns->last_commit_epoch_server= ndb_get_latest_trans_gci();
664665
if (thd_ndb)
665666
{
@@ -781,6 +782,7 @@ SHOW_VAR ndb_status_variables_dynamic[]= {
781782
{"last_commit_epoch_session",
782783
(char*) &g_ndb_status.last_commit_epoch_session,
783784
SHOW_LONGLONG, SHOW_SCOPE_GLOBAL},
785+
{"system_name", (char*) &g_ndb_status.system_name, SHOW_CHAR_PTR, SHOW_SCOPE_GLOBAL},
784786
{NullS, NullS, SHOW_LONG, SHOW_SCOPE_GLOBAL}
785787
};
786788

sql/ha_ndbcluster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ struct st_ndb_status {
131131
long transaction_no_hint_count[MAX_NDB_NODES];
132132
long transaction_hint_count[MAX_NDB_NODES];
133133
long long api_client_stats[Ndb::NumClientStatistics];
134+
const char * system_name;
134135
};
135136

136137
int ndbcluster_commit(handlerton *hton, THD *thd, bool all);

storage/ndb/include/ndbapi/ndb_cluster_connection.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -203,6 +203,11 @@ class Ndb_cluster_connection {
203203
void set_auto_reconnect(int value);
204204
int get_auto_reconnect() const;
205205

206+
/**
207+
* Get system.name from cluster configuration
208+
*/
209+
const char * get_system_name() const;
210+
206211
/**
207212
* Collect client statistics for all Ndb objects in this connection
208213
* Note that this locks the ndb objects while collecting data.

storage/ndb/src/ndbapi/ndb_cluster_connection.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -1154,6 +1154,13 @@ Ndb_cluster_connection_impl::configure(Uint32 nodeId,
11541154
m_config.m_waitfor_timeout = timeout;
11551155
}
11561156
}
1157+
1158+
// System name
1159+
ndb_mgm_configuration_iterator s_iter(config, CFG_SECTION_SYSTEM);
1160+
const char * tmp_system_name;
1161+
s_iter.get(CFG_SYS_NAME, & tmp_system_name);
1162+
m_system_name.assign(tmp_system_name);
1163+
11571164
DBUG_RETURN(init_nodes_vector(nodeId, config));
11581165
}
11591166

@@ -1224,6 +1231,11 @@ void Ndb_cluster_connection::set_application_address(const char * addr, int port
12241231
m_impl.set_application_address(addr, port);
12251232
}
12261233

1234+
const char * Ndb_cluster_connection::get_system_name() const
1235+
{
1236+
return m_impl.m_system_name.c_str();
1237+
}
1238+
12271239
int Ndb_cluster_connection_impl::connect(int no_retries,
12281240
int retry_delay_in_seconds,
12291241
int verbose)

storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by

0 commit comments

Comments
 (0)