Commit graph

238 commits

Author SHA1 Message Date
anozdrin/alik@quad.
bdc83bf2cb Merge quad.:/mnt/raid/alik/MySQL/devel/5.1
into  quad.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
2008-02-26 19:34:02 +03:00
joerg@trift2.
25ab6afc03 Merge trift2.:/MySQL/M51/mysql-5.1
into  trift2.:/MySQL/M51/push-5.1
2008-02-22 16:14:27 +01:00
tomas@poseidon.ndb.mysql.com
39c20516b7 Upon the sql command flush logs, we need to ensure that all outstanding
ndb data to be logged has made it to the binary log to get a deterministic
behavior on the rotation of the log.
2008-02-20 12:52:04 +01:00
kostja@dipika.(none)
d8e6308c42 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  dipika.(none):/opt/local/work/mysql-5.1-2pc-opt-merge-push
2008-02-19 14:53:22 +03:00
kostja@dipika.(none)
acf9b1f346 A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem".

The idea of the fix is to ensure that we always commit the current
statement at the end of dispatch_command(). In order to not issue
redundant disc syncs, an optimization of the two-phase commit
protocol is implemented to bypass the two phase commit if
the transaction is read-only.
2008-02-19 14:43:01 +03:00
msvensson@pilot.mysql.com
6ee61e1196 Merge pilot.mysql.com:/data/msvensson/mysql/bug19911/my51-bug19911
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-build
2008-02-06 12:52:11 +01:00
msvensson@pilot.mysql.com
784eaab4ec Bug#19911 ndb does not work on sol10 x86 2008-02-06 11:44:07 +01:00
mkindahl@dl145h.mysql.com
bdea24f483 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge
2007-12-19 18:51:46 +01:00
kostja@bodhi.(none)
16f0bd712e Try to fix assertion failures at slave shutdown when running
rpl_ndb tests on sapsrv1.
2007-12-15 22:24:01 +03:00
kostja@bodhi.(none)
bffc615e6c Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime
2007-12-15 16:59:43 +03:00
bar@mysql.com/bar.myoffice.izhnet.ru
664162d1ef NDB didn't like utf-8 in the last change for some reasons
Changing charset to latin1.
2007-12-14 20:11:49 +04:00
bar@bar.myoffice.izhnet.ru
02ef77d8df Merge mysql.com:/home/bar/mysql-work/mysql-5.1.b29562
into  mysql.com:/home/bar/mysql-work/mysql-5.1.b29562v2
2007-12-14 13:41:36 +04:00
davi@endora.local
d099e6a257 Merge mysql.com:/Users/davi/mysql/bugs/32395-5.1
into  mysql.com:/Users/davi/mysql/mysql-5.1-runtime
2007-12-13 16:33:04 -02:00
davi@mysql.com/endora.local
137e90ed55 Bug#32395 Alter table under a impending global read lock causes a server crash
The problem is that some DDL statements (ALTER TABLE, CREATE
TRIGGER, FLUSH TABLES, ...) when under LOCK TABLES need to
momentarily drop the lock, reopen the table and grab the write
lock again (using reopen_tables). When grabbing the lock again,
reopen_tables doesn't pass a flag to mysql_lock_tables in
order to ignore the impending global read lock, which causes a
assertion because LOCK_open is being hold. Also dropping the
lock must not signal to any threads that the table has been
relinquished (related to the locking/flushing protocol).

The solution is to correct the way the table is reopenned
and the locks grabbed. When reopening the table and under
LOCK TABLES, the table version should be set to 0 so other
threads have to wait for the table. When grabbing the lock,
any other flush should be ignored because it's theoretically
a atomic operation. The chosen solution also fixes a potential
discrepancy between binlog and GRL (global read lock) because
table placeholders were being ignored, now a FLUSH TABLES WITH
READ LOCK will properly for table with open placeholders.

It's also important to mention that this patch doesn't fix
a potential deadlock if one uses two GRLs under LOCK TABLES
concurrently.
2007-12-12 19:44:14 -02:00
kostja@bodhi.(none)
ebb9c5d983 Bug#12713 "Error in a stored function called from a SELECT doesn't
cause ROLLBACK of statement", part 1. Review fixes.

Do not send OK/EOF packets to the client until we reached the end of 
the current statement.
This is a consolidation, to keep the functionality that is shared by all 
SQL statements in one place in the server.
Currently this functionality includes:
- close_thread_tables()
- log_slow_statement().

