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
eccbd69f
Commit
eccbd69f
authored
May 14, 2010
by
Vasil Dimov
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql-trunk-innodb from bk-internal into my local branch
parents
16968abb
2a3db4b9
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
136 additions
and
45 deletions
+136
-45
mysql-test/suite/innodb/r/innodb_bug48024.result
mysql-test/suite/innodb/r/innodb_bug48024.result
+10
-0
mysql-test/suite/innodb/t/innodb_bug48024.test
mysql-test/suite/innodb/t/innodb_bug48024.test
+20
-0
storage/innobase/dict/dict0dict.c
storage/innobase/dict/dict0dict.c
+32
-19
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+24
-5
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/ha_innodb.h
+1
-1
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0dict.h
+1
-0
storage/innobase/include/ha_prototypes.h
storage/innobase/include/ha_prototypes.h
+11
-1
storage/innobase/include/row0mysql.h
storage/innobase/include/row0mysql.h
+1
-0
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0trx.h
+0
-3
storage/innobase/row/row0mysql.c
storage/innobase/row/row0mysql.c
+3
-2
storage/innobase/trx/trx0i_s.c
storage/innobase/trx/trx0i_s.c
+33
-12
storage/innobase/trx/trx0trx.c
storage/innobase/trx/trx0trx.c
+0
-2
No files found.
mysql-test/suite/innodb/r/innodb_bug48024.result
0 → 100644
View file @
eccbd69f
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
DROP TABLE bug48024,bug48024_b;
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
DROP TABLE bug48024,bug48024_b;
mysql-test/suite/innodb/t/innodb_bug48024.test
0 → 100644
View file @
eccbd69f
# Bug #48024 Innodb doesn't work with multi-statements
--
source
include
/
have_innodb
.
inc
CREATE
TABLE
bug48024
(
a
int
PRIMARY
KEY
,
b
int
NOT
NULL
,
KEY
(
b
))
ENGINE
=
InnoDB
;
CREATE
TABLE
bug48024_b
(
b
int
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
# Bug #53644 InnoDB thinks that /*/ starts and ends a comment
ALTER
TABLE
bug48024
/*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD
CONSTRAINT
FOREIGN
KEY
(
b
)
REFERENCES
bug48024_b
(
b
);
DROP
TABLE
bug48024
,
bug48024_b
;
delimiter
|
;
CREATE
TABLE
bug48024
(
a
int
PRIMARY
KEY
,
b
int
NOT
NULL
,
KEY
(
b
))
ENGINE
=
InnoDB
;
CREATE
TABLE
bug48024_b
(
b
int
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
ALTER
TABLE
bug48024
/*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD
CONSTRAINT
FOREIGN
KEY
(
b
)
REFERENCES
bug48024_b
(
b
)
|
delimiter
;
|
DROP
TABLE
bug48024
,
bug48024_b
;
storage/innobase/dict/dict0dict.c
View file @
eccbd69f
...
...
@@ -3023,25 +3023,28 @@ static
char
*
dict_strip_comments
(
/*================*/
const
char
*
sql_string
)
/*!< in: SQL string */
const
char
*
sql_string
,
/*!< in: SQL string */
size_t
sql_length
)
/*!< in: length of sql_string */
{
char
*
str
;
const
char
*
sptr
;
const
char
*
eptr
=
sql_string
+
sql_length
;
char
*
ptr
;
/* unclosed quote character (0 if none) */
char
quote
=
0
;
str
=
mem_alloc
(
s
trlen
(
sql_string
)
+
1
);
str
=
mem_alloc
(
s
ql_length
+
1
);
sptr
=
sql_string
;
ptr
=
str
;
for
(;;)
{
scan_more:
if
(
*
sptr
==
'\0'
)
{
if
(
sptr
>=
eptr
||
*
sptr
==
'\0'
)
{
end_of_string:
*
ptr
=
'\0'
;
ut_a
(
ptr
<=
str
+
s
trlen
(
sql_string
)
);
ut_a
(
ptr
<=
str
+
s
ql_length
);
return
(
str
);
}
...
...
@@ -3060,30 +3063,35 @@ scan_more:
||
(
sptr
[
0
]
==
'-'
&&
sptr
[
1
]
==
'-'
&&
sptr
[
2
]
==
' '
))
{
for
(;;)
{
if
(
++
sptr
>=
eptr
)
{
goto
end_of_string
;
}
/* In Unix a newline is 0x0A while in Windows
it is 0x0D followed by 0x0A */
if
(
*
sptr
==
(
char
)
0x0A
||
*
sptr
==
(
char
)
0x0D
||
*
sptr
==
'\0'
)
{
switch
(
*
sptr
)
{
case
(
char
)
0X0A
:
case
(
char
)
0x0D
:
case
'\0'
:
goto
scan_more
;
}
sptr
++
;
}
}
else
if
(
!
quote
&&
*
sptr
==
'/'
&&
*
(
sptr
+
1
)
==
'*'
)
{
sptr
+=
2
;
for
(;;)
{
if
(
*
sptr
==
'*'
&&
*
(
sptr
+
1
)
==
'/'
)
{
sptr
+=
2
;
goto
scan_more
;
if
(
sptr
>=
eptr
)
{
goto
end_of_string
;
}
if
(
*
sptr
==
'\0'
)
{
switch
(
*
sptr
)
{
case
'\0'
:
goto
scan_more
;
case
'*'
:
if
(
sptr
[
1
]
==
'/'
)
{
sptr
+=
2
;
goto
scan_more
;
}
}
sptr
++
;
...
...
@@ -3764,6 +3772,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
size_t
sql_length
,
/*!< in: length of sql_string */
const
char
*
name
,
/*!< in: table full name in the
normalized form
database_name/table_name */
...
...
@@ -3778,7 +3787,7 @@ dict_create_foreign_constraints(
ut_a
(
trx
);
ut_a
(
trx
->
mysql_thd
);
str
=
dict_strip_comments
(
sql_string
);
str
=
dict_strip_comments
(
sql_string
,
sql_length
);
heap
=
mem_heap_create
(
10000
);
err
=
dict_create_foreign_constraints_low
(
...
...
@@ -3811,6 +3820,7 @@ dict_foreign_parse_drop_constraints(
dict_foreign_t
*
foreign
;
ibool
success
;
char
*
str
;
size_t
len
;
const
char
*
ptr
;
const
char
*
id
;
FILE
*
ef
=
dict_foreign_err_file
;
...
...
@@ -3825,7 +3835,10 @@ dict_foreign_parse_drop_constraints(
*
constraints_to_drop
=
mem_heap_alloc
(
heap
,
1000
*
sizeof
(
char
*
));
str
=
dict_strip_comments
(
*
(
trx
->
mysql_query_str
));
ptr
=
innobase_get_stmt
(
trx
->
mysql_thd
,
&
len
);
str
=
dict_strip_comments
(
ptr
,
len
);
ptr
=
str
;
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
...
...
storage/innobase/handler/ha_innodb.cc
View file @
eccbd69f
...
...
@@ -1133,6 +1133,23 @@ innobase_get_charset(
return
(
thd_charset
((
THD
*
)
mysql_thd
));
}
/**********************************************************************//**
Determines the current SQL statement.
@return SQL statement string */
extern
"C"
UNIV_INTERN
const
char
*
innobase_get_stmt
(
/*==============*/
void
*
mysql_thd
,
/*!< in: MySQL thread handle */
size_t
*
length
)
/*!< out: length of the SQL statement */
{
LEX_STRING
*
stmt
;
stmt
=
thd_query_string
((
THD
*
)
mysql_thd
);
*
length
=
stmt
->
length
;
return
(
stmt
->
str
);
}
#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
extern
MYSQL_PLUGIN_IMPORT
MY_TMPDIR
mysql_tmpdir_list
;
/*******************************************************************//**
...
...
@@ -1465,7 +1482,6 @@ innobase_trx_allocate(
trx
=
trx_allocate_for_mysql
();
trx
->
mysql_thd
=
thd
;
trx
->
mysql_query_str
=
thd_query
(
thd
);
innobase_trx_init
(
thd
,
trx
);
...
...
@@ -6632,6 +6648,8 @@ ha_innobase::create(
/* Cache the value of innodb_file_format, in case it is
modified by another thread while the table is being created. */
const
ulint
file_format
=
srv_file_format
;
const
char
*
stmt
;
size_t
stmt_len
;
DBUG_ENTER
(
"ha_innobase::create"
);
...
...
@@ -6908,9 +6926,11 @@ ha_innobase::create(
}
}
if
(
*
trx
->
mysql_query_str
)
{
error
=
row_table_add_foreign_constraints
(
trx
,
*
trx
->
mysql_query_str
,
norm_name
,
stmt
=
innobase_get_stmt
(
thd
,
&
stmt_len
);
if
(
stmt
)
{
error
=
row_table_add_foreign_constraints
(
trx
,
stmt
,
stmt_len
,
norm_name
,
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
);
error
=
convert_error_code_to_mysql
(
error
,
flags
,
NULL
);
...
...
@@ -7195,7 +7215,6 @@ innobase_drop_database(
/* In the Windows plugin, thd = current_thd is always NULL */
trx
=
trx_allocate_for_mysql
();
trx
->
mysql_thd
=
NULL
;
trx
->
mysql_query_str
=
NULL
;
#else
trx
=
innobase_trx_allocate
(
thd
);
#endif
...
...
storage/innobase/handler/ha_innodb.h
View file @
eccbd69f
...
...
@@ -231,7 +231,7 @@ the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
extern
"C"
{
struct
charset_info_st
*
thd_charset
(
MYSQL_THD
thd
);
char
**
thd_query
(
MYSQL_THD
thd
);
LEX_STRING
*
thd_query_string
(
MYSQL_THD
thd
);
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
...
...
storage/innobase/include/dict0dict.h
View file @
eccbd69f
...
...
@@ -352,6 +352,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
size_t
sql_length
,
/*!< in: length of sql_string */
const
char
*
name
,
/*!< in: table full name in the
normalized form
database_name/table_name */
...
...
storage/innobase/include/ha_prototypes.h
View file @
eccbd69f
...
...
@@ -215,11 +215,21 @@ innobase_casedn_str(
/**********************************************************************//**
Determines the connection character set.
@return connection character set */
UNIV_INTERN
struct
charset_info_st
*
innobase_get_charset
(
/*=================*/
void
*
mysql_thd
);
/*!< in: MySQL thread handle */
/**********************************************************************//**
Determines the current SQL statement.
@return SQL statement string */
UNIV_INTERN
const
char
*
innobase_get_stmt
(
/*==============*/
void
*
mysql_thd
,
/*!< in: MySQL thread handle */
size_t
*
length
)
/*!< out: length of the SQL statement */
__attribute__
((
nonnull
));
/******************************************************************//**
This function is used to find the storage length in bytes of the first n
characters for prefix indexes using a multibyte character set. The function
...
...
storage/innobase/include/row0mysql.h
View file @
eccbd69f
...
...
@@ -403,6 +403,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
size_t
sql_length
,
/*!< in: length of sql_string */
const
char
*
name
,
/*!< in: table full name in the
normalized form
database_name/table_name */
...
...
storage/innobase/include/trx0trx.h
View file @
eccbd69f
...
...
@@ -560,9 +560,6 @@ struct trx_struct{
/*------------------------------*/
void
*
mysql_thd
;
/*!< MySQL thread handle corresponding
to this trx, or NULL */
char
**
mysql_query_str
;
/* pointer to the field in mysqld_thd
which contains the pointer to the
current SQL query string */
const
char
*
mysql_log_file_name
;
/* if MySQL binlog is used, this field
contains a pointer to the latest file
...
...
storage/innobase/row/row0mysql.c
View file @
eccbd69f
...
...
@@ -2060,6 +2060,7 @@ row_table_add_foreign_constraints(
FOREIGN KEY (a, b) REFERENCES table2(c, d),
table2 can be written also with the
database name before it: test.table2 */
size_t
sql_length
,
/*!< in: length of sql_string */
const
char
*
name
,
/*!< in: table full name in the
normalized form
database_name/table_name */
...
...
@@ -2081,8 +2082,8 @@ row_table_add_foreign_constraints(
trx_set_dict_operation
(
trx
,
TRX_DICT_OP_TABLE
);
err
=
dict_create_foreign_constraints
(
trx
,
sql_string
,
name
,
reject_fks
);
err
=
dict_create_foreign_constraints
(
trx
,
sql_string
,
sql_length
,
name
,
reject_fks
);
if
(
err
==
DB_SUCCESS
)
{
/* Check that also referencing constraints are ok */
err
=
dict_load_foreigns
(
name
,
TRUE
);
...
...
storage/innobase/trx/trx0i_s.c
View file @
eccbd69f
...
...
@@ -438,6 +438,10 @@ fill_trx_row(
which to copy volatile
strings */
{
const
char
*
stmt
;
size_t
stmt_len
;
const
char
*
s
;
ut_ad
(
mutex_own
(
&
kernel_mutex
));
row
->
trx_id
=
trx_get_id
(
trx
);
...
...
@@ -460,20 +464,32 @@ fill_trx_row(
row
->
trx_weight
=
(
ullint
)
ut_conv_dulint_to_longlong
(
TRX_WEIGHT
(
trx
));
if
(
trx
->
mysql_thd
!=
NULL
)
{
row
->
trx_mysql_thread_id
=
thd_get_thread_id
(
trx
->
mysql_thd
);
}
else
{
if
(
trx
->
mysql_thd
==
NULL
)
{
/* For internal transactions e.g., purge and transactions
being recovered at startup there is no associated MySQL
thread data structure. */
row
->
trx_mysql_thread_id
=
0
;
row
->
trx_query
=
NULL
;
goto
thd_done
;
}
if
(
trx
->
mysql_query_str
!=
NULL
&&
*
trx
->
mysql_query_str
!=
NULL
)
{
row
->
trx_mysql_thread_id
=
thd_get_thread_id
(
trx
->
mysql_thd
);
stmt
=
innobase_get_stmt
(
trx
->
mysql_thd
,
&
stmt_len
);
TRX_I_S_STRING_COPY
(
*
trx
->
mysql_query_str
,
row
->
trx_query
,
TRX_I_S_TRX_QUERY_MAX_LEN
,
cache
);
if
(
stmt
!=
NULL
)
{
char
query
[
TRX_I_S_TRX_QUERY_MAX_LEN
+
1
];
if
(
stmt_len
>
TRX_I_S_TRX_QUERY_MAX_LEN
)
{
stmt_len
=
TRX_I_S_TRX_QUERY_MAX_LEN
;
}
memcpy
(
query
,
stmt
,
stmt_len
);
query
[
stmt_len
]
=
'\0'
;
row
->
trx_query
=
ha_storage_put_memlim
(
cache
->
storage
,
stmt
,
stmt_len
+
1
,
MAX_ALLOWED_FOR_STORAGE
(
cache
));
if
(
row
->
trx_query
==
NULL
)
{
...
...
@@ -484,9 +500,12 @@ fill_trx_row(
row
->
trx_query
=
NULL
;
}
if
(
trx
->
op_info
!=
NULL
&&
trx
->
op_info
[
0
]
!=
'\0'
)
{
thd_done:
s
=
trx
->
op_info
;
TRX_I_S_STRING_COPY
(
trx
->
op_info
,
row
->
trx_operation_state
,
if
(
s
!=
NULL
&&
s
[
0
]
!=
'\0'
)
{
TRX_I_S_STRING_COPY
(
s
,
row
->
trx_operation_state
,
TRX_I_S_TRX_OP_STATE_MAX_LEN
,
cache
);
if
(
row
->
trx_operation_state
==
NULL
)
{
...
...
@@ -534,9 +553,11 @@ fill_trx_row(
row
->
trx_foreign_key_checks
=
(
ibool
)
trx
->
check_foreigns
;
if
(
trx
->
detailed_error
!=
NULL
&&
trx
->
detailed_error
[
0
]
!=
'\0'
)
{
s
=
trx
->
detailed_error
;
if
(
s
!=
NULL
&&
s
[
0
]
!=
'\0'
)
{
TRX_I_S_STRING_COPY
(
trx
->
detailed_error
,
TRX_I_S_STRING_COPY
(
s
,
row
->
trx_foreign_key_error
,
TRX_I_S_TRX_FK_ERROR_MAX_LEN
,
cache
);
...
...
@@ -545,7 +566,7 @@ fill_trx_row(
return
(
FALSE
);
}
}
else
{
row
->
trx_foreign_key_error
=
NULL
;
row
->
trx_foreign_key_error
=
NULL
;
}
row
->
trx_has_search_latch
=
(
ibool
)
trx
->
has_search_latch
;
...
...
storage/innobase/trx/trx0trx.c
View file @
eccbd69f
...
...
@@ -124,7 +124,6 @@ trx_create(
trx
->
table_id
=
ut_dulint_zero
;
trx
->
mysql_thd
=
NULL
;
trx
->
mysql_query_str
=
NULL
;
trx
->
active_trans
=
0
;
trx
->
duplicates
=
0
;
...
...
@@ -944,7 +943,6 @@ trx_commit_off_kernel(
trx
->
rseg
=
NULL
;
trx
->
undo_no
=
ut_dulint_zero
;
trx
->
last_sql_stat_start
.
least_undo_no
=
ut_dulint_zero
;
trx
->
mysql_query_str
=
NULL
;
ut_ad
(
UT_LIST_GET_LEN
(
trx
->
wait_thrs
)
==
0
);
ut_ad
(
UT_LIST_GET_LEN
(
trx
->
trx_locks
)
==
0
);
...
...
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