Commit 79d87430 authored by unknown's avatar unknown

After merge fixes

Remove compiler warnings
Fix some broken tests
Workaround for syncronization bug in NDB (Bug #16445)


client/mysqltest.c:
  Added more information to output from abort_not_supported_test()
  Removed compiler warnings
include/my_sys.h:
  Added function to print names of open files
include/mysys_err.h:
  Print names of open files
mysql-test/include/have_ndb.inc:
  Added comment
mysql-test/lib/mtr_report.pl:
  Only print warning once
mysql-test/r/mysqldump.result:
  After merge fix
mysql-test/r/ndb_basic.result:
  Workaround for syncronization bug in NDB
mysql-test/r/ndb_config.result:
  Remove not portable test
mysql-test/t/ndb_basic.test:
  Workaround for syncronization bug in NDB
mysql-test/t/ndb_config.test:
  Remove not portable test
mysys/errors.c:
  Print names of open files
mysys/my_file.c:
  Ensure that structs are cleared and copyied properly so that my_print_open_files() works.
mysys/my_init.c:
  In case of EXTRA_DEBUG, print names of open files
mysys/my_open.c:
  Added function to print names of open files
sql/sql_table.cc:
  Fixed file-not-closed error
parent 26fe4bf9
...@@ -688,10 +688,11 @@ static void die(const char *fmt, ...) ...@@ -688,10 +688,11 @@ static void die(const char *fmt, ...)
/* Note that we will get some memory leaks when calling this! */ /* Note that we will get some memory leaks when calling this! */
static void abort_not_supported_test() static void abort_not_supported_test(const char *fname)
{ {
DBUG_ENTER("abort_not_supported_test"); DBUG_ENTER("abort_not_supported_test");
fprintf(stderr, "This test is not supported by this installation\n"); fprintf(stderr, "The test '%s' is not supported by this installation\n",
fname);
if (!silent) if (!silent)
printf("skipped\n"); printf("skipped\n");
free_used_memory(); free_used_memory();
...@@ -814,7 +815,7 @@ static void check_result(DYNAMIC_STRING* ds, const char *fname, ...@@ -814,7 +815,7 @@ static void check_result(DYNAMIC_STRING* ds, const char *fname,
DBUG_ENTER("check_result"); DBUG_ENTER("check_result");
if (res && require_option) if (res && require_option)
abort_not_supported_test(); abort_not_supported_test(fname);
switch (res) { switch (res) {
case RESULT_OK: case RESULT_OK:
break; /* ok */ break; /* ok */
...@@ -1036,7 +1037,7 @@ int do_wait_for_slave_to_stop(struct st_query *q __attribute__((unused))) ...@@ -1036,7 +1037,7 @@ int do_wait_for_slave_to_stop(struct st_query *q __attribute__((unused)))
int do_require_manager(struct st_query *query __attribute__((unused)) ) int do_require_manager(struct st_query *query __attribute__((unused)) )
{ {
if (!manager) if (!manager)
abort_not_supported_test(); abort_not_supported_test("manager");
return 0; return 0;
} }
...@@ -1305,7 +1306,9 @@ int var_query_set(VAR* var, const char *query, const char** query_end) ...@@ -1305,7 +1306,9 @@ int var_query_set(VAR* var, const char *query, const char** query_end)
uint i; uint i;
ulong *lengths; ulong *lengths;
char *end; char *end;
#ifdef NOT_YET
MYSQL_FIELD *fields= mysql_fetch_fields(res); MYSQL_FIELD *fields= mysql_fetch_fields(res);
#endif
init_dynamic_string(&result, "", 16384, 65536); init_dynamic_string(&result, "", 16384, 65536);
lengths= mysql_fetch_lengths(res); lengths= mysql_fetch_lengths(res);
...@@ -1920,7 +1923,7 @@ static void set_charset(struct st_query *q) ...@@ -1920,7 +1923,7 @@ static void set_charset(struct st_query *q)
q->last_argument= p; q->last_argument= p;
charset_info= get_charset_by_csname(charset_name,MY_CS_PRIMARY,MYF(MY_WME)); charset_info= get_charset_by_csname(charset_name,MY_CS_PRIMARY,MYF(MY_WME));
if (!charset_info) if (!charset_info)
abort_not_supported_test(); abort_not_supported_test(charset_name);
} }
static uint get_errcodes(match_err *to,struct st_query *q) static uint get_errcodes(match_err *to,struct st_query *q)
...@@ -1963,7 +1966,7 @@ static uint get_errcodes(match_err *to,struct st_query *q) ...@@ -1963,7 +1966,7 @@ static uint get_errcodes(match_err *to,struct st_query *q)
(as in ER_WRONG_VALUE vs. ER_WRONG_VALUE_COUNT). (as in ER_WRONG_VALUE vs. ER_WRONG_VALUE_COUNT).
*/ */
if (!strncmp(start, e->name, (int) (p - start)) && if (!strncmp(start, e->name, (int) (p - start)) &&
strlen(e->name) == (p - start)) (uint) strlen(e->name) == (uint) (p - start))
{ {
to[count].code.errnum= (uint) e->code; to[count].code.errnum= (uint) e->code;
to[count].type= ERR_ERRNO; to[count].type= ERR_ERRNO;
...@@ -4329,7 +4332,7 @@ static void handle_error(const char *query, struct st_query *q, ...@@ -4329,7 +4332,7 @@ static void handle_error(const char *query, struct st_query *q,
if (err_errno == CR_SERVER_LOST || if (err_errno == CR_SERVER_LOST ||
err_errno == CR_SERVER_GONE_ERROR) err_errno == CR_SERVER_GONE_ERROR)
die("require query '%s' failed: %d: %s", query, err_errno, err_error); die("require query '%s' failed: %d: %s", query, err_errno, err_error);
abort_not_supported_test(); abort_not_supported_test("failed_query");
} }
if (q->abort_on_error) if (q->abort_on_error)
...@@ -5101,7 +5104,7 @@ static void init_var_hash(MYSQL *mysql) ...@@ -5101,7 +5104,7 @@ static void init_var_hash(MYSQL *mysql)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static void mark_progress(int line) static void mark_progress(int line __attribute__((unused)))
{ {
#ifdef NOT_YET #ifdef NOT_YET
static FILE* fp = NULL; static FILE* fp = NULL;
......
...@@ -558,6 +558,7 @@ extern File my_open(const char *FileName,int Flags,myf MyFlags); ...@@ -558,6 +558,7 @@ extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName, extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file, enum file_type type_of_file,
uint error_message_number, myf MyFlags); uint error_message_number, myf MyFlags);
extern void my_print_open_files(void);
extern File my_create(const char *FileName,int CreateFlags, extern File my_create(const char *FileName,int CreateFlags,
int AccessFlags, myf MyFlags); int AccessFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags); extern int my_close(File Filedes,myf MyFlags);
...@@ -647,6 +648,12 @@ extern void allow_break(void); ...@@ -647,6 +648,12 @@ extern void allow_break(void);
#define allow_break() #define allow_break()
#endif #endif
#ifdef EXTRA_DEBUG
void my_print_open_files();
#else
#define my_print_open_files()
#endif
extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
extern char *my_tmpdir(MY_TMPDIR *tmpdir); extern char *my_tmpdir(MY_TMPDIR *tmpdir);
extern void free_tmpdir(MY_TMPDIR *tmpdir); extern void free_tmpdir(MY_TMPDIR *tmpdir);
......
...@@ -62,7 +62,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ ...@@ -62,7 +62,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_SYNC 27 #define EE_SYNC 27
#define EE_UNKNOWN_COLLATION 28 #define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29 #define EE_FILENOTFOUND 29
#define EE_ERROR_LAST 29 /*Copy last error nr.*/ #define EE_FILE_NOT_CLOSED 30
#define EE_ERROR_LAST 30 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */ /* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */ /* exit codes for all MySQL programs */
......
...@@ -5,6 +5,8 @@ show variables like "have_ndbcluster"; ...@@ -5,6 +5,8 @@ show variables like "have_ndbcluster";
enable_query_log; enable_query_log;
# Check that NDB is installed and known to be working # Check that NDB is installed and known to be working
# This will disable ndb from the shell script 'mysql-test-run'
-- require r/have_ndb_status_ok.require -- require r/have_ndb_status_ok.require
disable_query_log; disable_query_log;
eval select "$NDB_STATUS_OK" as ndb_status_ok; eval select "$NDB_STATUS_OK" as ndb_status_ok;
......
...@@ -244,6 +244,7 @@ sub mtr_report_stats ($) { ...@@ -244,6 +244,7 @@ sub mtr_report_stats ($) {
} }
} }
} }
}
if ( $found_problems ) if ( $found_problems )
{ {
mtr_warning("Got errors/warnings while running tests, please examine", mtr_warning("Got errors/warnings while running tests, please examine",
...@@ -251,7 +252,6 @@ sub mtr_report_stats ($) { ...@@ -251,7 +252,6 @@ sub mtr_report_stats ($) {
} }
} }
} }
}
print "\n"; print "\n";
......
...@@ -3,13 +3,14 @@ drop database if exists mysqldump_test_db; ...@@ -3,13 +3,14 @@ drop database if exists mysqldump_test_db;
drop database if exists db1; drop database if exists db1;
drop database if exists db2; drop database if exists db2;
drop view if exists v1, v2, v3; drop view if exists v1, v2, v3;
CREATE TABLE t1(a int); CREATE TABLE t1(a int, key (a)) key_block_size=1024;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?> <?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test"> <database name="test">
<table_structure name="t1"> <table_structure name="t1">
<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" /> <field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" />
<key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
</table_structure> </table_structure>
<table_data name="t1"> <table_data name="t1">
<row> <row>
......
...@@ -6,6 +6,13 @@ attr1 INT NOT NULL, ...@@ -6,6 +6,13 @@ attr1 INT NOT NULL,
attr2 INT, attr2 INT,
attr3 VARCHAR(10) attr3 VARCHAR(10)
) ENGINE=ndbcluster; ) ENGINE=ndbcluster;
drop table t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE
......
...@@ -8,4 +8,3 @@ ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,loc ...@@ -8,4 +8,3 @@ ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,loc
ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10, ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15, ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
...@@ -6,6 +6,18 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; ...@@ -6,6 +6,18 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists mysqltest; drop database if exists mysqltest;
--enable_warnings --enable_warnings
# workaround for bug#16445
# remove to reproduce bug and run tests from ndb start
# and with ndb_autodiscover disabled. Fails on Linux 50 % of the times
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
drop table t1;
# #
# Basic test to show that the NDB # Basic test to show that the NDB
# table handler is working # table handler is working
......
...@@ -15,4 +15,9 @@ ...@@ -15,4 +15,9 @@
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster0 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null --exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster0 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster1 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null --exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster1 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null --exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null
# Following doesn't work in all configurations
--disable_parsing
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null --exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
--enable_parsing
...@@ -50,6 +50,7 @@ const char * NEAR globerrs[GLOBERRS]= ...@@ -50,6 +50,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't sync file '%s' to disk (Errcode: %d)", "Can't sync file '%s' to disk (Errcode: %d)",
"Collation '%s' is not a compiled collation and is not specified in the '%s' file", "Collation '%s' is not a compiled collation and is not specified in the '%s' file",
"File '%s' not found (Errcode: %d)", "File '%s' not found (Errcode: %d)",
"File '%s' (fileno: %d) was not closed"
}; };
void init_glob_errs(void) void init_glob_errs(void)
...@@ -89,5 +90,6 @@ void init_glob_errs() ...@@ -89,5 +90,6 @@ void init_glob_errs()
EE(EE_SYNC)= "Can't sync file '%s' to disk (Errcode: %d)"; EE(EE_SYNC)= "Can't sync file '%s' to disk (Errcode: %d)";
EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file"; EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file";
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)"; EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
} }
#endif #endif
...@@ -107,7 +107,10 @@ uint my_set_max_open_files(uint files) ...@@ -107,7 +107,10 @@ uint my_set_max_open_files(uint files)
DBUG_RETURN(MY_NFILE); DBUG_RETURN(MY_NFILE);
/* Copy any initialized files */ /* Copy any initialized files */
memcpy((char*) tmp, (char*) my_file_info, sizeof(*tmp) * my_file_limit); memcpy((char*) tmp, (char*) my_file_info,
sizeof(*tmp) * min(my_file_limit, files));
bzero((char*) (tmp + my_file_limit),
max((int) (files- my_file_limit), 0)*sizeof(*tmp));
my_free_open_file_info(); /* Free if already allocated */ my_free_open_file_info(); /* Free if already allocated */
my_file_info= tmp; my_file_info= tmp;
my_file_limit= files; my_file_limit= files;
...@@ -121,8 +124,12 @@ void my_free_open_file_info() ...@@ -121,8 +124,12 @@ void my_free_open_file_info()
DBUG_ENTER("my_free_file_info"); DBUG_ENTER("my_free_file_info");
if (my_file_info != my_file_info_default) if (my_file_info != my_file_info_default)
{ {
/* Copy data back for my_print_open_files */
memcpy((char*) my_file_info_default, my_file_info,
sizeof(*my_file_info_default)* MY_NFILE);
my_free((char*) my_file_info, MYF(0)); my_free((char*) my_file_info, MYF(0));
my_file_info= my_file_info_default; my_file_info= my_file_info_default;
my_file_limit= MY_NFILE;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -150,6 +150,7 @@ void my_end(int infoflag) ...@@ -150,6 +150,7 @@ void my_end(int infoflag)
sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened); sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened);
(void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL); (void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL);
DBUG_PRINT("error",("%s",errbuff[0])); DBUG_PRINT("error",("%s",errbuff[0]));
my_print_open_files();
} }
} }
free_charsets(); free_charsets();
......
...@@ -351,3 +351,24 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode) ...@@ -351,3 +351,24 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
return fh; /* return handle */ return fh; /* return handle */
} }
#endif /* __WIN__ */ #endif /* __WIN__ */
#ifdef EXTRA_DEBUG
void my_print_open_files(void)
{
if (my_file_opened | my_stream_opened)
{
uint i;
for (i= 0 ; i < my_file_limit ; i++)
{
if (my_file_info[i].type != UNOPEN)
{
fprintf(stderr, EE(EE_FILE_NOT_CLOSED), my_file_info[i].name, i);
fputc('\n', stderr);
}
}
}
}
#endif
...@@ -1073,7 +1073,7 @@ void execute_ddl_log_recovery() ...@@ -1073,7 +1073,7 @@ void execute_ddl_log_recovery()
global_ddl_log.inited= FALSE; global_ddl_log.inited= FALSE;
global_ddl_log.recovery_phase= TRUE; global_ddl_log.recovery_phase= TRUE;
global_ddl_log.io_size= IO_SIZE; global_ddl_log.io_size= IO_SIZE;
global_ddl_log.file_id=(File)-1; global_ddl_log.file_id= (File) -1;
/* /*
To be able to run this from boot, we allocate a temporary THD To be able to run this from boot, we allocate a temporary THD
...@@ -1138,11 +1138,12 @@ void release_ddl_log() ...@@ -1138,11 +1138,12 @@ void release_ddl_log()
my_free((char*)free_list, MYF(0)); my_free((char*)free_list, MYF(0));
free_list= tmp; free_list= tmp;
} }
if (global_ddl_log.inited) if (global_ddl_log.file_id >= 0)
{ {
global_ddl_log.inited= 0;
VOID(my_close(global_ddl_log.file_id, MYF(MY_WME))); VOID(my_close(global_ddl_log.file_id, MYF(MY_WME)));
global_ddl_log.file_id= (File) -1;
} }
global_ddl_log.inited= 0;
pthread_mutex_unlock(&LOCK_gdl); pthread_mutex_unlock(&LOCK_gdl);
VOID(pthread_mutex_destroy(&LOCK_gdl)); VOID(pthread_mutex_destroy(&LOCK_gdl));
DBUG_VOID_RETURN; 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