After this patch and the subsequent patch for Bug#12713, it shall also include:
- ha_autocommit_or_rollback()
- net_end_statement()
- query_cache_end_of_result().

In future it may also include:
- mysql_reset_thd_for_next_command().
2007-12-12 18:21:01 +03:00
tomas@whalegate.ndb.mysql.com
fe46b09e3e remove memleak cased by dynamic variables being lost 2007-12-11 19:51:44 +01:00
tomas@whalegate.ndb.mysql.com
9eb0ef8914 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge
2007-12-10 10:26:01 +01:00
bar@mysql.com/bar.myoffice.izhnet.ru
7840cdae38 bug#29562 default collation of ucs2_unicode_ci crashes slave
Problem: some pieces of code relied on the default character
set settings, which didn't work in case of default character set
ucs2.
Fix: Specifying character set explicitly, not to depend on
the default settings.
2007-11-28 15:35:25 +04:00
tomas@whalegate.ndb.mysql.com
9eb3a99e67 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge
2007-11-16 11:15:53 +01:00
istruewing@stella.local
0605274155 Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
corrupts a MERGE table
Bug 26867 - LOCK TABLES + REPAIR + merge table result in
            memory/cpu hogging
Bug 26377 - Deadlock with MERGE and FLUSH TABLE
Bug 25038 - Waiting TRUNCATE
Bug 25700 - merge base tables get corrupted by
            optimize/analyze/repair table
Bug 30275 - Merge tables: flush tables or unlock tables
            causes server to crash
Bug 19627 - temporary merge table locking
Bug 27660 - Falcon: merge table possible
Bug 30273 - merge tables: Can't lock file (errno: 155)

The problems were:

Bug 26379 - Combination of FLUSH TABLE and REPAIR TABLE
                corrupts a MERGE table

  1. A thread trying to lock a MERGE table performs busy waiting while
     REPAIR TABLE or a similar table administration task is ongoing on
     one or more of its MyISAM tables.
  
  2. A thread trying to lock a MERGE table performs busy waiting until all
     threads that did REPAIR TABLE or similar table administration tasks
     on one or more of its MyISAM tables in LOCK TABLES segments do UNLOCK
     TABLES. The difference against problem #1 is that the busy waiting
     takes place *after* the administration task. It is terminated by
     UNLOCK TABLES only.
  
  3. Two FLUSH TABLES within a LOCK TABLES segment can invalidate the
     lock. This does *not* require a MERGE table. The first FLUSH TABLES
     can be replaced by any statement that requires other threads to
     reopen the table. In 5.0 and 5.1 a single FLUSH TABLES can provoke
     the problem.

Bug 26867 - LOCK TABLES + REPAIR + merge table result in
            memory/cpu hogging

  Trying DML on a MERGE table, which has a child locked and
  repaired by another thread, made an infinite loop in the server.

Bug 26377 - Deadlock with MERGE and FLUSH TABLE

  Locking a MERGE table and its children in parent-child order
  and flushing the child deadlocked the server.

Bug 25038 - Waiting TRUNCATE

  Truncating a MERGE child, while the MERGE table was in use,
  let the truncate fail instead of waiting for the table to
  become free.

Bug 25700 - merge base tables get corrupted by
            optimize/analyze/repair table

  Repairing a child of an open MERGE table corrupted the child.
  It was necessary to FLUSH the child first.

Bug 30275 - Merge tables: flush tables or unlock tables
            causes server to crash

  Flushing and optimizing locked MERGE children crashed the server.

Bug 19627 - temporary merge table locking

  Use of a temporary MERGE table with non-temporary children
  could corrupt the children.

  Temporary tables are never locked. So we do now prohibit
  non-temporary chidlren of a temporary MERGE table.

Bug 27660 - Falcon: merge table possible

  It was possible to create a MERGE table with non-MyISAM children.

Bug 30273 - merge tables: Can't lock file (errno: 155)

  This was a Windows-only bug. Table administration statements
  sometimes failed with "Can't lock file (errno: 155)".

These bugs are fixed by a new implementation of MERGE table open.

When opening a MERGE table in open_tables() we do now add the
child tables to the list of tables to be opened by open_tables()
(the "query_list"). The children are not opened in the handler at
this stage.

After opening the parent, open_tables() opens each child from the
now extended query_list. When the last child is opened, we remove
the children from the query_list again and attach the children to
the parent. This behaves similar to the old open. However it does
not open the MyISAM tables directly, but grabs them from the already
open children.

