Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
dd49c33f
Commit
dd49c33f
authored
Mar 21, 2003
by
hf@genie.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCRUM
two versions of KILL implementation
parent
df8ac83e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
9 deletions
+31
-9
include/mysql_com.h
include/mysql_com.h
+2
-0
sql/lex.h
sql/lex.h
+1
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+17
-5
sql/sql_yacc.yy
sql/sql_yacc.yy
+9
-3
No files found.
include/mysql_com.h
View file @
dd49c33f
...
...
@@ -118,6 +118,8 @@ enum enum_server_command
#define NET_WRITE_TIMEOUT 60
/* Timeout on write */
#define NET_WAIT_TIMEOUT 8*60*60
/* Wait for new query */
#define ONLY_KILL_QUERY 1
struct
st_vio
;
/* Only C */
typedef
struct
st_vio
Vio
;
...
...
sql/lex.h
View file @
dd49c33f
...
...
@@ -102,6 +102,7 @@ static SYMBOL symbols[] = {
{
"COMMITTED"
,
SYM
(
COMMITTED_SYM
),
0
,
0
},
{
"COMPRESSED"
,
SYM
(
COMPRESSED_SYM
),
0
,
0
},
{
"CONCURRENT"
,
SYM
(
CONCURRENT
),
0
,
0
},
{
"CONNECTION"
,
SYM
(
CONNECTION_SYM
),
0
,
0
},
{
"CONSTRAINT"
,
SYM
(
CONSTRAINT
),
0
,
0
},
{
"CREATE"
,
SYM
(
CREATE
),
0
,
0
},
{
"CROSS"
,
SYM
(
CROSS
),
0
,
0
},
...
...
sql/mysql_priv.h
View file @
dd49c33f
...
...
@@ -45,7 +45,7 @@ char *sql_strdup(const char *str);
char
*
sql_strmake
(
const
char
*
str
,
uint
len
);
gptr
sql_memdup
(
const
void
*
ptr
,
unsigned
size
);
void
sql_element_free
(
void
*
ptr
);
void
kill_one_thread
(
THD
*
thd
,
ulong
id
);
void
kill_one_thread
(
THD
*
thd
,
ulong
id
,
bool
only_kill_query
);
bool
net_request_file
(
NET
*
net
,
const
char
*
fname
);
char
*
query_table_status
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
...
...
sql/sql_class.h
View file @
dd49c33f
...
...
@@ -550,6 +550,7 @@ public:
bool
system_thread
,
in_lock_tables
,
global_read_lock
;
bool
query_error
,
bootstrap
,
cleanup_done
;
bool
volatile
killed
;
bool
volatile
only_kill_query
;
bool
prepare_command
;
bool
tmp_table_used
;
sp_rcontext
*
spcont
;
// SP runtime context
...
...
sql/sql_parse.cc
View file @
dd49c33f
...
...
@@ -848,7 +848,7 @@ pthread_handler_decl(handle_one_connection,arg)
init_sql_alloc
(
&
thd
->
mem_root
,
MEM_ROOT_BLOCK_SIZE
,
MEM_ROOT_PREALLOC
);
init_sql_alloc
(
&
thd
->
transaction
.
mem_root
,
TRANS_MEM_ROOT_BLOCK_SIZE
,
TRANS_MEM_ROOT_PREALLOC
);
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
thd
->
killed
)
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
(
thd
->
killed
&&
!
thd
->
only_kill_query
)
)
{
if
(
do_command
(
thd
))
break
;
...
...
@@ -1054,6 +1054,12 @@ bool do_command(THD *thd)
}
else
{
if
(
thd
->
only_kill_query
)
{
thd
->
killed
=
FALSE
;
thd
->
only_kill_query
=
FALSE
;
}
packet
=
(
char
*
)
net
->
read_pos
;
command
=
(
enum
enum_server_command
)
(
uchar
)
packet
[
0
];
if
(
command
>=
COM_END
)
...
...
@@ -1473,7 +1479,7 @@ restore_user:
{
statistic_increment
(
com_stat
[
SQLCOM_KILL
],
&
LOCK_status
);
ulong
id
=
(
ulong
)
uint4korr
(
packet
);
kill_one_thread
(
thd
,
id
);
kill_one_thread
(
thd
,
id
,
false
);
break
;
}
case
COM_DEBUG
:
...
...
@@ -2890,7 +2896,7 @@ mysql_execute_command(THD *thd)
reload_acl_and_cache
(
thd
,
lex
->
type
,
tables
)
;
break
;
case
SQLCOM_KILL
:
kill_one_thread
(
thd
,
lex
->
thread_id
);
kill_one_thread
(
thd
,
lex
->
thread_id
,
lex
->
type
&
ONLY_KILL_QUERY
);
break
;
case
SQLCOM_SHOW_GRANTS
:
res
=
0
;
...
...
@@ -4179,7 +4185,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
This is written such that we have a short lock on LOCK_thread_count
*/
void
kill_one_thread
(
THD
*
thd
,
ulong
id
)
void
kill_one_thread
(
THD
*
thd
,
ulong
id
,
bool
only_kill_query
)
{
THD
*
tmp
;
uint
error
=
ER_NO_SUCH_THREAD
;
...
...
@@ -4199,6 +4205,12 @@ void kill_one_thread(THD *thd, ulong id)
if
((
thd
->
master_access
&
SUPER_ACL
)
||
!
strcmp
(
thd
->
user
,
tmp
->
user
))
{
if
(
only_kill_query
)
{
tmp
->
killed
=
1
;
tmp
->
only_kill_query
=
1
;
}
else
tmp
->
awake
(
1
/*prepare to die*/
);
error
=
0
;
}
...
...
sql/sql_yacc.yy
View file @
dd49c33f
...
...
@@ -201,6 +201,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token COLUMNS
%token COLUMN_SYM
%token CONCURRENT
%token CONNECTION_SYM
%token CONSTRAINT
%token CONVERT_SYM
%token DATABASES
...
...
@@ -4231,18 +4232,23 @@ purge:
/* kill threads */
kill:
KILL_SYM expr
KILL_SYM
kill_option
expr
{
LEX *lex=Lex;
if ($
2->fix_fields(lex->thd, 0, &$2) || $2
->check_cols(1))
if ($
3->fix_fields(lex->thd, 0, &$3) || $3
->check_cols(1))
{
send_error(lex->thd, ER_SET_CONSTANTS_ONLY);
YYABORT;
}
lex->sql_command=SQLCOM_KILL;
lex->thread_id= (ulong) $
2
->val_int();
lex->thread_id= (ulong) $
3
->val_int();
};
kill_option:
/* empty */ { Lex->type= 0; }
| CONNECTION_SYM { Lex->type= 0; }
| QUERY_SYM { Lex->type= ONLY_KILL_QUERY; };
/* change database */
use: USE_SYM ident
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment