Bug #62635 ndb_size.pl not taking port number correctly
Submitted: 5 Oct 2011 20:52 Modified: 4 Apr 2012 21:21
Reporter: Douglas Van Hollen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1.56-ndb-7.1.15-cluster-gpl-log OS:Any (RHEL 5.7)
Assigned to: MySQL Verification Team CPU Architecture:Any

[5 Oct 2011 20:52] Douglas Van Hollen
Description:
Attempting to run ndb_size.pl against a MySQL not on the default port fails.  Hard-coding the port in the script succeeds.

How to repeat:
Supposing your target MySQL server is running on port 3364 (like mine), this happens:

[myhost] > bin/ndb_size.pl --database=myDatabase --hostname=myhost:3364--user=**** --password=******
DBI connect('host=myhost:3364','****',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at bin/ndb_size.pl line 467

You can get around this problem by changing line 467 in ndb_size.pl to this:

 $dbh= DBI->connect("DBI:mysql:host=myhost;port=3364", '****', '******') or exit(1);

Suggested fix:
I don't think that DBI accepts "hostname:portnumber" as a value for "DBI:mysql:host=".  

Either allow "--port=" as a commandline argument or parse the host:port connection string given by the user, and then change the connect() call to separately assign host and port, like "host=$host;port=$port".
[7 Oct 2011 7:39] Valeriy Kravchuk
Code itself says:

    print STDERR "\t--hostname=<host>:<port> can be used to designate a "
        ."specific port\n";

So, looks like usage of <host>:<port> syntax was assumed... But then we see how hostname is used:

    my $dsn = "DBI:mysql:host=$hostname";

and this may lead to problems, as expected syntax is:

DBI:mysql:host:port
[29 Mar 2012 14:27] MySQL Verification Team
(revid:memontgo@memontgo-vmoel6-20120321214405-kny8qkiqmfm8ajtq)
(version source
revid:memontgo@memontgo-vmoel6-20120321214405-kny8qkiqmfm8ajtq)
(merge vers: 5.1.61-ndb-6.3.49) (trigger:102)
Pushed into mysql-5.1-telco-7.0 5.1.61-ndb-7.0.32
(revid:frazer.clement@oracle.com-20120323124328-8xmgzvvfbdox9hv3)
(version source
revid:frazer.clement@oracle.com-20120323124328-8xmgzvvfbdox9hv3)
(merge vers: 5.1.61-ndb-7.0.32) (trigger:102)
Pushed into mysql-5.1-telco-7.1 5.1.61-ndb-7.1.21
(revid:frazer.clement@oracle.com-20120323124529-ltmev6567y38wrra)
(version source
revid:frazer.clement@oracle.com-20120323124529-ltmev6567y38wrra)
(merge vers: 5.1.61-ndb-7.1.21) (trigger:102)
[4 Apr 2012 21:21] Jon Stephens
Fixed in NDB 6.3+. Documented in the NDB 6.3.49, 7.0.32, 7.1.21, and 7.2.6 changelogs as follows:

    When trying to use ndb_size.pl --hostname=host:port to connect 
    to a MySQL server running on a nonstandard port, the port
    argument was ignored.

Closed.