Merge chilla.local:/home/mydev/mysql-5.1

into  chilla.local:/home/mydev/mysql-5.1-amerge
This commit is contained in:
unknown 2006-07-11 11:34:38 +02:00
commit e8f8fd8d7e
21 changed files with 280 additions and 61 deletions

View file

@ -1,3 +1,6 @@
show variables like 'collation_server';
Variable_name Value
collation_server ucs2_unicode_ci
show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2

View file

@ -386,11 +386,11 @@ show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
NULL test v0 select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER
NULL test v1 select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhost DEFINER
NULL test v2 select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhost DEFINER
NULL test v3 select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
NULL test v4 select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
NULL test v0 /* ALGORITHM=UNDEFINED */ select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER
NULL test v1 /* ALGORITHM=UNDEFINED */ select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhost DEFINER
NULL test v2 /* ALGORITHM=UNDEFINED */ select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhost DEFINER
NULL test v3 /* ALGORITHM=UNDEFINED */ select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
NULL test v4 /* ALGORITHM=UNDEFINED */ select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER
drop view v0, v1, v2, v3, v4;
create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost;
@ -483,9 +483,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
select * from information_schema.views;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
NULL test v1 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
NULL test v2 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER
NULL test v3 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER
grant select (a) on test.t1 to joe@localhost with grant option;
select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
@ -1169,7 +1169,7 @@ select * from information_schema.views
where table_name='v1' or table_name='v2';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE
NULL test v1 NONE YES root@localhost DEFINER
NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER
NULL test v2 /* ALGORITHM=UNDEFINED */ select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER
drop view v1, v2;
drop table t1;
drop user mysqltest_1@localhost;

View file

@ -420,3 +420,34 @@ ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
---> connection: root
DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO
user19857@localhost;
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con
use test;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END //
SHOW CREATE PROCEDURE test.sp19857;
Procedure sql_mode Create Procedure
sp19857 CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END
DROP PROCEDURE IF EXISTS test.sp19857;
---> connection: root
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;

View file

@ -421,6 +421,28 @@ set tmp_table_size=100;
set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
select @@session.insert_id;
@@session.insert_id
1
set @save_insert_id=@@session.insert_id;
set session insert_id=20;
select @@session.insert_id;
@@session.insert_id
20
set session last_insert_id=100;
select @@session.insert_id;
@@session.insert_id
20
select @@session.last_insert_id;
@@session.last_insert_id
100
select @@session.insert_id;
@@session.insert_id
20
set @@session.insert_id=@save_insert_id;
select @@session.insert_id;
@@session.insert_id
1
create table t1 (a int not null auto_increment, primary key(a));
create table t2 (a int not null auto_increment, primary key(a));
insert into t1 values(null),(null),(null);

View file

@ -1 +1 @@
--default-character-set=ucs2 --default-collation=ucs2_unicode_ci
--default-collation=ucs2_unicode_ci --default-character-set=ucs2

View file

@ -1,3 +1,8 @@
#
# MySQL Bug#15276: MySQL ignores collation-server
#
show variables like 'collation_server';
#
# Bug#18004 Connecting crashes server when default charset is UCS2
#

View file

@ -744,4 +744,50 @@ DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
#
# Can't test with embedded server that doesn't support grants
GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO
user19857@localhost;
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--connect (mysqltest_2_con,localhost,user19857,meow,test)
--echo
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use test;
DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END //
DELIMITER ;//
SHOW CREATE PROCEDURE test.sp19857;
--disconnect mysqltest_2_con
--connect (mysqltest_2_con,localhost,user19857,meow,test)
--connection mysqltest_2_con
DROP PROCEDURE IF EXISTS test.sp19857;
--echo
--echo ---> connection: root
--connection con1root
--disconnect mysqltest_2_con
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
DROP USER user19857@localhost;
# End of 5.0 bugs.

View file

@ -301,6 +301,22 @@ set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
#
# Bugs: #20392: INSERT_ID session variable has weird value
#
select @@session.insert_id;
set @save_insert_id=@@session.insert_id;
set session insert_id=20;
select @@session.insert_id;
set session last_insert_id=100;
select @@session.insert_id;
select @@session.last_insert_id;
select @@session.insert_id;
set @@session.insert_id=@save_insert_id;
select @@session.insert_id;
#
# key buffer
#

View file

@ -1701,7 +1701,7 @@ int mysql_init_character_set(MYSQL *mysql)
C_MODE_END
MYSQL *
MYSQL * STDCALL
CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)

View file

@ -323,7 +323,9 @@ static char *opt_init_slave, *language_ptr, *opt_init_connect;
static char *default_character_set_name;
static char *character_set_filesystem_name;
static char *my_bind_addr_str;
static char *default_collation_name, *default_storage_engine_str;
static char *default_collation_name;
static char *default_storage_engine_str;
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
static char mysql_data_home_buff[2];
static struct passwd *user_info;
static I_List<THD> thread_cache;
@ -7047,7 +7049,7 @@ static void mysql_init_variables(void)
/* Variables in libraries */
charsets_dir= 0;
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME;
default_collation_name= compiled_default_collation_name;
sys_charset_system.value= (char*) system_charset_info->csname;
character_set_filesystem_name= (char*) "binary";
@ -7181,7 +7183,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
strmake(mysql_home,argument,sizeof(mysql_home)-1);
break;
case 'C':
default_collation_name= 0;
if (default_collation_name == compiled_default_collation_name)
default_collation_name= 0;
break;
case 'l':
opt_log=1;

View file

@ -2817,7 +2817,7 @@ bool sys_var_insert_id::update(THD *thd, set_var *var)
byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
return (byte*) &thd->current_insert_id;
return (byte*) &thd->next_insert_id;
}

View file

@ -5749,25 +5749,30 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
TABLE_LIST tables[1];
List<LEX_USER> user_list;
bool result;
ACL_USER *au;
char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
DBUG_ENTER("sp_grant_privileges");
if (!(combo=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
DBUG_RETURN(TRUE);
combo->user.str= sctx->user;
VOID(pthread_mutex_lock(&acl_cache->lock));
if (!find_acl_user(combo->host.str=(char*)sctx->host_or_ip, combo->user.str,
FALSE) &&
!find_acl_user(combo->host.str=(char*)sctx->host, combo->user.str,
FALSE) &&
!find_acl_user(combo->host.str=(char*)sctx->ip, combo->user.str,
FALSE) &&
!find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE))
{
VOID(pthread_mutex_unlock(&acl_cache->lock));
DBUG_RETURN(TRUE);
}
if ((au= find_acl_user(combo->host.str=(char*)sctx->host_or_ip,combo->user.str,FALSE)))
goto found_acl;
if ((au= find_acl_user(combo->host.str=(char*)sctx->host, combo->user.str,FALSE)))
goto found_acl;
if ((au= find_acl_user(combo->host.str=(char*)sctx->ip, combo->user.str,FALSE)))
goto found_acl;
if((au= find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE)))
goto found_acl;
VOID(pthread_mutex_unlock(&acl_cache->lock));
DBUG_RETURN(TRUE);
found_acl:
VOID(pthread_mutex_unlock(&acl_cache->lock));
bzero((char*)tables, sizeof(TABLE_LIST));
@ -5775,13 +5780,37 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
tables->db= (char*)sp_db;
tables->table_name= tables->alias= (char*)sp_name;
combo->host.length= strlen(combo->host.str);
combo->user.length= strlen(combo->user.str);
combo->host.str= thd->strmake(combo->host.str,combo->host.length);
combo->user.str= thd->strmake(combo->user.str,combo->user.length);
combo->password.str= (char*)"";
combo->password.length= 0;
if(au && au->salt_len)
{
if (au->salt_len == SCRAMBLE_LENGTH)
{
make_password_from_salt(passwd_buff, au->salt);
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
}
else if (au->salt_len == SCRAMBLE_LENGTH_323)
{
make_password_from_salt_323(passwd_buff, (ulong *) au->salt);
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
}
else
{
my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
return -1;
}
combo->password.str= passwd_buff;
}
else
{
combo->password.str= (char*)"";
combo->password.length= 0;
}
if (user_list.push_back(combo))
DBUG_RETURN(TRUE);

