Bug #41592 ndb-cluster-connection-pool should [WARNING] when all connection do not connect
Submitted: 18 Dec 2008 15:40 Modified: 18 Dec 2008 15:40
Reporter: Jonathan Miller Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-7.0 OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D4 (Minor) / R2 (Low) / E2 (Low)

[18 Dec 2008 15:40] Jonathan Miller
Description:
If you set ndb-cluster-connection-pool to more connection then there are [API] slots the MySQLD will connect to as many as possible. 

Yet there is nothing in the MySQLD (error) log telling DBA's that there are connections that can not be used.

How to repeat:
set ndb-cluster-connection-pool to a higher value then there are [API] slots in the cluster.

Suggested fix:
There should be both an [INFO] and a [WARNING] message in the mysqld log.

[INFO] NDB Connected # out of # ndb-cluster-connection-pool

[WARNING] # connection of ndb-cluster-connection-pool did not connect. Please check that there are enough API slots configured on cluster.
[2 Feb 2009 7:15] Matthew Montgomery
Additionally, mysqld attempts to balance client threads against unestablished connections.

For example, If you have 1 slot available to a node and ndb-cluster-connection-pool=2 then 1/2 of your connections with ndb commands, will not succeed. If you have 3 slots available and you have ndb-cluster-connection-pool=4 then 1/4 will fail.

$ cat my.cnf
[mysqld]
datadir=/home/matt/mysql/sandbox/63/data
port=3363
socket=/tmp/mysql63.sock
ndbcluster
ndb-connectstring=bouchon
ndb_cluster_connection_pool=2

$ cat config.ini 
[NDBD DEFAULT]
NoOfReplicas	= 2
Datadir		= /home/matt/mysql/sandbox/63/cluster
MemReportFrequency	= 60
MaxNoOfConcurrentOperations=20000
# MaxNoOfOrderedIndexes = 25
StopOnError = 1 

[NDB_MGMD]
Hostname	= bouchon
Datadir		= /home/matt/mysql/sandbox/63/cluster

[NDBD]
Hostname	= bouchon
[NDBD]
Hostname	= bouchon

[MYSQLD]
Hostname	= bouchon

$ ./bin/ndb_mgm -e 'show';
Connected to Management Server at: bouchon:1186
Cluster Configuration
---------------------
[ndbd(NDB)]	2 node(s)
id=2	@192.168.23.10  (mysql-5.1.28 ndb-6.3.18, Nodegroup: 0, Master)
id=3	@192.168.23.10  (mysql-5.1.28 ndb-6.3.18, Nodegroup: 0)

[ndb_mgmd(MGM)]	1 node(s)
id=1	@192.168.23.10  (mysql-5.1.28 ndb-6.3.18)

[mysqld(API)]	1 node(s)
id=4	@192.168.23.10  (mysql-5.1.28 ndb-6.3.18)

$ mysql -S /tmp/mysql63.sock  test -e "show tables; CREATE TABLE foo (a int(11)) engine=ndb; drop table foo;"; 
$ mysql -S /tmp/mysql63.sock  test -e "show tables; CREATE TABLE foo (a int(11)) engine=ndb; drop table foo;"; 
ERROR 1005 (HY000) at line 1: Can't create table 'test.foo' (errno: 157)

Handle failed API connections gracefully and only balance MySQL threads against established connections.