Skip to content

Commit

Permalink
WL#15154 patch #6 Add "encrypted" column to ndbinfo.transporters
Browse files Browse the repository at this point in the history
This patch exposes the transporter-level encrypted flag for
publication in ndbinfo.transporters.

Change-Id: I7bab7d437aaae001c4d4298ef9f827632401785f
  • Loading branch information
jdduncan committed Jul 18, 2023
1 parent 8c9b493 commit bc05ac9
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mysql-test/suite/ndb/r/ndbinfo.result
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ SELECT COUNT(*) FROM ndb$tables t, ndb$columns c
WHERE t.table_id = c.table_id AND
t.table_id in (1,2,3,4,5,6);
COUNT(*)
49
50

SELECT table_id, table_name, comment from ndb$tables
WHERE table_id > 2 AND table_id <= 5 ORDER BY table_id;
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/ndb/r/ndbinfo_plans.result
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ndb$acc_operations 15 64
ndb$backup_id 1 20
ndb$blocks 29 20
ndb$certificates 34 44
ndb$columns 535 44
ndb$columns 536 44
ndb$config_nodes 34 28
ndb$counters 200 24
ndb$dblqh_tcconnect_state 19 52
Expand Down Expand Up @@ -105,7 +105,7 @@ ndb$threadblocks 124 16
ndb$threads 26 40
ndb$threadstat 22 144
ndb$transactions 5 44
ndb$transporters 32 64
ndb$transporters 32 68

CALL populate_sizes();

Expand Down
15 changes: 15 additions & 0 deletions mysql-test/suite/ndb_tls/sign_keys.result
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
SELECT 1;
1
1
SELECT node_id, remote_node_id, encrypted from ndbinfo.transporters
ORDER BY node_id;
node_id remote_node_id encrypted
1 2 0
1 3 0
1 51 0
1 52 0
1 53 0
1 54 0
2 1 0
2 3 0
2 51 0
2 52 0
2 53 0
2 54 0
ndb-api-cert
ndb-api-private-key
ndb-data-node-cert
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/suite/ndb_tls/sign_keys.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# The MySQL server is up
SELECT 1;

# Look at the transporters table
SELECT node_id, remote_node_id, encrypted from ndbinfo.transporters
ORDER BY node_id;

# On startup, none of the files exist
--error 1
--file_exists $MYSQLTEST_VARDIR/mysql_cluster.1/NDB-Cluster-cert
Expand Down
1 change: 1 addition & 0 deletions storage/ndb/include/transporter/TransporterRegistry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ class TransporterRegistry
Transporter* get_node_transporter(NodeId nodeId) const;
bool is_shm_transporter(NodeId nodeId);
ndb_sockaddr get_connect_address(NodeId node_id) const;
bool is_encrypted_link(NodeId) const;

Uint64 get_bytes_sent(NodeId nodeId) const;
Uint64 get_bytes_received(NodeId nodeId) const;
Expand Down
2 changes: 1 addition & 1 deletion storage/ndb/plugin/ha_ndbinfo_sql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ static struct view {
" END AS status, "
" remote_address, bytes_sent, bytes_received, "
" connect_count, "
" overloaded, overload_count, slowdown, slowdown_count "
" overloaded, overload_count, slowdown, slowdown_count, encrypted "
"FROM `ndbinfo`.`ndb$transporters`"},
};

Expand Down
7 changes: 4 additions & 3 deletions storage/ndb/src/common/debugger/NdbinfoTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ DECLARE_NDBINFO_TABLE(POOLS,14) =
}
};

DECLARE_NDBINFO_TABLE(TRANSPORTERS, 11) =
{ { "transporters", 11, 0,
DECLARE_NDBINFO_TABLE(TRANSPORTERS, 12) =
{ { "transporters", 12, 0,
[] (const Ndbinfo::Counts &counts) {
return (counts.data_nodes) * (counts.all_nodes - 1); },
"transporter status" },
Expand All @@ -135,7 +135,8 @@ DECLARE_NDBINFO_TABLE(TRANSPORTERS, 11) =
{"overload_count", Ndbinfo::Number, "Number of overload onsets since connect"},

{"slowdown", Ndbinfo::Number, "Is link requesting slowdown"},
{"slowdown_count", Ndbinfo::Number, "Number of slowdown onsets since connect"}
{"slowdown_count", Ndbinfo::Number, "Number of slowdown onsets since connect"},
{"encrypted", Ndbinfo::Number, "Is link using TLS encryption"}
}
};

Expand Down
7 changes: 7 additions & 0 deletions storage/ndb/src/common/transporter/Multi_Transporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,10 @@ Multi_Transporter::switch_active_trp()
}
m_num_inactive_transporters = save_num_active_transporters;
}

bool
Multi_Transporter::is_encrypted() const {
if(m_num_active_transporters)
return m_active_transporters[0]->is_encrypted();
return false;
}
2 changes: 2 additions & 0 deletions storage/ndb/src/common/transporter/Multi_Transporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class Multi_Transporter : public Transporter {
return m_inactive_transporters[index];
}

bool is_encrypted() const override;

private:
/**
* Allocate buffers for sending and receiving
Expand Down
1 change: 1 addition & 0 deletions storage/ndb/src/common/transporter/Transporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class Transporter {
Uint32 get_max_send_buffer() { return m_max_send_buffer; }

Uint32 get_connect_count() { return m_connect_count; }
virtual bool is_encrypted() const { return m_encrypted; }

void inc_overload_count() { m_overload_count++; }
Uint32 get_overload_count() { return m_overload_count; }
Expand Down
6 changes: 6 additions & 0 deletions storage/ndb/src/common/transporter/TransporterRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3738,6 +3738,12 @@ TransporterRegistry::is_shm_transporter(TrpId trp_id)
return false;
}

bool
TransporterRegistry::is_encrypted_link(NodeId nodeId) const
{
return theNodeIdTransporters[nodeId]->is_encrypted();
}

Transporter*
TransporterRegistry::get_transporter(TrpId trp_id) const
{
Expand Down
4 changes: 4 additions & 0 deletions storage/ndb/src/kernel/blocks/trpman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ Trpman::execDBINFO_SCANREQ(Signal *signal)
row.write_uint32(globalTransporterRegistry.get_overload_count(rnode));
row.write_uint32(globalTransporterRegistry.get_status_slowdown().get(rnode));
row.write_uint32(globalTransporterRegistry.get_slowdown_count(rnode));

/* TLS */
row.write_uint32(globalTransporterRegistry.is_encrypted_link(rnode));

ndbinfo_send_row(signal, req, row, rl);
break;
}
Expand Down

0 comments on commit bc05ac9

Please sign in to comment.