Skip to content

Commit 4a79351

Browse files
author
Andrzej Religa
committed
Merge branch 'mysql-8.0' into mysql-trunk
Change-Id: If3700cb77730c3bd4b01807d196cccc6bcc3fb5c
2 parents e529ad1 + 4d4be52 commit 4a79351

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

router/src/metadata_cache/src/cluster_metadata_gr.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,17 +1395,19 @@ static std::optional<size_t> target_cluster_pos(
13951395

13961396
std::optional<metadata_cache::metadata_server_t>
13971397
GRClusterSetMetadataBackend::find_rw_server() {
1398-
for (auto &cluster : (*cluster_topology_).clusters_data) {
1399-
if (!cluster.is_primary) continue;
1398+
if (cluster_topology_) {
1399+
for (auto &cluster : (*cluster_topology_).clusters_data) {
1400+
if (!cluster.is_primary) continue;
14001401

1401-
log_debug("Updating the status of cluster '%s' to find the writable node",
1402-
cluster.name.c_str());
1402+
log_debug("Updating the status of cluster '%s' to find the writable node",
1403+
cluster.name.c_str());
14031404

1404-
// we need to connect to the Primary Cluster and query its GR status to
1405-
// figure out the current Primary node
1406-
metadata_->update_cluster_status_from_gr(false, cluster);
1405+
// we need to connect to the Primary Cluster and query its GR status to
1406+
// figure out the current Primary node
1407+
metadata_->update_cluster_status_from_gr(false, cluster);
14071408

1408-
return metadata_->find_rw_server(cluster.members);
1409+
return metadata_->find_rw_server(cluster.members);
1410+
}
14091411
}
14101412

14111413
return std::nullopt;

0 commit comments

Comments
 (0)