Commit graph

6678 commits

Author SHA1 Message Date
Inaam Rana
0023147055 Bug#13825266 RACE IN LOCK_VALIDATE() WHEN ACCESSING PAGES DIRECTLY
FROM BUFFER POOL

rb://975
approved by: Marko Makela

There is a race in lock_validate() where we try to access a page
without ensuring that the tablespace stays valid during the operation
i.e.: it is not deleted. This patch tries to fix that by using an
existing flag (the flag is renamed to make it's name more generic
in line with it's new use).
2012-03-15 13:30:17 -04:00
Inaam Rana
1ca73ab435 merge from 5.1 2012-03-15 12:45:24 -04:00
Inaam Rana
04c96834cc Bug#13851171 STRING OVERFLOW IN INNODB CODE FOUND BY STATIC ANALYSIS
rb://976
approved by: Marko Makela

Add an assertion to ensure that string overflow is not happening.
Pointed by Coverity analysis.
2012-03-15 12:38:40 -04:00
Inaam Rana
2ceb117750 merge from 5.1 2012-03-15 11:57:01 -04:00
Inaam Rana
a8217b7cd3 Bug#13537504 VALGRIND: COND. JUMP/MOVE DEPENDS ON UNINITIALISED VALUES
IN OS_THREAD_EQ

rb://977
approved by: Marko Makela

rw_lock::writer_thread field contains the thread id of current x-holder
or wait-x thread. This field is un-initialized at lock creation and is
written to for the first time when an attempt is made to x-lock.

Current code considers ::writer_thread as valid memory region only when
the lock is held in x-mode (or there is an x-waiter). This is an
overkill and it generates valgrind warnings.

The fix is to consider ::writer_thread as valid memory region once it
has been written to.

Reasoning:
==========
The ::writer_thread can be safely considered valid because:

* We only ever do comparison with current calling threads id.
* We only ever do comparison when ::recursive flag is set
* We always unset ::recursive flag in x-unlock
* Same thread cannot be unlocking and attempting to lock at the same
time
* thread_id recycling is not an issue because before an id is recycled
the thread must leave innodb meaning it must release all locks meaning
it must unset ::recursive flag.
2012-03-15 11:53:30 -04:00
Vladislav Vaintroub
eb30253d69 Fix access to uninitialized variable in innodb error message in case WriteFile() fails. 2012-03-15 15:06:06 +01:00
Jon Olav Hauglid
29443d085c Merge from mysql-5.5 to mysql-5.5-security
No conflicts
2012-03-15 11:25:53 +01:00
Sergei Golubchik
c3c14a069b another fix for --innodb-trx* name conflict 2012-03-14 19:47:15 +01:00
Michael Widenius
6f06cef02b Fixed bug lp:917689 "Archive table corruption crashing MariaDB signal 11"
Added 'from_end' as extra parameter to Field::unpack() to detect wrong from data.
Change ha_archive::unpack_row() to detect wrong field lengths.
Replication code changed to detect wrong field information in events.


mysql-test/r/archive.result:
  dded test case for lp:917689
sql/field.cc:
  Added 'from_end' as extra parameter to Field::unpack() to detect wrong from data.
  Removed not used 'unpack_key' functions.
sql/field.h:
  Added 'from_end' as extra parameter to Field::unpack() to detect wrong from data.
  Removed not used 'unpack_key' functions.
  Removed some not needed unpack() functions.
sql/filesort.cc:
  Added buffer end parameter to unpack_addon_fields()
sql/log_event.h:
  Added end of buffer argument to unpack_row()
sql/log_event_old.cc:
  Added end of buffer argument to unpack_row()
sql/log_event_old.h:
  Added end of buffer argument to unpack_row()
sql/records.cc:
  Added buffer end parameter to unpack_addon_fields()
sql/rpl_record.cc:
  Added end of buffer argument to unpack_row()
  Added detection of wrong field information in events
sql/rpl_record.h:
  Added end of buffer argument to unpack_row()
sql/rpl_record_old.cc:
  Added end of buffer argument to unpack_row()
  Added detection of wrong field information in events
sql/rpl_record_old.h:
  Added end of buffer argument to unpack_row()
sql/table.h:
  Added buffer end parameter to unpack()
storage/archive/ha_archive.cc:
  Change ha_archive::unpack_row() to detect wrong field lengths.
  This fixes lp:917689
2012-03-13 16:38:43 +02:00
Sergei Golubchik
1cbc3790d3 fix SphinxSE version as reported in I_S.PLUGINS 2012-03-13 13:31:21 +01:00
Sergei Golubchik
262a2ab59d monty's cleanup of my_thr_init.c
and collateral changes
2012-03-13 13:29:44 +01:00
Inaam Rana
e56854d8e5 Bug#13789853 SHOW ENGINE INNODB STATUS HANGS DUE TO EXCESSIVE WORK
IN LOCK_VALIDATE()

rb://917
approved by: Marko Makela

In lock_validate() the limit is used to release the kernel_mutex during
the validation, to obey the latching order.
If we do the limit++ then we are rechecking the same lock most times on
each iteration because limit is being incremented by one and
<space, page_no> will nearly always be > limit. If we set the limit
correctly to (space, page+1) then we are actually making progress
during the iteration.
2012-03-12 13:04:54 -04:00
Sergei Golubchik
4933d21e5d merge with mysql-5.5.21 2012-03-09 08:06:59 +01:00
Annamalai Gurusami
29aaa6588d Bug #11766634 59783: InnoDB data grows unexpectedly when inserting,
truncating, inserting the same set of rows. When a table is 
re-created with the same set of rows, the data file size must
not grow.  

rb:968
Approved by Marko.
2012-03-09 11:07:16 +05:30
Annamalai Gurusami
3ce20ed4f9 Merging from mysql-5.1 to mysql-5.5. 2012-03-09 12:35:27 +05:30
Georgi Kodinov
9c366f7921 merge mysql-5.5->mysql-5.5-security 2012-03-08 17:19:54 +02:00
Georgi Kodinov
4b5306fd6e merge mysql-5.1->mysql-5.1-security 2012-03-08 17:16:53 +02:00
Marko Mäkelä
26ab3d1258 Merge mysql-5.1 to mysql-5.5. 2012-03-08 17:12:42 +02:00
Marko Mäkelä
6e6ba8654b Fix a compiler warning about possibly uninitiaizlied variable. 2012-03-08 17:10:10 +02:00
Marko Mäkelä
9747c33b31 Merge mysql-5.1 to mysql-5.5. 2012-03-08 15:03:40 +02:00
Marko Mäkelä
c5511bdf08 Bug#13807811 BTR_PCUR_RESTORE_POSITION() CAN SKIP A RECORD
This bug has been there at least since MySQL 4.0.9. (Before 4.0.9, the
code probably was even more severely broken.)

btr_pcur_restore_position(): When cursor restoration fails, before
invoking btr_pcur_store_position() move to the previous or next record
unless cursor->rel_pos==BTR_PCUR_ON or the record was not a user
record.

This bug can cause skipped records when btr_pcur_store_position() is
called on the last record of a page. A symptom would be record count
mismatch in CHECK TABLE, or failure to find a record to delete-mark or
update or purge. The following operations should be affected by the
bug:

* row_search_for_mysql(): SELECT, UPDATE, REPLACE, CHECK TABLE,
  (almost anything else than INSERT)

* foreign key CASCADE operations

* row_merge_read_clustered_index(): index creation (since MySQL 5.1
  InnoDB Plugin)

* multi-threaded purge (after MySQL 5.5): not sure, but it might fail
  to purge some records

Not all callers of btr_pcur_restore_position() should be affected.
Anything that asserts or checks that restoration succeeds is
unaffected. For example, cursor restoration on the change buffer tree
should always succeed, because access is being protected by additional
latches. Likewise, rollback, or any code accesses data dictionary
tables while holding dict_sys->mutex should be safe.

rb:967 approved by Jimmy Yang
2012-03-08 14:56:22 +02:00
Michael Widenius
aba6d06c34 Upgraded sphinx to version 2.0.4
Fixed memory leaks and compiler warnings in ha_sphinx.cc
Added HA_MUST_USE_TABLE_CONDITION_PUSHDOWN so that an engine can force index condition to be used

mysql-test/suite/sphinx/sphinx.result:
  Added testing of pushdown conditions and sphinx status variables.
mysql-test/suite/sphinx/sphinx.test:
  Added testing of pushdown conditions and sphinx status variables.
mysql-test/suite/sphinx/suite.pm:
  Print version number if sphinx version is too old.
sql/handler.h:
  Added HA_MUST_USE_TABLE_CONDITION_PUSHDOWN so that an engine can force index condition to be used
sql/sql_base.cc:
  Added 'thd' argument to check_unused() to be able to set 'entry->in_use' if we call handler->extra().
  This was needed as sphinx (and possible other storage engines) assumes that 'in_use' is set if handler functions are called.
sql/sql_select.cc:
  Test if handler is forcing pushdown condition to be used.
storage/sphinx/ha_sphinx.cc:
  Updated to version 2.0.4
  Fixed memory leaks and compiler warnings.
storage/sphinx/ha_sphinx.h:
  Updated to version 2.0.4
storage/sphinx/snippets_udf.cc:
  Updated to version 2.0.4
2012-03-07 17:38:47 +02:00
Sergei Golubchik
18c51eee35 5.3 merge 2012-03-06 20:46:07 +01:00
Tor Didriksen
84c6c75979 Merge 5.1 => 5.5
storage/innobase/include/sync0rw.ic:
  Prerequisite for compiling with gcc4 on solaris: ignore result from
  os_compare_and_swap_ulint
storage/myisam/mi_dynrec.c:
  Prerequisite for compiling with gcc4 on solaris: cast to void*
2012-03-06 13:47:57 +01:00
Sergei Golubchik
1c530b36d1 mdev-20: INSTALL PLUGIN SONAME 2012-03-05 21:48:06 +01:00
Michael Widenius
4ab7a33e1e Automatic merge 2012-03-05 22:00:24 +02:00
Michael Widenius
c437506826 Ensure that we mark all processed tables as 'properly closed'.
This is needed as last log entry may be a DDL that is not processed and then a table may be left in 'not properly closed state' even if information is correct in it.
2012-03-05 21:59:00 +02:00
Igor Babaev
fba0ead63e Supported extended keys (MWL #247) for innodb_plugin. 2012-03-03 13:22:49 -08:00
Igor Babaev
8bc5045ea3 Merge MWL #247 from mariadb 5.3 -> mariadb 5.5. 2012-03-02 15:03:20 -08:00
Igor Babaev
8b469eb515 Merge 5.3->5.5. 2012-03-01 14:22:22 -08:00
Sergei Golubchik
29b0b0b5de misc test/result fixes
mysql-test/include/have_xtradb.combinations:
  xtradb tests need this I_S table
mysql-test/lib/mtr_cases.pm:
  fix for .deb and .rpm installations
2012-03-01 17:04:57 +01:00
Annamalai Gurusami
621db3d42e The innodb plugin module cannot use DEBUG_SYNC_C facility on Windows.
Taking care of it.
2012-03-01 15:44:23 +05:30
Annamalai Gurusami
7e36c4bdb0 Bug#13635833: MULTIPLE CRASHES IN FOREIGN KEY CODE WITH CONCURRENT DDL/DML
There are two threads.  In one thread, dml operation is going on 
involving cascaded update operation.  In another thread, alter 
table add foreign key constraint is happening.  Under these 
circumstances, it is possible for the dml thread to access a 
dict_foreign_t object that has been freed by the ddl thread.  
The debug sync test case provides the sequence of operations.  
Without fix, the test case will crash the server (because of 
newly added assert).  With fix, the alter table stmt will return 
an error message.  
      
Backporting the fix from MySQL 5.5 to 5.1

rb:961
rb:947
2012-03-01 11:05:51 +05:30
Sergei Golubchik
e4bfb6f161 pbxt suite is now a main-pbxt overlay 2012-02-29 21:55:04 +01:00
Michael Widenius
e4e85cd2ef Fixed lp:925377 "Querying myisam table metadata while 'alter table..enable keys' is running may corrupt the table"
Fixed wrong mutex order bug in Aria when flush_log_for_bitmap() was called when table is not yet marked for change.

include/my_base.h:
  Added flag that table is opened only for status
mysql-test/r/myisam-big.result:
  Test case for lp:925377
mysql-test/t/myisam-big.test:
  Test case for lp:925377
sql/sql_base.cc:
  If thd->version == 0 (happens only when we are opening a table that is flushed under  MYSQL_LOCK_IGNORE_FLUSH), open the table in HA_OPEN_FOR_STATUS mode
storage/maria/ma_bitmap.c:
  Fixed wrong mutex order bug in Aria when flush_log_for_bitmap() was called when table is not yet marked for change.
storage/maria/ma_dbug.c:
  Ignore last_version <= 1 as these are either flushed or only opened for status
storage/maria/ma_open.c:
  Use last_version=1 as a marker that table was opened with HA_OPEN_FOR_STATUS.
  In this case we just open a new version of the table in read only mode.
storage/myisam/mi_create.c:
  Update prototype
storage/myisam/mi_dbug.c:
  Ignore last_version <= 1 as these are either flushed or only opened for status
storage/myisam/mi_open.c:
  Use last_version=1 as a marker that table was opened with HA_OPEN_FOR_STATUS.
  If HA_OPEN_FOR_STATUS is used, we will not assert if there is an old not-to-be-used version of the table existing.
  In this case we just open a new version of the table in read only mode.
storage/myisam/myisamdef.h:
  Updated prototype
2012-02-28 23:18:52 +02:00
Igor Babaev
2521ac0c7f Addressed all review feedbacks for mwl #247. 2012-02-28 13:03:10 -08:00
Marko Mäkelä
e74c9b71ab Fix a mistake in the Bug#12861864 fix.
row_drop_table_for_mysql(): Really flag the indexes unavailable before
starting to drop the table.
2012-02-28 21:41:55 +02:00
Sergei Golubchik
45faabf44f merge 2012-02-28 15:04:31 +01:00
Marko Mäkelä
1bd0c9b531 Bug#12861864 RACE CONDITION IN BTR_GET_SIZE() AND DROP INDEX/TABLE/DATABASE
also filed as Bug#13146269, Bug#13713178

btr_get_size(): Add mtr_t parameter. Require that the caller S-latches
index->lock. If index->page==FIL_NULL or the index is to be dropped,
return ULINT_UNDEFINED to indicate that the statistics are
unavailable.

dict_update_statistics(): If btr_get_size() returns ULINT_UNDEFINED,
fake the index cardinality statistics.

dict_index_set_page(): Unused function, remove.

row_drop_table_for_mysql(): Before starting to drop the table, mark
the indexes unavailable in the data dictionary cache while holding
index->lock X-latch.

ha_innobase::prepare_drop_index(), ha_innobase::final_drop_index():
When setting index->to_be_dropped, acquire the index->lock X-latch.

rb:960 approved by Jimmy Yang
2012-02-28 14:00:00 +02:00
Michael Widenius
cf06b29f60 Fixed lp:905716 "Assertion `page->size <= share->max_index_block_size'"
The issue was that Aria allowed too long keys to be created (so that the internal buffer was not big enough to hold the whole key).
Key lengths is now limited to HA_MAX_KEY_LENGTH (1000), as for MyISAM.
Fixed failure in  "_ma_apply_redo_index: Assertion `new_page_length == 0", as found by buildbot.

mysql-test/suite/maria/r/maria.result:
  Updated results
mysql-test/suite/maria/r/maria3.result:
  Updated results. Added test for bug fix
mysql-test/suite/maria/t/maria3.test:
  Updated results. Added test for bug fix
mysql-test/suite/maria/t/optimize.test:
  Updated test for new max key length
storage/maria/ha_maria.cc:
  Limit key to HA_MAX_KEY_LENGTH.
storage/maria/ma_key_recover.c:
  Limit used page length to max page size (this is in line with the code that writes the entry to the log).
  This fixes failure in  "_ma_apply_redo_index: Assertion `new_page_length == 0", as found by buildbot.
storage/maria/ma_search.c:
  Extra DBUG
storage/maria/ma_write.c:
  Added test to detect errors earlier.
2012-02-28 13:39:02 +02:00
Marko Mäkelä
2367e79e4c Merge mysql-5.1 to mysql-5.5. 2012-02-28 21:43:08 +02:00
Marko Mäkelä
8235c4e161 Merge mysql-5.1 to mysql-5.5. 2012-02-28 14:04:21 +02:00
Igor Babaev
9db23c8280 Merge. 2012-02-27 21:23:12 -08:00
Marko Mäkelä
a44974abdc Merge mysql-5.1 to mysql-5.5. 2012-02-27 23:24:36 +02:00
Marko Mäkelä
5682272e1c Remove a bogus BLOB debug assertion that was added in Bug#13721257 fix. 2012-02-27 23:19:14 +02:00
Annamalai Gurusami
c1615df32c Bug#13635833: MULTIPLE CRASHES IN FOREIGN KEY CODE WITH CONCURRENT DDL/DML
There are two threads.  In one thread, dml operation is going on 
involving cascaded update operation.  In another thread, alter 
table add foreign key constraint is happening.  Under these 
circumstances, it is possible for the dml thread to access a 
dict_foreign_t object that has been freed by the ddl thread.  
The debug sync test case provides the sequence of operations.  
Without fix, the test case will crash the server (because of 
newly added assert).  With fix, the alter table stmt will return 
an error message.  
      
rb:947
approved by Jimmy Yang
2012-02-27 17:23:56 +05:30
Sergey Petrunya
2256ecdd7c Merge 5.2->5.3 2012-02-24 20:07:12 +04:00
Michael Widenius
0919edf32d Automatic merge 2012-02-24 17:21:44 +02:00
Michael Widenius
60aad31422 Fix for lp:909635: MariaDB crashes on a select with long varchar and blob fields
Problem was a crash in internal temporary (Maria) files when row length exceeded 65535

mysql-test/suite/maria/r/maria3.result:
  Added test case
mysql-test/suite/maria/t/maria3.test:
  Added test case
storage/maria/ma_open.c:
  Added support for row length > 65535.
  This fixes crash when using tables with longer row lengths.
2012-02-24 17:01:47 +02:00
Jimmy Yang
37d2bf8454 Fix Bug #64432 Port bug fix #54330 from mysql-5.1 to mysql-5.5 2012-02-24 21:21:07 +08:00
Michael Widenius
c068b831ac Removed const declarations to get rid of compiler warnings. The changes are similar to what is done in innobase in MySQL 5.5 2012-02-24 12:34:47 +02:00
Sergei Golubchik
c39877071a overlay support for mysql-test-run and mysqltest
mysql-test-run auto-disables all optional plugins.


mysql-test/include/default_client.cnf:
  no @OPT.plugindir anymore
mysql-test/include/default_mysqld.cnf:
  don't disable plugins manually - mtr can do it better
mysql-test/suite/innodb/t/innodb_bug47167.test:
  mtr now uses suite-dir as an include path
mysql-test/suite/innodb/t/innodb_file_format.test:
  mtr now uses suite-dir as an include path
mysql-test/t/partition_binlog.test:
  this test uses partitions
storage/example/mysql-test/mtr/t/source.result:
  update results. as mysqltest includes the correct overlayed include
storage/innobase/handler/ha_innodb.cc:
  the assert is wrong
2012-02-23 07:50:11 +01:00
Igor Babaev
90c26209ba Merge. 2012-02-22 13:04:58 -08:00
Michael Widenius
6fbeed067b Fixed that 'make distcheck' works with automake 1.11.11
Fixed compiler warnings found by buildbot

Makefile.am:
  Removed extra empty line
cmd-line-utils/libedit/sys.h:
  Fixed that strndup() doesn't give compiler warnings
mysql-test/Makefile.am:
  Fixes for 'make distcheck'
plugin/auth_pam/auth_pam.c:
  Ensure that prototype for strndup() is included on linux
sql/share/Makefile.am:
  Fixes for 'make distcheck'
storage/innodb_plugin/btr/btr0sea.c:
  Fixed compiler warning
support-files/Makefile.am:
  Fixes for 'make distcheck'
2012-02-21 17:58:43 +02:00
Sergei Golubchik
446554a15b fix for
"relocation R_X86_64_PC32 against `handler_index_cond_check' can not be used when making a shared object; recompile with -fPIC"
don't use visibility=hidden for external functions
2012-02-20 21:30:23 +01:00
Michael Widenius
b2ce6e3cde Automatic merge 2012-02-21 09:43:36 +02:00
Michael Widenius
15c5a2686f Merge with MariaDB 5.2 2012-02-21 01:58:50 +02:00
Sergey Petrunya
c381e44050 BUG#933412: Server crashes in _mi_put_key_in_record on KILL QUERY with ICP, STRAIGHT_JOIN
- In mi_rkey(), do correct handling of case where mi_yield_and_check_if_killed() 
  detects that the thread was killed (all other similar functions in MyISAM/Aria have 
  slightly different code and do not have this problem).
- Also fixed assignment in DBUG_ASSERT
- this is 2nd variant of the fix:
   = make .result file smaller
   = run KILLable statements in a separate connection, otherwise we could end up trying to 
     KILL the final "DROP TABLE" statement
2012-02-20 20:38:05 +04:00
Michael Widenius
038b739c98 Merge with MariaDB 5.1 and MySQL 5.1.61 2012-02-20 17:49:21 +02:00
Michael Widenius
ae07ec6cbf Merge with MYSQL 5.1.61
Fixed README with link to source
Merged InnoDB change to XtraDB

README:
  Added information of where to find MariaDB code
storage/archive/ha_archive.cc:
  Removed memset() of rows, a MariaDB checksum's doesn't touch not used data.
2012-02-20 16:23:18 +02:00
Michael Widenius
3c07d04580 Fixed lp:902654 "MariaDB consistently crashes in collect_tables on Aria checkpoint execution"
This happend when you have more than 1024 open Aria tables during checkpoint.


mysql-test/mysql-test-run.pl:
  Fixed that variable names are consistent between external and internal server.
mysql-test/suite/maria/suite.pm:
  Test for aria-block-size instead of 'aria' as 'aria' is not set for embedded server.
  This should be ok for aria tests, as aria is never disabled for these.
storage/maria/ma_checkpoint.c:
  Fixed bug when there are more than 1024 open Aria tables during checkpoint.
2012-02-20 14:03:44 +02:00
Georgi Kodinov
d4c35861e5 merge mysql-5.5->mysql-5.5-security 2012-02-18 10:58:31 +02:00
Georgi Kodinov
9078288a6a merge mysql-5.1->mysql-5.1-security 2012-02-18 10:58:19 +02:00
unknown
abd3c3a9e1 Merge with mysql-5.5 2012-02-17 08:28:28 -06:00
Sergei Golubchik
bbb3527635 Remove engine-specific (but identical) icp callbacks. create one reusable
common icp callback in the handler.cc.

It can also increment status counters, without making the engine
dependent on the exact THD layout (that is different in embedded).
2012-02-17 13:27:41 +01:00
Georgi Kodinov
9f18fc5a06 merged mysql-5.5->mysql-5.5-security 2012-02-17 11:55:36 +02:00
Marko Mäkelä
4ea57c80b2 Merge mysql-5.1 to mysql-5.5. 2012-02-17 11:52:51 +02:00
Georgi Kodinov
387721101c merge mysql-5.1->mysql-5.1-security 2012-02-17 11:52:41 +02:00
Marko Mäkelä
f77329ace9 Bug#13721257 RACE CONDITION IN UPDATES OR INSERTS OF WIDE RECORDS
This bug was originally filed and fixed as Bug#12612184. The original
fix was buggy, and it was patched by Bug#12704861. Also that patch was
buggy (potentially breaking crash recovery), and both fixes were
reverted.

This fix was not ported to the built-in InnoDB of MySQL 5.1, because
the function signatures of many core functions are different from
InnoDB Plugin and later versions. The block allocation routines and
their callers would have to changed so that they handle block
descriptors instead of page frames.

When a record is updated so that its size grows, non-updated columns
can be selected for external (off-page) storage. The bug is that the
initially inserted updated record contains an all-zero BLOB pointer to
the field that was not updated. Only after the BLOB pages have been
allocated and written, the valid pointer can be written to the record.

Between the release of the page latch in mtr_commit(mtr) after
btr_cur_pessimistic_update() and the re-latching of the page in
btr_pcur_restore_position(), other threads can see the invalid BLOB
pointer consisting of 20 zero bytes. Moreover, if the system crashes
at this point, the situation could persist after crash recovery, and
the contents of the non-updated column would be permanently lost.

The problem is amplified by the ROW_FORMAT=DYNAMIC and
ROW_FORMAT=COMPRESSED that were introduced in
innodb_file_format=barracuda in InnoDB Plugin, but the bug does exist
in all InnoDB versions.

The fix is as follows. After a pessimistic B-tree operation that needs
to write out off-page columns, allocate the pages for these columns in
the mini-transaction that performed the B-tree operation (btr_mtr),
but write the pages in a separate mini-transaction (blob_mtr). Do
mtr_commit(blob_mtr) before mtr_commit(btr_mtr). A quirk: Do not reuse
pages that were previously freed in btr_mtr. Only write the off-page
columns to 'fresh' pages.

In this way, crash recovery will see redo log entries for blob_mtr
before any redo log entry for btr_mtr. It will apply the BLOB page
writes to pages that were marked free at that point. If crash recovery
fails to see all of the btr_mtr redo log, there will be some
unreachable BLOB data in free pages, but the B-tree will be in a
consistent state.

btr_page_alloc_low(): Renamed from btr_page_alloc(). Add the parameter
init_mtr. Return an allocated block, or NULL. If init_mtr!=mtr but
the page was already X-latched in mtr, do not initialize the page.

btr_page_alloc(): Wrapper for btr_page_alloc_for_ibuf() and
btr_page_alloc_low().

btr_page_free(): Add a debug assertion that the page was a B-tree page.

btr_lift_page_up(): Return the father block.

btr_compress(), btr_cur_compress_if_useful(): Add the parameter ibool
adjust, for adjusting the cursor position.

btr_cur_pessimistic_update(): Preserve the cursor position when
big_rec will be written and the new flag BTR_KEEP_POS_FLAG is defined.
Remove a duplicate rec_get_offsets() call. Keep the X-latch on
index->lock when big_rec is needed.

btr_store_big_rec_extern_fields(): Replace update_inplace with
an operation code, and local_mtr with btr_mtr. When not doing a
fresh insert and btr_mtr has freed pages, put aside any pages that
were previously X-latched in btr_mtr, and free the pages after
writing out all data. The data must be written to 'fresh' pages,
because btr_mtr will be committed and written to the redo log after
the BLOB writes have been written to the redo log.

btr_blob_op_is_update(): Check if an operation passed to
btr_store_big_rec_extern_fields() is an update or insert-by-update.

fseg_alloc_free_page_low(), fsp_alloc_free_page(),
fseg_alloc_free_extent(), fseg_alloc_free_page_general(): Add the
parameter init_mtr. Return an allocated block, or NULL. If
init_mtr!=mtr but the page was already X-latched in mtr, do not
initialize the page.

xdes_get_descriptor_with_space_hdr(): Assert that the file space
header is being X-latched.

fsp_alloc_from_free_frag(): Refactored from fsp_alloc_free_page().

fsp_page_create(): New function, for allocating, X-latching and
potentially initializing a page. If init_mtr!=mtr but the page was
already X-latched in mtr, do not initialize the page.

fsp_free_page(): Add ut_ad(0) to the error outcomes.

fsp_free_page(), fseg_free_page_low(): Increment mtr->n_freed_pages.

fsp_alloc_seg_inode_page(), fseg_create_general(): Assert that the
page was not previously X-latched in the mini-transaction. A file
segment or inode page should never be allocated in the middle of an
mini-transaction that frees pages, such as btr_cur_pessimistic_delete().

fseg_alloc_free_page_low(): If the hinted page was allocated, skip the
check if the tablespace should be extended. Return NULL instead of
FIL_NULL on failure. Remove the flag frag_page_allocated. Instead,
return directly, because the page would already have been initialized.

fseg_find_free_frag_page_slot() would return ULINT_UNDEFINED on error,
not FIL_NULL. Correct a bogus assertion.

fseg_alloc_free_page(): Redefine as a wrapper macro around
fseg_alloc_free_page_general().

buf_block_buf_fix_inc(): Move the definition from the buf0buf.ic to
buf0buf.h, so that it can be called from other modules.

mtr_t: Add n_freed_pages (number of pages that have been freed).

page_rec_get_nth_const(), page_rec_get_nth(): The inverse function of
page_rec_get_n_recs_before(), get the nth record of the record
list. This is faster than iterating the linked list. Refactored from
page_get_middle_rec().

trx_undo_rec_copy(): Add a debug assertion for the length.

trx_undo_add_page(): Return a block descriptor or NULL instead of a
page number or FIL_NULL.

trx_undo_report_row_operation(): Add debug assertions.

trx_sys_create_doublewrite_buf(): Assert that each page was not
previously X-latched.

page_cur_insert_rec_zip_reorg(): Make use of page_rec_get_nth().

row_ins_clust_index_entry_by_modify(): Pass BTR_KEEP_POS_FLAG, so that
the repositioning of the cursor can be avoided.

row_ins_index_entry_low(): Add DEBUG_SYNC points before and after
writing off-page columns. If inserting by updating a delete-marked
record, do not reposition the cursor or commit the mini-transaction
before writing the off-page columns.

row_build(): Tighten a debug assertion about null BLOB pointers.

row_upd_clust_rec(): Add DEBUG_SYNC points before and after writing
off-page columns. Do not reposition the cursor or commit the
mini-transaction before writing the off-page columns.

rb:939 approved by Jimmy Yang
2012-02-17 11:42:04 +02:00
Marko Mäkelä
2837fba743 Put back a fix that was reverted when reverting the buggy Bug#12612184 fix in
revision-id inaam.rana@oracle.com-20110930110219-vnpaqghj9hm0grds
(revno 3559).
2012-02-17 09:18:53 +02:00
unknown
971fe347dd Bug#64160, Oracle Bug#13698765
The problem was introduced in 5.5.20 by Bug 13116225.  It tried to
protect against downgrading from a version 5.6.4 database that was
created with a page size other than 16k.  Version 5.6.4 supports
page sizes 4k and 8k and stamps that page size into the header page
of each tablespace file.  Version 5.5.20 attempts to read that page
size in the file header.

But it turns out that only the first system tablespace file has a
reliable flags field in the header. So only ibdata1 can be or needs
to be tested for another page size. Extra system tablespace files
like ibdata2, ibdata3, etc do not and should not be tested since the
flags field is unreliable.
2012-02-16 12:13:08 -06:00
Marko Mäkelä
e63d0c916b Fix link error on Windows.
error LNK2001: unresolved external symbol _debug_sync_C_callback_ptr
2012-02-16 15:54:16 +02:00
Kent Boortz
3269f45489 Merge 2012-02-16 12:04:44 +01:00
Kent Boortz
2f755bdf66 Merge 2012-02-16 12:02:53 +01:00
Marko Mäkelä
6ff320e0f6 Merge mysql-5.1 to mysql-5.5. 2012-02-16 12:28:49 +02:00
Marko Mäkelä
4045c9976c Add instrumentation for Bug#13721257 RACE CONDITION IN UPDATES OR INSERTS
OF WIDE RECORDS

row_ins_index_entry_low(), row_upd_clust_rec(): Make a redo log
checkpoint if a DEBUG flag is set. Add DEBUG_SYNC around
btr_store_big_rec_extern_fields().

rb:946 approved by Jimmy Yang
2012-02-16 12:24:11 +02:00
Marko Mäkelä
66b6587206 Correct a few copyright messages. 2012-02-16 12:20:41 +02:00
MySQL Build Team
7a35cb9150 Updated/added copyright headers 2012-02-16 10:48:16 +01:00
unknown
607aab9c1d Counters for Index Condition Pushdown added (MDEV-130). 2012-02-16 08:49:10 +02:00
Kent Boortz
6a003dd8ef Updated/added copyright headers 2012-02-15 17:21:38 +01:00
Sunny Bains
b566d9a512 BUG#12739098 - 62401: ASSERTION TRX->ERROR_STATE == DB_SUCCESS, QUE0QUE.C LINE 1264 ON TRUNCATE
During FIC error handling the trx->error_state was not being set to DB_SUCCESS
after failure, before attempting the next DDL SQL operation. This reset to
DB_SUCCESS is somewhat of a requirement though not explicitly stated anywhere.
The fix is to reset it to DB_SUCCESS in row0merge.cc if row_merge_rename_indexes
or row_merge_drop_index functions fail, also reset to DB_SUCCESS at trx commit.
				          
rb://935 Approved by Jimmy Yang.
2012-02-10 14:09:12 +11:00
Sunny Bains
ec47cb6034 Merge from mysql-5.1-innodb. 2012-02-10 13:04:10 +11:00
Sunny Bains
297002573c BUG#12739098 - 62401: ASSERTION TRX->ERROR_STATE == DB_SUCCESS, QUE0QUE.C LINE 1264 ON TRUNCATE
During FIC error handling the trx->error_state was not being set to DB_SUCCESS
after failure, before attempting the next DDL SQL operation. This reset to
DB_SUCCESS is somewhat of a requirement though not explicitly stated anywhere.
The fix is to reset it to DB_SUCCESS in row0merge.cc if row_merge_rename_indexes
or row_merge_drop_index functions fail, also reset to DB_SUCCESS at trx commit.

rb://935 Approved by Jimmy Yang.
2012-02-10 12:47:42 +11:00
Sergei Golubchik
2682a280c8 allow suite.pm to skip combinations that originate from test/include files.
storage/innobase/handler/handler0alter.cc:
  for NEWDATE key_type says unsigned, thus col->prtype says unsigned,
  but field->flags says signed. Use the same flag for value retrieval
  that was used for value storage.
2012-02-07 16:22:36 +01:00
Georgi Kodinov
91c1c93019 merge mysql-5.5->mysql-5.5-security 2012-02-06 18:26:36 +02:00
Georgi Kodinov
d29ae4918e merged mysql-5.1->mysql-5.1-security 2012-02-06 18:24:51 +02:00
Vladislav Vaintroub
62dcaf8c29 merge 5.5 2012-02-27 19:32:44 +01:00
Sergei Golubchik
3f28115e0e 5.3 merge 2012-02-24 14:37:00 +01:00
Sergei Golubchik
edab37cd68 5.3 merge 2012-02-21 20:51:56 +01:00
Sergei Golubchik
5bf311e1e8 fix the include guards and add missing gplv2 headers 2012-02-17 12:19:38 +01:00
Vladislav Vaintroub
3fde590805 Only synchronous disk reads should use thd_wait_begin with THD_WAIT_DISKIO 2012-02-16 18:12:40 +01:00
Sergei Golubchik
0d0e68da6a merge 2012-02-15 19:11:16 +01:00
Sergei Golubchik
25609313ff 5.3.4 merge 2012-02-15 18:08:08 +01:00
unknown
13113c9e1a Fix wrong type causing build failure on windows. 2012-02-15 17:09:56 +01:00
unknown
db4b6aa3ae Fix wrong type causing build failure on windows. 2012-02-15 16:38:38 +01:00
unknown
4917073305 Merge XtraDB from Percona-Server-5.5.20-24.1 into MariaDB 5.5. 2012-02-15 15:37:38 +01:00
unknown
47a54a2e08 Merge MySQL 5.5.20 into MariaDB 5.5. 2012-02-14 16:06:41 +01:00
Vasil Dimov
56e3f68c72 Merge mysql-5.1 -> mysql-5.5
The actual Bug#11754376 does not exist in MySQL 5.5 because at startup
we drop entries for temporary tables from InnoDB dictionary cache (only
if ROW_FORMAT is not REDUNDANT). But nevertheless the bug in
normalize_table_name_low() is present so we fix it.
2012-02-06 13:00:41 +02:00
Vasil Dimov
1c4fd3bb54 Fix Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON
GRACEFUL SHUTDOWN

During startup mysql picks up .frm files from the tmpdir directory and
tries to drop those tables in the storage engine.

The problem is that when tmpdir ends in / then ha_innobase::delete_table()
is passed a string like "/var/tmp//#sql123", then it wrongly normalizes it
to "/#sql123" and calls row_drop_table_for_mysql() which of course fails
to delete the table entry from the InnoDB dictionary cache.
ha_innobase::delete_table() returns an error but nevertheless mysql wipes
away the .frm file and the entry in the InnoDB dictionary cache remains
orphaned with no easy way to remove it.

The "no easy" way to remove it is to create a similar temporary table again,
copy its .frm file to tmpdir under "#sql123.frm" and restart mysqld with
tmpdir=/var/tmp (no trailing slash) - this way mysql will pick the .frm file
after restart and will try to issue drop table for "/var/tmp/#sql123"
(notice do double slash), ha_innobase::delete_table() will normalize it to
"tmp/#sql123" and row_drop_table_for_mysql() will successfully remove the
table entry from the dictionary cache.

The solution is to fix normalize_table_name_low() to normalize things like
"/var/tmp//table" correctly to "tmp/table".

This patch also adds a test function which invokes
normalize_table_name_low() with various inputs to make sure it works
correctly and a mtr test that calls this test function.

Reviewed by:	Marko (http://bur03.no.oracle.com/rb/r/929/)
2012-02-06 12:44:59 +02:00
Ashish Agarwal
b259646460 BUG#11748748: Merge from mysql-5.1 to mysql-5.5 2012-02-03 19:41:03 +05:30
Ashish Agarwal
cfcb5daba8 BUG#11748748 - 37280: CHECK AND REPAIR TABLE REPORT TABLE
CORRUPTED WHEN RUN CONCURRENTLY WITH

ISSUE: Table corruption due to concurrent queries.
       Different threads running check, repair query
       along with insert. Locks not properly acquired
       in repair query. Rows are inserted inbetween
       repair query.

SOLUTION: Mutex lock is acquired before the
          repair call. Concurrent queries wont
          effect the call to repair.
2012-02-03 19:37:00 +05:30
Vladislav Vaintroub
24e7faa54f Various fixes for Solaris compiler.
Also, restrict symbol visibility in statically
built plugins, to minimize the chance for symbol 
name clashes with dynamic plugins.
2012-02-03 11:46:40 +01:00
Igor Babaev
046988661d Back-ported the fix for bug #12831587 from mysql-5.6 code line.
The comment for the fix commit says:
Due to the changes required by ICP we first copy a row from the InnoDB
format to the MySQL row buffer and then copy it to the pre-fetch queue.
This was done for the non-ICP code path too. This change removes the
double copy for the latter.
2012-02-03 00:46:34 -08:00
Igor Babaev
94c316069e Applied the patch from mysql-5.6 code line that fixed
a significant performance drop for high concurrency bechmarks
(bug #11765850 - 58854).

Here's the comment of the patch commit:

The bug is that the InnoDB pre-fetch cache was not being used in
row_search_for_mysql().  Secondly the changeset that planted the
bug also introduced some inefficient code. It would read an extra
row, convert it to MySQL row format (for ICP==off), copy the row
to the pre-fetch cache row buffer, then check for cache overflow
and dequeue the row that was pushed if there was a possibility of
a cache overflow.
2012-02-02 22:22:27 -08:00
Vladislav Vaintroub
d8751d283c MDEV-100 : innodb_plugin tests fail on Solaris.
The reason for the failure is that the loaded library has the same exported symbols
as the builtin one. So the plugin uses innodb functions e.g srv_boot from mysqld
rather than plugin's own. This causes the crash.

On Unix systems with gcc4 later this error was so far worked around using GCC's
visibility attribute. However, in our case, we're using gcc3.

See related MySQL bug http://bugs.mysql.com/bug.php?id=48524 and
http://bugs.mysql.com/bug.php?id=52263

The fix is to restrict symbol visibility in the plugin using version script 
(called map file on Solaris).
2012-02-02 21:12:49 +01:00
Ashish Agarwal
f0955f9ec7 BUG#11754145 - 45702: IMPOSSIBE TO SPECIFY MYISAM_SORT_BUFFER > 4GB
ON 64 BIT MACHINES

PROBLEM: When sorting index during repair of
         myisam tables, due to improper casting
         of buffer size variables value of myisam_
         sort_buffer_size is not set greater than
         4GB.

SOLUTION: Proper casting of buffer size variable.
          myisam_buffer_size changed to unsigned
          long long to handle size > 4GB on
          linux as well as windows.
2012-02-02 18:17:14 +05:30
Marko Mäkelä
1fbbacfea5 ha_innobase::records_in_range(): Remove a debug assertion
that prohibits an open range (full table).
This assertion catches unnecessary calls to this method, but such calls
are not harming correctness.
2012-02-02 13:54:27 +02:00
Marko Mäkelä
567a422cf9 Merge mysql-5.1 to mysql-5.5. 2012-02-02 13:50:54 +02:00
Marko Mäkelä
e726580b66 Bug#13654923 BOGUS DEBUG ASSERTION IN INDEX CREATION FOR ZERO-LENGTH RECORD
row_merge_buf_write(): Relax the bogus assertion.
2012-02-02 13:38:32 +02:00
Marko Mäkelä
39100cd984 Bug #13651627 Move ut_ad(0) from the beginning to the end of buf_page_print(),
print page dump

buf_page_print(): Remove the ut_ad(0) from the beginning. Add two flags
(enum buf_page_print_flags) that can be bitwise-ORed together:

BUF_PAGE_PRINT_NO_CRASH:
  Do not crash debug builds at the end of buf_page_print().
BUF_PAGE_PRINT_NO_FULL:
  Do not print the full page dump. This can be useful when adding
  diagnostic printout to flushing or to the doublewrite buffer.

trx_sys_doublewrite_init_or_restore_page(): Replace exit(1) with ut_error,
so that we can get a core dump if this extraordinary condition happens.

rb:924 approved by Sunny Bains
2012-02-02 12:31:57 +02:00
Ashish Agarwal
a076427ffd BUG#11756869: Merge from mysql-5.1 to mysql-5.5 2012-02-02 14:25:43 +05:30
Ashish Agarwal
4e096d2a45 BUG#11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
CASES RESETS DATA POINTER TO SMAL

ISSUE: Myisamchk doing sort recover
       on a table reduces data_file_length.
       Maximum size of data file decreases,
       lesser number of rows are stored.

SOLUTION: Size of data_file_length is
          fixed to the original length.
2012-02-02 14:19:38 +05:30
Igor Babaev
7b79d8a33f Merge 5.2->5.3 in preparation for the release of mariadb-5.3.4-rc. 2012-02-01 15:48:02 -08:00
Ashish Agarwal
52357198d0 BUG#11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
CASES RESETS DATA POINTER TO SMAL

ISSUE: Myisamchk doing sort recover
       on a table reduces data_file_length.
       Maximum size of data file decreases,
       lesser number of rows are stored.

SOLUTION: Size of data_file_length is
          fixed to the original length.
2012-02-01 11:19:53 +05:30
Inaam Rana
43108b2c2b bug#13636122: mysql-5.1 => mysql-5.5 2012-01-31 09:50:17 -05:00
Inaam Rana
63769afc52 Bug#13636122 THE ORIGINAL TABLE MISSING WHILE EXECUTE THE DDL 'ALTER TABLE ADD COLUMN
rb://914
approved by: Marko Makela

Poll in fil_rename_tablespace() after setting ::stop_ios flag can
result in a hang because the other thread actually dispatching the IO
won't wake IO helper threads or flush the tablespace before starting
wait in fil_mutex_enter_and_prepare_for_io().
2012-01-31 09:31:31 -05:00
unknown
2abc4c4896 remove building pbxt by default in any configuration (need explicit ./configure --with-pbxt-storage-engine ) 2012-01-30 17:12:22 +02:00
Inaam Rana
40bab62acf Bug#11836233 MISLEADING SUGGESTION REGARDING LINUX NATIVE AIO IN INNODB
ERROR LOG

Fixed error meesage
2012-01-30 09:24:09 -05:00
unknown
b0a17a2fb3 Fixed tests consumed big amount of disk space to be "BIG". 2012-01-27 10:58:59 +02:00
Yasufumi Kinoshita
636a7f79e8 Fix for build break introduced at rev 3711
asked by Calvin
2012-01-27 13:07:24 +09:00
Vladislav Vaintroub
1c461d91f7 fix embedded build 2012-01-26 20:07:25 +01:00
Vladislav Vaintroub
66a64adb3e Xtradb recently started to access thd members directly ,e.g thd->stmt_da (ha_innodb.cc)
It needs recompilation for embedded server, as layout of THD is different in embedded.
2012-01-26 16:06:08 +01:00
Jorgen Loland
705a65e901 BUG 13413535 followup: Fix gcc warning
storage/innobase/ibuf/ibuf0ibuf.c:
  Cast to avoid gcc warning
2012-01-26 13:30:11 +01:00
Marko Mäkelä
d84c95579b Bug #13413535 61104: INNODB: FAILING ASSERTION: PAGE_GET_N_RECS(PAGE) > 1
This fix does not remove the underlying cause of the assertion
failure. It just works around the problem, allowing a corrupted
secondary index to be fixed by DROP INDEX and CREATE INDEX (or in the
worst case, by re-creating the table).

ibuf_delete(): If the record to be purged is the last one in the page
or it is not delete-marked, refuse to purge it. Instead, write an
error message to the error log and let a debug assertion fail.

ibuf_set_del_mark(): If the record to be delete-marked is not found,
display some more information in the error log and let a debug
assertion fail.

row_undo_mod_del_unmark_sec_and_undo_update(),
row_upd_sec_index_entry(): Let a debug assertion fail when the record
to be delete-marked is not found.

buf_page_print(): Add ut_ad(0) so that corruption will be more
prominent in stress testing with debug binaries. Add ut_ad(0) here and
there where corruption is noticed.

btr_corruption_report(): Display some data on page_is_comp() mismatch.

btr_assert_not_corrupted(): A wrapper around btr_corruption_report().
Assert that page_is_comp() agrees with the table flags.

rb:911 approved by Inaam Rana
2012-01-26 13:24:00 +02:00
Vladislav Vaintroub
7ffa6f4d06 Always define UT_DBG_ABORT in innodb/xtradb, also on Windows. This will avoid endless hangs inside ut_dgb_stop_thread 2012-01-25 21:23:14 +01:00
Marko Mäkelä
82fec153b7 Merge mysql-5.1 to mysql-5.5. 2012-01-25 10:18:14 +02:00
Marko Mäkelä
a5d2554db0 btr_cur_search_to_nth_level(): Add a debug assertion
and some Valgrind instrumentation.
2012-01-25 10:15:27 +02:00
Igor Babaev
507e1927e1 Merge. 2012-01-24 21:12:02 -08:00
Michael Widenius
59f5c05a38 Don't crash with: UPDATE performance_schema.setup_instruments SET ENABLED="NO";
Don't log updates to performance schema in replication log.
Ensure that we don't call ha_update after ha_index_or_rnd_end() is called on slave.


.bzrignore:
  Ignore some generated files
mysql-test/include/show_slave_status.inc:
  Ensure that ./ is removed from file names
mysql-test/suite/perfschema/r/binlog_mix.result:
  Updated results
mysql-test/suite/perfschema/r/binlog_row.result:
  Updated results
mysql-test/suite/perfschema/r/binlog_stmt.result:
  Updated results
mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result:
  Updated results
mysql-test/suite/rpl/r/rpl_performance_schema.result:
  Ensure that we don't crash slave when we update performance schema
mysql-test/suite/rpl/t/rpl_performance_schema.test:
  Ensure that we don't crash slave when we update performance schema
sql/log_event.cc:
  Ensure that we don't call ha_update after ha_index_or_rnd_end() is called.
  Remove old code that is not needed anymore (like restarting read loop over all rows if no matcing row is found)
  Simplify code
sql/log_event_old.cc:
  Ensure that we don't call ha_update after ha_index_or_rnd_end() is called.
storage/myisam/ha_myisam.cc:
  More DBUG_PRINT
storage/perfschema/ha_perfschema.h:
  Don't log updates to performance schema in replication log.
2012-01-24 18:07:35 +02:00
Vladislav Vaintroub
19d13a3b17 portability fixes for FreeBSD 8 and 9 2012-01-23 17:12:25 +01:00
Inaam Rana
9cb16ec55b Bug#13612811 VALGRIND ERROR IN OS_AIO_INIT
Fix valgrind warning introduced by fix for bug 11765450.
2012-01-20 10:47:01 -05:00
Vladislav Vaintroub
607c9a6c68 Fix innodb_bug60229 (get the innodb change into xtradb) 2012-01-19 17:31:07 +01:00
Inaam Rana
efddb7acb9 Bug#11765450 58421: INNODB TEMPORARY TABLE CRASH WHEN TMPDIR ON LINUX TMPFS
rb://898
approved by: Marko Makela

On some kernel versions native aio operations are not supported on
tmpfs. Check this during start up and fall back to simulated aio.
2012-01-19 09:10:30 -05:00
Vladislav Vaintroub
0e975ded65 Fix compiler warning on Windows. 2012-01-19 13:46:59 +01:00
Sergei Golubchik
baca1a40e9 enable test cases for bugs fixed in xtradb.
disable test cases for bugs not fixed in xtradb.

mysql-test/suite/innodb/t/innodb-lock.test:
  instead of disabling the test in disabled.def
  (hoping that somebody someday will enable it),
  skip it only for xtradb (not for innodb), and
  only for the current xtradb version. the test
  will enable itself automatically on the next
  xtradb merge
mysql-test/suite/innodb/t/innodb_cmp_drop_table.test:
  instead of disabling the test in disabled.def
  (hoping that somebody someday will enable it),
  skip it only for xtradb (not for innodb), and
  only for the current xtradb version. the test
  will enable itself automatically on the next
  xtradb merge
mysql-test/suite/innodb/t/innodb_corrupt_bit.test:
  fix the error number
storage/innobase/handler/ha_innodb.cc:
  fix the error number
storage/xtradb/handler/ha_innodb.cc:
  fix the error number
2012-01-16 21:02:43 +01:00
Sergei Golubchik
38e3ae155d mysql-5.5 merge 2012-01-16 20:16:35 +01:00
Marko Mäkelä
ae3962d142 Merge mysql-5.1 to mysql-5.5. 2012-01-16 14:26:42 +02:00
Marko Mäkelä
97e83eae2d Bug#13496818 ASSERTION: REC_PAGE_NO > 4 IN IBUF CONTRACTION
Relax a bogus debug assertion.
Approved by Jimmy Yang on IM.
2012-01-16 14:22:03 +02:00
Marko Mäkelä
b9692a96be Merge mysql-5.1 to mysql-5.5. 2012-01-16 09:58:02 +02:00
Marko Mäkelä
a0ba966db7 buf_page_get_known_nowait(): Relax a bogus debug assertion.
When mode==BUF_KEEP_OLD, buffered inserts are being merged to the page.
It is possible that a read request for a page was pending while the page
was freed in DROP INDEX or DROP TABLE. In these cases, it is OK (although
useless) to merge the buffered changes to the freed page.
2012-01-16 09:55:12 +02:00
Annamalai Gurusami
d9aeddf76a Merging from mysql-5.1 to mysql-5.5. 2012-01-16 10:30:51 +05:30
Annamalai Gurusami
020f3914a2 Bug #11765438 58406:
ISSUES WITH COPYING PARTITIONED INNODB TABLES FROM LINUX TO WINDOWS

This problem was already fixed in mysql-trunk as part of bug #11755924.  I am 
backporting the fix to mysql-5.1.
2012-01-16 09:58:31 +05:30
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Georgi Kodinov
b8cbc736d0 weave merge mysql-5.5->mysql-5.5-security 2012-01-12 16:44:37 +02:00
Georgi Kodinov
8aa1e57941 weave merge mysql-5.1->mysql-5.1-security 2012-01-12 16:42:23 +02:00
Karen Langford
4b0d98b28c Merge from mysql-5.1.61-release 2012-01-11 18:51:42 +01:00
unknown
5e3a454755 Merge from mysql-5.5.20-release 2012-01-11 18:50:47 +01:00
Yasufumi Kinoshita
ad6a4986eb Bug#12400341 INNODB CAN LEAVE ORPHAN IBD FILES AROUND
If we meet DB_TOO_MANY_CONCURRENT_TRXS during the execution tab_create_graph from row_create_table_for_mysql(), .ibd file for the table should be created already but was not deleted for the error handling.

rb:875 approved by Jimmy Yang
2012-01-10 14:23:20 +09:00
Yasufumi Kinoshita
115f5e8551 Bug#12400341 INNODB CAN LEAVE ORPHAN IBD FILES AROUND
If we meet DB_TOO_MANY_CONCURRENT_TRXS during the execution tab_create_graph from row_create_table_for_mysql(), .ibd file for the table should be created already but was not deleted for the error handling.

rb:875 approved by Jimmy Yang
2012-01-10 14:18:58 +09:00
Vladislav Vaintroub
cf86abffbf MDEV-77 - possible deadlock in XtraDB async io subsystem on Windows.
Split IO threads into ones that handle only read completion and ones that handle only write completion, as it was originally done, but got lost with "completion port" patch. The reason we need to have dedicated read and dedicated write threads is that read completion routine can block waiting for write io to complete, and in rare cases where all io threads are handling async reads, it can deadlock.
2012-01-08 21:14:07 +01:00
Vladislav Vaintroub
239f813cea Fix compile error 2012-01-03 00:17:36 +01:00
Sergey Petrunya
591fdbe188 Fix compile warnings 2012-01-02 21:56:16 +01:00
Igor Babaev
e5b0f4bb6c Fixed compiler warnings. 2012-01-01 21:41:57 -08:00
Igor Babaev
d1fa433212 Fixed calculation of rec_per_key elements for added components of the extended keys.
Slightly corrected the implementation of the function ha_innobase::read_time().
Changed the implementation of handler::keyread_time to make the cost of single key
index only look-ups dependent on the key entry length.
Corrected the index of the last possible components of an extended key in the
function best_access_path().
2012-01-01 20:47:36 -08:00
Igor Babaev
ec2828e4f7 Merged MWL#247 into the latest 5.3. 2011-12-31 03:36:20 -08:00
Igor Babaev
b6b5f9fabe Implementation of the MWL#247: Make the optimizer use extended keys.
The main patch.
.
2011-12-31 02:25:57 -08:00
Vladislav Vaintroub
33a60e7fb6 Fix oqgraph so it can be built on Window as well.
Note: to build with -fno-rtti as we currently build the server, boost version  1.45 or later is required.
(without -fno-rtti, 1.40 is enough)
2011-12-30 11:21:39 +01:00
Sergei Golubchik
1417606b1f on windows: don't link all plugins with mysqld, only do it for storage engines. 2011-12-29 22:52:13 +01:00
Vasil Dimov
cb80ad09da Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Port vasil.dimov@oracle.com-20111205083046-jtgi1emlvtfnjatt from mysql-trunk
2011-12-29 16:19:33 +02:00
Vasil Dimov
a4fa485f5f Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Port vasil.dimov@oracle.com-20111205082900-lx9om1joscejr25e from mysql-trunk
2011-12-29 16:14:45 +02:00
Vasil Dimov
93ab1d547d Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Port vasil.dimov@oracle.com-20111205082831-7v1qu50hvd9hjr3g from mysql-trunk
2011-12-29 16:12:55 +02:00
Vasil Dimov
b7b9a4e810 Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Port vasil.dimov@oracle.com-20111205082756-wtlg8isyn4yohyny from mysql-trunk
2011-12-29 16:11:07 +02:00
Vasil Dimov
841e8ddbc5 Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Port vasil.dimov@oracle.com-20111205082626-87j5f48dq1ouk86r from mysql-trunk
2011-12-29 16:05:08 +02:00
Vladislav Vaintroub
aa5623ce33 Fix oqgraph build . Plugin does not need rtti, and does not load if rtti compile settings are different from server's 2011-12-28 22:47:27 +01:00
Marko Mäkelä
1b6cb0128a Merge mysql-5.1 to mysql-5.5. 2011-12-28 12:31:18 +02:00
Marko Mäkelä
e498a1bf65 Bug#13418934 REMOVE HAVE_PURIFY DEPENDENCES FROM INNODB
InnoDB: Remove HAVE_purify, UNIV_INIT_MEM_TO_ZERO, UNIV_SET_MEM_TO_ZERO.

The compile-time setting HAVE_purify can mask potential bugs.
It is being set in PB2 Valgrind runs. We should simply get rid of it,
and replace it with UNIV_MEM_INVALID() to declare uninitialized memory
as such in Valgrind-instrumented binaries.

os_mem_alloc_large(), ut_malloc_low(): Remove the parameter set_to_zero.

ut_malloc(): Define as a macro that invokes ut_malloc_low().

buf_pool_init(): Never initialize the buffer pool frames. All pages
must be initialized before flushing them to disk.

mem_heap_alloc(): Never initialize the allocated memory block.

os_mem_alloc_nocache(), ut_test_malloc(): Unused function, remove.

rb:813 approved by Jimmy Yang
2011-12-28 12:19:30 +02:00
Ramil Kalimullin
a338023323 Auto-merge from mysql-5.1. 2011-12-23 18:56:29 +04:00
Ramil Kalimullin
289af2579b Fix for bug#11758931 - 51196: SLAVE SQL: GOT AN ERROR WRITING
COMMUNICATION PACKETS, ERROR_CODE: 1160

Addendum: for some queries table->in_use might be NULL -
check it.
2011-12-23 18:52:44 +04:00
Ramil Kalimullin
d0ed9f437c Auto-merge from mysq-5.1. 2011-12-23 17:26:17 +04:00
Ramil Kalimullin
790a3a46f3 Fix for bug#11758931 - 51196: SLAVE SQL: GOT AN ERROR WRITING
COMMUNICATION PACKETS, ERROR_CODE: 1160

If idle FEDERATED table is evicted from the table cache when 
a connection to remote server is lost, query that initiated 
eviction may fail.
If this query is executed by slave SQL thread it may fail as well.

An error of close was stored in diagnostics area, which was later
attributed to the statement that caused eviction.

With this patch FEDERATED clears an error of close.
2011-12-23 17:22:48 +04:00
Vladislav Vaintroub
0e8f71b2bc LPBUG#906638 : Fixes to build oqgraph with boost 1.48
- dijkstra_shortest_paths() needs a Graph as first parameter, in case of reverse_graph we now need to use
  its m_g member
- use boost::tuples::tie() on all places where tie() was used . Reason -
  fix the build with Visual Studio 10 SP1 (which includes std:tr1:tie, thus creating  ambiguity)
2011-12-22 15:50:33 +01:00
Vasil Dimov
dfc75197f9 Merge mysql-5.1-security -> mysql-5.5-security 2011-12-22 13:05:33 +02:00
Vasil Dimov
86505c3c54 Fix Bug#13510739 63775: SERVER CRASH ON HANDLER READ NEXT AFTER DELETE RECORD.
CREATE TABLE bug13510739 (c INTEGER NOT NULL, PRIMARY KEY (c)) ENGINE=INNODB;
INSERT INTO bug13510739 VALUES (1), (2), (3), (4);
DELETE FROM bug13510739 WHERE c=2;
HANDLER bug13510739 OPEN;
HANDLER bug13510739 READ `primary` = (2);
HANDLER bug13510739 READ `primary` NEXT;  <-- crash

The bug is that in the particular testcase row_search_for_mysql() picked up
a delete-marked record and quit, leaving the cursor non-positioned state and
on the subsequent 'get next' call the code crashed because of the
non-positioned cursor.

In row0sel.cc (line numbers from mysql-trunk):

4653         if (rec_get_deleted_flag(rec, comp)) {
...
4679                 if (index == clust_index && unique_search) {
4680 
4681                         err = DB_RECORD_NOT_FOUND;
4682                         
4683                         goto normal_return;
4684                 }       

it quit from here, not storing the cursor position.

In contrast, if the record=2 is not found at all (e.g. sleep(1) after DELETE
to let the purge wipe it away completely) then 'get = 2' does find record=3
and quits from here:

4366                 if (0 != cmp_dtuple_rec(search_tuple, rec, offsets)) {
...
4394                         btr_pcur_store_position(pcur, &mtr);
4395 
4396                         err = DB_RECORD_NOT_FOUND;
4397 #if 0
4398                         ut_print_name(stderr, trx, FALSE, index->name);
4399                         fputs(" record not found 3\n", stderr);
4400 #endif
4401 
4402                         goto normal_return;

Another fix could be to extend the condition on line 4366 to hold only if
seach_tuple matches rec AND if rec is not delete marked.

Notice that in the above test case if we wait about 1 second somewhere after
DELETE and before 'get = 2', then the testcase does not crash and returns 4
instead. Not sure if this is the correct behavior, but this bugfix removes
the crash and makes the code return what it also returns in the non-crashing
case (if rec=2 is not found during 'get = 2', e.g. we have sleep(1) there).

Approved by:	Marko (http://bur03.no.oracle.com/rb/r/863/)
2011-12-22 12:55:44 +02:00
Sergei Golubchik
a5e92c7e6d compilation warning - unused variable 2011-12-22 11:07:04 +01:00
Inaam Rana
c225712f41 merge from mysql-5.1 2011-12-21 21:40:35 -05:00
Inaam Rana
564d4a65bd Add ChangeLog message. 2011-12-21 21:36:52 -05:00
Inaam Rana
3953b48971 Bug#11866367 FPE WHEN SETTING INNODB_SPIN_WAIT_DELAY
rb://865
approved by: Jimmy

Integer overflow causes division by zero.
2011-12-21 21:33:13 -05:00
Vladislav Vaintroub
c03deada6c fix 64 bit Windows build 2011-12-21 02:44:50 +01:00
unknown
61e0b38f7f Restore some fixes for slow xtradb shutdown that were lost in the 5.5 merge. 2011-12-16 14:13:27 +01:00
Sergei Golubchik
1efdd5a572 rename debug variable to debug_dbug, to make test pass in release builds
(and to follow the naming conventons).
keep old debug variable, but mark it as deprecated.
2011-12-15 22:07:58 +01:00
unknown
505a601821 Fix XtraDB build on windows (avoid #ifdef inside macro invocation). 2011-12-15 16:00:07 +01:00
Sergey Petrunya
876f16afbb Fix unused variable 'thd' error. 2011-12-15 17:26:32 +04:00
Georgi Kodinov
d7bc26c464 merge mysql-5.5->mysql-5.5-security 2011-12-15 14:13:46 +02:00
Georgi Kodinov
65fbeccd23 merge mysql-5.1->mysql-5.1-security 2011-12-15 14:10:20 +02:00
unknown
a6c7c53b63 Merge XtraDB from Percona-server-5.5.17-rel22.1 into MariaDB 5.5 2011-12-15 10:34:14 +01:00
Michael Widenius
511fd82b26 Merge with 5.2 2011-12-14 20:36:51 +02:00
Mattias Jonsson
7e63c8ac0d merged bug#12361113.
Also added tests for partitions key caches.
2011-12-14 15:33:01 +01:00
Mattias Jonsson
52076824c9 merge 2011-12-14 14:41:40 +01:00
Michael Widenius
1a985a17c0 Merge with 5.1
Updated version number in configure
2011-12-13 20:08:41 +02:00
Michael Widenius
33c26f7842 Fixed bug: lp:887051 ; Error in recovery with LOAD DATA + DELETE
mysql-test/suite/maria/r/maria-recovery3.result:
  Added test case for recovery bug
mysql-test/suite/maria/t/maria-recovery3.test:
  Added test case for recovery bug
storage/maria/ha_maria.cc:
  Don't print query twice to log
storage/maria/ma_delete.c:
  More DBUG_PRINT
storage/maria/ma_key_recover.c:
  Added new asserts to detect errors earlier
storage/maria/ma_recovery.c:
  Update all states when moving a non-transactional file to transactional. This fixes lp:887051
2011-12-13 19:57:19 +02:00
Annamalai Gurusami
76383243b2 Merging from mysql-5.1 to mysql-5.5. 2011-12-13 17:10:09 +05:30
Annamalai Gurusami
ad84fb5c37 Bug #13117023: Innodb increments handler_read_key when it should not
The counter handler_read_key (SSV::ha_read_key_count) is incremented 
incorrectly.

The mysql server maintains a per thread system_status_var (SSV)
object.  This object contains among other things the counter
SSV::ha_read_key_count. The purpose of this counter is to measure the
number of requests to read a row based on a key (or the number of
index lookups).

This counter was wrongly incremented in the
ha_innobase::innobase_get_index(). The fix removes
this increment statement (for both innodb and innodb_plugin).

The various callers of the innobase_get_index() was checked to
determine if anybody must increment this counter (if they first call
innobase_get_index() and then perform an index lookup).  It was found
that no caller of innobase_get_index() needs to worry about the
SSV::ha_read_key_count counter.
2011-12-13 14:26:12 +05:30
Sergei Golubchik
6cc9d0ffa0 move safemalloc out of dbug.
remeber a real backtrace for every allocation.
make safemalloc to tract C++ new/delete too.
collateral fixes to make the test suite pass.
2011-12-12 22:58:24 +01:00
unknown
6ad3179d6d Fix GCC build failure in PBXT in some cases/platforms. 2011-12-12 13:37:18 +01:00
Sergei Golubchik
745c53ec06 5.2->5.3 merge 2011-12-12 13:00:33 +01:00
Marko Mäkelä
091a2e3b0b Merge mysql-5.1 to mysql-5.5. 2011-12-12 13:53:18 +02:00
Marko Mäkelä
3d58fd6900 Bug#13418887 ERROR IN DIAGNOSTIC FUNCTION PAGE_REC_PRINT()
When printing information about a ROW_FORMAT=REDUNDANT record, pass
the correct flag to rec_get_next_offs().

rb:821 approved by Jimmy Yang
2011-12-12 13:48:24 +02:00
Georgi Kodinov
dfc9bbff2a merge 5.1->5.1-security. 2011-12-12 12:25:35 +01:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
unknown
7532976dd9 Bug #13116225 LIVE DOWNGRADE CRASHES WITH INNODB_PAGE_SIZE=4K
This bug ensures that a live downgrade from an InnoDB 5.6 with WL5756 and
a database created with innodb-page-size=8k or 4k will make a version 5.5
installation politely refuse to start. Instead of crashing or giving some
indication about a corrupted database, it will indicate the page size
difference. 

This patch takes only that part of the Wl5756 patch that is needed to
protect against opening a tablespace that is stamped with a different
page size.

It also contains the change in dict_index_find_on_id_low() just in case
a database with another page size is created by recompiling a pre-WL5756
InnoDB.
2011-12-08 13:32:19 -06:00