Commit graph

175448 commits

Author SHA1 Message Date
sensssz
fd30d07f23 Style fixes. 2016-10-23 13:17:30 -04:00
sensssz
149581a643 Remove unnecessary changes. Apply changes to XtraDB. 2016-10-22 15:01:37 -04:00
sensssz
04f241a4a2 Add a NULL check for thd_is_replication_slave_thread 2016-10-22 10:22:03 -04:00
sensssz
adaebd25eb A few bug fixes. Use thd_is_slave_replication. 2016-10-22 10:19:41 -04:00
Kristian Nielsen
82b974a1b6 Merge MDEV-11064: "Restrict the speed of reading binlog from Master" into 10.2 2016-10-21 17:37:30 +02:00
vinchen
9970e81f10 fix the ABI check 2016-10-21 13:37:48 +02:00
vinchen
07f09df92b fix the ABI and stop slave hang problem 2016-10-21 13:37:48 +02:00
Kristian Nielsen
c06bc66816 MDEV-11065: Compressed binary log
Minor review comments/changes:

 - A bunch of style-fixes.

 - Change macros to static inline functions.

 - Update check_event_type() with compressed event types.

 - Small .result file update.
2016-10-20 18:00:59 +02:00
vinchen
e1c502879f test suite for compressed binlog event 2016-10-19 20:20:47 +02:00
vinchen
d4b2c9bb1a optimize the memory allocation for compressed binlog event 2016-10-19 20:20:47 +02:00
vinchen
640051e06a Binlog compressed
Add some event types for the compressed event, there are:
     QUERY_COMPRESSED_EVENT,
     WRITE_ROWS_COMPRESSED_EVENT_V1,
     UPDATE_ROWS_COMPRESSED_EVENT_V1,
     DELETE_POWS_COMPRESSED_EVENT_V1,
     WRITE_ROWS_COMPRESSED_EVENT,
     UPDATE_ROWS_COMPRESSED_EVENT,
     DELETE_POWS_COMPRESSED_EVENT.
These events inheritance the uncompressed editor events. One of their constructor functions and write
function have been overridden for uncompressing and compressing. Anything but this is totally the same.

On slave, The IO thread will uncompress and convert them When it receiving the events from the master.
So the SQL and worker threads can be stay unchanged.

Now we use zlib as compress algorithm. It maybe support other algorithm in the future.
2016-10-19 20:20:35 +02:00
sensssz
36841ac799 Add INNODB_LOCK_SCHEDULE_ALGORITHM to sysvars_innodb.result 2016-10-19 10:10:22 -04:00
vinchen
0fa39ffba7 fix code style.. 2016-10-19 13:52:17 +02:00
vinchen
c334f4fe46 fix the code style for read_binlog_speed_limit 2016-10-19 13:52:17 +02:00
vinchen
ef77847ccf fix common test suite 2016-10-19 13:51:49 +02:00
vinchen
43789901c7 Control the binlog read speed for compressed protocol 2016-10-19 13:51:08 +02:00
vinchen
8eb0f5ca1a Control the Maximum speed(KB/s) to read binlog from master 2016-10-19 13:51:08 +02:00
Alexey Botchkov
27025221fe MDEV-9143 JSON_xxx functions.
strings/json_lib.c added as a JSON library.
        SQL frunction added with sql/item_jsonfunc.h/cc
2016-10-19 14:10:03 +04:00
sensssz
f62fd5add8 Bug fix: remove redundant code from check_deadlock_result. Remove assert. 2016-10-19 01:46:57 -04:00
sensssz
0f93b5331e Merge branch '10.2-vats' of https://github.com/sensssz/server into 10.2-vats
Rebase
2016-10-19 01:42:34 -04:00
sensssz
0e60f89c29 Change VATS implementation. 2016-10-19 01:42:10 -04:00
sensssz
03b3425d31 Disable VATS on slave servers during replication. 2016-10-19 01:42:10 -04:00
sensssz
c455898b2c Implement VATS in XtraDB and InnoDB. 2016-10-19 01:42:10 -04:00
sensssz
5661b5c1d2 Change VATS implementation. 2016-10-19 01:37:52 -04:00
sensssz
5c40954798 Merge branch '10.2-vats' of https://github.com/sensssz/server into 10.2-vats
Sync upstream and rebase.
2016-10-18 10:29:02 -04:00
sensssz
a9bdea5d14 Disable VATS on slave servers during replication. 2016-10-18 10:28:05 -04:00
sensssz
0b7c35cd6a Implement VATS in XtraDB and InnoDB. 2016-10-18 10:28:05 -04:00
sensssz
88519c99c2 Disable VATS on slave servers during replication. 2016-10-18 09:52:39 -04:00
sensssz
87abc87004 Implement VATS in XtraDB and InnoDB. 2016-10-17 21:56:05 -04:00
Sergey Vojtovich
8303aded29 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.
2016-10-17 18:35:49 +04:00
Sergey Vojtovich
2b47f8ff03 MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes
Clean-up periodic mutex/rwlock waiters wake up. This was a hack needed to
workaround broken mutexes/rwlocks implementation. We must have sane
implementations now and don't need these anymore: release thread is
guaranteed to wake up waiters.

