Commit graph

69380 commits

Author SHA1 Message Date
Mayank Prasad
08f1257dc5 BUG#12561297:LIBMYSQLD/EXAMPLE/MYSQL_EMBEDDED IS ABORTING.
Issue:
------
New test case mysql_embedded.test was failing on pb2.

Description:
------------
To run this test case executable libmysqld/examples/mysql_embedded is required.
But as per /libmysqld/examples/cmake_install.cmake this executable doesn't get
copied to <install_dir> when mysql is installed at <install_dir>.That is the
reason it was passing in my local branch and failed on pb2 when pushed.

Solution;
---------
Added code in mysql-test-run.pl, which will try to see if this file exists.If
It doesn't exist, test case will be skipped with a skip message. New code in
mysql-test-run.pl looks only for directory libmysqld/examples/mysql_embedded
because this is the only place where this file could/does exist.
2011-06-16 19:25:11 +05:30
Vasil Dimov
c551dd9cee Merge mysql-5.1 -> mysql-5.5 2011-06-16 16:14:16 +03:00
Vasil Dimov
da9a249b0a Silence bogus compiler warning introduced in
marko.makela@oracle.com-20110616072721-8bo92ctixq6eqavr
2011-06-16 16:11:43 +03:00
Marko Mäkelä
d73998eb87 Merge mysql-5.1 to mysql-5.5. 2011-06-16 15:13:24 +03:00
Marko Mäkelä
bedad62231 Bug #61341 buf_LRU_insert_zip_clean can be O(N) on LRU length
The buf_pool->zip_clean list is only needed for debugging, or for
recomputing buf_pool->page_hash when resizing the buffer pool. Buffer
pool resizing was never fully implemented. Remove the resizing code,
and define buf_pool->zip_clean only in debug builds.

buf_pool->zip_clean, buf_LRU_insert_zip_clean(): Enclose in
#if defined UNIV_DEBUG || UNIV_BUF_DEBUG.

buf_chunk_free(), buf_chunk_all_free(), buf_pool_shrink(),
buf_pool_page_hash_rebuild(), buf_pool_resize(): Remove (unreachable code).

rb:671 approved by Inaam Rana
2011-06-16 14:55:46 +03:00
Marko Mäkelä
49c0ae1998 Bug#12595087 - 61191: Question about page_zip_available
There is an apparent problem with page_zip_clear_rec().
In btr_cur_optimistic_update() we do this:

	page_cur_delete_rec(page_cursor, index, offsets, mtr);
...
	rec = btr_cur_insert_if_possible(cursor, new_entry, 0/*n_ext*/, mtr);
	ut_a(rec); /* <- We calculated above the insert would fit */

The problem is that page_cur_delete_rec() could fill the modification
log while doing page_zip_clear_rec(), requiring recompression for the
btr_cur_insert_if_possible(). In a pathological case, the data could
fail to recompress.

page_zip_clear_rec(): Leave the page modification log alone. Only
clear the necessary fields.

rb:673 approved by Jimmy Yang
2011-06-16 14:22:12 +03:00
Marko Mäkelä
7540b1a7d5 Merge mysql-5.1 to mysql-5.5. 2011-06-16 12:07:49 +03:00
Marko Mäkelä
f842fd501f Re-enable the debug assertions for Bug#12650861.
Replace UNIV_BLOB_NULL_DEBUG with UNIV_DEBUG||UNIV_BLOB_LIGHT_DEBUG. 
Fix known bogus failures.

btr_cur_optimistic_update(): If rec_offs_any_null_extern(), assert that
the current transaction is an incomplete transaction that is being
rolled back in crash recovery.

row_build(): If rec_offs_any_null_extern(), assert that the transaction
that last updated the record was recovered during crash recovery
(and will soon be rolled back).
2011-06-16 11:51:04 +03:00
Marko Mäkelä
8a94d55e69 Bug#12612184 Race condition after btr_cur_pessimistic_update()
btr_cur_compress_if_useful(), btr_compress(): Add the parameter ibool
adjust. If adjust=TRUE, adjust the cursor position after compressing
the page.

btr_lift_page_up(): Return a pointer to the father page.

BTR_KEEP_POS_FLAG: A new flag for btr_cur_pessimistic_update().

btr_cur_pessimistic_update(): If *big_rec != NULL and flags &
BTR_KEEP_POS_FLAG, keep the cursor positioned on the updated record.
Also, do not release the index tree x-lock if *big_rec != NULL.

