Commit graph

701 commits

Author SHA1 Message Date
Jan Lindström
e9c10f9916 MDEV-7908: assertion in innobase_release_savepoint
Problem was that in XA prepared state we should still be able to
release a savepoint, but assertions were too strict.
2015-04-06 17:38:51 +03:00
Jan Lindström
b53bcd438f MDEV-7367: Updating a virtual column corrupts table which crashes server
Analysis: MySQL table definition contains also virtual columns. Similarly,
index fielnr references MySQL table fields. However, InnoDB table definition
does not contain virtual columns. Therefore, when matching MySQL key fieldnr
we need to use actual column name to find out referenced InnoDB dictionary
column name.

Fix: Add new function to match MySQL index key columns to InnoDB dictionary.
2015-03-31 09:16:48 +03:00
Jan Lindström
0563f49ba3 MDEV-7754: innodb assert "array->n_elems < array->max_elems" on a huge blob update
Replace static array of thread sync levels with std::vector.
2015-03-31 09:16:48 +03:00
Jan Lindström
1020d56934 Better and more correct comment. 2015-03-18 15:17:17 +02:00
Jan Lindström
2bdbfd334b Fix assertion failure seen on Buildbot win32-debug
There is a bug in Visual Studio 2010
Visual Studio has a feature "Checked Iterators". In a debug build, every
iterator operation is checked at runtime for errors, e g, out of range.
Disable this "Checked Iterators" for Windows and Debug if defined.
2015-03-18 12:18:39 +02:00
Jan Lindström
c14d9c21f0 Make sure that sync level vector is emptied. 2015-03-18 06:25:10 +02:00
Jan Lindström
99a2c061d7 MDEV-7754: innodb assert "array->n_elems < array->max_elems" on a huge blob update
Problem was that static array was used for storing thread mutex sync levels.
Fixed by using std::vector instead.

Does not contain test case to avoid too big memory/disk space usage
on buildbot VMs.
2015-03-17 20:35:05 +02:00
Kristian Nielsen
184f718fef MDEV-7249: Performance problem in parallel replication with multi-level slaves
Parallel replication (in 10.0 / "conservative" mode) relies on binlog group
commits to group transactions that can be safely run in parallel on the
slave. The --binlog-commit-wait-count and --binlog-commit-wait-usec options
exist to increase the number of commits per group. But in case of conflicts
between transactions, this can cause unnecessary delay and reduced througput,
especially on a slave where commit order is fixed.

This patch adds a heuristics to reduce this problem. When transaction T1 goes
to commit, it will first wait for N transactions to queue up for a group
commit. However, if we detect that another transaction T2 is waiting for a row
lock held by T1, then we will skip the wait and let T1 commit immediately,
releasing locks and let T2 continue.

On a slave, this avoids the unfortunate situation where T1 is waiting for T2
to join the group commit, but T2 is waiting for T1 to release locks, causing
no work to be done for the duration of the --binlog-commit-wait-usec timeout.

(The heuristic seems reasonable on the master as well, so it is enabled for
all transactions, not just replication transactions).
2015-03-13 14:01:52 +01:00
Jan Lindström
702fdc52fa MDEV-7714: Make possible to get innodb internal primary key for wrapper
type storage engine.

Authored by: Kentoku Shiba
2015-03-12 18:37:32 +02:00
Jan Lindström
a7fd11b31d MDEV-7685: MariaDB - server crashes when inserting more rows than
available space on disk

Add error handling when disk full situation happens and
intentionally bring server down with stacktrace because
on all cases InnoDB can't continue anyway.
2015-03-09 18:33:25 +02:00
Jan Lindström
040027c888 MDEV-7627 :Some symbols in table name can cause to Error Code: 1050
when created FK

Analysis: Table name is on filename charset but foreign key
identifiers are not. This lead incorrect foreign key
identifier number to be used.

Fix: Convert foreign key identifier to filename charset before
comparing it to table name when largest foreign key identifier
number is resolved.
2015-03-09 09:47:25 +02:00
Sergei Golubchik
5f510a9175 Merge branch '5.5' into 10.0 2015-03-06 18:41:32 +01:00
Sergei Golubchik
17a37796e1 after innodb/xtradb merge: use the correct visibility for internal functions
otherwise innodb plugin might invoke xtradb function with the same name,
and that might crash (./mtr --emb innodb.strict_mode)
2015-03-06 18:13:06 +01:00
Jan Lindström
206b111b11 MDEV-7672: Crash creating an InnoDB table with foreign keys
Analysis: after a red-black-tree lookup we use node withouth
checking did lookup succeed or not. This lead to situation
where NULL-pointer was used.

Fix: Add additional check that found node from red-back-tree
is valid.
2015-03-06 11:19:23 +02:00
Sergey Vojtovich
e13459a11e MDEV-7148 - Recurring: InnoDB: Failing assertion: !lock->recursive
Re-applied lost in the merge revision:
commit ed313e8a92
Author: Sergey Vojtovich <svoj@mariadb.org>
Date:   Mon Dec 1 14:58:29 2014 +0400

    MDEV-7148 - Recurring: InnoDB: Failing assertion: !lock->recursive

    On PPC64 high-loaded server may crash due to assertion failure in InnoDB
    rwlocks code.

    This happened because load order between "recursive" and "writer_thread"
    wasn't properly enforced.
2015-03-05 15:30:11 +04:00
Jan Lindström
f66fbe8ce0 MDEV-7578 :Slave is ~10x slower to execute set of statements compared to master when using RBR
Analysis: On master when executing (single/multi) row INSERTs/REPLACEs
InnoDB fallback to old style autoinc locks (table locks)
only if another transaction has already acquired the AUTOINC lock.
Instead on slave as we are executing log_events and sql_command
is not correctly set, InnoDB does not use new style autoinc
locks when it could.

Fix: Use new style autoinc locks also when
thd_sql_command(user_thd) == SQLCOM_END i.e. this is RBR event.
2015-03-05 12:05:59 +02:00
Buggynours
eb2f763872 Add #include <ostream> in dict0mem.h and change iterator to const_iterator in dic0mem.cc
This fix compiling error when compiled with Visual Studio 9 2008
2015-03-03 12:39:42 +01:00
Sergei Golubchik
6c09a72af5 Merge remote-tracking branch 'origin/10.0' into 10.0 2015-02-24 20:52:37 +01:00
Jan Lindström
8799f87075 MDEV-7623: Add lock wait time and hold time to every record/table lock in
InnoDB transaction lock printout.
2015-02-24 10:33:49 +02:00
Jan Lindström
90635c6fb5 MDEV-7620: Transaction lock wait is missing number of lock
waits and total wait time.
2015-02-23 11:24:19 +02:00
Sergei Golubchik
f2cb45daf3 Merge remote-tracking branch 'origin/10.0' into 10.0 2015-02-22 21:45:24 +01:00
Sergei Golubchik
174bccd3ff xtradb 5.6.22-72.0 2015-02-18 20:31:40 +01:00
Sergei Golubchik
d7e7862364 Merge branch '5.5' into 10.0 2015-02-18 15:16:27 +01:00
Jan Lindström
a1a32f8f25 Revert file space allocation change on row0merge.cc. 2015-02-18 06:59:28 +02:00
Jan Lindström
454beee5fb MDEV-6288 :Innodb causes server crash after disk full, then can't ALTER TABLE any more
Fix try to avoid unnecessary crashes when disk full situation is reached
on alter table.
2015-02-13 11:49:31 +02:00
Sergei Golubchik
5dce6aa1fe Merge remote-tracking branch 'bzr/5.5' into bb-5.5-merge 2015-02-12 13:14:55 +01:00
Sergei Golubchik
2a1be9cdf8 XtraDB 5.5.41-37.0 2015-02-11 20:40:56 +01:00
Jan Lindström
56da6252f7 Improve InnoDB transaction lock output by providing number of table locks
this transaction is currently holding and total number of table locks to
the table where lock is held.
2015-02-10 15:15:27 +02:00
Jan Lindström
44a9e3f7b4 MDEV-7139: Sporadic failure in innodb.innodb_corrupt_bit on P8
The testcase fails randomly due to ibuf merge happening in the background.
Fix not to do any merges with ibuf_debug enabled.
2015-02-09 16:14:27 +02:00
Jan Lindström
8cc9751165 MDEV-7538: Wrong constraint (TINYINT or MEDIUMINT and INT)
causes server crash

