MCPcopy Create free account
hub / github.com/ByConity/ByConity / fetchMasterVariablesValue

Method fetchMasterVariablesValue

src/Databases/MySQL/MaterializeMetadata.cpp:135–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void MaterializeMetadata::fetchMasterVariablesValue(const mysqlxx::PoolWithFailover::Entry & connection)
136{
137 Block variables_header{
138 {std::make_shared<DataTypeString>(), "Variable_name"},
139 {std::make_shared<DataTypeString>(), "Value"}
140 };
141
142 const String & fetch_query = "SHOW VARIABLES WHERE Variable_name = 'binlog_checksum'";
143 StreamSettings mysql_input_stream_settings(settings, false, true);
144 MySQLBlockInputStream variables_input(connection, fetch_query, variables_header, mysql_input_stream_settings);
145
146 while (Block variables_block = variables_input.read())
147 {
148 ColumnPtr variables_name = variables_block.getByName("Variable_name").column;
149 ColumnPtr variables_value = variables_block.getByName("Value").column;
150
151 for (size_t index = 0; index < variables_block.rows(); ++index)
152 {
153 if (variables_name->getDataAt(index) == "binlog_checksum")
154 binlog_checksum = variables_value->getDataAt(index).toString();
155 }
156 }
157}
158
159static bool checkSyncUserPrivImpl(const mysqlxx::PoolWithFailover::Entry & connection, const Settings & global_settings, WriteBuffer & out)
160{

Callers 1

onEventMethod · 0.80

Calls 5

getByNameMethod · 0.80
readMethod · 0.45
rowsMethod · 0.45
getDataAtMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected