Commit 29afba7c authored by unknown's avatar unknown

Cleanups

Don't run upgrade.test with embedded server as it requires mysqlcheck


mysql-test/r/upgrade.result:
  Change database names to start with mysqltest
mysql-test/t/upgrade.test:
  Change database names to start with mysqltest
  Don't run test with embedded server as it requires mysqlcheck
sql/ha_ndbcluster.cc:
  Code style cleanups
  more dbugging
sql/ha_ndbcluster_binlog.cc:
  Free table_share properly in case of errors
  More debugging
parent d3f2988a
drop database if exists `testdb1`;
drop database if exists `testdb-1`;
drop database if exists `#mysql50#testdb-1`;
create database `testdb1`;
create database `#mysql50#testdb-1`;
create table `testdb1`.`t1` (a int);
create table `testdb1`.`#mysql50#t-1` (a int);
create table `#mysql50#testdb-1`.`t1` (a int);
create table `#mysql50#testdb-1`.`#mysql50#t-1` (a int);
show create database `testdb1`;
drop database if exists `mysqltest1`;
drop database if exists `mysqltest-1`;
drop database if exists `#mysql50#mysqltest-1`;
create database `mysqltest1`;
create database `#mysql50#mysqltest-1`;
create table `mysqltest1`.`t1` (a int);
create table `mysqltest1`.`#mysql50#t-1` (a int);
create table `#mysql50#mysqltest-1`.`t1` (a int);
create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
show create database `mysqltest1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
ERROR 42000: Unknown database 'testdb-1'
show create database `#mysql50#testdb-1`;
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `mysqltest-1`;
ERROR 42000: Unknown database 'mysqltest-1'
show create database `#mysql50#mysqltest-1`;
Database Create Database
#mysql50#testdb-1 CREATE DATABASE `#mysql50#testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show tables in `testdb1`;
Tables_in_testdb1
#mysql50#mysqltest-1 CREATE DATABASE `#mysql50#mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show tables in `mysqltest1`;
Tables_in_mysqltest1
#mysql50#t-1
t1
show tables in `#mysql50#testdb-1`;
Tables_in_#mysql50#testdb-1
show tables in `#mysql50#mysqltest-1`;
Tables_in_#mysql50#mysqltest-1
#mysql50#t-1
t1
show create database `testdb1`;
show create database `mysqltest1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `mysqltest-1`;
Database Create Database
testdb-1 CREATE DATABASE `testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `#mysql50#testdb-1`;
ERROR 42000: Unknown database '#mysql50#testdb-1'
show tables in `testdb1`;
Tables_in_testdb1
mysqltest-1 CREATE DATABASE `mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `#mysql50#mysqltest-1`;
ERROR 42000: Unknown database '#mysql50#mysqltest-1'
show tables in `mysqltest1`;
Tables_in_mysqltest1
t1
t-1
show tables in `testdb-1`;
Tables_in_testdb-1
show tables in `mysqltest-1`;
Tables_in_mysqltest-1
t1
t-1
drop database `testdb1`;
drop database `testdb-1`;
drop database `mysqltest1`;
drop database `mysqltest-1`;
-- source include/not_embedded.inc
--disable_warnings
drop database if exists `testdb1`;
drop database if exists `testdb-1`;
drop database if exists `#mysql50#testdb-1`;
drop database if exists `mysqltest1`;
drop database if exists `mysqltest-1`;
drop database if exists `#mysql50#mysqltest-1`;
--enable_warnings
create database `testdb1`;
create database `#mysql50#testdb-1`;
create table `testdb1`.`t1` (a int);
create table `testdb1`.`#mysql50#t-1` (a int);
create table `#mysql50#testdb-1`.`t1` (a int);
create table `#mysql50#testdb-1`.`#mysql50#t-1` (a int);
show create database `testdb1`;
create database `mysqltest1`;
create database `#mysql50#mysqltest-1`;
create table `mysqltest1`.`t1` (a int);
create table `mysqltest1`.`#mysql50#t-1` (a int);
create table `#mysql50#mysqltest-1`.`t1` (a int);
create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
show create database `mysqltest1`;
--error 1049
show create database `testdb-1`;
show create database `#mysql50#testdb-1`;
show tables in `testdb1`;
show tables in `#mysql50#testdb-1`;
show create database `mysqltest-1`;
show create database `#mysql50#mysqltest-1`;
show tables in `mysqltest1`;
show tables in `#mysql50#mysqltest-1`;
--exec $MYSQL_CHECK --all-databases --fix-db-names --fix-table-names
show create database `testdb1`;
show create database `testdb-1`;
show create database `mysqltest1`;
show create database `mysqltest-1`;
--error 1049
show create database `#mysql50#testdb-1`;
show tables in `testdb1`;
show tables in `testdb-1`;
drop database `testdb1`;
drop database `testdb-1`;
show create database `#mysql50#mysqltest-1`;
show tables in `mysqltest1`;
show tables in `mysqltest-1`;
drop database `mysqltest1`;
drop database `mysqltest-1`;
......@@ -6700,6 +6700,7 @@ NDB_SHARE *ndbcluster_get_share(NDB_SHARE *share)
return share;
}
/*
Get a share object for key
......@@ -6714,17 +6715,19 @@ NDB_SHARE *ndbcluster_get_share(NDB_SHARE *share)
have_lock == TRUE, pthread_mutex_lock(&ndbcluster_mutex) already taken
*/
NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
bool create_if_not_exists,
bool have_lock)
{
DBUG_ENTER("get_share");
DBUG_PRINT("info", ("get_share: key %s", key));
THD *thd= current_thd;
NDB_SHARE *share;
uint length= (uint) strlen(key);
DBUG_ENTER("ndbcluster_get_share");
DBUG_PRINT("enter", ("key: '%s'", key));
if (!have_lock)
pthread_mutex_lock(&ndbcluster_mutex);
uint length= (uint) strlen(key);
if (!(share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables,
(byte*) key,
length)))
......@@ -6784,10 +6787,10 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
dbug_print_open_tables();
DBUG_PRINT("get_share",
DBUG_PRINT("info",
("0x%lx key: %s key_length: %d key: %s",
share, share->key, share->key_length, key));
DBUG_PRINT("get_share",
DBUG_PRINT("info",
("db.tablename: %s.%s use_count: %d commit_count: %d",
share->db, share->table_name,
share->use_count, share->commit_count));
......@@ -6796,8 +6799,10 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
DBUG_RETURN(share);
}
void ndbcluster_real_free_share(NDB_SHARE **share)
{
DBUG_ENTER("ndbcluster_real_free_share");
DBUG_PRINT("real_free_share",
("0x%lx key: %s key_length: %d",
(*share), (*share)->key, (*share)->key_length));
......@@ -6835,6 +6840,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share)
*share= 0;
dbug_print_open_tables();
DBUG_VOID_RETURN;
}
/*
......
......@@ -245,10 +245,9 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
sql_print_error("Unable to get table share for %s, error=%d",
share->key, error);
DBUG_PRINT("error", ("open_table_def failed %d", error));
free_table_share(table_share);
my_free((gptr) table_share, MYF(0));
table_share= 0;
my_free((gptr) table, MYF(0));
table= 0;
DBUG_RETURN(error);
}
if ((error= open_table_from_share(thd, table_share, "", 0,
......@@ -257,10 +256,9 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
sql_print_error("Unable to open table for %s, error=%d(%d)",
share->key, error, my_errno);
DBUG_PRINT("error", ("open_table_from_share failed %d", error));
free_table_share(table_share);
my_free((gptr) table_share, MYF(0));
table_share= 0;
my_free((gptr) table, MYF(0));
table= 0;
DBUG_RETURN(error);
}
assign_new_table_id(table);
......@@ -304,6 +302,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
THD *thd= current_thd;
MEM_ROOT *mem_root= &share->mem_root;
int do_event_op= ndb_binlog_running;
DBUG_ENTER("ndbcluster_binlog_init_share");
share->op= 0;
share->table= 0;
......@@ -342,7 +341,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
{
share->flags|= NSF_NO_BINLOG;
}
return;
DBUG_VOID_RETURN;
}
while (1)
{
......@@ -358,6 +357,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
share->flags|= NSF_BLOB_FLAG;
break;
}
DBUG_VOID_RETURN;
}
/*****************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment