Merge mysql.com:/home/pz/mysql/mysql-4.1-root
into mysql.com:/home/pz/mysql/mysql-4.1 sql/sql_yacc.yy: Auto merged
This commit is contained in:
commit
a6a8ce2842
23
.bzrignore
23
.bzrignore
@ -75,6 +75,7 @@ Makefile.in'
|
|||||||
PENDING/*
|
PENDING/*
|
||||||
TAGS
|
TAGS
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
|
autom4te.cache/*
|
||||||
bdb/README
|
bdb/README
|
||||||
bdb/btree/btree_auto.c
|
bdb/btree/btree_auto.c
|
||||||
bdb/build_unix/*
|
bdb/build_unix/*
|
||||||
@ -192,6 +193,7 @@ config.h.in
|
|||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
configure
|
configure
|
||||||
|
configure.lineno
|
||||||
core
|
core
|
||||||
db-*.*.*
|
db-*.*.*
|
||||||
dbug/user.t
|
dbug/user.t
|
||||||
@ -209,10 +211,13 @@ include/my_config.h
|
|||||||
include/my_global.h
|
include/my_global.h
|
||||||
include/mysql_version.h
|
include/mysql_version.h
|
||||||
include/widec.h
|
include/widec.h
|
||||||
|
innobase/autom4te.cache/*
|
||||||
|
innobase/configure.lineno
|
||||||
innobase/conftest.s1
|
innobase/conftest.s1
|
||||||
innobase/conftest.subs
|
innobase/conftest.subs
|
||||||
innobase/ib_config.h
|
innobase/ib_config.h
|
||||||
innobase/ib_config.h.in
|
innobase/ib_config.h.in
|
||||||
|
innobase/stamp-h1
|
||||||
isam/isamchk
|
isam/isamchk
|
||||||
isam/isamlog
|
isam/isamlog
|
||||||
isam/pack_isam
|
isam/pack_isam
|
||||||
@ -302,6 +307,7 @@ libmysqld/sql_db.cc
|
|||||||
libmysqld/sql_delete.cc
|
libmysqld/sql_delete.cc
|
||||||
libmysqld/sql_do.cc
|
libmysqld/sql_do.cc
|
||||||
libmysqld/sql_handler.cc
|
libmysqld/sql_handler.cc
|
||||||
|
libmysqld/sql_help.cc
|
||||||
libmysqld/sql_insert.cc
|
libmysqld/sql_insert.cc
|
||||||
libmysqld/sql_lex.cc
|
libmysqld/sql_lex.cc
|
||||||
libmysqld/sql_list.cc
|
libmysqld/sql_list.cc
|
||||||
@ -361,6 +367,8 @@ myisam/myisamchk
|
|||||||
myisam/myisamlog
|
myisam/myisamlog
|
||||||
myisam/myisampack
|
myisam/myisampack
|
||||||
myisam/rt_test
|
myisam/rt_test
|
||||||
|
myisam/rt_test.MYD
|
||||||
|
myisam/rt_test.MYI
|
||||||
myisam/sp_test
|
myisam/sp_test
|
||||||
myisam/test1.MYD
|
myisam/test1.MYD
|
||||||
myisam/test1.MYI
|
myisam/test1.MYI
|
||||||
@ -405,6 +413,8 @@ repl-tests/test-repl/foo-dump-slave.master.
|
|||||||
repl-tests/test-repl/sum-wlen-slave.master.
|
repl-tests/test-repl/sum-wlen-slave.master.
|
||||||
repl-tests/test-repl/sum-wlen-slave.master.re
|
repl-tests/test-repl/sum-wlen-slave.master.re
|
||||||
repl-tests/test-repl/sum-wlen-slave.master.reje
|
repl-tests/test-repl/sum-wlen-slave.master.reje
|
||||||
|
scripts/fill_func_tables
|
||||||
|
scripts/fill_func_tables.sql
|
||||||
scripts/make_binary_distribution
|
scripts/make_binary_distribution
|
||||||
scripts/msql2mysql
|
scripts/msql2mysql
|
||||||
scripts/mysql_config
|
scripts/mysql_config
|
||||||
@ -474,8 +484,11 @@ sql/sql_select.cc.orig
|
|||||||
sql/sql_yacc.cc
|
sql/sql_yacc.cc
|
||||||
sql/sql_yacc.h
|
sql/sql_yacc.h
|
||||||
sql/sql_yacc.yy.orig
|
sql/sql_yacc.yy.orig
|
||||||
|
sql_error.cc
|
||||||
|
sql_prepare.cc
|
||||||
stamp-h
|
stamp-h
|
||||||
stamp-h.in
|
stamp-h.in
|
||||||
|
stamp-h1
|
||||||
strings/conf_to_src
|
strings/conf_to_src
|
||||||
strings/ctype_autoconf.c
|
strings/ctype_autoconf.c
|
||||||
strings/ctype_extra_sources.c
|
strings/ctype_extra_sources.c
|
||||||
@ -503,13 +516,3 @@ vio/test-ssl
|
|||||||
vio/test-sslclient
|
vio/test-sslclient
|
||||||
vio/test-sslserver
|
vio/test-sslserver
|
||||||
vio/viotest-ssl
|
vio/viotest-ssl
|
||||||
sql_error.cc
|
|
||||||
sql_prepare.cc
|
|
||||||
autom4te.cache/*
|
|
||||||
innobase/autom4te.cache/*
|
|
||||||
configure.lineno
|
|
||||||
innobase/configure.lineno
|
|
||||||
innobase/stamp-h1
|
|
||||||
myisam/rt_test.MYD
|
|
||||||
myisam/rt_test.MYI
|
|
||||||
stamp-h1
|
|
||||||
|
@ -69,4 +69,5 @@ pager:
|
|||||||
hours:
|
hours:
|
||||||
[serg:]checkout:get
|
[serg:]checkout:get
|
||||||
[arjen:]checkout:get
|
[arjen:]checkout:get
|
||||||
|
[nick:]checkout:get
|
||||||
checkout:edit
|
checkout:edit
|
||||||
|
@ -74,6 +74,7 @@ typedef struct st_thr_lock_data {
|
|||||||
enum thr_lock_type type;
|
enum thr_lock_type type;
|
||||||
ulong thread_id;
|
ulong thread_id;
|
||||||
void *status_param; /* Param to status functions */
|
void *status_param; /* Param to status functions */
|
||||||
|
void *debug_print_param;
|
||||||
} THR_LOCK_DATA;
|
} THR_LOCK_DATA;
|
||||||
|
|
||||||
struct st_lock_list {
|
struct st_lock_list {
|
||||||
@ -97,6 +98,9 @@ typedef struct st_thr_lock {
|
|||||||
} THR_LOCK;
|
} THR_LOCK;
|
||||||
|
|
||||||
|
|
||||||
|
extern LIST *thr_lock_thread_list;
|
||||||
|
extern pthread_mutex_t THR_LOCK_lock;
|
||||||
|
|
||||||
my_bool init_thr_lock(void); /* Must be called once/thread */
|
my_bool init_thr_lock(void); /* Must be called once/thread */
|
||||||
void thr_lock_init(THR_LOCK *lock);
|
void thr_lock_init(THR_LOCK *lock);
|
||||||
void thr_lock_delete(THR_LOCK *lock);
|
void thr_lock_delete(THR_LOCK *lock);
|
||||||
|
@ -18,3 +18,9 @@ a y
|
|||||||
3 3
|
3 3
|
||||||
3 3
|
3 3
|
||||||
drop table if exists t1.t2,t3;
|
drop table if exists t1.t2,t3;
|
||||||
|
select * from (select 1);
|
||||||
|
1
|
||||||
|
1
|
||||||
|
select a from (select 1 as a);
|
||||||
|
a
|
||||||
|
1
|
||||||
|
Binary file not shown.
@ -9,3 +9,5 @@ CREATE TABLE t3 (a int not null, b char (10) not null);
|
|||||||
insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
|
insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
|
||||||
select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
|
select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
|
||||||
drop table if exists t1.t2,t3;
|
drop table if exists t1.t2,t3;
|
||||||
|
select * from (select 1);
|
||||||
|
select a from (select 1 as a);
|
||||||
|
@ -91,7 +91,7 @@ enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE;
|
|||||||
#define MAX_LOCKS 100
|
#define MAX_LOCKS 100
|
||||||
|
|
||||||
|
|
||||||
static LIST *thread_list; /* List of threads in use */
|
LIST *thr_lock_thread_list; /* List of threads in use */
|
||||||
ulong max_write_lock_count= ~(ulong) 0L;
|
ulong max_write_lock_count= ~(ulong) 0L;
|
||||||
|
|
||||||
static inline pthread_cond_t *get_cond(void)
|
static inline pthread_cond_t *get_cond(void)
|
||||||
@ -307,7 +307,7 @@ void thr_lock_init(THR_LOCK *lock)
|
|||||||
|
|
||||||
pthread_mutex_lock(&THR_LOCK_lock); /* Add to locks in use */
|
pthread_mutex_lock(&THR_LOCK_lock); /* Add to locks in use */
|
||||||
lock->list.data=(void*) lock;
|
lock->list.data=(void*) lock;
|
||||||
thread_list=list_add(thread_list,&lock->list);
|
thr_lock_thread_list=list_add(thr_lock_thread_list,&lock->list);
|
||||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ void thr_lock_delete(THR_LOCK *lock)
|
|||||||
DBUG_ENTER("thr_lock_delete");
|
DBUG_ENTER("thr_lock_delete");
|
||||||
VOID(pthread_mutex_destroy(&lock->mutex));
|
VOID(pthread_mutex_destroy(&lock->mutex));
|
||||||
pthread_mutex_lock(&THR_LOCK_lock);
|
pthread_mutex_lock(&THR_LOCK_lock);
|
||||||
thread_list=list_delete(thread_list,&lock->list);
|
thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list);
|
||||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -1061,7 +1061,7 @@ void thr_print_locks(void)
|
|||||||
|
|
||||||
pthread_mutex_lock(&THR_LOCK_lock);
|
pthread_mutex_lock(&THR_LOCK_lock);
|
||||||
puts("Current locks:");
|
puts("Current locks:");
|
||||||
for (list=thread_list ; list && count++ < MAX_THREADS ; list=rest(list))
|
for (list=thr_lock_thread_list ; list && count++ < MAX_THREADS ; list=rest(list))
|
||||||
{
|
{
|
||||||
THR_LOCK *lock=(THR_LOCK*) list->data;
|
THR_LOCK *lock=(THR_LOCK*) list->data;
|
||||||
VOID(pthread_mutex_lock(&lock->mutex));
|
VOID(pthread_mutex_lock(&lock->mutex));
|
||||||
|
11
sql/lock.cc
11
sql/lock.cc
@ -69,6 +69,12 @@ TODO:
|
|||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ha_myisammrg.h>
|
||||||
|
#ifndef MASTER
|
||||||
|
#include "../srclib/myisammrg/myrg_def.h"
|
||||||
|
#else
|
||||||
|
#include "../myisammrg/myrg_def.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern HASH open_cache;
|
extern HASH open_cache;
|
||||||
|
|
||||||
@ -154,6 +160,7 @@ retry:
|
|||||||
sql_lock=0;
|
sql_lock=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thd->lock_time();
|
thd->lock_time();
|
||||||
DBUG_RETURN (sql_lock);
|
DBUG_RETURN (sql_lock);
|
||||||
}
|
}
|
||||||
@ -410,8 +417,12 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
THR_LOCK_DATA **org_locks = locks;
|
||||||
locks=table->file->store_lock(thd, locks, get_old_locks ? TL_IGNORE :
|
locks=table->file->store_lock(thd, locks, get_old_locks ? TL_IGNORE :
|
||||||
lock_type);
|
lock_type);
|
||||||
|
if (locks)
|
||||||
|
for ( ; org_locks != locks ; org_locks++)
|
||||||
|
(*org_locks)->debug_print_param= (void *) table;
|
||||||
}
|
}
|
||||||
return sql_lock;
|
return sql_lock;
|
||||||
}
|
}
|
||||||
|
2995
sql/log_event.cc
2995
sql/log_event.cc
File diff suppressed because it is too large
Load Diff
107
sql/log_event.h
107
sql/log_event.h
@ -54,6 +54,11 @@
|
|||||||
#define LINE_START_EMPTY 0x8
|
#define LINE_START_EMPTY 0x8
|
||||||
#define ESCAPED_EMPTY 0x10
|
#define ESCAPED_EMPTY 0x10
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
old_sql_ex struct
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
struct old_sql_ex
|
struct old_sql_ex
|
||||||
{
|
{
|
||||||
char field_term;
|
char field_term;
|
||||||
@ -67,6 +72,11 @@ struct old_sql_ex
|
|||||||
|
|
||||||
#define NUM_LOAD_DELIM_STRS 5
|
#define NUM_LOAD_DELIM_STRS 5
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
sql_ex_info struct
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
struct sql_ex_info
|
struct sql_ex_info
|
||||||
{
|
{
|
||||||
char* field_term;
|
char* field_term;
|
||||||
@ -99,13 +109,19 @@ struct sql_ex_info
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*****************************************************************************
|
||||||
Binary log consists of events. Each event has a fixed length header,
|
|
||||||
followed by possibly variable ( depending on the type of event) length
|
MySQL Binary Log
|
||||||
data body. The data body consists of an optional fixed length segment
|
|
||||||
(post-header), and an optional variable length segment. See #defines and
|
This log consists of events. Each event has a fixed-length header,
|
||||||
comments below for the format specifics
|
possibly followed by a variable length data body.
|
||||||
*/
|
|
||||||
|
The data body consists of an optional fixed length segment (post-header)
|
||||||
|
and an optional variable length segment.
|
||||||
|
|
||||||
|
See the #defines below for the format specifics.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
/* event-specific post-header sizes */
|
/* event-specific post-header sizes */
|
||||||
#define LOG_EVENT_HEADER_LEN 19
|
#define LOG_EVENT_HEADER_LEN 19
|
||||||
@ -221,6 +237,13 @@ class THD;
|
|||||||
|
|
||||||
struct st_relay_log_info;
|
struct st_relay_log_info;
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Log_event class
|
||||||
|
|
||||||
|
This is the abstract base class for binary log events.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Log_event
|
class Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -303,6 +326,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Query Log Event class
|
||||||
|
|
||||||
|
Logs SQL queries
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Query_log_event: public Log_event
|
class Query_log_event: public Log_event
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -355,6 +385,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Slave Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Slave_log_event: public Log_event
|
class Slave_log_event: public Log_event
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -384,6 +419,12 @@ public:
|
|||||||
int write_data(IO_CACHE* file );
|
int write_data(IO_CACHE* file );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Load Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Load_log_event: public Log_event
|
class Load_log_event: public Log_event
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -446,6 +487,11 @@ public:
|
|||||||
|
|
||||||
extern char server_version[SERVER_VERSION_LENGTH];
|
extern char server_version[SERVER_VERSION_LENGTH];
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Start Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Start_log_event: public Log_event
|
class Start_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -477,6 +523,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Intvar Log Event class
|
||||||
|
|
||||||
|
Logs special variables such as auto_increment values
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Intvar_log_event: public Log_event
|
class Intvar_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -503,9 +556,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
|
||||||
* Rand log event class
|
Rand Log Event class
|
||||||
*
|
|
||||||
|
Logs random seed used by the next RAND()
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
class Rand_log_event: public Log_event
|
class Rand_log_event: public Log_event
|
||||||
{
|
{
|
||||||
@ -531,6 +586,12 @@ class Rand_log_event: public Log_event
|
|||||||
bool is_valid() { return 1; }
|
bool is_valid() { return 1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Stop Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Stop_log_event: public Log_event
|
class Stop_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -551,6 +612,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Rotate Log Event class
|
||||||
|
|
||||||
|
This will be depricated when we move to using sequence ids.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Rotate_log_event: public Log_event
|
class Rotate_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -585,6 +653,11 @@ public:
|
|||||||
|
|
||||||
/* the classes below are for the new LOAD DATA INFILE logging */
|
/* the classes below are for the new LOAD DATA INFILE logging */
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Create File Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Create_file_log_event: public Load_log_event
|
class Create_file_log_event: public Load_log_event
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -641,6 +714,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Append Block Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Append_block_log_event: public Log_event
|
class Append_block_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -665,7 +743,11 @@ public:
|
|||||||
int write_data(IO_CACHE* file);
|
int write_data(IO_CACHE* file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Delete File Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Delete_file_log_event: public Log_event
|
class Delete_file_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -687,6 +769,11 @@ public:
|
|||||||
int write_data(IO_CACHE* file);
|
int write_data(IO_CACHE* file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
Execute Load Log Event class
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
class Execute_load_log_event: public Log_event
|
class Execute_load_log_event: public Log_event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -70,7 +70,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t,
|
|||||||
|
|
||||||
if (tables_is_opened || !(res=open_and_lock_tables(thd,tables)))
|
if (tables_is_opened || !(res=open_and_lock_tables(thd,tables)))
|
||||||
{
|
{
|
||||||
if (tables && setup_fields(thd,tables,item_list,0,0,1))
|
if (setup_fields(thd,tables,item_list,0,0,1))
|
||||||
{
|
{
|
||||||
res=-1;
|
res=-1;
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -113,6 +113,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t,
|
|||||||
t->table=table;
|
t->table=table;
|
||||||
table->derived_select_number= sl->select_number;
|
table->derived_select_number= sl->select_number;
|
||||||
sl->exclude();
|
sl->exclude();
|
||||||
|
t->db= (tables && tables->db && tables->db[0]) ? t->db : thd->db;
|
||||||
t->derived=(SELECT_LEX *)0; // just in case ...
|
t->derived=(SELECT_LEX *)0; // just in case ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1388,10 +1388,14 @@ mysql_execute_command(THD *thd)
|
|||||||
for (TABLE_LIST *cursor= tables;
|
for (TABLE_LIST *cursor= tables;
|
||||||
cursor;
|
cursor;
|
||||||
cursor= cursor->next)
|
cursor= cursor->next)
|
||||||
if (cursor->derived && mysql_derived(thd, lex,
|
if (cursor->derived && (res=mysql_derived(thd, lex,
|
||||||
(SELECT_LEX_UNIT *)cursor->derived,
|
(SELECT_LEX_UNIT *)cursor->derived,
|
||||||
cursor, 0))
|
cursor, 0)))
|
||||||
|
{
|
||||||
|
if (res < 0)
|
||||||
|
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((lex->select_lex.next_select_in_list() &&
|
if ((lex->select_lex.next_select_in_list() &&
|
||||||
lex->unit.create_total_list(thd, lex, &tables)) ||
|
lex->unit.create_total_list(thd, lex, &tables)) ||
|
||||||
@ -2781,7 +2785,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
|
|||||||
found=1;
|
found=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
|
else if (tables->db && check_access(thd,want_access,tables->db,&tables->grant.privilege,
|
||||||
0, no_errors))
|
0, no_errors))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
129
sql/sql_test.cc
129
sql/sql_test.cc
@ -26,6 +26,23 @@
|
|||||||
/* Intern key cache variables */
|
/* Intern key cache variables */
|
||||||
extern "C" pthread_mutex_t THR_LOCK_keycache;
|
extern "C" pthread_mutex_t THR_LOCK_keycache;
|
||||||
|
|
||||||
|
static const char *lock_descriptions[] =
|
||||||
|
{
|
||||||
|
"No lock",
|
||||||
|
"Low priority read lock",
|
||||||
|
"Shared Read lock",
|
||||||
|
"High priority read lock",
|
||||||
|
"Read lock without concurrent inserts",
|
||||||
|
"Write lock that allows other writers",
|
||||||
|
"Write lock, but allow reading",
|
||||||
|
"Concurrent insert lock",
|
||||||
|
"Lock Used by delayed insert",
|
||||||
|
"Low priority write lock",
|
||||||
|
"High priority write lock",
|
||||||
|
"Highest priority write lock"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -45,29 +62,11 @@ print_where(COND *cond,const char *info)
|
|||||||
DBUG_UNLOCK_FILE;
|
DBUG_UNLOCK_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is for debugging purposes */
|
/* This is for debugging purposes */
|
||||||
|
|
||||||
extern HASH open_cache;
|
extern HASH open_cache;
|
||||||
extern TABLE *unused_tables;
|
extern TABLE *unused_tables;
|
||||||
|
|
||||||
static const char *lock_descriptions[] =
|
|
||||||
{
|
|
||||||
"No lock",
|
|
||||||
"Low priority read lock",
|
|
||||||
"Shared Read lock",
|
|
||||||
"High priority read lock",
|
|
||||||
"Read lock without concurrent inserts",
|
|
||||||
"Write lock that allows other writers",
|
|
||||||
"Write lock, but allow reading",
|
|
||||||
"Concurrent insert lock",
|
|
||||||
"Lock Used by delayed insert",
|
|
||||||
"Low priority write lock",
|
|
||||||
"High priority write lock",
|
|
||||||
"Highest priority write lock"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void print_cached_tables(void)
|
void print_cached_tables(void)
|
||||||
{
|
{
|
||||||
uint idx,count,unused;
|
uint idx,count,unused;
|
||||||
@ -203,6 +202,99 @@ TEST_join(JOIN *join)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct st_debug_lock
|
||||||
|
{
|
||||||
|
ulong thread_id;
|
||||||
|
char table_name[FN_REFLEN];
|
||||||
|
bool waiting;
|
||||||
|
const char *lock_text;
|
||||||
|
enum thr_lock_type type;
|
||||||
|
} TABLE_LOCK_INFO;
|
||||||
|
|
||||||
|
static int dl_compare(TABLE_LOCK_INFO *a,TABLE_LOCK_INFO *b)
|
||||||
|
{
|
||||||
|
if (a->thread_id > b->thread_id)
|
||||||
|
return 1;
|
||||||
|
if (a->thread_id < b->thread_id)
|
||||||
|
return -1;
|
||||||
|
if (a->waiting == b->waiting)
|
||||||
|
return 0;
|
||||||
|
else if (a->waiting)
|
||||||
|
return -1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data, bool wait, const char *text)
|
||||||
|
{
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
TABLE *table=(TABLE *)data->debug_print_param;
|
||||||
|
if (table && table->tmp_table == NO_TMP_TABLE)
|
||||||
|
{
|
||||||
|
TABLE_LOCK_INFO table_lock_info;
|
||||||
|
table_lock_info.thread_id=table->in_use->thread_id;
|
||||||
|
memcpy(table_lock_info.table_name, table->table_cache_key, table->key_length);
|
||||||
|
table_lock_info.table_name[strlen(table_lock_info.table_name)]='.';
|
||||||
|
table_lock_info.waiting=wait;
|
||||||
|
table_lock_info.lock_text=text;
|
||||||
|
table_lock_info.type=table->reginfo.lock_type; // obtainable also from THR_LOCK_DATA
|
||||||
|
VOID(push_dynamic(ar,(gptr) &table_lock_info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Regarding MERGE tables:
|
||||||
|
|
||||||
|
For now, the best option is to use the common TABLE *pointer for all
|
||||||
|
cases; The drawback is that for MERGE tables we will see many locks
|
||||||
|
for the merge tables even if some of them are for individual tables.
|
||||||
|
|
||||||
|
The way to solve this is to add to 'THR_LOCK' structure a pointer to
|
||||||
|
the filename and use this when printing the data.
|
||||||
|
(We can for now ignore this and just print the same name for all merge
|
||||||
|
table parts; Please add the above as a comment to the display_lock
|
||||||
|
function so that we can easily add this if we ever need this.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void display_table_locks (void)
|
||||||
|
{
|
||||||
|
LIST *list;
|
||||||
|
DYNAMIC_ARRAY saved_table_locks;
|
||||||
|
|
||||||
|
VOID(my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO),open_cache.records + 20,50));
|
||||||
|
VOID(pthread_mutex_lock(&THR_LOCK_lock));
|
||||||
|
for (list=thr_lock_thread_list ; list ; list=rest(list))
|
||||||
|
{
|
||||||
|
THR_LOCK *lock=(THR_LOCK*) list->data;
|
||||||
|
|
||||||
|
VOID(pthread_mutex_lock(&lock->mutex));
|
||||||
|
push_locks_into_array(&saved_table_locks, lock->write.data, false, "Locked - write");
|
||||||
|
push_locks_into_array(&saved_table_locks, lock->write_wait.data, true, "Waiting - write");
|
||||||
|
push_locks_into_array(&saved_table_locks, lock->read.data, false, "Locked - read");
|
||||||
|
push_locks_into_array(&saved_table_locks, lock->read_wait.data, true, "Waiting - read");
|
||||||
|
VOID(pthread_mutex_unlock(&lock->mutex));
|
||||||
|
}
|
||||||
|
VOID(pthread_mutex_unlock(&THR_LOCK_lock));
|
||||||
|
if (!saved_table_locks.elements) goto end;
|
||||||
|
|
||||||
|
qsort((gptr) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
|
||||||
|
freeze_size(&saved_table_locks);
|
||||||
|
|
||||||
|
puts("\nThread database.table_name Locked/Waiting Lock_type\n");
|
||||||
|
|
||||||
|
for (uint i=0 ; i < saved_table_locks.elements ; i++)
|
||||||
|
{
|
||||||
|
TABLE_LOCK_INFO *dl_ptr=dynamic_element(&saved_table_locks,i,TABLE_LOCK_INFO*);
|
||||||
|
printf("%-8ld%-28.28s%-22s%s\n",
|
||||||
|
dl_ptr->thread_id,dl_ptr->table_name,dl_ptr->lock_text,lock_descriptions[(int)dl_ptr->type]);
|
||||||
|
}
|
||||||
|
puts("\n\n");
|
||||||
|
end:
|
||||||
|
delete_dynamic(&saved_table_locks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void mysql_print_status(THD *thd)
|
void mysql_print_status(THD *thd)
|
||||||
{
|
{
|
||||||
char current_dir[FN_REFLEN];
|
char current_dir[FN_REFLEN];
|
||||||
@ -268,6 +360,7 @@ Next alarm time: %lu\n",
|
|||||||
alarm_info.max_used_alarms,
|
alarm_info.max_used_alarms,
|
||||||
alarm_info.next_alarm_time);
|
alarm_info.next_alarm_time);
|
||||||
#endif
|
#endif
|
||||||
|
display_table_locks();
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (thd)
|
if (thd)
|
||||||
thd->proc_info="malloc";
|
thd->proc_info="malloc";
|
||||||
|
@ -1449,20 +1449,6 @@ slave:
|
|||||||
lex->sql_command = SQLCOM_SLAVE_STOP;
|
lex->sql_command = SQLCOM_SLAVE_STOP;
|
||||||
lex->type = 0;
|
lex->type = 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
SLAVE START_SYM slave_thread_opts
|
|
||||||
{
|
|
||||||
LEX *lex=Lex;
|
|
||||||
lex->sql_command = SQLCOM_SLAVE_START;
|
|
||||||
lex->type = 0;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
SLAVE STOP_SYM slave_thread_opts
|
|
||||||
{
|
|
||||||
LEX *lex=Lex;
|
|
||||||
lex->sql_command = SQLCOM_SLAVE_STOP;
|
|
||||||
lex->type = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
slave_thread_opts:
|
slave_thread_opts:
|
||||||
slave_thread_opt
|
slave_thread_opt
|
||||||
|
@ -64,7 +64,7 @@ longlong2str:
|
|||||||
jne .L150
|
jne .L150
|
||||||
movb $48,(%edi)
|
movb $48,(%edi)
|
||||||
incl %edi
|
incl %edi
|
||||||
jmp .L164
|
jmp .L10_end
|
||||||
.align 4
|
.align 4
|
||||||
|
|
||||||
.L150:
|
.L150:
|
||||||
@ -81,9 +81,9 @@ longlong2str:
|
|||||||
movl %eax,%ebp
|
movl %eax,%ebp
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
divl %ebx
|
divl %ebx
|
||||||
|
decl %ecx
|
||||||
movl %eax,%esi # quotent in ebp:esi
|
movl %eax,%esi # quotent in ebp:esi
|
||||||
movb _dig_vec(%edx),%al # al is faster than dl
|
movb _dig_vec(%edx),%al # al is faster than dl
|
||||||
decl %ecx
|
|
||||||
movb %al,(%ecx) # store value in buff
|
movb %al,(%ecx) # store value in buff
|
||||||
.align 4
|
.align 4
|
||||||
.L155:
|
.L155:
|
||||||
@ -91,7 +91,7 @@ longlong2str:
|
|||||||
ja .L153
|
ja .L153
|
||||||
testl %esi,%esi # rest value
|
testl %esi,%esi # rest value
|
||||||
jl .L153
|
jl .L153
|
||||||
je .L160 # Ready
|
je .L10_mov # Ready
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
movl $_dig_vec,%ebp
|
movl $_dig_vec,%ebp
|
||||||
.align 4
|
.align 4
|
||||||
@ -105,14 +105,14 @@ longlong2str:
|
|||||||
movb %dl,(%ecx)
|
movb %dl,(%ecx)
|
||||||
jne .L154
|
jne .L154
|
||||||
|
|
||||||
.L160:
|
.L10_mov:
|
||||||
movl %ecx,%esi
|
movl %ecx,%esi
|
||||||
leal 92(%esp),%ecx # End of buffer
|
leal 92(%esp),%ecx # End of buffer
|
||||||
subl %esi,%ecx
|
subl %esi,%ecx
|
||||||
rep
|
rep
|
||||||
movsb
|
movsb
|
||||||
|
|
||||||
.L164:
|
.L10_end:
|
||||||
movl %edi,%eax # Pointer to end null
|
movl %edi,%eax # Pointer to end null
|
||||||
movb $0,(%edi) # Store the end null
|
movb $0,(%edi) # Store the end null
|
||||||
|
|
||||||
@ -131,10 +131,93 @@ longlong2str:
|
|||||||
.Lfe3:
|
.Lfe3:
|
||||||
.size longlong2str,.Lfe3-longlong2str
|
.size longlong2str,.Lfe3-longlong2str
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is almost equal to the above, except that we can do the final
|
||||||
|
# loop much more efficient
|
||||||
|
#
|
||||||
|
|
||||||
|
.align 4
|
||||||
|
.Ltmp:
|
||||||
|
.long 0xcccccccd
|
||||||
|
.align 4
|
||||||
|
|
||||||
.globl longlong10_to_str
|
.globl longlong10_to_str
|
||||||
.type longlong10_str,@function
|
.type longlong10_str,@function
|
||||||
longlong10_to_str:
|
longlong10_to_str:
|
||||||
jmp longlong2str
|
subl $80,%esp
|
||||||
|
pushl %ebp
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
pushl %ebx
|
||||||
|
movl 100(%esp),%esi # Lower part of val
|
||||||
|
movl 104(%esp),%ebp # Higher part of val
|
||||||
|
movl 108(%esp),%edi # get dst
|
||||||
|
movl 112(%esp),%ebx # Radix (10 or -10)
|
||||||
|
testl %ebx,%ebx
|
||||||
|
jge .L10_10 # Positive radix
|
||||||
|
|
||||||
|
negl %ebx # Change radix to positive (= 10)
|
||||||
|
|
||||||
|
testl %ebp,%ebp # Test if negative value
|
||||||
|
jge .L10_10
|
||||||
|
movb $45,(%edi) # Add sign
|
||||||
|
incl %edi
|
||||||
|
negl %esi # Change sign of val (ebp:esi)
|
||||||
|
adcl $0,%ebp
|
||||||
|
negl %ebp
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
.L10_10:
|
||||||
|
leal 92(%esp),%ecx # End of buffer
|
||||||
|
movl %esi,%eax # Test if zero (for easy loop)
|
||||||
|
orl %ebp,%eax
|
||||||
|
jne .L10_30 # Not zero
|
||||||
|
|
||||||
|
# Here when value is zero
|
||||||
|
movb $48,(%edi)
|
||||||
|
incl %edi
|
||||||
|
jmp .L10_end
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
.L10_20:
|
||||||
|
# val is stored in in ebp:esi
|
||||||
|
movl %ebp,%eax # High part of value
|
||||||
|
xorl %edx,%edx
|
||||||
|
divl %ebx # Divide by 10
|
||||||
|
movl %eax,%ebp
|
||||||
|
movl %esi,%eax
|
||||||
|
divl %ebx # Divide by 10
|
||||||
|
decl %ecx
|
||||||
|
movl %eax,%esi # quotent in ebp:esi
|
||||||
|
addl $48,%edx # Convert to ascii
|
||||||
|
movb %dl,(%ecx) # store value in buff
|
||||||
|
|
||||||
|
.L10_30:
|
||||||
|
testl %ebp,%ebp
|
||||||
|
ja .L10_20
|
||||||
|
testl %esi,%esi # rest value
|
||||||
|
jl .L10_20 # Unsigned, do ulonglong div once more
|
||||||
|
je .L10_mov # Ready
|
||||||
|
movl %esi,%ebx # Move val to %ebx
|
||||||
|
|
||||||
|
# The following code uses some tricks to change division by 10 to
|
||||||
|
# multiplication and shifts
|
||||||
|
movl .Ltmp,%esi # set %esi to 0xcccccccd
|
||||||
|
|
||||||
|
.L10_40:
|
||||||
|
movl %ebx,%eax
|
||||||
|
mull %esi
|
||||||
|
decl %ecx
|
||||||
|
shrl $3,%edx
|
||||||
|
leal (%edx,%edx,4),%eax
|
||||||
|
addl %eax,%eax
|
||||||
|
subb %al,%bl # %bl now contains val % 10
|
||||||
|
addb $48,%bl
|
||||||
|
movb %bl,(%ecx)
|
||||||
|
movl %edx,%ebx
|
||||||
|
testl %ebx,%ebx
|
||||||
|
jne .L10_40
|
||||||
|
jmp .L10_mov # Shared end with longlong10_to_str
|
||||||
|
|
||||||
.L10end:
|
.L10end:
|
||||||
.size longlong10_to_str,.L10end-longlong10_to_str
|
.size longlong10_to_str,.L10end-longlong10_to_str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user