When closing a MERGE table in close_thread_table() we detach the
children only. Closing of the children is done implicitly because
they are in thd->open_tables.

For more detail see the comment at the top of ha_myisammrg.cc.

Changed from open_ltable() to open_and_lock_tables() in all places
that can be relevant for MERGE tables. The latter can handle tables
added to the list on the fly. When open_ltable() was used in a loop
over a list of tables, the list must be temporarily terminated
after every table for open_and_lock_tables().
table_list->required_type is set to FRMTYPE_TABLE to avoid open of
special tables. Handling of derived tables is suppressed.
These details are handled by the new function
open_n_lock_single_table(), which has nearly the same signature as
open_ltable() and can replace it in most cases.

In reopen_tables() some of the tables open by a thread can be
closed and reopened. When a MERGE child is affected, the parent
must be closed and reopened too. Closing of the parent is forced
before the first child is closed. Reopen happens in the order of
thd->open_tables. MERGE parents do not attach their children
automatically at open. This is done after all tables are reopened.
So all children are open when attaching them.

Special lock handling like mysql_lock_abort() or mysql_lock_remove()
needs to be suppressed for MERGE children or forwarded to the parent.
This depends on the situation. In loops over all open tables one
suppresses child lock handling. When a single table is touched,
forwarding is done.

Behavioral changes:
===================

This patch changes the behavior of temporary MERGE tables.
Temporary MERGE must have temporary children.
The old behavior was wrong. A temporary table is not locked. Hence
even non-temporary children were not locked. See
Bug 19627 - temporary merge table locking.

You cannot change the union list of a non-temporary MERGE table
when LOCK TABLES is in effect. The following does *not* work:
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ...;
LOCK TABLES t1 WRITE, t2 WRITE, m1 WRITE;
ALTER TABLE m1 ... UNION=(t1,t2) ...;
However, you can do this with a temporary MERGE table.

You cannot create a MERGE table with CREATE ... SELECT, neither
as a temporary MERGE table, nor as a non-temporary MERGE table.
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ... SELECT ...;
Gives error message: table is not BASE TABLE.
2007-11-15 20:25:43 +01:00
mattiasj@mattiasj-laptop.(none)
32d7dd8679 Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-last_with_main
2007-11-12 21:09:48 +01:00
tomas@whalegate.ndb.mysql.com
20e3804ea9 Merge whalegate.ndb.mysql.com:/home/tomas/cge-5.1
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge
2007-11-12 10:50:58 +01:00
tomas@whalegate.ndb.mysql.com
0feaff83b7 only potentially skip GAP event on startup, not on cluster restart 2007-11-06 22:28:44 +01:00
tomas@whalegate.ndb.mysql.com
312aec9e27 Bug #31484 Cluster LOST_EVENTS entry not added to binlog on mysqld restart
- correction, do not insert GAP on first startup
2007-11-06 15:12:27 +01:00
tomas@whalegate.ndb.mysql.com
47a245559c break out tuple data read 2007-11-06 10:27:56 +01:00
tomas@whalegate.ndb.mysql.com
bfc80edec5 preserve more of the state 2007-11-05 23:23:26 +01:00
istruewing@stella.local
3eaf82a175 Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table

Trying INSERT DELAYED on a partitioned table, that has not been
used right before, crashes the server. When a table is used for
select or update, it is kept open for some time. This period I
mean with "right before".

Information about partitioning of a table is stored in form of
a string in the .frm file. Parsing of this string requires a
correctly set up lexical analyzer (lex). The partitioning code
uses a new temporary instance of a lex. But it does still refer
to the previously active lex. The delayd insert thread does not
initialize its lex though...

