How to detect the use of NDB cluster as the default engine
SHOW VARIABLES has the following values of interest
Variable_name Value
storage_engine ndbcluster
have_ndbcluster YES
t/mysql.dbtest does not currently have a section for ndbcluster under
sub have_transactions ()
Basic patch to t/mysql.dbtest may look like the following but not tested
it atm so got no idea of cascade effect this has.
--- mysql.dbtest 2009-09-15 02:57:53.000000000 +0100
+++ patch/mysql.dbtest 2010-01-20 17:22:32.000000000 +0000
@@ -58,6 +58,11 @@
$have_transactions = "gemini";
last;
}
+ if ($row->{'Variable_name'} eq 'have_ndbcluster' &&
+ $row->{'Value'} eq 'YES') {
+ $have_transactions = "ndbcluster";
+ last;
+ }
}
}
return $have_transactions;
For the initial bug this should be enough :
--- 40keyinfo.t 2009-09-15 02:57:53.000000000 +0100
+++ patch/40keyinfo.t 2010-01-20 17:24:38.000000000 +0000
@@ -26,7 +26,7 @@
# Non-primary key is there as a regression test for Bug #26786.
ok($dbh->do("CREATE TABLE $table (a int, b varchar(20), c int,
- primary key (a,b(10)), key (c))"),
+ primary key (a,b), key (c))"),
"Created table $table");
my $sth= $dbh->primary_key_info(undef, undef, $table);
Hope this helps
Paddy
On Wed Jan 20 11:17:38 2010, UNDERMINE wrote:
Show quoted text> Tests fail if database uses NDB as the mysql servers default storage
> engine for tables and force install is required.
>
> Failed Test Stat Wstat Total Fail Failed List of Failed
>
-------------------------------------------------------------------------------
Show quoted text> t/40keyinfo.t 255 65280 7 10 142.86% 3-7
> 1 test skipped.
> Failed 1/36 test scripts, 97.22% okay. 5/745 subtests failed, 99.33%
> okay.
> make: *** [test_dynamic] Error 255
> /usr/bin/make test -- NOT OK
>
>
> The line that causes the issue is :-
> CREATE TABLE $table (a int, b varchar(20), c int, primary key
> (a,b(10)),
> key (c));
>
> This returns
> ERROR 1089 (HY000): Incorrect prefix key; the used key part isn't a
> string, the used length is longer than the key part, or the storage
> engine doesn't support unique prefix keys
>
> However the following versions do create the table :-
> CREATE TABLE $table (a int, b varchar(20), c int, primary key (a,b),
> key
> (c));
>
> CREATE TABLE $table (a int, b varchar(20), c int, primary key
> (a,b(10)),
> key (c)) engine=innodb;
>
> So the problem is NDB not supporting partial column primary key
> indexes.
>
> Hope that helps
>
> Paddy