Commit graph

23 commits

Author SHA1 Message Date
Kristofer Pettersson
1634777203 Bug#39843 DELETE requires write access to table in subquery in where clause
An unnecessarily restrictive lock were taken on sub-SELECTs during DELETE.

During parsing, a global structure is reused for sub-SELECTs and the attribute
keeping track of lock options were not reset properly.
This patch introduces a new attribute to keep track on the syntactical lock
option elements found in a sub-SELECT and then sets the lock options accordingly.

Now the sub-SELECTs will try to acquire a READ lock if possible
instead of a WRITE lock as inherited from the outer DELETE statement.
2009-03-05 15:22:33 +01:00
kostja@bodhi.(none)
ea3388f2b2 Add a test case for Bug#5719 "impossible to lock VIEW".
It has been possible to lock a view in 5.1 for some time.
2007-08-02 13:59:02 +04:00
kroki/tomash@moonlight.home
c19affef54 BUG#9953: CONVERT_TZ requires mysql.time_zone_name to be locked
The problem was that some facilities (like CONVERT_TZ() function or
server HELP statement) may require implicit access to some tables in
'mysql' database.  This access was done by ordinary means of adding
such tables to the list of tables the query is going to open.
However, if we issued LOCK TABLES before that, we would get "table
was not locked" error trying to open such implicit tables.

The solution is to treat certain tables as MySQL system tables, like
we already do for mysql.proc.  Such tables may be opened for reading
at any moment regardless of any locks in effect.  The cost of this is
that system table may be locked for writing only together with other
system tables, it is disallowed to lock system tables for writing and
have any other lock on any other table.

After this patch the following tables are treated as MySQL system
tables:
  mysql.help_category
  mysql.help_keyword
  mysql.help_relation
  mysql.help_topic
  mysql.proc (it already was)
  mysql.time_zone
  mysql.time_zone_leap_second
  mysql.time_zone_name
  mysql.time_zone_transition
  mysql.time_zone_transition_type

These tables are now opened with open_system_tables_for_read() and
closed with close_system_tables(), or one table may be opened with
open_system_table_for_update() and closed with close_thread_tables()
(the latter is used for mysql.proc table, which is updated as part of
normal MySQL server operation).  These functions may be used when
some tables were opened and locked already.

NOTE: online update of time zone tables is not possible during
replication, because there's no time zone cache flush neither on LOCK
TABLES, nor on FLUSH TABLES, so the master may serve stale time zone
data from cache, while on slave updated data will be loaded from the
time zone tables.
2007-03-09 13:12:31 +03:00
kostja@bodhi.local
72c7fea1a2 Add a test case for Bug#18884 "lock table + global read lock = crash"
(the bug itself is not repeatable any more).
2006-07-08 00:26:18 +04:00
ingo@mysql.com
e0098885f6 Merge mysql.com:/home/mydev/mysql-4.1-bug5390
into  mysql.com:/home/mydev/mysql-5.0-bug5390
2006-02-06 15:15:44 +01:00
ingo@mysql.com
7e58102bfd Merge mysql.com:/home/mydev/mysql-4.0-bug5390
into  mysql.com:/home/mydev/mysql-4.1-bug5390
2006-01-23 19:19:29 +01:00
ingo@mysql.com
87f9c10db5 BUG#5390 - problems with merge tables
After-fix optimizations proposed and finally
implemented by Monty.
2006-01-23 19:12:29 +01:00
monty@mysql.com
15d48525af Merge mysql.com:/home/my/mysql-4.1
into  mysql.com:/home/my/mysql-5.0
2005-07-28 17:09:54 +03:00
monty@mysql.com
3c12d0ae54 Added end marker for tests to make future merges easier 2005-07-28 03:22:47 +03:00
acurtis@xiphis.org
4a77febaab Merge 2005-05-24 15:52:48 +01:00
acurtis@xiphis.org
a6a589ef76 Bug#7241 - Invalid response when DELETE .. USING and LOCK TABLES used.
Only acquire necessary write lock for multi-delete
2005-05-24 11:44:34 +01:00
dlenev@brandersnatch.localdomain
5a6c7027f0 Better approach for prelocking of tables for stored routines execution
and some SP-related cleanups.

- We don't have separate stage for calculation of list of tables
  to be prelocked and doing implicit LOCK/UNLOCK any more.
  Instead we calculate this list at open_tables() and do implicit
  LOCK in lock_tables() (and UNLOCK in close_thread_tables()).
  Also now we support cases when same table (with same alias) is
  used several times in the same query in SP.

- Cleaned up execution of SP. Moved all common code which handles
  LEX and does preparations before statement execution or complex
  expression evaluation to auxilary sp_lex_keeper class. Now 
  all statements in SP (and corresponding instructions) that
  evaluate expression which can contain subquery have their
  own LEX.
2005-03-04 16:35:28 +03:00
pem@mysql.comhem.se
2c26ebe359 WL#2130: Table locking for stored FUNCTIONs
Collect all tables and SPs refered by a statement, and open all tables
with an implicit LOCK TABLES. Do find things refered by triggers and views,
we open them first (and then repeat this until nothing new is found), before
doing the actual lock tables.
2005-02-08 20:52:50 +01:00
monty@mysql.com
ce14578909 Merge with 4.0.18 2004-02-11 00:06:46 +01:00
monty@mysql.com
268521a61d Give error if locked table is used twice in query. This fixes strange error message when doing LOCK TABLES t1 WRITE; INSERT TABLE t1 SELECT * from t1 (Bug #2296) 2004-02-03 09:46:48 +01:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
fcf96dbb18 WorkLog#1323
Deprecate the use of TYPE=... Preferred syntax is ENGINE=
2003-12-10 04:31:42 +00:00
monty@mashka.mysql.fi
1f6ecc0cd3 Changed mysql-test to print warnings for not existing table to DROP TABLE
Cleaned up test; Removed wrong DROP TABLE commands and use standard table and database names.
changed store_warning() -> push_warning_print()
2003-01-06 01:48:59 +02:00
monty@hundin.mysql.fi
88aff4bf85 Updated manual about embedded version.
Speed up column-completion in 'mysql'
Don't use ISAM if HAVE_ISAM is not defined
A lot of fixes for the embedded version.  All libraries are now included in libmysqld.a
Changed arguments to convert_dirname() to make it more general.
Renamed files in the 'merge' directory to all use a common prefix.
Don't compile both assembler and C functions on x86
2001-10-08 04:58:07 +03:00
monty@hundin.mysql.fi
e3e51204ec Added timeouts to make lock test repeatable 2001-07-17 22:59:14 +03:00
sasha@mysql.sashanet.com
ace20e0c41 updated lock test 2001-07-13 17:45:14 -06:00
sasha@mysql.sashanet.com
9f00125ab8 test case for low priority updates race bug
not yet fixed
2001-07-13 17:25:37 -06:00
monty@donna.mysql.fi
bc6fd0acaa Added test for PTHREAD_YIELD
Removed test of default master parameter
Don't lock locked tables in REPAIR
Changed optimzation for SELECT * from table,table ORDER BY keypart LIMIT
2001-04-18 23:47:11 +03:00
monty@donna.mysql.fi
e5da9a96de Fixed bug in lock tables introduced by shared locks.
New lock test
2001-03-27 13:05:48 +03:00