Removed redundant ifdef that has equivalent code in both branches.

Removed os0atomic.h and os0atomic.ic: not used anymore.

Clean-up unused cmake checks.
2016-10-17 18:35:49 +04:00
Sergey Vojtovich
5608a737ea MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes
No point to issue RELEASE memory barrier in os_thread_create_func(): thread
creation is full memory barrier.

No point to issue os_wmb in rw_lock_set_waiter_flag() and
rw_lock_reset_waiter_flag(): this is deadcode and it is unlikely operational
anyway. If atomic builtins are unavailable - memory barriers are most certainly
unavailable too.

RELEASE memory barrier is definitely abused in buf_pool_withdraw_blocks(): most
probably it was supposed to commit volatile variable update, which is not what
memory barriers actually do. To operate properly it needs corresponding ACQUIRE
barrier without an associated atomic operation anyway.

ACQUIRE memory barrier is definitely abused in log_write_up_to(): most probably
it was supposed to synchronize dirty read of log_sys->write_lsn. To operate
properly it needs corresponding RELEASE barrier without an associated atomic
operation anyway.

Removed a bunch of ACQUIRE memory barriers from InnoDB rwlocks. They're
meaningless without corresponding RELEASE memory barriers.

Valid usage example of memory barriers without an associated atomic operation:
http://en.cppreference.com/w/cpp/atomic/atomic_thread_fence
2016-10-17 18:35:49 +04:00
Sergey Vojtovich
f4d885c4e9 MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes
Replaced InnoDB atomic operations with server atomic operations.

Moved INNODB_RW_LOCKS_USE_ATOMICS - it is always defined (code won't compile
otherwise).

NOTE: InnoDB uses thread identifiers as a target for atomic operations.
Thread identifiers should be considered opaque: any attempt to use a
thread ID other than in pthreads calls is nonportable and can lead to
unspecified results.
2016-10-17 18:35:48 +04:00
Sergey Vojtovich
d055e28f61 MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes
Simplified InnoDB mutex implementations, corrected memory barriers usage, use
server atomic builtins.
2016-10-17 18:35:48 +04:00
Kristian Nielsen
cc49f00994 Move InnoDB/XtraDB to async deadlock kill for parallel replication.
In 10.2, use the thd_rpl_deadlock_check() API. This way, all the
locking hacks around thd_report_wait_for() can be removed. Now
parallel replication deadlock kill happens asynchroneously, from the
slave background thread.

In InnoDB, remove also the buffering of wait reports, to simplify the
code, as this is no longer needed when the locking issues are gone.

In XtraDB, the buffering is kept for now. This is just because
presumably XtraDB will eventually be updated to MySQL 5.7-based InnoDB
as well, so there is little need to modify the existing code only for
clean-up purposes.

The old synchronous function thd_report_wait_for() is no longer used
and removed in this patch.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-17 12:52:14 +02:00
Elena Stepanova
4d3e3669ec MDEV-11061 Valgrind builder produces warnings with OpenSSL 2016-10-17 00:59:02 +03:00
Kristian Nielsen
e1ef99c3dc MDEV-7145: Delayed replication
Merge feature into 10.2 from feature branch.

Delayed replication adds an option

  CHANGE MASTER TO master_delay=<seconds>

Replication will then delay applying events with that many
seconds. This creates a replication slave that reflects the state of
the master some time in the past.