btr_cur_mtr_commit_and_start(): Commits and restarts a
mini-transaction so that it will retain an x-lock on index->lock and
the page of the cursor. This is invoked when
btr_cur_pessimistic_update() returns *big_rec != NULL.

In all callers of btr_cur_pessimistic_update() that do not pass
BTR_KEEP_POS_FLAG, assert that *big_rec == NULL.

btr_cur_compress(): Unused function [in the built-in MySQL 5.1], remove.

page_rec_get_nth(): Return the nth record on the page (an inverse
function of page_rec_get_n_recs_before()). Refactored from
page_get_middle_rec().

page_get_middle_rec(): Invoke page_rec_get_nth().

page_cur_insert_rec_zip_reorg(): Make use of the page directory
shortcuts in page_rec_get_nth() instead of scanning the whole list of
records.

row_ins_clust_index_entry_by_modify(): Pass BTR_KEEP_POS_FLAG to
btr_cur_pessimistic_update().

row_ins_index_entry_low(): If row_ins_clust_index_entry_by_modify()
returns a big_rec, invoke btr_cur_mtr_commit_and_start() in order to
commit and start the mini-transaction without releasing the x-locks on
index->lock and the cursor page, and write the big_rec. Releasing the
page latch in mtr_commit() caused a race condition.

row_upd_clust_rec(): Pass BTR_KEEP_POS_FLAG to
btr_cur_pessimistic_update(). If it returns a big_rec, invoke
btr_cur_mtr_commit_and_start() in order to commit and start the
mini-transaction without releasing the x-locks on index->lock and the
cursor page, and write the big_rec. Releasing the page latch in
mtr_commit() caused a race condition.

sync_thread_add_level(): Add the parameter ibool relock. When TRUE,
bypass the latching order rules.

rw_lock_add_debug_info(): For nested X-lock requests, pass relock=TRUE
to sync_thread_add_level().

rb:678 approved by Jimmy Yang
2011-06-16 10:27:21 +03:00
Jorgen Loland
ebe94178d1 BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
UPDATED TWICE

For multi update it is not allowed to update a column
of a table if that table is accessed through multiple aliases
and either
1) the updated column is used as partitioning key
2) the updated column is part of the primary key 
   and the primary key is clustered

This check is done in unsafe_key_update().

The bug was that for case 2), it was checked whether
updated_column_number == table_share->primary_key 
However, the primary_key variable is the index number of the 
primary key, not a column number.

Prior to this bugfix, the first column was wrongly believed to be
the primary key. The columns covered by an index is found in
table->key_info[idx_number]->key_part. The bugfix is to check if
any of the columns in the keyparts of the primary key are
updated.

The user-visible effect is that for storage engines with
clustered primary key (e.g. InnoDB but not MyISAM) queries
like 
"UPDATE t1 AS A JOIN t2 AS B SET A.primkey=..."
will now error with 
"ERROR HY000: Primary key/partition key update is not allowed 
since the table is updated both as 'A' and 'B'." 
instead of 
"ERROR 1032 (HY000): Can't find record in 't1_tb'"
even if primkey is not the first column in the table. This 
was the intended behavior of bugfix 11764529.
2011-06-16 08:24:00 +02:00
Vinay Fisrekar
0357d0dced Skip test run with valgrind as test has restarts 2011-06-16 10:00:51 +05:30
Dmitry Shulga
7b8dd7b41c Fixed bug#12403662 (formerly known as bug#60987): LOAD DATA LOCAL INFILE
can't parse relative paths "higher" than 3 levels up

When trying to LOAD DATA LOCAL INFILE using a relative path with 3 or
more levels up in the directory hierarchy, mysqld wrongly parses 
the path and as a consequence, can't find the file.

