Commit graph

61140 commits

Author SHA1 Message Date
Alexander Nozdrin
7547912586 Auto-merge from mysql-next-4284. 2010-02-15 17:08:38 +03:00
Dmitry Lenev
aab777ca1e Fix for bug #51093 "Crash (possibly stack overflow) in
MDL_lock::find_deadlock".

On some platforms deadlock detector in metadata locking 
subsystem under certain conditions might have exhausted
stack space causing server crashes.

Particularly this caused failures of rqg_mdl_stability
test on Solaris in PushBuild.

During search for deadlock MDL deadlock detector could 
sometimes encounter loop in the waiters graph in which 
MDL_context which has started search for a deadlock 
does not participate. In such case our algorithm will 
continue looping assuming that either this deadlock will 
be resolved by MDL_context which has created it (i.e.
by one of loop participants) or maximum search depth
will be reached. 
Since max search depth was set to 1000 in the latter case 
on platforms where each iteration of deadlock search 
algorithm needs more than DEFAULT_STACK_SIZE/1000 bytes 
of stack (around 192 bytes for 32-bit and around 256 bytes 
for 64-bit platforms) we might have exhausted stack space.

This patch solves this problem by reducing maximum search
depth for MDL deadlock detector to 32. This should be safe
at the moment as it is unlikely that each iteration of the 
current deadlock detector algorithm will consume more than 
1K of stack (thus total amount of stack required can't be
more than 32K) and we require at least 80K of stack in order
to open any table. Also this value should be (hopefully) big
enough to not cause too much false deadlock errors (there
is an anecdotal evidence that real-life deadlocks are
typically shorter than that).

Additional reasearch should be conducted in future in order
to determine the more optimal value of maximum search depth.

This patch does not include test case as existing
rqg_mdl_stability test can serve as one.
2010-02-15 15:37:48 +03:00
Jon Olav Hauglid
9656026658 Followup to Bug#45225 Locking: hang if drop table with no timeout
This patch removes the unused server variable
"table_lock_wait_timeout".
2010-02-15 13:11:20 +01:00
Alexander Nozdrin
e8d19b9618 Auto-merge from mysql-next-4284. 2010-02-15 15:04:05 +03:00
Alexander Nozdrin
04d77e8f43 After-merge fix. 2010-02-15 15:00:45 +03:00
Dmitry Lenev
68710e2b36 Fix for bug #51136 "Crash in pthread_rwlock_rdlock on
TEMPORARY + HANDLER + LOCK + SP".

Server crashed when one: 
1) Opened HANDLER or acquired global read lock
2) Then locked one or several temporary tables with
   LOCK TABLES statement (but no base tables).
3) Then issued any statement causing commit (explicit 
   or implicit).
4) Issued statement which should have closed HANDLER
   or released global read lock.
   
The problem was that when entering LOCK TABLES mode in the
scenario described above we incorrectly set transactional
MDL sentinel to zero. As result during commit all metadata 
locks were released (including lock for open HANDLER or
global metadata shared lock). Indeed, attempt to release
metadata lock for the second time which happened during
HANLDER CLOSE or during release of GLR caused crash.

This patch fixes problem by changing MDL_context's
set_trans_sentinel() method to set sentinel to correct 
value (it should point to the most recent ticket).
2010-02-15 14:23:36 +03:00
Alexander Nozdrin
6c32fa7357 Manual merge from mysql-next-mr.
Conflicts:
  - sql/log_event.cc
  - sql/sql_class.h
2010-02-15 14:16:49 +03:00
Dmitry Lenev
22bc48b280 Fix for bug #51134 "Crash in MDL_lock::destroy on a concurrent
DDL workload".

When a RENAME TABLE or LOCK TABLE ... WRITE statement which
mentioned the same table several times were aborted during 
the process of acquring metadata locks (due to deadlock 
which was discovered or because of KILL statement) server 
might have crashed.

When attempt to acquire all locks requested had failed we
went through the list of requests and released locks which
we have managed to acquire by that moment one by one. Since 
in the scenario described above list of requests contained 
duplicates this led to releasing the same ticket twice and 
a crash as result.