Analysis: If wrong data types used on foreign constraint there
was possibility that foreign->id is NULL when incorrect
foreign constraint was removed from the dictionary cache.

Fix: Add guard foreign->id != NULL before trying to lookup
or remove the foreign constraint from dictionary cache.

Tested using user database where problem was repeatable.
2015-02-04 14:40:46 +02:00
Jan Lindström
f32091532d MDEV-7055: MySQL#74664 - InnoDB: Failing assertion: len <= col->len || col->mtype == 5 || (col->len == 0 && col->mtype == 1) in file rem0rec.cc line 845
Debug assertion maybe too strict.
2015-02-04 10:50:16 +02:00
Sergei Golubchik
f2be9c0fea after merge. innodb/xtradb to work on Windows 2015-01-22 08:58:13 +01:00
Sergei Golubchik
78e131d493 XtraDB 5.6.22-71.0 2015-01-21 14:34:58 +01:00
Sergei Golubchik
d854a254b8 remove incorrect asserts in innodb/xtradb. 0 is a valid file handle value. 2015-01-19 16:30:32 +01:00
Jan Lindström
4a3251595c MDEV-7403: should not pass recv_writer_thread_handle to CloseHandle()
Analysis: For some reason actual thread handle is not
returned on Windows instead lpThreadId was returned and
thread handle was closed after thread create. Later
CloseHandle was called for recv_writer_thread_handle
and psort_info->thread_hdl.

Fix: Return thread handle from os_thread_create()
also on Windows and store these thread handles also
in srv0start.cc so that they can be later closed.
2015-01-06 16:08:42 +02:00
Jan Lindström
de09076486 MDEV-7369: MariaDB build fails when XTRADB_STORAGE_ENGINE enabled
Patch by James Taylor.
2014-12-28 13:44:30 +02:00
Jan Lindström
5fafc3ce42 MDEV-7369: MariaDB build fails when XTRADB_STORAGE_ENGINE enabled
Patch by James Taylor.
2014-12-28 13:24:53 +02:00
Sergey Vojtovich
094640c036 Fixed a couple of compiler warnings. 2014-12-19 23:17:59 +04:00
Sergey Vojtovich
ed313e8a92 MDEV-7148 - Recurring: InnoDB: Failing assertion: !lock->recursive
On PPC64 high-loaded server may crash due to assertion failure in InnoDB
rwlocks code.

This happened because load order between "recursive" and "writer_thread"
wasn't properly enforced.
2014-12-01 14:58:29 +04:00
Jan Lindström
89a3628b0b Better comments part 2 with proof and simplified implementation.
Thanks to Daniel Black.
2014-11-25 12:04:32 +02:00
Jan Lindström
e5802c38f9 Better comments and add a test case. 2014-11-25 08:06:41 +02:00
Jan Lindström
e15a83c0c7 Better comments part 2 with proof and simplified implementation.
Thanks to Daniel Black.
2014-11-26 16:41:28 +02:00
Jan Lindström
f3bdf9d741 MDEV-7046: MySQL#74480 - Failing assertion: os_file_status(newpath, &exists, &type)
after Operating system error number 36 in a file operation.

Analysis: os_file_get_status did not handle error ENAMETOOLONG
correctly.

Fix: Add correct handling for error ENAMETOOLONG. Note that on InnoDB
case the error is not passed all the way up to server. That would
be bigger rewamp.
2014-11-25 11:38:01 +02:00
Jan Lindström
b62c4c6586 Better comments and add a test case. 2014-11-25 08:31:03 +02:00
Jan Lindström
ef1ba3b1e6 MDEV-7164: innodb.innodb-alter-table-disk-full fails in buildbot on Windows
Analysis: Test case uses Linux specific error codes.

Fix: Can't run test case with Windows currently because requires
to inject error to system.
2014-11-24 15:26:47 +02:00
Sergei Golubchik
ffc0ef6316 5.5 merge 2014-11-21 20:20:39 +01:00
Sergey Vojtovich
4472a0ef95 MDEV-7026 - Race in InnoDB/XtraDB mutex implementation can stall or hang the
server

This is an addition to original patch. Added full memory barrier to ensure
proper StoreLoad order between waiters and lock_word on PPC64.
2014-11-21 15:23:18 +04:00
Jan Lindström
b0febdb66e MDEV-7084: innodb index stats inadequate using constant innodb_stats_sample_pages
Use traditional statistics estimation by default (innodb-stats-traditional=true).
There could be performance regression for customers if there is a lot of
open table operations.
2014-11-21 13:27:36 +02:00
Sergei Golubchik
32ec8625af XtraDB 5.6.21-70.0 2014-11-20 17:05:13 +01:00
Sergei Golubchik
3c12c27907 5.5 merge 2014-11-20 16:07:34 +01:00
Sergei Golubchik
afca52bb52 5.5 merge 2014-11-20 15:26:31 +01:00
Jan Lindström
8bc5eabea8 MDEV-7084: innodb index stats inadequate using constant
innodb_stats_sample_pages

Analysis: If you set the number of analyzed pages 
to very low number compared to actual pages on 
that table/index it randomly pics those pages 
(default 8 pages), this leads to fact that query 
after analyze table returns different results. If 
the index tree is small, smaller than 10 * 
n_sample_pages + total_external_size, then the 
estimate is ok. For bigger index trees it is 
common that we do not see any borders between 
key values in the few pages we pick. But still 
there may be n_sample_pages different key values, 
or even more. And it just tries to 
approximate to n_sample_pages (8).

Fix: (1) Introduced new dynamic configuration variable
innodb_stats_sample_traditional  that retains
the current design. Default false.

(2) If traditional sample is not used we use
n_sample_pages = max(min(srv_stats_sample_pages,
                         index->stat_index_size),
                     log2(index->stat_index_size)*
                          srv_stats_sample_pages);

(3) Introduced new dynamic configuration variable
stat_modified_counter (default = 0) if set
sets lower bound for row updates when statistics is re-estimated.

If user has provided upper bound for how many rows needs to be updated
before we calculate new statistics we use minimum of provided value
and 1/16 of table every 16th round. If no upper bound is provided
(srv_stats_modified_counter = 0, default) then calculate new statistics
if 1 / 16 of table has been modified
since the last time a statistics batch was run.
We calculate statistics at most every 16th round, since we may have
a counter table which is very small and updated very often.
@param t table
@return true if the table has changed too much and stats need to be
recalculated
*/
#define DICT_TABLE_CHANGED_TOO_MUCH(t) \
	((ib_int64_t) (t)->stat_modified_counter > (srv_stats_modified_counter ? \
	ut_min(srv_stats_modified_counter, (16 + (t)->stat_n_rows / 16)) : \
		16 + (t)->stat_n_rows / 16))
2014-11-19 20:27:34 +02:00
Sergei Golubchik
3495801e2e 5.5 merge 2014-11-19 17:23:39 +01:00
Kristian Nielsen
6ea41f1e84 MDEV-7026: Race in InnoDB/XtraDB mutex implementation can stall or hang the server.
The bug was that full memory barrier was missing in the code that ensures that
a waiter on an InnoDB mutex will not go to sleep unless it is guaranteed to be
woken up again by another thread currently holding the mutex. This made
possible a race where a thread could get stuck waiting for a mutex that is in
fact no longer locked. If that thread was also holding other critical locks,
this could stall the entire server. There is an error monitor thread than can
break the stall, it runs about once per second. But if the error monitor
thread itself got stuck or was not running, then the entire server could hang
infinitely.