This bug was introduced by patch for bug#58205.
The reason for bug is that implementaiton of function cleanup_dirname()
doesn't take into account the begin of buffer being processed during
handling of path to file.
2011-06-15 16:18:08 +07:00
Marko Mäkelä
3015542b1a Merge mysql-5.1 to mysql-5.5. 2011-06-15 10:30:19 +03:00
Marko Mäkelä
2a48b14270 Introduce UNIV_BLOB_NULL_DEBUG for temporarily hiding Bug#12650861.
Some ut_a(!rec_offs_any_null_extern()) assertion failures are indicating
genuine BLOB bugs, others are bogus failures when rolling back incomplete
transactions at crash recovery. This needs more work, and until I get a
chance to work on it, other testing must not be disrupted by this.
2011-06-15 10:16:59 +03:00
Anitha Gopi
cdcf1e8f13 Bug#12561297 : Disable test main.mysql_embedded since it is failing on all platforms 2011-06-15 08:33:13 +05:30
Marko Mäkelä
f4ef3e0d27 Null merge mysql-5.1 to mysql-5.5. 2011-06-14 08:47:33 +03:00
Marko Mäkelä
c0fcd9e0b6 Merge a fix from mysql-5.5 to mysql-5.1:
revno 2995.37.209
revision id marko.makela@oracle.com-20110518120508-qhn7vz814vn77v5k
parent marko.makela@oracle.com-20110517121555-lmple24qzxqkzep4
timestamp: Wed 2011-05-18 15:05:08 +0300
message:
  Fix a bogus UNIV_SYNC_DEBUG failure in the fix of Bug #59641
  or Oracle Bug #11766513.

  trx_undo_free_prepared(): Do not acquire or release trx->rseg->mutex.
  This code is invoked in the single-threaded part of shutdown, therefore
  a mutex is not needed.
2011-06-14 08:40:32 +03:00
Mayank Prasad
061983f9f3 BUG#12561297:LIBMYSQLD/EXAMPLE/MYSQL_EMBEDDED IS ABORTING.
Issue:
When libmysqld/example/mysql_embedded is executed, it was getting abort. Its a
regression as it was working in 5.1 and failed in 5.5. Issue is there because 
remaining_argc/remaining_argv were not getting assigned correctly in 
init_embedded_server() which were being used later in init_common_variable().

Solution:
Rectified code to pass correct argc/argv to be used in init_common_variable().
2011-06-14 00:11:24 +05:30
Mattias Jonsson
10e3313366 merge 2011-06-13 11:57:47 +02:00
Mattias Jonsson
f2f22614fa merge 2011-06-13 11:21:54 +02:00
Mattias Jonsson
8f3bb95a43 merge 2011-06-13 11:09:56 +02:00
Karen Langford
2a4e1bc9f6 Merged from mysql-5.1 2011-06-10 18:37:57 +02:00
Karen Langford
ba6d3a5cd6 Merged from mysql-5.0 2011-06-10 18:22:24 +02:00
Karen Langford
940335e18c increase version number to 5.0.95 2011-06-10 18:12:18 +02:00
Karen Langford
afafca1ad2 Raise version number after cloning 5.1.58 2011-06-10 16:37:11 +02:00
Mayank Prasad
d9a35da161 Bug#12337762 : MYSQL_LIST_FIELDS() RETURNS WRONG CHARSET FOR CHAR/VARCHAR/TEXT
COLUMNS IN VIEWS

Issue:
charset value for a Column, returned by MYSQL_LIST_FIELDS(), was not same
for Table and View. This was because, for view, field charset was not being
returned.

Solution:
Added definition of function "charset_for_protocol()" in calss 
Item_ident_for_show to return field charset value.
2011-06-10 19:56:35 +05:30
Daniel Fischer
96b6dc6d91 RETURN doesn't exactly return from the macro... 2011-06-10 14:57:42 +02:00
Jon Olav Hauglid
cc4530f92d Bug#12584161 - 43861: MAIN.QUERY_CACHE_28249 FAILS SPORADICALLY
This test case was failing on 5.5 and trunk for two reasons.
1) It waited for the "Waiting for table level lock" process
   state while this state was renamed "Waiting for table
   metadata lock" with the introduction of MDL in 5.5.
2) SET GLOBAL query_cache_size= 100000; gave a warning since
   query_cache_size is supposed to be multiples of 1024.

This patch fixes these two issues and re-enables the test case.
2011-06-10 11:40:57 +02:00
Jorgen Loland
9506c81809 local merge 2011-06-10 10:55:46 +02:00
Sunanda Menon
7e39ef17ae increased the version number to .15 2011-06-10 10:38:27 +02:00
Jorgen Loland
fb110da7e8 BUG#12561818 - RERUN OF STORED FUNCTION GIVES ERROR 1172:
RESULT CONSISTED OF MORE THAN ONE ROW

MySQL converts incorrect DATEs and DATETIMEs to '0000-00-00' on
insertion by default. This means that this sequence is possible:

CREATE TABLE t1(date_notnull DATE NOT NULL);
INSERT INTO t1 values (NULL);
SELECT * FROM t1;
0000-00-00