Added initialization for thd->lex before open table in the delayed
thread and at all other places where it is necessary to call
lex_start() if all tables would be partitioned and need to parse
the .frm file.
2007-11-05 16:25:40 +01:00
tomas@whalegate.ndb.mysql.com
2635cb0a93 compile error 2007-11-03 13:46:49 +01:00
tomas@whalegate.ndb.mysql.com
96dfac7cb1 this error should not be printed 2007-11-02 23:44:17 +01:00
tomas@whalegate.ndb.mysql.com
9952ee4f91 Bug #31484 Cluster LOST_EVENTS entry not added to binlog on mysqld restart
- correction
2007-11-01 20:00:44 +01:00
tomas@whalegate.ndb.mysql.com
9320ec8d16 Bug #31484 Cluster LOST_EVENTS entry not added to binlog on mysqld restart. 2007-11-01 15:08:00 +01:00
kostja@bodhi.(none)
e4b353c40c Use an inline getter method (thd->is_error()) to query if there is an error
in THD.
In future the error may be stored elsewhere (not in net.report_error) and 
it's important to start using an opaque getter to simplify merges.
2007-10-30 20:08:16 +03:00
kostja@bodhi.(none)
7c00f8a3b4 Rename: query_error -> is_slave_error.
Add comments.
2007-10-20 01:20:38 +04:00
tomas@whalegate.ndb.mysql.com
35bddfecf7 Bug #11313 confusing/erroneous 4006 message 2007-09-07 11:15:07 +02:00
tomas@whalegate.ndb.mysql.com
1657c2d88a getting rid of flush altogether, fix with post_epoch hendeling and/or changes in Rows_log_event
- problem is the database name accessed in Rows_log_event write... get_db() which is a pointer to the share string...
- point to table map instead?
- or copy it?
- or make sure that anything interacting with the share happens _after_ the epoch

Problem with flush is that STMT_END_F may not be included as it shoudld...
2007-09-05 11:43:42 +02:00
tomas@whalegate.ndb.mysql.com
39edaf9f8d this flush with flag TRUE causes spurious errors in the binlog... as it will insert a STMT_END_F... and hence an invalid binlog (missing table mappings) 2007-09-05 09:22:58 +02:00
tomas@whalegate.ndb.mysql.com
08b8d6aeaf Bug#20872 master*.err: miscellaneous error messages 2007-08-30 11:46:30 +02:00
tomas@whalegate.ndb.mysql.com
a7921ab61d Bug#20872 master*.err: miscellaneous error messages 2007-08-30 10:41:19 +02:00
tomas@whalegate.ndb.mysql.com
166849188d manual merge 2007-08-21 14:41:50 +02:00
gluh@mysql.com/eagle.(none)
27ab885525 WL#3732 Information schema optimization 2007-08-03 03:14:05 +05:00
tomas@whalegate.ndb.mysql.com
81bc79a711 BUG#30017 log-slave-updates incorrect behavior for cluster
- let the receiving injector thread decide what to do
2007-07-25 07:24:25 +02:00
tomas@poseidon.mysql.com
f7a1a076c7 WL#3303
- binlog should always run if opt_bin_log is set
2007-06-27 22:28:18 +02:00
tomas@whalegate.ndb.mysql.com
6a51e0f8a2 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-rpl
2007-06-18 23:55:48 +02:00
tomas@whalegate.ndb.mysql.com
7d4467766f correction 2007-06-18 15:41:02 +02:00
tomas@whalegate.ndb.mysql.com
e5565db7c6 Bug #28989 hpux11 ps_row warnings
- also remove printout for error 4009
2007-06-18 15:38:37 +02:00
tomas@whalegate.ndb.mysql.com
6b8e7c9484 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-engines
2007-06-17 19:47:56 +02:00
tomas@whalegate.ndb.mysql.com
ff804bc546 Bug #28989 hpux11 ps_row warnings
- do not print 701 dictionary busy error
2007-06-17 19:47:20 +02:00
jani@a88-113-38-195.elisa-laajakaista.fi
2c8f4f9791 Added casts to avoid compiler warnings and fixed a wrong type.
---
Added casts and fixed wrong type.
---
Added casts and fixed wrong type.
---
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
---
Don't give warning that readonly variable is forced to be readonly
mysql-test-run run now fails if we have [Warning] and [ERROR] as tags in .err file
Fixed wrong reference to the mysql manual
Fixed wrong prototype that caused some tests to fail on 64 bit platforms
---
Disabled compiler warnings mainly for Win 64.
---
Added casts to remove compiler warnings on windows
Give warnings also for safe_mutex errors found by test system
Added some warnings from different machines in pushbuild
---
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  mysql.com:/home/my/mysql-5.1
---
Added escapes for double quotes and parenthesis.
---
Archive db fix plus added non-critical warnings
in ignore list.
---
Fixed previously added patch and added new ignored warning.
2007-05-31 17:45:22 +03:00
jani@a88-113-38-195.elisa-laajakaista.fi
fc3b3a0a86 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-05-24 13:24:36 +03:00
kostja@vajra.(none)
0a061c902b Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  vajra.(none):/opt/local/work/mysql-5.1-runtime
2007-05-15 17:54:11 +04:00