View file

@ -71,6 +71,10 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
static void store_key_options(THD *thd, String *packet, TABLE *table,
KEY *key_info);
static void
append_algorithm(TABLE_LIST *table, String *buff);
/***************************************************************************
** List all table types supported
***************************************************************************/
@ -1422,6 +1426,28 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
void
view_store_options(THD *thd, TABLE_LIST *table, String *buff)
{
append_algorithm(table, buff);
append_definer(thd, buff, &table->definer.user, &table->definer.host);
if (table->view_suid)
buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER "));
else
buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER "));
}
/*
Append DEFINER clause to the given buffer.
SYNOPSIS
append_definer()
thd [in] thread handle
buffer [inout] buffer to hold DEFINER clause
definer_user [in] user name part of definer
definer_host [in] host name part of definer
*/
static void append_algorithm(TABLE_LIST *table, String *buff)
{
buff->append(STRING_WITH_LEN("ALGORITHM="));
switch ((int8)table->algorithm) {
@ -1437,11 +1463,6 @@ view_store_options(THD *thd, TABLE_LIST *table, String *buff)
default:
DBUG_ASSERT(0); // never should happen
}
append_definer(thd, buff, &table->definer.user, &table->definer.host);
if (table->view_suid)
buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER "));
else
buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER "));
}
/*
@ -3517,7 +3538,16 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
if (grant & SHOW_VIEW_ACL)
table->field[3]->store(tables->query.str, tables->query.length, cs);
{
char buff[2048];
String qwe_str(buff, sizeof(buff), cs);
qwe_str.length(0);
qwe_str.append(STRING_WITH_LEN("/* "));
append_algorithm(tables, &qwe_str);
qwe_str.append(STRING_WITH_LEN("*/ "));
qwe_str.append(tables->query.str, tables->query.length);
table->field[3]->store(qwe_str.ptr(), qwe_str.length(), cs);
}
if (tables->with_check != VIEW_CHECK_NONE)
{

View file

@ -365,6 +365,8 @@ const GsnName SignalNames [] = {
,{ GSN_EVENT_SUBSCRIBE_REF, "EVENT_SUBSCRIBE_REF" }
,{ GSN_DUMP_STATE_ORD, "DUMP_STATE_ORD" }
,{ GSN_NODE_START_REP, "NODE_START_REP" }
,{ GSN_START_INFOREQ, "START_INFOREQ" }
,{ GSN_START_INFOREF, "START_INFOREF" }
,{ GSN_START_INFOCONF, "START_INFOCONF" }

View file

@ -85,10 +85,14 @@ DIH/s
START_MECONF
DIH/s
* sp7 - release DICT lock
* (copy data, omitted)
DIH/s
DICT_UNLOCK_ORD
DICT/m
* SL_STARTED - release DICT lock
CNTR/s
NODE_START_REP
DIH/s
DICT_UNLOCK_ORD
DICT/m
# vim: set et sw=4:

View file

@ -1609,6 +1609,9 @@ private:
void dump_replica_info();
// DIH specifics for execNODE_START_REP (sendDictUnlockOrd)
void exec_node_start_rep(Signal* signal);
/*
* Lock master DICT. Only current use is by starting node
* during NR. A pool of slave records is convenient anyway.

View file

@ -1387,24 +1387,6 @@ void Dbdih::execNDB_STTOR(Signal* signal)
}
ndbrequire(false);
break;
case ZNDB_SPH7:
jam();
switch (typestart) {
case NodeState::ST_INITIAL_START:
case NodeState::ST_SYSTEM_RESTART:
jam();
ndbsttorry10Lab(signal, __LINE__);
return;
case NodeState::ST_NODE_RESTART:
case NodeState::ST_INITIAL_NODE_RESTART:
jam();
sendDictUnlockOrd(signal, c_dictLockSlavePtrI_nodeRestart);
c_dictLockSlavePtrI_nodeRestart = RNIL;
ndbsttorry10Lab(signal, __LINE__);
return;
}
ndbrequire(false);
break;
default:
jam();
ndbsttorry10Lab(signal, __LINE__);
@ -1412,6 +1394,27 @@ void Dbdih::execNDB_STTOR(Signal* signal)
}//switch
}//Dbdih::execNDB_STTOR()
void
Dbdih::exec_node_start_rep(Signal* signal)
{
/*
* Send DICT_UNLOCK_ORD when this node is SL_STARTED.
*
* Sending it before (sp 7) conflicts with code which assumes
* SL_STARTING means we are in copy phase of NR.
*
* NodeState::starting.restartType is not supposed to be used
* when SL_STARTED. Also it seems NODE_START_REP can arrive twice.
*
* For these reasons there are no consistency checks and
* we rely on c_dictLockSlavePtrI_nodeRestart alone.
*/
if (c_dictLockSlavePtrI_nodeRestart != RNIL) {
sendDictUnlockOrd(signal, c_dictLockSlavePtrI_nodeRestart);
c_dictLockSlavePtrI_nodeRestart = RNIL;
}
}
void
Dbdih::createMutexes(Signal * signal, Uint32 count){
Callback c = { safe_cast(&Dbdih::createMutex_done), count };
@ -1636,6 +1639,7 @@ void Dbdih::nodeRestartPh2Lab(Signal* signal)
void Dbdih::recvDictLockConf_nodeRestart(Signal* signal, Uint32 data, Uint32 ret)
{
ndbrequire(c_dictLockSlavePtrI_nodeRestart == RNIL);
ndbrequire(data != RNIL);
c_dictLockSlavePtrI_nodeRestart = data;
nodeRestartPh2Lab2(signal);

View file

@ -498,6 +498,7 @@ void Dblqh::execSTTOR(Signal* signal)
csignalKey = signal->theData[6];
#if defined VM_TRACE || defined ERROR_INSERT || defined NDBD_TRACENR
char *name;
FILE *out = 0;
#endif
switch (tstartPhase) {
case ZSTART_PHASE1:
@ -509,8 +510,14 @@ void Dblqh::execSTTOR(Signal* signal)
sendsttorryLab(signal);
#if defined VM_TRACE || defined ERROR_INSERT || defined NDBD_TRACENR
name = NdbConfig_SignalLogFileName(getOwnNodeId());
tracenrout = new NdbOut(* new FileOutputStream(fopen(name, "w+")));
#ifdef VM_TRACE
out = globalSignalLoggers.getOutputStream();
#endif
if (out == 0) {
name = NdbConfig_SignalLogFileName(getOwnNodeId());
out = fopen(name, "a");
}
tracenrout = new NdbOut(* new FileOutputStream(out));
#endif
#ifdef ERROR_INSERT

View file

@ -920,6 +920,15 @@ SimulatedBlock::execCONTINUE_FRAGMENTED(Signal * signal){
void
SimulatedBlock::execNODE_START_REP(Signal* signal)
{
// common stuff for all blocks
// block specific stuff by virtual method override (default empty)
exec_node_start_rep(signal);
}
void
SimulatedBlock::exec_node_start_rep(Signal* signal)
{
}

View file

@ -446,7 +446,8 @@ private:
void execCONTINUE_FRAGMENTED(Signal* signal);
void execAPI_START_REP(Signal* signal);
void execNODE_START_REP(Signal* signal);
virtual void exec_node_start_rep(Signal* signal);
Uint32 c_fragmentIdCounter;
ArrayPool<FragmentInfo> c_fragmentInfoPool;
DLHashTable<FragmentInfo> c_fragmentInfoHash;

View file

@ -531,6 +531,10 @@ max-time: 1500
cmd: testDict
args: -n TemporaryTables T1 T6 T7 T8
max-time: 1500
cmd: testDict
args: -n Restart_NR2 T1
#
# TEST NDBAPI
#