Skip to content

Commit 47d37af

Browse files
committed
wl#9819 Version 2. Patch #10: set service URI from memcached
1 parent 85fc3de commit 47d37af

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

storage/ndb/memcache/include/ClusterConnectionPool.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2011, Oracle and/or its affiliates. All rights
2+
Copyright (c) 2011, 2017 Oracle and/or its affiliates. All rights
33
reserved.
44
55
This program is free software; you can redistribute it and/or
@@ -81,12 +81,6 @@ class ClusterConnectionPool {
8181

8282
/* Inline functions */
8383

84-
inline void ClusterConnectionPool::setMainConnection(Ndb_cluster_connection *c) {
85-
main_conn = c;
86-
pool_size = 1;
87-
pool_connections[0] = c;
88-
}
89-
9084
inline Ndb_cluster_connection * ClusterConnectionPool::getPooledConnection(int i) const {
9185
return pool_connections[i % pool_size];
9286
}

storage/ndb/memcache/src/ClusterConnectionPool.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights
2+
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights
33
reserved.
44
55
This program is free software; you can redistribute it and/or
@@ -157,6 +157,16 @@ ClusterConnectionPool::~ClusterConnectionPool() {
157157
}
158158

159159

160+
/* setMainConnection()
161+
*/
162+
void ClusterConnectionPool::setMainConnection(Ndb_cluster_connection *c) {
163+
main_conn = c;
164+
pool_size = 1;
165+
pool_connections[0] = c;
166+
c->set_service_uri("memcache", NULL, 0, "");
167+
}
168+
169+
160170
/* addPooledConnection()
161171
*/
162172
Ndb_cluster_connection * ClusterConnectionPool::addPooledConnection() {
@@ -169,6 +179,9 @@ Ndb_cluster_connection * ClusterConnectionPool::addPooledConnection() {
169179

170180
if(conn && conn->node_id()) {
171181
pool_connections[pool_size++] = conn;
182+
char uri_query_buff[32];
183+
snprintf(uri_query_buff, sizeof(uri_query_buff), "?connection=%d", pool_size);
184+
conn->set_service_uri("memcache", NULL, 0, uri_query_buff);
172185
}
173186
else {
174187
logger->log(LOG_WARNING, 0, " Failed to grow connection pool.\n");

0 commit comments

Comments
 (0)