This was introduced on i386/amd64 platforms in 5.5.40 and 10.0.13 by an
incorrect patch that tried to fix the similar problem for PowerPC.

This commit reverts the incorrect PowerPC patch, and instead implements a fix
for PowerPC that does not change i386/amd64 behaviour, making PowerPC work
similarly to i386/amd64.
2014-11-19 13:56:46 +01:00
Sergei Golubchik
303eec5774 MDEV-6880 Can't define CURRENT_TIMESTAMP as default value for added column
ALTER TABLE: don't fill default values per row, do it once.
And do it in two places - for copy_data_between_tables() and for online ALTER.

Also, run function_defaults test both for MyISAM and for InnoDB.
2014-11-18 22:25:33 +01:00
Jan Lindström
b7d32e053d MDEV-7083: sys_vars.innodb_sched_priority* tests fail in
buildbot on work-amd64-valgrind

Fixed issue by finding out first the current used priority
for both treads and using that seeing did we really change
the priority or not.
2014-11-14 09:13:13 +02:00
Jan Lindström
0f32299437 MDEV-7035: Remove innodb_io_capacity setting depending on
setting of innodb_io_capacity_max

(a) Changed the behaviour so that if you set innodb_io_capacity to a 
value > innodb_io_capacity_max that the value is accepted AND 
that innodb_io_capacity_max = innodb_io_capacity * 2.

(b) If someone wants to reduce innodb_io_capacity_max and 
reduce it below innodb_io_capacity then innodb_io_capacity 
should be reduced to the same level as innodb_io_capacity_max.

In both cases give a warning to user.
2014-11-13 13:24:26 +02:00
Jan Lindström
bff2d46bf7 MDEV-7100: InnoDB error monitor might unnecessary wait log_sys mutex
Analysis: InnoDB error monitor is responsible to call every second
sync_arr_wake_threads_if_sema_free() to wake up possible hanging
threads if they are missed in mutex_signal_object. This is not
possible if error monitor itself is on mutex/semaphore wait. We
should avoid all unnecessary mutex/semaphore waits on error monitor.
Currently error monitor calls function buf_flush_stat_update()
that calls log_get_lsn() function and there we will try to get
log_sys mutex. Better, solution for error monitor is that in
buf_flush_stat_update() we will try to get lsn with
mutex_enter_nowait() and if we did not get mutex do not update
the stats.

Fix: Use log_get_lsn_nowait() function on buf_flush_stat_update()
function. If returned lsn is 0, we do not update flush stats.
log_get_lsn_nowait() will use mutex_enter_nowait() and if
we get mutex we return a correct lsn if not we return 0.
2014-11-13 12:00:57 +02:00
Jan Lindström
84f3f3fa1e MDEV-7083: sys_vars.innodb_sched_priority* tests fail in buildbot
on work-amd64-valgrind.

Fixed issue by finding out first the current used priority
for both treads and using that seeing did we really change
the priority or not.
2014-11-13 11:05:22 +02:00
Jan Lindström
8c7ef99bb2 MDEV-7100: InnoDB error monitor might unnecessary wait log_sys mutex
Analysis: InnoDB error monitor is responsible to call every second
sync_arr_wake_threads_if_sema_free() to wake up possible hanging 
threads if they are missed in mutex_signal_object. This is not 
possible if error monitor itself is on mutex/semaphore wait. We 
should avoid all unnecessary mutex/semaphore waits on error monitor.
Currently error monitor calls function buf_flush_stat_update() 
that calls log_get_lsn() function and there we will try to get 
log_sys mutex. Better, solution for error monitor is that in 
buf_flush_stat_update() we will try to get lsn with 
mutex_enter_nowait() and if we did not get mutex do not update 
the stats.

Fix: Use log_get_lsn_nowait() function on buf_flush_stat_update()
function. If returned lsn is 0, we do not update flush stats. 
log_get_lsn_nowait() will use mutex_enter_nowait() and if
we get mutex we return a correct lsn if not we return 0.
2014-11-13 11:24:19 +02:00
Jan Lindström
2da6f7ceba MDEV-7017: Add function to print semaphore waits
Add function to print to stderr all current semaphore 
waits. This function should be able to executed 
inside a gdb/ddd.
2014-11-03 15:43:44 +02:00
Jan Lindström
8777e80151 MDEV-6759: innodb valgrind failures
Fix failure seen on dict_foreign_remove_partial().
2014-10-27 16:58:16 +02:00
Jan Lindström
85c21dbc47 MDEV-6925: Remove bad "" operators.
Merged Facebook commit ec1aac68c74f3c1e558d057c4c9fcfe6edbbea93
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6

In C++11, "" is not parsed as before.  So "A""B" is not the same as "AB".
Instead, whitespace is required, like: "A" "B"
2014-10-26 07:29:37 +02:00
Jan Lindström
caeffc7a7d MDEV-6926: innodb_rows_updated is misleading on slav
Merged Facebook commit dd2d11be7aaf3be270e740fb95cbc4eacb52f4d7
authored by Rongrong Zhong from https://github.com/facebook/mysql-5.6

This fixes MySQL Bug #68220 innodb_rows_updated is misleading on slave
http://bugs.mysql.com/bug.php?id=68220

Added innodb_system_rows_read/inserted/updated/deleted counters
that are the equivalent of innodb_rows_* but that only account for
changes made to system databases (mysql, information_schame and
preformance_schema). These counters will be used on slaves to
differentiated the updates made on system databases from those made on
user databases.

innodb_rows_* status counters are not updated when innodb_system_rows_*
are updated.

dd2d11be7a
2014-10-26 07:22:51 +02:00
Jan Lindström
60e995cfec MDEV-6930: Make innodb_max_dirty_pages_pct my.cnf variable a double
Merged Facebook commit ecff018632c6db49bad73d9233c3cdc9f41430e9
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6

This change is to fix: http://bugs.mysql.com/62534

This makes innodb_max_dirty_pages_pct a double with min,default,max values
0.001, 75, 99.999.

This also makes innodb_max_dirty_pages_pct_lwm and adaptive_flushing_lwm
doubles, as these sysvars are inter-dependent.

Added more to the BUFFER POOL AND MEMORY section of SHOW INNODB STATUS:
Percent pages dirty: X.X
This is all n_dirty_pages / used_pages
Percent all pages dirty: X.X
This is all n_dirty_pages / all-pages
Max dirty pages percent: X.X
This is innodb_max_dirty_pages_pct

Also changed all of buf from 2 to 3 digits of precision (%.2f -> %.3f).
2014-10-25 09:24:39 +03:00
Jan Lindström
cff0012d28 MDEV-6927: Share more structures
Merge Facebook commit f981a51a47519b0ba527917887f8adc6df9ae147
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6.

This just moves some structure definitions from inside a
single .cc file to a shared .h file, with a few tweaks to
allow these structures to be shared.

On its own, it should have no actual effect. This is needed later.
2014-10-25 08:21:52 +03:00
Jan Lindström
3486135bb5 MDEV-6928: Add trx pointer to struct mtr_t
Merge Facebook commit 25295d003cb0c17aa8fb756523923c77250b3294
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6

This adds a pointer to the trx to each mtr.
This allows the trx to be accessed in parts of the code
where it was otherwise not available. This is needed later.
2014-10-24 22:26:31 +03:00
Jan Lindström
78e31f0a2e MDEV-6931: Page cleaner should do LRU flushing regardless of server activity
Merge Facebook commit 926a077b14b73c14094de7fc7aa913241b801b4d
authored by Inaam Rana from https://github.com/facebook/mysql-5.6.

This is fix for upstream bugs
http://bugs.mysql.com/bug.php?id=71988
http://bugs.mysql.com/bug.php?id=70500

page_cleaner should work whether or not there is server activity.
Its iterations become a noop when there is no work to do but we
should not tie it to the server activity.