This patch solves the problem by employing different approach
to releasing locks in case of failure to acquire all locks
requested. 
Now we take a MDL savepoint before starting acquiring locks 
and simply rollback to it if things go bad.
2010-02-15 13:23:34 +03:00
Alexander Barkov
0c61e7ab18 WL#3090 Japanese Character Set adjustments
added:
  @ mysql-test/include/ctype_utf8_table.inc
    Adding a share file to populate all utf8 values [U+0000..U+FFFF]
modified:
  @ include/m_ctype.h
    Introducing MB2 and MY_PUT_MB2 macros

  @ mysql-test/r/ctype_cp932_binlog_stm.result
  @ mysql-test/r/ctype_eucjpms.result
  @ mysql-test/r/ctype_sjis.result
  @ mysql-test/r/ctype_ujis.result
  @ mysql-test/t/ctype_cp932_binlog_stm.test
  @ mysql-test/t/ctype_eucjpms.test
  @ mysql-test/t/ctype_sjis.test
  @ mysql-test/t/ctype_ujis.test
    Adding test

  @ strings/ctype-cp932.c
  @ strings/ctype-eucjpms.c
  @ strings/ctype-sjis.c
  @ strings/ctype-ujis.c
    Adding new functions using Big-Table approach.
2010-02-15 09:57:24 +04:00
Vladislav Vaintroub
09dfcfa14b check for poll.h 2010-02-14 20:30:41 +01:00
Magne Mahre
6f80e0697d Bug#48929 Error in Accept() if using many file descriptors
In POSIX systems, the file descriptor set used in the select(2)
system call is represented by a bit vector of size FD_SETSIZE.
When select(2) is used on file/socket descriptors with a value
that is beyond this size, unpredictable errors may occur.

In this case, the error happens when there are a large number
of tables that need repair.  These tables are opened before
the sockets for incoming connections are acquired, resulting
in these sockets getting descriptor id which is higher than
FD_SETSIZE.

Replacing the call to select(2) with poll(2) fixes the problem,
as poll takes an array of the wanted descriptors, instead of
a bit vector.  

