Commit 2f86009c authored by monty@mysql.com's avatar monty@mysql.com

Merge mysql.com:/home/my/mysql-4.1

into  mysql.com:/home/my/mysql-5.0
parents a5f362cb 445dfdc3
...@@ -59,7 +59,7 @@ int main(int argc, char **argv) ...@@ -59,7 +59,7 @@ int main(int argc, char **argv)
bzero((gptr) flags,sizeof(flags)); bzero((gptr) flags,sizeof(flags));
printf("- Creating heap-file\n"); printf("- Creating heap-file\n");
if (heap_create(filename,1,keyinfo,30,(ulong) flag*100000L,101L, if (heap_create(filename,1,keyinfo,30,(ulong) flag*100000L,10L,
&hp_create_info) || &hp_create_info) ||
!(file= heap_open(filename, 2))) !(file= heap_open(filename, 2)))
goto err; goto err;
......
...@@ -2391,10 +2391,9 @@ static void net_store_datetime(NET *net, MYSQL_TIME *tm) ...@@ -2391,10 +2391,9 @@ static void net_store_datetime(NET *net, MYSQL_TIME *tm)
static void store_param_date(NET *net, MYSQL_BIND *param) static void store_param_date(NET *net, MYSQL_BIND *param)
{ {
MYSQL_TIME *tm= (MYSQL_TIME *) param->buffer; MYSQL_TIME tm= *((MYSQL_TIME *) param->buffer);
tm->hour= tm->minute= tm->second= 0; tm.hour= tm.minute= tm.second= tm.second_part= 0;
tm->second_part= 0; net_store_datetime(net, &tm);
net_store_datetime(net, tm);
} }
static void store_param_datetime(NET *net, MYSQL_BIND *param) static void store_param_datetime(NET *net, MYSQL_BIND *param)
......
...@@ -1381,16 +1381,16 @@ start_master() ...@@ -1381,16 +1381,16 @@ start_master()
if [ x$DO_DDD = x1 ] if [ x$DO_DDD = x1 ]
then then
$ECHO "set args $master_args" > $GDB_MASTER_INIT $ECHO "set args $master_args" > $GDB_MASTER_INIT$1
manager_launch master ddd -display $DISPLAY --debugger \ manager_launch master ddd -display $DISPLAY --debugger \
"gdb -x $GDB_MASTER_INIT" $MASTER_MYSQLD "gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD
elif [ x$DO_GDB = x1 ] elif [ x$DO_GDB = x1 ]
then then
if [ x$MANUAL_GDB = x1 ] if [ x$MANUAL_GDB = x1 ]
then then
$ECHO "set args $master_args" > $GDB_MASTER_INIT $ECHO "set args $master_args" > $GDB_MASTER_INIT$1
$ECHO "To start gdb for the master , type in another window:" $ECHO "To start gdb for the master , type in another window:"
$ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD" $ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
wait_for_master=1500 wait_for_master=1500
else else
( $ECHO set args $master_args; ( $ECHO set args $master_args;
...@@ -1402,9 +1402,9 @@ disa 1 ...@@ -1402,9 +1402,9 @@ disa 1
end end
r r
EOF EOF
fi ) > $GDB_MASTER_INIT fi ) > $GDB_MASTER_INIT$1
manager_launch master $XTERM -display $DISPLAY \ manager_launch master $XTERM -display $DISPLAY \
-title "Master" -e gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD -title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD
fi fi
else else
manager_launch master $MASTER_MYSQLD $master_args manager_launch master $MASTER_MYSQLD $master_args
...@@ -2088,13 +2088,7 @@ then ...@@ -2088,13 +2088,7 @@ then
fi fi
start_manager start_manager
# Do not automagically start daemons if we are in gdb or running only one test
# case
if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ]
then
mysql_start mysql_start
fi
$ECHO "Loading Standard Test Databases" $ECHO "Loading Standard Test Databases"
mysql_loadstd mysql_loadstd
fi fi
......
...@@ -336,8 +336,16 @@ UNIQUE i1idx (i1), ...@@ -336,8 +336,16 @@ UNIQUE i1idx (i1),
UNIQUE i2idx (i2)); UNIQUE i2idx (i2));
desc t1; desc t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
i1 int(11) NO UNI i1 int(11) NO PRI
i2 int(11) NO UNI i2 int(11) NO UNI
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i1` int(11) NOT NULL default '0',
`i2` int(11) NOT NULL default '0',
UNIQUE KEY `i1idx` (`i1`),
UNIQUE KEY `i2idx` (`i2`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 ( create table t1 (
c1 int, c1 int,
......
...@@ -334,6 +334,7 @@ create table t1 ( ...@@ -334,6 +334,7 @@ create table t1 (
UNIQUE i1idx (i1), UNIQUE i1idx (i1),
UNIQUE i2idx (i2)); UNIQUE i2idx (i2));
desc t1; desc t1;
show create table t1;
drop table t1; drop table t1;
# #
......
...@@ -610,7 +610,7 @@ drop database db1; ...@@ -610,7 +610,7 @@ drop database db1;
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
# #
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump --exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
# #
......
...@@ -2254,9 +2254,10 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -2254,9 +2254,10 @@ int ha_ndbcluster::write_row(byte *record)
{ {
Ndb *ndb= get_ndb(); Ndb *ndb= get_ndb();
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1; Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
char buff[22];
DBUG_PRINT("info", DBUG_PRINT("info",
("Trying to set next auto increment value to %llu", ("Trying to set next auto increment value to %s",
(ulonglong) next_val)); llstr(next_val, buff)));
if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE) if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE)
== -1) == -1)
ERR_RETURN(ndb->getNdbError()); ERR_RETURN(ndb->getNdbError());
...@@ -2582,12 +2583,14 @@ void ha_ndbcluster::unpack_record(byte* buf) ...@@ -2582,12 +2583,14 @@ void ha_ndbcluster::unpack_record(byte* buf)
{ {
// Table with hidden primary key // Table with hidden primary key
int hidden_no= table->s->fields; int hidden_no= table->s->fields;
char buff[22];
const NDBTAB *tab= (const NDBTAB *) m_table; const NDBTAB *tab= (const NDBTAB *) m_table;
const NDBCOL *hidden_col= tab->getColumn(hidden_no); const NDBCOL *hidden_col= tab->getColumn(hidden_no);
const NdbRecAttr* rec= m_value[hidden_no].rec; const NdbRecAttr* rec= m_value[hidden_no].rec;
DBUG_ASSERT(rec); DBUG_ASSERT(rec);
DBUG_PRINT("hidden", ("%d: %s \"%llu\"", hidden_no, DBUG_PRINT("hidden", ("%d: %s \"%s\"", hidden_no,
hidden_col->getName(), rec->u_64_value())); hidden_col->getName(),
llstr(rec->u_64_value(), buff)));
} }
print_results(); print_results();
#endif #endif
...@@ -4101,10 +4104,11 @@ static int create_ndb_column(NDBCOL &col, ...@@ -4101,10 +4104,11 @@ static int create_ndb_column(NDBCOL &col,
// Set autoincrement // Set autoincrement
if (field->flags & AUTO_INCREMENT_FLAG) if (field->flags & AUTO_INCREMENT_FLAG)
{ {
char buff[22];
col.setAutoIncrement(TRUE); col.setAutoIncrement(TRUE);
ulonglong value= info->auto_increment_value ? ulonglong value= info->auto_increment_value ?
info->auto_increment_value : (ulonglong) 1; info->auto_increment_value : (ulonglong) 1;
DBUG_PRINT("info", ("Autoincrement key, initial: %llu", value)); DBUG_PRINT("info", ("Autoincrement key, initial: %s", llstr(value, buff)));
col.setAutoIncrementInitialValue(value); col.setAutoIncrementInitialValue(value);
} }
else else
...@@ -5493,8 +5497,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname, ...@@ -5493,8 +5497,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
if (share->commit_count != 0) if (share->commit_count != 0)
{ {
*commit_count= share->commit_count; *commit_count= share->commit_count;
DBUG_PRINT("info", ("Getting commit_count: %llu from share", char buff[22];
share->commit_count)); DBUG_PRINT("info", ("Getting commit_count: %s from share",
llstr(share->commit_count, buff)));
pthread_mutex_unlock(&share->mutex); pthread_mutex_unlock(&share->mutex);
free_share(share); free_share(share);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -5518,7 +5523,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname, ...@@ -5518,7 +5523,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
pthread_mutex_lock(&share->mutex); pthread_mutex_lock(&share->mutex);
if (share->commit_count_lock == lock) if (share->commit_count_lock == lock)
{ {
DBUG_PRINT("info", ("Setting commit_count to %llu", stat.commit_count)); char buff[22];
DBUG_PRINT("info", ("Setting commit_count to %s",
llstr(stat.commit_count, buff)));
share->commit_count= stat.commit_count; share->commit_count= stat.commit_count;
*commit_count= stat.commit_count; *commit_count= stat.commit_count;
} }
...@@ -5568,13 +5575,12 @@ ndbcluster_cache_retrieval_allowed(THD *thd, ...@@ -5568,13 +5575,12 @@ ndbcluster_cache_retrieval_allowed(THD *thd,
char *full_name, uint full_name_len, char *full_name, uint full_name_len,
ulonglong *engine_data) ulonglong *engine_data)
{ {
DBUG_ENTER("ndbcluster_cache_retrieval_allowed");
Uint64 commit_count; Uint64 commit_count;
bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)); bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
char *dbname= full_name; char *dbname= full_name;
char *tabname= dbname+strlen(dbname)+1; char *tabname= dbname+strlen(dbname)+1;
char buff[22], buff2[22];
DBUG_ENTER("ndbcluster_cache_retrieval_allowed");
DBUG_PRINT("enter", ("dbname: %s, tabname: %s, is_autocommit: %d", DBUG_PRINT("enter", ("dbname: %s, tabname: %s, is_autocommit: %d",
dbname, tabname, is_autocommit)); dbname, tabname, is_autocommit));
...@@ -5590,8 +5596,8 @@ ndbcluster_cache_retrieval_allowed(THD *thd, ...@@ -5590,8 +5596,8 @@ ndbcluster_cache_retrieval_allowed(THD *thd,
DBUG_PRINT("exit", ("No, could not retrieve commit_count")); DBUG_PRINT("exit", ("No, could not retrieve commit_count"));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
DBUG_PRINT("info", ("*engine_data: %llu, commit_count: %llu", DBUG_PRINT("info", ("*engine_data: %s, commit_count: %s",
*engine_data, commit_count)); llstr(*engine_data, buff), llstr(commit_count, buff2)));
if (commit_count == 0) if (commit_count == 0)
{ {
*engine_data= 0; /* invalidate */ *engine_data= 0; /* invalidate */
...@@ -5605,7 +5611,8 @@ ndbcluster_cache_retrieval_allowed(THD *thd, ...@@ -5605,7 +5611,8 @@ ndbcluster_cache_retrieval_allowed(THD *thd,
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
DBUG_PRINT("exit", ("OK to use cache, engine_data: %llu", *engine_data)); DBUG_PRINT("exit", ("OK to use cache, engine_data: %s",
llstr(*engine_data, buff)));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -5638,10 +5645,10 @@ ha_ndbcluster::register_query_cache_table(THD *thd, ...@@ -5638,10 +5645,10 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
qc_engine_callback *engine_callback, qc_engine_callback *engine_callback,
ulonglong *engine_data) ulonglong *engine_data)
{ {
DBUG_ENTER("ha_ndbcluster::register_query_cache_table"); Uint64 commit_count;
char buff[22];
bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)); bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
DBUG_ENTER("ha_ndbcluster::register_query_cache_table");
DBUG_PRINT("enter",("dbname: %s, tabname: %s, is_autocommit: %d", DBUG_PRINT("enter",("dbname: %s, tabname: %s, is_autocommit: %d",
m_dbname, m_tabname, is_autocommit)); m_dbname, m_tabname, is_autocommit));
...@@ -5651,7 +5658,6 @@ ha_ndbcluster::register_query_cache_table(THD *thd, ...@@ -5651,7 +5658,6 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
Uint64 commit_count;
if (ndb_get_commitcount(thd, m_dbname, m_tabname, &commit_count)) if (ndb_get_commitcount(thd, m_dbname, m_tabname, &commit_count))
{ {
*engine_data= 0; *engine_data= 0;
...@@ -5660,7 +5666,7 @@ ha_ndbcluster::register_query_cache_table(THD *thd, ...@@ -5660,7 +5666,7 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
} }
*engine_data= commit_count; *engine_data= commit_count;
*engine_callback= ndbcluster_cache_retrieval_allowed; *engine_callback= ndbcluster_cache_retrieval_allowed;
DBUG_PRINT("exit", ("commit_count: %llu", commit_count)); DBUG_PRINT("exit", ("commit_count: %s", llstr(commit_count, buff)));
DBUG_RETURN(commit_count > 0); DBUG_RETURN(commit_count > 0);
} }
...@@ -5841,12 +5847,13 @@ int ...@@ -5841,12 +5847,13 @@ int
ndb_get_table_statistics(Ndb* ndb, const char * table, ndb_get_table_statistics(Ndb* ndb, const char * table,
struct Ndb_statistics * ndbstat) struct Ndb_statistics * ndbstat)
{ {
DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", table));
NdbTransaction* pTrans; NdbTransaction* pTrans;
NdbError error; NdbError error;
int retries= 10; int retries= 10;
int retry_sleep= 30 * 1000; /* 30 milliseconds */ int retry_sleep= 30 * 1000; /* 30 milliseconds */
char buff[22], buff2[22], buff3[22], buff4[22];
DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", table));
do do
{ {
...@@ -5923,10 +5930,13 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, ...@@ -5923,10 +5930,13 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
ndbstat->row_size= sum_row_size; ndbstat->row_size= sum_row_size;
ndbstat->fragment_memory= sum_mem; ndbstat->fragment_memory= sum_mem;
DBUG_PRINT("exit", ("records: %llu commits: %llu " DBUG_PRINT("exit", ("records: %s commits: %s "
"row_size: %llu mem: %llu count: %u", "row_size: %s mem: %s count: %u",
sum_rows, sum_commits, sum_row_size, llstr(sum_rows, buff),
sum_mem, count)); llstr(sum_commits, buff2),
llstr(sum_row_size, buff3),
llstr(sum_mem, buff4),
count));
DBUG_RETURN(0); DBUG_RETURN(0);
retry: retry:
...@@ -6461,9 +6471,12 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -6461,9 +6471,12 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
if (ndb_get_table_statistics(ndb, tabname, &stat) == 0) if (ndb_get_table_statistics(ndb, tabname, &stat) == 0)
{ {
char buff[22], buff2[22];
DBUG_PRINT("ndb_util_thread", DBUG_PRINT("ndb_util_thread",
("Table: %s, commit_count: %llu, rows: %llu", ("Table: %s commit_count: %s rows: %s",
share->table_name, stat.commit_count, stat.row_count)); share->table_name,
llstr(stat.commit_count, buff),
llstr(stat.row_count, buff2));
} }
else else
{ {
......
...@@ -678,6 +678,27 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -678,6 +678,27 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if (outparam->key_info[key].flags & HA_FULLTEXT) if (outparam->key_info[key].flags & HA_FULLTEXT)
outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT; outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT;
if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME))
{
/*
If the UNIQUE key doesn't have NULL columns and is not a part key
declare this as a primary key.
*/
primary_key=key;
for (i=0 ; i < keyinfo->key_parts ;i++)
{
uint fieldnr= key_part[i].fieldnr;
if (!fieldnr ||
outparam->field[fieldnr-1]->null_ptr ||
outparam->field[fieldnr-1]->key_length() !=
key_part[i].length)
{
primary_key=MAX_KEY; // Can't be used
break;
}
}
}
for (i=0 ; i < keyinfo->key_parts ; key_part++,i++) for (i=0 ; i < keyinfo->key_parts ; key_part++,i++)
{ {
if (new_field_pack_flag <= 1) if (new_field_pack_flag <= 1)
......
...@@ -14882,7 +14882,9 @@ static void test_bug17667() ...@@ -14882,7 +14882,9 @@ static void test_bug17667()
printf("success. All queries found intact in the log.\n"); printf("success. All queries found intact in the log.\n");
} else { }
else
{
fprintf(stderr, "Could not find the log file, var/log/master.log, so " fprintf(stderr, "Could not find the log file, var/log/master.log, so "
"test_bug17667 is \ninconclusive. Run test from the " "test_bug17667 is \ninconclusive. Run test from the "
"mysql-test/mysql-test-run* program \nto set up the correct " "mysql-test/mysql-test-run* program \nto set up the correct "
...@@ -14896,7 +14898,8 @@ static void test_bug17667() ...@@ -14896,7 +14898,8 @@ static void test_bug17667()
/* /*
Bug#14169: type of group_concat() result changed to blob if tmp_table was used Bug#14169: type of group_concat() result changed to blob if tmp_table was
used
*/ */
static void test_bug14169() static void test_bug14169()
{ {
...@@ -14929,7 +14932,62 @@ static void test_bug14169() ...@@ -14929,7 +14932,62 @@ static void test_bug14169()
rc= mysql_query(mysql, "drop table t1"); rc= mysql_query(mysql, "drop table t1");
myquery(rc); myquery(rc);
}/* }
/*
Bug#20152: mysql_stmt_execute() writes to MYSQL_TYPE_DATE buffer
*/
static void test_bug20152()
{
MYSQL_BIND bind[1];
MYSQL_STMT *stmt;
MYSQL_TIME tm;
int rc;
const char *query= "INSERT INTO t1 (f1) VALUES (?)";
myheader("test_bug20152");
memset(bind, 0, sizeof(bind));
bind[0].buffer_type= MYSQL_TYPE_DATE;
bind[0].buffer= (void*)&tm;
tm.year = 2006;
tm.month = 6;
tm.day = 18;
tm.hour = 14;
tm.minute = 9;
tm.second = 42;
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 (f1 DATE)");
myquery(rc);
stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt, query, strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, bind);
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
rc= mysql_stmt_close(stmt);
check_execute(stmt, rc);
rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc);
if (tm.hour == 14 && tm.minute == 9 && tm.second == 42) {
if (!opt_silent)
printf("OK!");
} else {
printf("[14:09:42] != [%02d:%02d:%02d]\n", tm.hour, tm.minute, tm.second);
DIE_UNLESS(0==1);
}
}
/*
Read and parse arguments and MySQL options from my.cnf Read and parse arguments and MySQL options from my.cnf
*/ */
...@@ -15193,6 +15251,7 @@ static struct my_tests_st my_tests[]= { ...@@ -15193,6 +15251,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug12744", test_bug12744 }, { "test_bug12744", test_bug12744 },
{ "test_bug16143", test_bug16143 }, { "test_bug16143", test_bug16143 },
{ "test_bug15613", test_bug15613 }, { "test_bug15613", test_bug15613 },
{ "test_bug20152", test_bug20152 },
{ "test_bug14169", test_bug14169 }, { "test_bug14169", test_bug14169 },
{ "test_bug17667", test_bug17667 }, { "test_bug17667", test_bug17667 },
{ 0, 0 } { 0, 0 }
......
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