The page_cleaner thread does spurious background flushing
because of conditional sleep between iterations. The solution
is not to make sleep dependent on server activity etc.
2014-10-24 18:58:04 +03:00
Jan Lindström
7e71dfa9f5 MDEV-6933: Spurious lock_wait_timeout_thread wakeup in lock_wait_suspend_thread()
Merged Facebooks commit 6e06bbfa315ffb97d713dd6e672d6054036ddc21
authored by Inaam Rana from https://github.com/facebook/mysql-5.6.

Fixes MySQL bug http://bugs.mysql.com/bug.php?id=72123

lock_timeout thread works in a tight loop waking up every second
and checking for lock_wait_timeout. In addition, when a mysql
thread is forced to wait on a lock, it signals the lock_timeout thread
as well. This call is not required. In a heavily contended workload
each thread going to wait will signal the lock_timeout thread making
it work all the time. As lock_timeout thread scans the array of
waiting threads under lock_sys::wait_mutex which is already very
hot in contneded loads, these extra scans can cause significanct
performance regression.

Also, in various codepaths lock_timeout thread is signalled where
actual intention was to signal the innodb monitor thread.
2014-10-24 17:56:04 +03:00
Jan Lindström
f0debf2feb MDEV-6934: os_event_wait_time_low(): wait time calculation is messed up
Merged Facebook commit bdab302a7e3c37da21a1bffe1550cdbe6c906695
by Inaam Rana from https://github.com/facebook/mysql-5.6.

In os_event_wait_time_low() the logic to calculate abs_time
for wait is broken. The bug has been present at least since
5.5. It gets acutely sensitized when sub-second wait intervals
are passed. It is particularly relevant to us because the
page_cleaner thread will mostly request sub-second wait
intervals. This can potentially lead to a near tight loop
behaviour of page_cleaner with much less sleep then what we'd
actually expect.
2014-10-24 17:11:09 +03:00
Kristian Nielsen
4c07b93bdb Fix missing UNIV_INTERN on dict_table_check_foreign_keys().
When UNIV_INTERN is missing in built-in XtraDB, this causes the
innodb_plugin to call the XtraDB version of the function instead
of its own (seen in --embedded-server test failure in Buildbot).
This in turn causes bad things to happen in case of difference
between XtranDB and innodb_plugin.
2014-10-20 10:50:10 +02:00
Sergei Golubchik
1b75bed00f 5.5.40+ merge 2014-10-09 10:30:11 +02:00
Sergei Golubchik
7e6d4bba0c XtraDB 5.5.40-36.1 2014-10-08 00:44:37 +02:00
Sergei Golubchik
0d2cba5df2 XtraDB 5.5.39-36.0 2014-10-06 20:06:39 +02:00
Sergei Golubchik
22f9353bfd xtradb/innodb: fix to compile with VS 2008
and compiler warnings
2014-10-04 15:26:04 +02:00
Sergey Vojtovich
5e1fad8512 MDEV-6533 - MySQL Bug#72718 - CACHE_LINE_SIZE in innodb should be 128 on POWER
This patch is suggested by Stewart Smith.
Define CACHE_LINE_SIZE to 128 on POWER.
2014-10-03 17:38:46 +04:00
Michael Widenius
70823e1d91 MDEV-5120 Test suite test maria-no-logging fails
The reason for the failure was a bug in an include file on debian that causes 'struct stat'
to have different sized depending on the environment.

This patch fixes so that we always include my_global.h or my_config.h before we include any other files.

Other things:
- Removed #include <my_global.h> in some include files; Better to always do this at the top level to have as few
  "always-include-this-file-first' files as possible.
- Removed usage of some include files that where already included by my_global.h or by other files.


client/mysql_plugin.c:
  Use my_global.h first
client/mysqlslap.c:
  Remove duplicated include files
extra/comp_err.c:
  Remove duplicated include files
include/m_string.h:
  Remove duplicated include files
include/maria.h:
  Remove duplicated include files
libmysqld/emb_qcache.cc:
  Use my_global.h first
plugin/semisync/semisync.h:
  Use my_pthread.h first
sql/datadict.cc:
  Use my_global.h first
sql/debug_sync.cc:
  Use my_global.h first
sql/derror.cc:
  Use my_global.h first
sql/des_key_file.cc:
  Use my_global.h first
sql/discover.cc:
  Use my_global.h first
sql/event_data_objects.cc:
  Use my_global.h first
sql/event_db_repository.cc:
  Use my_global.h first
sql/event_parse_data.cc:
  Use my_global.h first
sql/event_queue.cc:
  Use my_global.h first
sql/event_scheduler.cc:
  Use my_global.h first
sql/events.cc:
  Use my_global.h first
sql/field.cc:
  Use my_global.h first
  Remove duplicated include files
sql/field_conv.cc:
  Use my_global.h first
sql/filesort.cc:
  Use my_global.h first
  Remove duplicated include files
sql/gstream.cc:
  Use my_global.h first
sql/ha_ndbcluster.cc:
  Use my_global.h first
sql/ha_ndbcluster_binlog.cc:
  Use my_global.h first
sql/ha_ndbcluster_cond.cc:
  Use my_global.h first
sql/ha_partition.cc:
  Use my_global.h first
sql/handler.cc:
  Use my_global.h first
sql/hash_filo.cc:
  Use my_global.h first
sql/hostname.cc:
  Use my_global.h first
sql/init.cc:
  Use my_global.h first
sql/item.cc:
  Use my_global.h first
sql/item_buff.cc:
  Use my_global.h first
sql/item_cmpfunc.cc:
  Use my_global.h first
sql/item_create.cc:
  Use my_global.h first
sql/item_geofunc.cc:
  Use my_global.h first
sql/item_inetfunc.cc:
  Use my_global.h first
sql/item_row.cc:
  Use my_global.h first
sql/item_strfunc.cc:
  Use my_global.h first
sql/item_subselect.cc:
  Use my_global.h first
sql/item_sum.cc:
  Use my_global.h first
sql/item_timefunc.cc:
  Use my_global.h first
sql/item_xmlfunc.cc:
  Use my_global.h first
sql/key.cc:
  Use my_global.h first
sql/lock.cc:
  Use my_global.h first
sql/log.cc:
  Use my_global.h first
sql/log_event.cc:
  Use my_global.h first
sql/log_event_old.cc:
  Use my_global.h first
sql/mf_iocache.cc:
  Use my_global.h first
sql/mysql_install_db.cc:
  Remove duplicated include files
sql/mysqld.cc:
  Remove duplicated include files
sql/net_serv.cc:
  Remove duplicated include files
sql/opt_range.cc:
  Use my_global.h first
sql/opt_subselect.cc:
  Use my_global.h first
sql/opt_sum.cc:
  Use my_global.h first
sql/parse_file.cc:
  Use my_global.h first
sql/partition_info.cc:
  Use my_global.h first
sql/procedure.cc:
  Use my_global.h first
sql/protocol.cc:
  Use my_global.h first
sql/records.cc:
  Use my_global.h first
sql/records.h:
  Don't include my_global.h
  Better to do this at the upper level
sql/repl_failsafe.cc:
  Use my_global.h first
sql/rpl_filter.cc:
  Use my_global.h first
sql/rpl_gtid.cc:
  Use my_global.h first
sql/rpl_handler.cc:
  Use my_global.h first
sql/rpl_injector.cc:
  Use my_global.h first
sql/rpl_record.cc:
  Use my_global.h first
sql/rpl_record_old.cc:
  Use my_global.h first
sql/rpl_reporting.cc:
  Use my_global.h first
sql/rpl_rli.cc:
  Use my_global.h first
sql/rpl_tblmap.cc:
  Use my_global.h first
sql/rpl_utility.cc:
  Use my_global.h first
sql/set_var.cc:
  Added comment
sql/slave.cc:
  Use my_global.h first
sql/sp.cc:
  Use my_global.h first
sql/sp_cache.cc:
  Use my_global.h first
sql/sp_head.cc:
  Use my_global.h first
sql/sp_pcontext.cc:
  Use my_global.h first
sql/sp_rcontext.cc:
  Use my_global.h first
sql/spatial.cc:
  Use my_global.h first
sql/sql_acl.cc:
  Use my_global.h first
sql/sql_admin.cc:
  Use my_global.h first
sql/sql_analyse.cc:
  Use my_global.h first
sql/sql_audit.cc:
  Use my_global.h first
sql/sql_base.cc:
  Use my_global.h first
sql/sql_binlog.cc:
  Use my_global.h first
sql/sql_bootstrap.cc:
  Use my_global.h first
  Use my_global.h first
sql/sql_cache.cc:
  Use my_global.h first
sql/sql_class.cc:
  Use my_global.h first
sql/sql_client.cc:
  Use my_global.h first
sql/sql_connect.cc:
  Use my_global.h first
sql/sql_crypt.cc:
  Use my_global.h first
sql/sql_cursor.cc:
  Use my_global.h first
sql/sql_db.cc:
  Use my_global.h first
sql/sql_delete.cc:
  Use my_global.h first
sql/sql_derived.cc:
  Use my_global.h first
sql/sql_do.cc:
  Use my_global.h first
sql/sql_error.cc:
  Use my_global.h first
sql/sql_explain.cc:
  Use my_global.h first
sql/sql_expression_cache.cc:
  Use my_global.h first
sql/sql_handler.cc:
  Use my_global.h first
sql/sql_help.cc:
  Use my_global.h first
sql/sql_insert.cc:
  Use my_global.h first
sql/sql_lex.cc:
  Use my_global.h first
sql/sql_load.cc:
  Use my_global.h first
sql/sql_locale.cc:
  Use my_global.h first
sql/sql_manager.cc:
  Use my_global.h first
sql/sql_parse.cc:
  Use my_global.h first
sql/sql_partition.cc:
  Use my_global.h first
sql/sql_plugin.cc:
  Added comment
sql/sql_prepare.cc:
  Use my_global.h first
sql/sql_priv.h:
  Added error if we use this before including my_global.h
  This check is here becasue so many files includes sql_priv.h first.
sql/sql_profile.cc:
  Use my_global.h first
sql/sql_reload.cc:
  Use my_global.h first
sql/sql_rename.cc:
  Use my_global.h first
sql/sql_repl.cc:
  Use my_global.h first
sql/sql_select.cc:
  Use my_global.h first
sql/sql_servers.cc:
  Use my_global.h first
sql/sql_show.cc:
  Added comment
sql/sql_signal.cc:
  Use my_global.h first
sql/sql_statistics.cc:
  Use my_global.h first
sql/sql_table.cc:
  Use my_global.h first
sql/sql_tablespace.cc:
  Use my_global.h first
sql/sql_test.cc:
  Use my_global.h first
sql/sql_time.cc:
  Use my_global.h first
sql/sql_trigger.cc:
  Use my_global.h first
sql/sql_udf.cc:
  Use my_global.h first
sql/sql_union.cc:
  Use my_global.h first
sql/sql_update.cc:
  Use my_global.h first
sql/sql_view.cc:
  Use my_global.h first
sql/sys_vars.cc:
  Added comment
sql/table.cc:
  Use my_global.h first
sql/thr_malloc.cc:
  Use my_global.h first
sql/transaction.cc:
  Use my_global.h first
sql/uniques.cc:
  Use my_global.h first
sql/unireg.cc:
  Use my_global.h first
sql/unireg.h:
  Removed inclusion of my_global.h
storage/archive/ha_archive.cc:
  Added comment
storage/blackhole/ha_blackhole.cc:
  Use my_global.h first
storage/csv/ha_tina.cc:
  Use my_global.h first
storage/csv/transparent_file.cc:
  Use my_global.h first
storage/federated/ha_federated.cc:
  Use my_global.h first
storage/federatedx/federatedx_io.cc:
  Use my_global.h first
storage/federatedx/federatedx_io_mysql.cc:
  Use my_global.h first
storage/federatedx/federatedx_io_null.cc:
  Use my_global.h first
storage/federatedx/federatedx_txn.cc:
  Use my_global.h first
storage/heap/ha_heap.cc:
  Use my_global.h first
storage/innobase/handler/handler0alter.cc:
  Use my_global.h first
storage/maria/ha_maria.cc:
  Use my_global.h first
storage/maria/unittest/ma_maria_log_cleanup.c:
  Remove duplicated include files
storage/maria/unittest/test_file.c:
  Added comment
storage/myisam/ha_myisam.cc:
  Move sql_plugin.h first as this includes my_global.h
storage/myisammrg/ha_myisammrg.cc:
  Use my_global.h first