MS Windows has a different implementation of 'select', and is not
affected by this bug.
2010-02-14 19:12:58 +01:00
Vladislav Vaintroub
c5934fa1ea remove use of undocumented __sparcv8plus - this macro does not seem to be defined anymore with Sun Studio 12 2010-02-14 14:32:27 +01:00
Bjorn Munch
af0b944a09 null upmerge 2010-02-14 12:28:33 +01:00
Bjorn Munch
5a8ec4a081 merge from next-mr 2010-02-14 12:26:36 +01:00
Bjorn Munch
a1d0a3e968 null upmerge 2010-02-14 12:25:42 +01:00
Bjorn Munch
052629faf2 merge from trunk 2010-02-14 12:24:16 +01:00
Bjorn Munch
4cc54ef0c3 merge from 5.1 main 2010-02-14 12:22:10 +01:00
Alexander Nozdrin
090bcbf016 Merge from mysql-trunk-bugfixing. 2010-02-14 13:26:25 +03:00
Alexander Nozdrin
9151c5e41a Null-merge from mysql-trunk. 2010-02-14 13:24:21 +03:00
Alexander Nozdrin
2fa7509bf0 Empty merge from mysql-trunk. 2010-02-14 13:23:09 +03:00
Alexander Nozdrin
43727b5b1c Fix tree name. 2010-02-14 13:22:03 +03:00
Vladislav Vaintroub
8ba512559c merge 2010-02-13 17:01:32 +01:00
Alexander Nozdrin
9f6a63497f Null-merge (configure.in) from mysql-trunk. 2010-02-13 11:33:27 +03:00
joerg.bruehe@sun.com
f68fbf2c24 Raise version number after cloning 5.5.2-m2 2010-02-12 20:17:53 +01:00
Joerg Bruehe
33f40fe452 Upmerge a merge changeset, whose contents was already here,
so this one doesn't have any contents change.
2010-02-12 17:51:26 +01:00
Joerg Bruehe
22008fb5e5 Automerge from central "trunk-bugfixing". 2010-02-12 17:41:00 +01:00
Joerg Bruehe
c6e6531bf6 Null-upmerge a fix to the RPM spec file, this one was already correct. 2010-02-12 17:30:52 +01:00
Joerg Bruehe
4ecf25d39e Upmerge the RPM spec file correction: "release" was missing. 2010-02-12 17:26:22 +01:00
Joerg Bruehe
a02157aea2 Correction: The "release" setting had got lost in the RPM spec file. 2010-02-12 17:23:22 +01:00
Joerg Bruehe
deee631885 Upmerge the spec file alignment from current 5.5 to the next milestone. 2010-02-12 16:31:18 +01:00
Joerg Bruehe
61ae95ed6b Upmerge the spec file alignment from 5.1 to 5.5,
no other functional changes.
2010-02-12 13:20:42 +01:00
Guilhem Bichot
8e6a72b934 merge with latest next-mr-bugfixing 2010-02-12 13:08:45 +01:00
Alexander Nozdrin
ccc354c1fe Fix tree name. 2010-02-12 13:13:12 +03:00
Alexander Nozdrin
a8eeb3fc8a Auto-merge from mysql-next-mr-bugfixing. 2010-02-12 12:59:12 +03:00
Evgeny Potemkin
7313daef8b Auto-merged fix for the bug#50539. 2010-02-12 12:41:15 +03:00
Evgeny Potemkin
b5f40f3454 Bug#50539: Wrong result when loose index scan is used for an aggregate
function with distinct.
Loose index scan is used to find MIN/MAX values using appropriate index and
thus allow to avoid grouping. For each found row it updates non-aggregated
fields with values from row with found MIN/MAX value.
Without loose index scan non-aggregated fields are copied by end_send_group
function. With loose index scan there is no need in end_send_group and
end_send is used instead. Non-aggregated fields still need to be copied and
this was wrongly implemented in QUICK_GROUP_MIN_MAX_SELECT::get_next.
WL#3220 added a case when loose index scan can be used with end_send_group to
optimize calculation of aggregate functions with distinct. In this case
the row found by QUICK_GROUP_MIN_MAX_SELECT::get_next might belong to a next
group and copying it will produce wrong result.

Update of non-aggregated fields is moved to the end_send function from
QUICK_GROUP_MIN_MAX_SELECT::get_next.
2010-02-12 11:51:52 +03:00
Dmitry Lenev
0ec868ca0e Fix for bug #50908 "Assertion `handler_tables_hash.records == 0'
failed in enter_locked_tables_mode".

Server was aborted due to assertion failure when one tried to 
execute statement requiring prelocking (i.e. firing triggers
or using stored functions) while having open HANDLERs.

The problem was that THD::enter_locked_tables_mode() method
which was called at the beginning of execution of prelocked 
statement assumed there are no open HANDLERs. It had to do 
so because corresponding THD::leave_locked_tables_mode()
method was unable to properly restore MDL sentinel when
leaving LOCK TABLES/prelocked mode in the presence of open 
HANDLERs.

This patch solves this problem by changing the latter method
to properly restore MDL sentinel and thus removing need for 
this assumption. As a side-effect, it lifts unjustified
limitation by allowing to keep HANDLERs open when entering 
LOCK TABLES mode.
2010-02-12 10:05:43 +03:00
de551587c8 Bug #43913 rpl_cross_version can't pass on conflicts complainig clash with
--slave-load-tm
      
The MDL_SHARED lock was introduced for an object in 5.4, but the 'TABLE_LIST' 
object was not initialized with the MDL_SHARED lock when applying event with 
LOAD DATA INFILE into table. So the failure is caused when checking the 
MDL_SHARED lock for the object.
      
To fix the problem, the 'TABLE_LIST' object was initialized with the MDL_SHARED 
lock when applying event with LOAD DATA INFILE into table.
2010-02-12 12:12:43 +08:00
6bad45745c Bug #43913 rpl_cross_version can't pass on conflicts complainig clash with
--slave-load-tm
      
The MDL_SHARED lock was introduced for an object in 5.4, but the 'TABLE_LIST' 
object was not initialized with the MDL_SHARED lock when applying event with 
LOAD DATA INFILE into table. So the failure is caused when checking the 
MDL_SHARED lock for the object.
To fix the problem, the 'TABLE_LIST' object was initialized with the MDL_SHARED 
lock when applying event with LOAD DATA INFILE into table.
2010-02-12 12:04:57 +08:00
Joerg Bruehe
16e60ff563 Upmerge changes done to the generic spec file in 5.0 to 5.1,
this includes a major whitespace (formatting) alignment
and sequence changes to better agree with other spec files.

Further changes:
- All features are controlled by "%define" set from call
  options or builtin.
- "bundled zlib" is on by default.
- "with libgcc" is controlled by runtime detection of gcc.
- Handling of "CFLAGS" and "CXXFLAGS" is more concentrated.
- Several missing man pages were added.
2010-02-11 21:33:48 +01:00
Magne Mahre
9148700166 merge from mysql-trunk-bugfixing 2010-02-11 18:32:53 +01:00
Magne Mahre
5f2c8caea9 Bug#50574 5.5.x allows spatial indexes on non-spatial columns,
causing crashes!

Adding a SPATIAL INDEX on a non-geometrical column caused a
segmentation fault when the table was subsequently 
inserted into.
      
A test was added in mysql_prepare_create_table to explicitly
check whether non-geometrical columns are used in a
spatial index, and throw an error if so.
2010-02-11 18:25:34 +01:00
Magne Mahre
071688ba79 merge 2010-02-11 18:04:32 +01:00
Magne Mahre
b2ddac5563 Bug#50542 5.5.x doesn't check length of key prefixes:
corruption and crash results
      
An index creation statement where the index key
is larger/wider than the column it references 
should throw an error.
      
A statement like:
  CREATE TABLE t1 (a CHAR(1), PRIMARY KEY (A(255)))
did not error, but a segmentation fault followed when
an insertion was attempted on the table
      
The partial key validiation clause has been 
restructured to (hopefully) better document which
uses of partial keys are valid.
2010-02-11 18:02:41 +01:00
Konstantin Osipov
bca1fec83e next-4284 tree:
fix lock_sync.test failure in row based replication mode.
2010-02-11 19:10:34 +03:00
Konstantin Osipov
8bd1e19d68 Fix a sporadic failure of rpl_sp.test in next-4284 tree: when doing
SELECT * FROM t1 on slave, first make sure that the slave has received
the CREATE TABLE from the master.
2010-02-11 19:02:21 +03:00
Konstantin Osipov
08df87e473 next-4284 tree: fix the failures of processlist_val_* tests,
update the condition to wait for in wait_condition
to reflect type-of-operation aware metadata locks.
2010-02-11 18:19:04 +03:00
Alexander Barkov
d59c06d96c A post-fix for WL#2649 Number-to-string conversion
Fixing problems discovered by "mtr --embedded" and "mtr --ps"


  @ libmysqld/lib_sql.cc
   "mtr --embedded --do-test=ps" failed.
   Applying a similar change to the one previously done in protocol.cc,
   to make embedded version work the same with client/server version.
   (a bug in the WL#2649 patch)

  @ mysql-test/include/ctype_numconv.inc
  @ mysql-test/r/ctype_binary.result
  @ mysql-test/r/ctype_cp1251.result
  @ mysql-test/r/ctype_latin1.result
  @ mysql-test/r/ctype_ucs.result

  - Changing tinyint(30) to tinyint(4)
    due to problems with "mtr --ps"
    Possibly a bug in libmysql.cc, in function fetch_long_with_conversion().
    Zerofill buffer is to short.

  - Commenting tests with get_lock/release_lock
    "mtr --ps" failed for some reasons in ctype_cp1251.
2010-02-11 18:28:28 +04:00
Luis Soares
ec9f4c70e1 Automerge from mysql-next-mr-bugfixing. 2010-02-11 13:50:18 +00:00
Bjorn Munch
a748b2bf21 upmerge 31602,47389,50618 2010-02-11 14:35:54 +01:00