Feature is ported from MySQL source tree.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-16 23:44:44 +02:00
Vladislav Vaintroub
057c560ee4 MDEV-10943 . Workaround linker error on Linux. Linux does not actually use __bss_start, put __bss_start into #ifndef __linux__ section 2016-10-15 02:27:28 +02:00
Kristian Nielsen
fb13616518 MDEV-7145: Delayed replication.
Add test cases for delayed slave with parallel replication.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:59 +02:00
Kristian Nielsen
3011060b2a MDEV-7145: Delayed slave.
Extend to work also for parallel replication.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:59 +02:00
Kristian Nielsen
09136ec304 MDEV-7145, Delayed slave.
Only run testcase in --big. It takes a long time due to excessive sleeps.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:59 +02:00
Kristian Nielsen
814880711f BUG#56442: Slave executes delayed statements when STOP SLAVE is issued
Problem:
When using the delayed slave feature, and the SQL thread is delaying,
and the user issues STOP SLAVE, the event we wait for was executed.
It should not be executed.
Fix:
Check the return value from the delay function,
slave.cc:slave_sleep(). If the return value is 1, it means the thread
has been stopped, in this case we don't execute the statement.

Also, refactored the test case for delayed slave a little: added the
test script include/rpl_assert.inc, which asserts that a condition holds
and prints a message if not. Made rpl_delayed_slave.test use this. The
advantage is that the test file is much easier to read and maintain,
because it is clear what is an assertion and what is not, and also the
expected result can be found in the test file, you don't have to compare
it to the result file.

Manually merged into MariaDB from MySQL commit
fd2b210383358fe7697f201e19ac9779879ba72a

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:59 +02:00
Kristian Nielsen
851c401c0d MDEV-7145: Delayed replication, fix wsrep build failure.
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:59 +02:00
Kristian Nielsen
b2bc6dadee MDEV-7145: Delayed replication, cleanup some code
The original MySQL patch left some refactoring todo's, possibly
because of known conflicts with other parallel development (like
info-repository feature perhaps).

This patch fixes those todos/refactorings.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:59 +02:00
Kristian Nielsen
a9fb480fd6 MDEV-7145: Delayed replication, fixing test failures.
Two merge error fixed, and testsuite updated to removed some other
test failues.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:58 +02:00
Kristian Nielsen
19abe79fd1 MDEV-7145: Delayed replication, intermediate commit.
Initial merge of delayed replication from MySQL git.

The code from the initial push into MySQL is merged, and the
associated test case passes. A number of tasks are still pending:

1. Check full test suite run for any regressions or .result file updates.

2. Extend the feature to also work for parallel replication.

3. There are some todo-comments about future refactoring left from
MySQL, these should be located and merged on top.

4. There are some later related MySQL commits, these should be checked
and merged. These include:
    e134b9362ba0b750d6ac1b444780019622d14aa5
    b38f0f7857c073edfcc0a64675b7f7ede04be00f
    fd2b210383358fe7697f201e19ac9779879ba72a
    afc397376ec50e96b2918ee64e48baf4dda0d37d

5. The testcase from MySQL relies heavily on sleep and timing for
testing, and seems likely to sporadically fail on heavily loaded test
servers in buildbot or distro build farms.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 23:15:58 +02:00
Kristian Nielsen
50f19ca809 Remove unnecessary global mutex in parallel replication.
The function apply_event_and_update_pos() is called with the
rli->data_lock mutex held. However, there seems to be nothing in the
function actually needing the mutex to be held. Certainly not in the
parallel replication case, where sql_slave_skip_counter is always 0
since the non-zero case is handled by the SQL driver thread.

So this patch makes parallel replication use a variant of
apply_event_and_update_pos() without the need to take the
rli->data_lock mutex. This avoids one contended global mutex for each
event executed, which might improve performance on CPU-bound workloads
somewhat.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2016-10-14 22:44:40 +02:00
Sergei Petrunia
b8b1b928ff MDEV-8359: WHERE condition referring to inner table of left join can be sargable
Implement a technique mentioned in the MDEV. Under certain conditions,
cond(inner_table.col) can be substituted for cond(outer_table.col) for
the purpose of range analysis.
2016-10-14 00:05:13 +03:00
Elena Stepanova
9208b87f18 Follow-up for big error-message cleanup (trailing dots were removed) 2016-10-13 16:54:59 +03:00
Alexander Barkov
5058ced5df MDEV-7769 MY_CHARSET_INFO refactoring# On branch 10.2
Part 3 (final): removing MY_CHARSET_HANDLER::well_formed_len().
2016-10-10 14:36:09 +04:00