storage/oqgraph/oqgraph_thunk.cc:
  Use my_config.h and my_global.h first
  One could not include my_global.h before oqgraph_thunk.h (don't know why)
storage/spider/ha_spider.cc:
  Use my_global.h first
storage/spider/hs_client/config.cpp:
  Use my_global.h first
storage/spider/hs_client/escape.cpp:
  Use my_global.h first
storage/spider/hs_client/fatal.cpp:
  Use my_global.h first
storage/spider/hs_client/hstcpcli.cpp:
  Use my_global.h first
storage/spider/hs_client/socket.cpp:
  Use my_global.h first
storage/spider/hs_client/string_util.cpp:
  Use my_global.h first
storage/spider/spd_conn.cc:
  Use my_global.h first
storage/spider/spd_copy_tables.cc:
  Use my_global.h first
storage/spider/spd_db_conn.cc:
  Use my_global.h first
storage/spider/spd_db_handlersocket.cc:
  Use my_global.h first
storage/spider/spd_db_mysql.cc:
  Use my_global.h first
storage/spider/spd_db_oracle.cc:
  Use my_global.h first
storage/spider/spd_direct_sql.cc:
  Use my_global.h first
storage/spider/spd_i_s.cc:
  Use my_global.h first
storage/spider/spd_malloc.cc:
  Use my_global.h first
storage/spider/spd_param.cc:
  Use my_global.h first
storage/spider/spd_ping_table.cc:
  Use my_global.h first
storage/spider/spd_sys_table.cc:
  Use my_global.h first
storage/spider/spd_table.cc:
  Use my_global.h first
storage/spider/spd_trx.cc:
  Use my_global.h first
storage/xtradb/handler/handler0alter.cc:
  Use my_global.h first
storage/xtradb/handler/i_s.cc:
  Use my_global.h first
2014-09-30 20:31:14 +03:00
Michael Widenius
caca6b9907 Fixed warnings
storage/oqgraph/ha_oqgraph.cc:
  Fixed compiler warning
storage/xtradb/handler/ha_innodb.cc:
  Ifdef:ed note used function
2014-09-30 20:12:59 +03:00
Sergei Golubchik
a006813fb1 merge 2014-09-16 14:08:05 +02:00
Sergei Golubchik
7e29c1b539 5.5 merge 2014-09-16 14:03:17 +02:00
Jan Lindström
ec46381990 Avoid using log_sys mutex when printing out show engine innodb status,
instead peek (maybe) old data.
2014-09-16 07:37:00 +03:00
Elena Stepanova
b41d5aebcf Changes in storage_engine test suite:
- added more logic for ON DUPICATE KEY UPDATE upon Monty's request;
  - added an overlay for XtraDB
2014-09-15 20:33:11 +04:00
Sergei Golubchik
4a68817d8d XtraDB 5.6.20-68.0 2014-09-11 16:44:16 +02:00
Jan Lindström
c30a8442e8 MDEV-6729: InnoDB: Failing assertion: state == TRX_STATE_NOT_STARTED in
file trx0trx.ic line 60 

Problem was that trx might have not been started when we enter release
savepoint, this can happen when trx with savepoint is already aborted 
or when we try to release non-existing savepoint.
2014-09-11 15:41:30 +03:00
Sergei Golubchik
8deb9066e2 fix compilation on windows - wrong include file 2014-09-08 17:10:48 +02:00
Sergei Golubchik
695781a53e MDEV-6595 [PATCH] HPPA: storage/xtradb/os/os0stacktrace.c:88:54: error: invalid operands to binary & (have 'void *' and 'long unsigned int')
fix precedence as in the patch from Brian Evans
2014-09-06 09:51:34 +02:00
Sergey Vojtovich
c01c819209 Backport from 10.0:
MDEV-6483 - Deadlock around rw_lock_debug_mutex on PPC64

This problem affects only debug builds on PPC64.

There are at least two race conditions around
rw_lock_debug_mutex_enter and rw_lock_debug_mutex_exit:

- rw_lock_debug_waiters was loaded/stored without setting
  appropriate locks/memory barriers.
- there is a gap between calls to os_event_reset() and
  os_event_wait() and in such case we're supposed to pass
  return value of the former to the latter.

Fixed by replacing self-cooked spinlocks with system mutexes.
These days system mutexes offer much better performance. OTOH
performance is not that critical for debug builds.
2014-08-29 16:14:11 +04:00
Sergey Vojtovich
40497577ff Backport from 10.0:
MDEV-6450 - MariaDB crash on Power8 when built with advance tool
            chain

InnoDB mutex_exit() function calls __sync_test_and_set() to release
the lock. According to manual this function is supposed to create
"acquire" memory barrier whereas in fact we need "release" memory
barrier at mutex_exit().

The problem isn't repeatable with gcc because it creates
"acquire-release" memory barrier for __sync_test_and_set().
ATC creates just "acquire" barrier.

Fixed by creating proper barrier at mutex_exit() by using
__sync_lock_release() instead of __sync_test_and_set().
2014-08-29 16:02:46 +04:00
Jan Lindström
18b307a7d2 MDEV-6590: InnoDB recover ends in signal 11
Analysis: When database is migrated from 5.5 or earlier and
database needs crash recovery, there is possibility that
SYS_DATAFILES system table does not exists, but
crash recovery in function dict_check_tablespaces_and_store_max_id()
assumes that SYS_DATAFILES exists.

Fix: If SYS_DATAFILES does not exists, create it before
we end up to function dict_check_tablespaces_and_store_max_id()
on crash recovery.
2014-08-25 13:35:33 +03:00
Michael Widenius
5569132ffe MDEV-6450 - MariaDB crash on Power8 when built with advance tool chain
Part of this work is based on Stewart Smitch's memory barrier and lower priori
patches for power8.

- Added memory syncronization for innodb & xtradb for power8.
- Added HAVE_WINDOWS_MM_FENCE to CMakeList.txt
- Added os_isync to fix a syncronization problem on power
- Added log_get_lsn_nowait which is now used srv_error_monitor_thread to ensur
  if log mutex is locked.

All changes done both for InnoDB and Xtradb
2014-08-19 19:28:35 +03:00
Sergei Golubchik
359d764b79 fix xtradb on windows (again) 2014-08-03 07:38:41 +02:00
Jan Lindström
27d23c020a Merged percona-server-5.5.38-35.2. 2014-08-01 12:54:56 +03:00
Michael Widenius
a1c1700b89 Fixed some compiler warnings 2014-07-30 10:05:01 +03:00
Sergei Golubchik
6ef139780d MDEV-6497 InnoDB deadlocks on UNINSTALL PLUGIN
Free the trx of the current thd (if any) in innobase_end()
2014-07-29 09:09:52 +02:00
Jan Lindström
42b9758814 Fix compiler error on sparc. 2014-07-27 08:44:45 +03:00
Jan Lindström
8ae267400c Fix InnoDB: Assertion failure in thread 2868898624 in file buf0lru.c line 1000
InnoDB: Failing assertion: mutex_own(&buf_pool->LRU_list_mutex)

and

InnoDB: Assertion failure in thread 2868898624 in file buf0lru.c line 1077
InnoDB: Failing assertion: mutex_own(&buf_pool->LRU_list_mutex)

Analysis: Function buf_LRU_free_block might release LRU_list_mutex on
same cases to avoid mutex order problems, we need to take it back 
before accessing list.
2014-07-26 21:14:21 +03:00
Jan Lindström
c104965746 Fix test failure caused by simulated compression failure on
IBUF_DUMMY table.
2014-07-25 09:34:05 +03:00
Jan Lindström
7bf45bec54 Fix too agressive long semaphore wait output and add guard against introducing
compression failures on insert buffer.
2014-07-24 14:35:09 +03:00
Jan Lindström
be00265557 Fix compiler errors on product build. 2014-07-23 13:52:17 +03:00
Michael Widenius
bd2117d154 Automatic merge from 5.5
Fixed 2 failing tests by replacing result files
2014-08-19 21:35:14 +03:00
Sergei Golubchik
9fffe990c4 buildbot found failures
config.h.cmake:
  define NOMINMAX, otherwise Windows system headers define min() and max() macros
sql/slave.cc:
  mi->report() has one more argument in MariaDB
storage/xtradb/buf/buf0flu.cc:
  xtradb fixes for windows, again
2014-08-08 13:53:43 +02:00
Sergei Golubchik
6fb17a0601 5.5.39 merge 2014-08-07 18:06:56 +02:00
Sergei Golubchik
a7f39aacd5 xtradb-5.6.19-67.0 2014-08-06 19:57:06 +02:00
Sergey Vojtovich
82ce2a2503 MDEV-6450 - MariaDB crash on Power8 when built with advance
tool chain

Reverted addition to the original patch:
InterlockedExchangeAcquire and InterlockedAndRelease are
supported only on Itanium-based systems.
2014-08-04 11:55:38 +04:00
Sergey Vojtovich
53360fd45f MDEV-6450 - MariaDB crash on Power8 when built with advance
tool chain

This is an addition to the original patch. On Windows
InterlockedExchange implies full memory barrier, whereas
only acquire/release barriers required.
2014-07-31 14:31:05 +04:00
Jan Lindström
c39a501cbe Try to fix compiler error seen on Labrador. 2014-07-31 14:43:35 +03:00
Sergei Golubchik
3e9d4541d5 MDEV-6340 Mariadb 10.0.12 fatal "Lost connection" error w/ GCC 4.9 'Release' build; workaround ~ CFLAGS="-fno-delete-null-pointer-checks"
don't use attribute nonnull for arguments that can be null
2014-07-31 09:51:05 +02:00
Jan Lindström
c2536764d8 MDEV-6506: InnoDB: Assertion failure in thread 2810182464 in file
buf0flu.cc line 549.

Analysis: If buf_page_get_state(bpage) == BUF_BLOCK_REMOVE_HASH then
buf_page_in_file(bpage) might not be true. 

Fix: ut_a(buf_page_in_file(bpage) || buf_page_get_state(bpage) == BUF_BLOCK_REMOVE_HASH);
2014-07-31 10:32:52 +03:00
Jan Lindström
2936bfd220 Merge revision 4244 from 5.5. Fix compiler error on sparc. 2014-07-27 08:47:37 +03:00
Jan Lindström
476feba941 Fix unnecessary printout of same writer thread more than once. Fixed
also a compiler warning.
2014-07-26 20:17:59 +03:00
Jan Lindström
a3acd72570 Merge InnoDB fixes from 5.5 revisions 4229, 4230, 4233, 4237 and 4238 i.e.
4229: MDEV-5670: Assertion failure in file buf0lru.c line 2355
      Add more status information if repeatable.

4230: MDEV-5673: Crash while parallel dropping multiple tables under heavy load
      Improve long semaphore wait output to include all semaphore waits
      and try to find out if there is a sequence of waiters.

4233: Fix compiler errors on product build.

4237: Fix too agressive long semaphore wait output and add guard against introducing
      compression failures on insert buffer.

4238: Fix test failure caused by simulated compression failure on
      IBUF_DUMMY table.
2014-07-25 10:30:16 +03:00
Sergey Vojtovich
6192f0bffa MDEV-6483 - Deadlock around rw_lock_debug_mutex on PPC64
This problem affects only debug builds on PPC64.

There are at least two race conditions around
rw_lock_debug_mutex_enter and rw_lock_debug_mutex_exit:

- rw_lock_debug_waiters was loaded/stored without setting
  appropriate locks/memory barriers.
- there is a gap between calls to os_event_reset() and
  os_event_wait() and in such case we're supposed to pass
  return value of the former to the latter.

Fixed by replacing self-cooked spinlocks with system mutexes.
These days system mutexes offer much better performance. OTOH
performance is not that critical for debug builds.
2014-07-24 18:12:32 +04:00
Jan Lindström
a1e41e3258 MDEV-6470: Restrict number of error messages about persistent statictic tables not found
If mysql.innodb_table_stats or mysql.innodb_index_stats is not found or has
unexpected structure output that error only once and no other error for
every table trying to use them. If they do exists, then print fetch or
recalculation errors only once / table or index.
2014-07-22 19:31:45 +03:00
Jan Lindström
ef67c3a239 MDEV-6443: Server crashed with assertaion failure in file ha_innodb.cc
line 8473

In case InnoDB index is not found, print the MySQL and InnoDB index
name we were trying to find and all MySQL and InnoDB index names there
is for this table.
2014-07-22 13:17:16 +03:00
Jan Lindström
fe3859cc9d MDEV-6443: Server crashed with assertaion failure in file
ha_innodb.cc line 8473

If index is not found from InnoDB make sure we print what we
were trying to find and all mysql and InnoDB index names there
is for this table.
2014-07-22 13:08:32 +03:00
Jan Lindström
0bb0230e3a MDEV-6426: Maria DB crashes randomly on creating indexes
Improve OS error messages on Windows.
2014-07-22 10:10:56 +03:00
Sergey Vojtovich
c0ebb3f388 MDEV-6450 - MariaDB crash on Power8 when built with advance tool
chain

InnoDB mutex_exit() function calls __sync_test_and_set() to release
the lock. According to manual this function is supposed to create
"acquire" memory barrier whereas in fact we need "release" memory
barrier at mutex_exit().

The problem isn't repeatable with gcc because it creates
"acquire-release" memory barrier for __sync_test_and_set().
ATC creates just "acquire" barrier.

Fixed by creating proper barrier at mutex_exit() by using
__sync_lock_release() instead of __sync_test_and_set().
2014-07-18 15:16:25 +04:00
Kristian Nielsen
501c56ef1e MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel replication causing replication to fail.
Merge the patches into MariaDB 10.0 main.

With this patch, parallel replication will now automatically retry a
transaction that fails due to deadlock or other temporary error, same as
single-threaded replication.

We catch deadlocks with InnoDB transactions due to enforced commit order. If
T1 must commit before T2 in parallel replication and T1 ends up waiting for T2
inside InnoDB, we kill T2 and retry it later to resolve the deadlock
automatically.
2014-07-11 12:06:47 +02:00
Kristian Nielsen
5b75891b7b Fix compile failure in non-debug build. 2014-07-10 14:24:53 +02:00
Kristian Nielsen
45f6262f54 MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel replication causing replication to fail.
After-review changes. Fix InnoDB coding style issues.
2014-07-09 13:02:52 +02:00
Kristian Nielsen
92577cc0eb MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel replication causing replication to fail.
Fix small (but nasty) typo.
2014-07-08 14:54:53 +02:00
Kristian Nielsen
98fc5b3af8 MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel replication causing replication to fail.
After-review changes.

For this patch in 10.0, we do not introduce a new public storage engine API,
we just fix the InnoDB/XtraDB issues. In 10.1, we will make a better public
API that can be used for all storage engines (MDEV-6429).

Eliminate the background thread that did deadlock kills asynchroneously.
Instead, we ensure that the InnoDB/XtraDB code can handle doing the kill from
inside the deadlock detection code (when thd_report_wait_for() needs to kill a
later thread to resolve a deadlock).

(We preserve the part of the original patch that introduces dedicated mutex
and condition for the slave init thread, to remove the abuse of
LOCK_thread_count for start/stop synchronisation of the slave init thread).
2014-07-08 12:54:47 +02:00
Jan Lindström
e005734058 MDEV-6424: Mariadb server crashes with assertion failure in file ha_innodb.cc
Analysis: For some reason table stats for a table pointed from a index 
is not initialized. Added additional warning output on this situation
and table stats initialization. This is better than asserting.
2014-07-08 21:05:18 +03:00
Jan Lindström
648fb98eb6 MDEV-6348: mariadb crash signal 11
Analysis: sync array output function, should make sure that all
used pointers are valid before using them.

Merge revision 4225 from lp:maria/5.5.
2014-07-08 18:51:34 +03:00
Jan Lindström
d2098b964d MDEV-6318: MariaDB with XtraDB uses times more of IO events
than with InnoDB plugin

Fix: os0file.h in XtraDB had OS_AIO_N_PENDING_IOS_PER_THREAD 256
when on InnoDB it is OS_AIO_N_PENDING_IOS_PER_THREAD 32. Changed
XtraDB also to use 32.
2014-07-04 08:09:27 +03:00
Jan Lindström
6bd2f900b2 MDEV-6288: Innodb causes server crash after disk full, then can't
ALTER TABLE any more.
2014-07-03 14:55:03 +03:00
Jan Lindström
ebf3437810 MDEV-5673: Crash while parallel dropping multiple tables under heavy load
Improve long semaphore wait output to include all semaphore waits
and try to find out if there is a sequence of waiters.
2014-07-23 09:04:59 +03:00
Jan Lindström
67eb6f33a9 MDEV-5670: Assertion failure in file buf0lru.c line 2355
Add more status information if repeatable.
2014-07-22 22:08:06 +03:00
unknown
71a596b90c Makes innodb/xtradb compilable in 5.5 2014-07-15 12:37:34 +03:00
Jan Lindström
970163d0be MDEV-6348: mariadb crash signal 11
Analysis: sync array output function, should make sure that all 
used pointers are valid before using them.
2014-07-08 17:21:13 +03:00
Jan Lindström
8d8c456dbb MDEV-5621: Server random crash on ALTER TABLE
This is not a real fix, instead try to gather additional information
at the point when dictionary content is not what we expect it to be.
2014-07-04 12:25:32 +03:00
Jan Lindström
c922048368 MDEV-6191: row_search_for_mysql comment and code consistency about isolation level
and gap locks
2014-07-04 08:42:59 +03:00
Jan Lindström
838977e54d MDEV-6318: MariaDB with XtraDB uses times more of IO events
than with InnoDB plugin
  
  Fix: os0file.h in XtraDB had OS_AIO_N_PENDING_IOS_PER_THREAD 256
  when on InnoDB it is OS_AIO_N_PENDING_IOS_PER_THREAD 32. Changed
  XtraDB also to use 32.
2014-07-04 08:16:45 +03:00
Jan Lindström
6cc5e00586 MDEV-6225: Idle replication slave keeps crashing.
Analysis: Based on crashed the buffer pool instance identifier is
  not correct on block to be freed. Add LRU list mutex holding
  on functions calling free and add additional safety checks.
2014-06-30 14:06:28 +03:00
Sergei Golubchik
315a4efb91 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751805 typo fixed
use ascii 'x' not utf8 '×' for hex numbers
2014-06-16 22:11:54 +02:00
unknown
bd4153a8c2 MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel
replication causing replication to fail.

Remove the temporary fix for MDEV-5914, which used READ COMMITTED for parallel
replication worker threads. Replace it with a better, more selective solution.

The issue is with certain edge cases of InnoDB gap locks, for example between
INSERT and ranged DELETE. It is possible for the gap lock set by the DELETE to
block the INSERT, if the DELETE runs first, while the record lock set by
INSERT does not block the DELETE, if the INSERT runs first. This can cause a
conflict between the two in parallel replication on the slave even though they
ran without conflicts on the master.

With this patch, InnoDB will ask the server layer about the two involved
transactions before blocking on a gap lock. If the server layer tells InnoDB
that the transactions are already fixed wrt. commit order, as they are in
parallel replication, InnoDB will ignore the gap lock and allow the two
transactions to proceed in parallel, avoiding the conflict.

Improve the fix for MDEV-6020. When InnoDB itself detects a deadlock, it now
asks the server layer for any preferences about which transaction to roll
back. In case of parallel replication with two transactions T1 and T2 fixed to
commit T1 before T2, the server layer will ask InnoDB to roll back T2 as the
deadlock victim, not T1. This helps in some cases to avoid excessive deadlock
rollback, as T2 will in any case need to wait for T1 to complete before it can
itself commit.

Also some misc. fixes found during development and testing:

 - Remove thd_rpl_is_parallel(), it is not used or needed.

 - Use KILL_CONNECTION instead of KILL_QUERY when a parallel replication
   worker thread is killed to resolve a deadlock with fixed commit
   ordering. There are some cases, eg. in sql/sql_parse.cc, where a KILL_QUERY
   can be ignored if the query otherwise completed successfully, and this
   could cause the deadlock kill to be lost, so that the deadlock was not
   correctly resolved.

 - Fix random test failure due to missing wait_for_binlog_checkpoint.inc.

 - Make sure that deadlock or other temporary errors during parallel
   replication are not printed to the the error log; there were some places
   around the replication code with extra error logging. These conditions can
   occur occasionally and are handled automatically without breaking
   replication, so they should not pollute the error log.

 - Fix handling of rgi->gtid_sub_id. We need to be able to access this also at
   the end of a transaction, to be able to detect and resolve deadlocks due to
   commit ordering. But this value was also used as a flag to mark whether
   record_gtid() had been called, by being set to zero, losing the value. Now,
   introduce a separate flag rgi->gtid_pending, so rgi->gtid_sub_id remains
   valid for the entire duration of the transaction.

 - Fix one place where the code to handle ignored errors called reset_killed()
   unconditionally, even if no error was caught that should be ignored. This
   could cause loss of a deadlock kill signal, breaking deadlock detection and
   resolution.

 - Fix a couple of missing mysql_reset_thd_for_next_command(). This could
   cause a prior error condition to remain for the next event executed,
   causing assertions about errors already being set and possibly giving
   incorrect error handling for following event executions.

 - Fix code that cleared thd->rgi_slave in the parallel replication worker
   threads after each event execution; this caused the deadlock detection and
   handling code to not be able to correctly process the associated
   transactions as belonging to replication worker threads.

 - Remove useless error code in slave_background_kill_request().

 - Fix bug where wfc->wakeup_error was not cleared at
   wait_for_commit::unregister_wait_for_prior_commit(). This could cause the
   error condition to wrongly propagate to a later wait_for_prior_commit(),
   causing spurious ER_PRIOR_COMMIT_FAILED errors.

 - Do not put the binlog background thread into the processlist. It causes
   too many result differences in mtr, but also it probably is not useful
   for users to pollute the process list with a system thread that does not
   really perform any user-visible tasks...
2014-06-10 10:13:15 +02:00
Sergey Vojtovich
23a5b2eb6d MDEV-6103 - Adding/removing non-materialized virtual column triggers
table recreation

Relaxed InnoDB/XtraDB checks to allow online add/drop of
non-materialized virtual columns.
2014-06-03 16:57:29 +04:00
Sergei Golubchik
77ec219d58 cmake: mark AIO_LIBRARY, EVENT_LIBRARY, GROFF, NROFF as advanced;
use -ggdb3 if supported
2014-06-03 10:57:57 +02:00
unknown
629b822913 MDEV-5262, MDEV-5914, MDEV-5941, MDEV-6020: Deadlocks during parallel
replication causing replication to fail.

In parallel replication, we run transactions from the master in parallel, but
force them to commit in the same order they did on the master. If we force T1
to commit before T2, but T2 holds eg. a row lock that is needed by T1, we get
a deadlock when T2 waits until T1 has committed.

Usually, we do not run T1 and T2 in parallel if there is a chance that they
can have conflicting locks like this, but there are certain edge cases where
it can occasionally happen (eg. MDEV-5914, MDEV-5941, MDEV-6020). The bug was
that this would cause replication to hang, eventually getting a lock timeout
and causing the slave to stop with error.

With this patch, InnoDB will report back to the upper layer whenever a
transactions T1 is about to do a lock wait on T2. If T1 and T2 are parallel
replication transactions, and T2 needs to commit later than T1, we can thus
detect the deadlock; we then kill T2, setting a flag that causes it to catch
the kill and convert it to a deadlock error; this error will then cause T2 to
roll back and release its locks (so that T1 can commit), and later T2 will be
re-tried and eventually also committed.

The kill happens asynchroneously in a slave background thread; this is
necessary, as the reporting from InnoDB about lock waits happen deep inside
the locking code, at a point where it is not possible to directly call
THD::awake() due to mutexes held.

Deadlock is assumed to be (very) rarely occuring, so this patch tries to
minimise the performance impact on the normal case where no deadlocks occur,
rather than optimise the handling of the occasional deadlock.

Also fix transaction retry due to deadlock when it happens after a transaction
already signalled to later transactions that it started to commit. In this
case we need to undo this signalling (and later redo it when we commit again
during retry), so following transactions will not start too early.

Also add a missing thd->send_kill_message() that got triggered during testing
(this corrects an incorrect fix for MySQL Bug#58933).
2014-06-03 10:31:11 +02:00
Sergei Golubchik
2d687cad5d merge with XtraDB 5.5.37-35.0 2014-06-03 09:53:10 +02:00
Jan Lindström
dabf471547 MDEV-4791: Assertion range_end >= range_start fails in log0online.c
on select from I_S.INNODB_CHANGED_PAGES

Analysis: limit_lsn_range_from_condition() incorrectly parses
start_lsn and/or end_lsn conditions.

Fix from SergeyP. Added some test cases.
2014-05-09 11:43:53 +03:00
Sergei Golubchik
99027efd14 post-fix for the merge of "Bug#16216513 INPLACE ALTER DISABLED FOR PARTITIONED TABLES"
make this innodb-only patch work for other engines as well
2014-05-08 10:25:09 +02:00
Sergei Golubchik
9927b36e87 merge of "Bug#16216513 INPLACE ALTER DISABLED FOR PARTITIONED TABLES"
revno: 4777
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: mysql-5.6
timestamp: Fri 2013-02-15 10:32:25 +0200
message:
  Bug#16216513 INPLACE ALTER DISABLED FOR PARTITIONED TABLES
2014-05-08 10:01:31 +02:00
Sergei Golubchik
a2807e41e8 xtradb 5.6.17-65.0 2014-05-07 17:33:33 +02:00
Sergei Golubchik
b968363aac MDEV-6184 10.0.11 merge
XtraDB 5.6.16-64.2
2014-05-06 10:21:34 +02:00
Jan Lindström
1adf9e7984 MDEV-6257: MariaDB 5.5 fails to start with 10.0 InnoDB log files
Analysis: Can't disable the error message because you may get database
started with incorrect log file size. 

Fix: Thus only improve the error message to give more information 
to users.
2014-05-22 16:20:56 +03:00
Jan Lindström
75137522b9 MDEV-6257: MariaDB 5.5 fails to start with 10.0 InnoDB log files
Analysis: By default 10.0 creates 48M log files and 5.5 assumes they
are 5M.

Fix: Remove the error and do size comparison later.
2014-05-21 13:14:43 +03:00
Jan Lindström
124428a9e2 MDEV-4791: Assertion range_end >= range_start fails in log0online.c
on select from I_S.INNODB_CHANGED_PAGES

Analysis: limit_lsn_range_from_condition() incorrectly parses
start_lsn and/or end_lsn conditions.

Fix from SergeyP. Added some test cases.
2014-05-09 11:03:39 +03:00
Sergei Golubchik
dc23a9501a Solaris compilation failure: xtradb is linked in statically, ha_innodb.so needs
the linker script.
2014-05-01 14:05:52 +02:00
Sergei Golubchik
2797f0c534 fix XtraDB version to tell the truth 2014-04-28 12:11:35 +02:00