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
e07c6806
Commit
e07c6806
authored
Nov 30, 2010
by
Sunny Bains
Browse files
Options
Browse Files
Download
Plain Diff
Merge from mysql-5.1-security to mysql-5.5-security.
parents
c829e363
9a0a5a9d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
187 additions
and
3 deletions
+187
-3
mysql-test/suite/innodb/r/innodb-autoinc-56228.result
mysql-test/suite/innodb/r/innodb-autoinc-56228.result
+30
-0
mysql-test/suite/innodb/t/innodb-autoinc-56228-master.opt
mysql-test/suite/innodb/t/innodb-autoinc-56228-master.opt
+1
-0
mysql-test/suite/innodb/t/innodb-autoinc-56228.test
mysql-test/suite/innodb/t/innodb-autoinc-56228.test
+33
-0
storage/innobase/include/ut0vec.h
storage/innobase/include/ut0vec.h
+19
-0
storage/innobase/include/ut0vec.ic
storage/innobase/include/ut0vec.ic
+29
-0
storage/innobase/lock/lock0lock.c
storage/innobase/lock/lock0lock.c
+75
-3
No files found.
mysql-test/suite/innodb/r/innodb-autoinc-56228.result
0 → 100644
View file @
e07c6806
DROP TABLE IF EXISTS t1_56228;
Warnings:
Note 1051 Unknown table 't1_56228'
DROP TABLE IF EXISTS t2_56228;
Warnings:
Note 1051 Unknown table 't2_56228'
DROP FUNCTION IF EXISTS bug56228;
Warnings:
Note 1305 FUNCTION test.bug56228 does not exist
CREATE TEMPORARY TABLE t1_56228(
c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2_56228(
c1 iNT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
CREATE FUNCTION bug56228() RETURNS INT DETERMINISTIC
BEGIN
INSERT INTO t1_56228 VALUES(NULL);
INSERT INTO t2_56228 VALUES(NULL);
INSERT INTO t1_56228 VALUES(NULL);
INSERT INTO t2_56228 VALUES(NULL);
DROP TEMPORARY TABLE t1_56228;
RETURN 42;
END //
SELECT bug56228();
bug56228()
42
DROP FUNCTION bug56228;
DROP TEMPORARY TABLE t2_56228;
DROP TEMPORARY TABLE IF EXISTS t1_56228;
Warnings:
Note 1051 Unknown table 't1_56228'
mysql-test/suite/innodb/t/innodb-autoinc-56228-master.opt
0 → 100644
View file @
e07c6806
--innodb_autoinc_lock_mode=0
mysql-test/suite/innodb/t/innodb-autoinc-56228.test
0 → 100644
View file @
e07c6806
--
source
include
/
have_innodb
.
inc
##
# Bug #56228: dropping tables from within an active statement crashes server
#
DROP
TABLE
IF
EXISTS
t1_56228
;
DROP
TABLE
IF
EXISTS
t2_56228
;
DROP
FUNCTION
IF
EXISTS
bug56228
;
CREATE
TEMPORARY
TABLE
t1_56228
(
c1
iNT
AUTO_INCREMENT
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
CREATE
TEMPORARY
TABLE
t2_56228
(
c1
iNT
AUTO_INCREMENT
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
DELIMITER
//;
CREATE
FUNCTION
bug56228
()
RETURNS
INT
DETERMINISTIC
BEGIN
INSERT
INTO
t1_56228
VALUES
(
NULL
);
INSERT
INTO
t2_56228
VALUES
(
NULL
);
INSERT
INTO
t1_56228
VALUES
(
NULL
);
INSERT
INTO
t2_56228
VALUES
(
NULL
);
DROP
TEMPORARY
TABLE
t1_56228
;
RETURN
42
;
END
//
DELIMITER
;
//
SELECT
bug56228
();
DROP
FUNCTION
bug56228
;
DROP
TEMPORARY
TABLE
t2_56228
;
DROP
TEMPORARY
TABLE
IF
EXISTS
t1_56228
;
storage/innobase/include/ut0vec.h
View file @
e07c6806
...
...
@@ -93,6 +93,25 @@ ib_vector_get(
ib_vector_t
*
vec
,
/*!< in: vector */
ulint
n
);
/*!< in: element index to get */
/****************************************************************//**
Get last element. The vector must not be empty.
@return last element */
UNIV_INLINE
void
*
ib_vector_get_last
(
/*===============*/
ib_vector_t
*
vec
);
/*!< in: vector */
/****************************************************************//**
Set the n'th element. */
UNIV_INLINE
void
ib_vector_set
(
/*==========*/
ib_vector_t
*
vec
,
/*!< in/out: vector */
ulint
n
,
/*!< in: element index to set */
void
*
elem
);
/*!< in: data element */
/****************************************************************//**
Remove the last element from the vector. */
UNIV_INLINE
...
...
storage/innobase/include/ut0vec.ic
View file @
e07c6806
...
...
@@ -50,6 +50,35 @@ ib_vector_get(
return(vec->data[n]);
}
/****************************************************************//**
Get last element. The vector must not be empty.
@return last element */
UNIV_INLINE
void*
ib_vector_get_last(
/*===============*/
ib_vector_t* vec) /*!< in: vector */
{
ut_a(vec->used > 0);
return(vec->data[vec->used - 1]);
}
/****************************************************************//**
Set the n'th element. */
UNIV_INLINE
void
ib_vector_set(
/*==========*/
ib_vector_t* vec, /*!< in/out: vector */
ulint n, /*!< in: element index to set */
void* elem) /*!< in: data element */
{
ut_a(n < vec->used);
vec->data[n] = elem;
}
/****************************************************************//**
Remove the last element from the vector.
@return last vector element */
...
...
storage/innobase/lock/lock0lock.c
View file @
e07c6806
...
...
@@ -3621,6 +3621,80 @@ lock_table_create(
return
(
lock
);
}
/*************************************************************//**
Pops autoinc lock requests from the transaction's autoinc_locks. We
handle the case where there are gaps in the array and they need to
be popped off the stack. */
UNIV_INLINE
void
lock_table_pop_autoinc_locks
(
/*=========================*/
trx_t
*
trx
)
/*!< in/out: transaction that owns the AUTOINC locks */
{
ut_ad
(
mutex_own
(
&
kernel_mutex
));
ut_ad
(
!
ib_vector_is_empty
(
trx
->
autoinc_locks
));
/* Skip any gaps, gaps are NULL lock entries in the
trx->autoinc_locks vector. */
do
{
ib_vector_pop
(
trx
->
autoinc_locks
);
if
(
ib_vector_is_empty
(
trx
->
autoinc_locks
))
{
return
;
}
}
while
(
ib_vector_get_last
(
trx
->
autoinc_locks
)
==
NULL
);
}
/*************************************************************//**
Removes an autoinc lock request from the transaction's autoinc_locks. */
UNIV_INLINE
void
lock_table_remove_autoinc_lock
(
/*===========================*/
lock_t
*
lock
,
/*!< in: table lock */
trx_t
*
trx
)
/*!< in/out: transaction that owns the lock */
{
lock_t
*
autoinc_lock
;
lint
i
=
ib_vector_size
(
trx
->
autoinc_locks
)
-
1
;
ut_ad
(
mutex_own
(
&
kernel_mutex
));
ut_ad
(
lock_get_mode
(
lock
)
==
LOCK_AUTO_INC
);
ut_ad
(
lock_get_type_low
(
lock
)
&
LOCK_TABLE
);
ut_ad
(
!
ib_vector_is_empty
(
trx
->
autoinc_locks
));
/* With stored functions and procedures the user may drop
a table within the same "statement". This special case has
to be handled by deleting only those AUTOINC locks that were
held by the table being dropped. */
autoinc_lock
=
ib_vector_get
(
trx
->
autoinc_locks
,
i
);
/* This is the default fast case. */
if
(
autoinc_lock
==
lock
)
{
lock_table_pop_autoinc_locks
(
trx
);
}
else
{
/* The last element should never be NULL */
ut_a
(
autoinc_lock
!=
NULL
);
/* Handle freeing the locks from within the stack. */
while
(
--
i
>=
0
)
{
autoinc_lock
=
ib_vector_get
(
trx
->
autoinc_locks
,
i
);
if
(
UNIV_LIKELY
(
autoinc_lock
==
lock
))
{
ib_vector_set
(
trx
->
autoinc_locks
,
i
,
NULL
);
return
;
}
}
/* Must find the autoinc lock. */
ut_error
;
}
}
/*************************************************************//**
Removes a table lock request from the queue and the trx list of locks;
this is a low-level function which does NOT check if waiting requests
...
...
@@ -3660,10 +3734,8 @@ lock_table_remove_low(
if
(
!
lock_get_wait
(
lock
)
&&
!
ib_vector_is_empty
(
trx
->
autoinc_locks
))
{
lock_t
*
autoinc_lock
;
autoinc_lock
=
ib_vector_pop
(
trx
->
autoinc_locks
);
ut_a
(
autoinc_lock
==
lock
);
lock_table_remove_autoinc_lock
(
lock
,
trx
);
}
ut_a
(
table
->
n_waiting_or_granted_auto_inc_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