At the same time, ODBC drivers do not (or at least did not in the
90's) understand the DATE and DATETIME value '0000-00-00'. Thus,
to be able to query for the value 0000-00-00 it was decided in
MySQL 4.x (or maybe even before that) that for the special case
of DATE/DATETIME NOT NULL columns, the query "SELECT ... WHERE
date_notnull IS NULL" should return rows with date_notnull ==
'0000-00-00'. This is documented misbehavior that we do not want
to change.

The hack used to make MySQL return these rows is to convert 
"date_notnull IS NULL" to "date_notnull = 0". This is, however,
only done if the table date_notnull belongs to is not an inner
table of an outer join. The rationale for this seems to be that
if there is no join match for the row in the outer table,
null-complemented rows would otherwise not be returned because
the null-complemented DATE value is actually NULL. On the other
hand, this means that the "return rows with 0000-00-00 when the
query asks for IS NULL"-hack is not in effect for outer joins.

In this bug, we have a LEFT JOIN that does not misbehave like 
the documentation says it should. The fix is to rewrite

"date_notnull IS NULL" to "date_notnull IS NULL OR 
                           date_notnull = 0"
if dealing with an OUTER JOIN, otherwise 
"date_notnull IS NULL" to "date_notnull = 0"
as was done before.

Note:
The bug was originally reported as different result on first 
and second execution of SP. The reason was that during first
execution the query was correctly rewritten to an inner join
due to a null-rejecting predicate. On second execution the
"IS NULL" -> "= 0" rewrite was done because there was no outer
join. The real problem, though, was incorrect date/datetime 
IS NULL handling for OUTER JOINs.
2011-06-10 10:22:45 +02:00
Dmitry Shulga
ab33df89b6 Manual-merge of patch for bug#11753738 from mysql-5.1 tree. 2011-06-10 14:20:15 +07:00
Tor Didriksen
eee0d59dd8 Bug#12641810 - MYSQL MAKE DIST DOESN'T WORK WHEN USING MYSQL TREE + PLUGIN TREE(S) 2011-06-10 09:12:10 +02:00
Dmitry Shulga
8867ad80ac Fixed bug#11753738 (formely known as bug#45235) - 5.1 DOES NOT SUPPORT 5.0-ONLY
SYNTAX TRIGGERS IN ANY WAY

Table with triggers which were using deprecated (5.0-only) syntax became
unavailable for any DML and DDL after upgrade to 5.1 version of server.
Attempt to execute any statement on such a table resulted in parsing
error reported. Since this included DROP TRIGGER and DROP TABLE
statements (actually, the latter was allowed but was not functioning
properly for such tables) it was impossible to fix the problem without
manual operations on .TRG and .TRN files in data directory.

The problem was that failure to parse trigger body (due to 5.0-only
syntax) when opening trigger file for a table prevented the table
from being open. This made all operations on the table impossible
(except DROP TABLE which due to peculiarity in its implementation
dropped the table but left trigger files around).

This patch solves this problem by silencing error which occurs when
we parse trigger body during table open. Error message is preserved
for the future use and table is marked as having a broken trigger.
We also try to analyze parse tree to recover trigger name, which
will be needed in order to drop the broken trigger. DML statements
which invoke triggers on the table marked as having broken trigger
are prohibited and emit saved error message. The same happens for
DDL which change triggers except DROP TRIGGER and DROP TABLE which
try their best to do what was requested. Table becomes no longer
marked as having broken trigger when last such trigger is dropped.
2011-06-10 10:52:39 +07:00
Marko Mäkelä
cfb1f299a4 Merge mysql-5.1 to mysql-5.5. 2011-06-09 22:03:16 +03:00
Marko Mäkelä
c8419facb5 Disable a debug assertion that was added to track down Bug#12612184.
row_build(): The record may contain null BLOB pointers when the server
is rolling back an insert that was interrupted by a server crash.
2011-06-09 21:50:41 +03:00
Dmitry Shulga
57d2668756 Auto-merge of follow-up for bug#11764334 from mysql-5.1 tree. 2011-06-10 01:08:38 +07:00
Dmitry Shulga
ef3c145d0e Follow-up for patch of bug#11764334. 2011-06-10 01:05:10 +07:00
Dmitry Shulga
7be063ad80 Auto-merge of patch for bug#11764334 from mysql-5.1 tree. 2011-06-10 00:07:03 +07:00
Dmitry Shulga
1cc304e33e Fixed bug#11764334 (formerly bug#57156): ALTER EVENT CHANGES
THE EVENT STATUS.

Any ALTER EVENT statement on a disabled event enabled it back
(unless this ALTER EVENT statement explicitly disabled the event).

The problem was that during processing of an ALTER EVENT statement
value of status field was overwritten unconditionally even if new
value was not specified explicitly. As a consequence this field
was set to default value for status which corresponds to ENABLE.

The solution is to check if status field was explicitly specified in
ALTER EVENT statement before assigning new value to status field.
2011-06-10 00:03:17 +07:00
Dmitry Lenev
95f1b6762b Fix for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
STATEMENTS FAIL".

Attempt to execute CREATE TABLE LIKE statement on a MyISAM
table with INDEX or DATA DIRECTORY options specified as a
source resulted in "MyISAM table '...' is in use..." error.
According to our documentation such a statement should create
a copy of source table with DATA/INDEX DIRECTORY options
omitted.

The problem was that new implementation of CREATE TABLE LIKE
statement in 5.5 tried to copy value of INDEX and DATA DIRECTORY
parameters from the source table. Since in description of source
table this parameters also included name of this table, attempt
to create target table with these parameter led to file name
conflict and error.

This fix addresses the problem by preserving documented and
backward-compatible behavior. I.e. by ensuring that contents
of DATA/INDEX DIRECTORY clauses for the source table is
ignored when target table is created.
2011-06-09 16:54:12 +04:00
Marko Mäkelä
b1fc801ad1 Merge mysql-5.1 to mysql-5.5. 2011-06-09 13:59:02 +03:00
Marko Mäkelä
6d20340c72 BLOB instrumentation for Bug#12612184 Race condition in row_upd_clust_rec()
If UNIV_DEBUG or UNIV_BLOB_LIGHT_DEBUG is enabled, add
!rec_offs_any_null_extern() assertions, ensuring that records do not
contain null pointers to externally stored columns in inappropriate
places.

btr_cur_optimistic_update(): Assert !rec_offs_any_null_extern().
Incomplete records must never be updated or deleted. This assertion
will cover also the pessimistic route.

row_build(): Assert !rec_offs_any_null_extern(). Search tuples must
never be built from incomplete index entries.

row_rec_to_index_entry(): Assert !rec_offs_any_null_extern() unless
ROW_COPY_DATA is requested. ROW_COPY_DATA is used for
multi-versioning, and therefore it might be valid to copy the most
recent (uncommitted) version while it contains a null pointer to
off-page columns.

row_vers_build_for_consistent_read(),
row_vers_build_for_semi_consistent_read(): Assert !rec_offs_any_null_extern()
on all versions except the most recent one.

trx_undo_prev_version_build(): Assert !rec_offs_any_null_extern() on
the previous version.

rb:682 approved by Sunny Bains
2011-06-09 13:31:15 +03:00
Dmitry Shulga
3f0b267802 Added regression test for bug#11763757 "56510: ERROR 42000:
FUNCTION DOES NOT EXIST IF NOT-PRIV USER RECONNECTS".

The bug itself was fixed by the same patch as bug@11747137
"30977: CONCURRENT STATEMENT USING STORED FUNCTION AND DROP
FUNCTION BREAKS SBR".
2011-06-08 20:44:50 +07:00
Ramil Kalimullin
5db6d914ee Auto-merge from mysql-5.1 2011-06-07 19:44:15 +04:00
Ramil Kalimullin
55015ea0b0 Bug#11764487: myisam corruption with insert ignore and invalid spatial data
Problem: in case of wrong data insert into indexed GEOMETRY fields 
(e.g. NULL value for a not NULL field) MyISAM reported 
"ERROR 126 (HY000): Incorrect key file for table; try to repair it"
due to misuse of the key deletion function.

Fix: always use R-tree key functions for R-tree based indexes
and B-tree key functions for B-tree based indexes.
2011-06-07 19:30:43 +04:00
Alexander Nozdrin
76874a3897 Ignore auto-generated files (source_downloads). 2011-06-07 17:06:26 +04:00
Marko Mäkelä
e91652afb8 Non-functional change: Unbreak the Hot Backup build.
page_rec_write_field(): Omit the definition if UNIV_HOTBACKUP is defined.
2011-06-06 16:24:01 +03:00
Georgi Kodinov
af78e87de3 merged the warnings fix. 2011-06-06 13:28:05 +03:00
Georgi Kodinov
8d7361f803 Fixed cast warnings in introducing the pluggable authentication client
options.
2011-06-06 13:27:05 +03:00