An error occurred fetching the project authors.
  1. 04 Mar, 2014 1 commit
    • unknown's avatar
      MDEV-5769: Slave crashes on attempt to do parallel replication from an older master · ec374f1e
      unknown authored
      Older master has no GTID events, so such events are not available for
      deciding on scheduling of event groups and so on.
      
      With this patch, we run such events from old masters single-threaded, in the
      sql driver thread.
      
      This seems better than trying to make the parallel code handle the data from
      older masters; while possible, this would require a lot of testing (as well as
      possibly some extra overhead in the scheduling of events), which hardly seems
      worthwhile.
      ec374f1e
  2. 03 Mar, 2014 1 commit
    • unknown's avatar
      MDEV-5764: START SLAVE UNTIL does not work with parallel replication · 641feed4
      unknown authored
      With parallel replication, there can be any number of events queued on
      in-memory lists in the worker threads.
      
      For normal STOP SLAVE, we want to skip executing any remaining events on those
      lists and stop as quickly as possible.
      
      However, for START SLAVE UNTIL, when the UNTIL position is reached in the SQL
      driver thread, we must _not_ stop until all already queued events for the
      workers have been executed - otherwise we would stop too early, before the
      actual UNTIL position had been completely reached.
      
      The code did not handle UNTIL correctly, stopping too early due to not
      executing the queued events to completion. Fix this, and also implement that
      an explicit STOP SLAVE in the middle (when the SQL driver thread has reached
      the UNTIL position but the workers have not) _will_ cause an immediate stop.
      641feed4
  3. 26 Feb, 2014 1 commit
    • unknown's avatar
      MDEV-5657: Parallel replication. · e90f68c0
      unknown authored
      Clean up and improve the parallel implementation code, mainly related to
      scheduling of work to threads and handling of stop and errors.
      
      Fix a lot of bugs in various corner cases that could lead to crashes or
      corruption.
      
      Fix that a single replication domain could easily grab all worker threads and
      stall all other domains; now a configuration variable
      --slave-domain-parallel-threads allows to limit the number of
      workers.
      
      Allow next event group to start as soon as previous group begins the commit
      phase (as opposed to when it ends it); this allows multiple event groups on
      the slave to participate in group commit, even when no other opportunities for
      parallelism are available.
      
      Various fixes:
      
       - Fix some races in the rpl.rpl_parallel test case.
      
       - Fix an old incorrect assertion in Log_event iocache read.
      
       - Fix repeated malloc/free of wait_for_commit and rpl_group_info objects.
      
       - Simplify wait_for_commit wakeup logic.
      
       - Fix one case in queue_for_group_commit() where killing one thread would
         fail to correctly signal the error to the next, causing loss of the
         transaction after slave restart.
      
       - Fix leaking of pthreads (and their allocated stack) due to missing
         PTHREAD_CREATE_DETACHED attribute.
      
       - Fix how one batch of group-committed transactions wait for the previous
         batch before starting to execute themselves. The old code had a very
         complex scheduling where the first transaction was handled differently,
         with subtle bugs in corner cases. Now each event group is always scheduled
         for a new worker (in a round-robin fashion amongst available workers).
         Keep a count of how many transactions have started to commit, and wait for
         that counter to reach the appropriate value.
      
       - Fix slave stop to wait for all workers to actually complete processing;
         before, the wait was for update of last_committed_sub_id, which happens a
         bit earlier, and could leave worker threads potentially accessing bits of
         the replication state that is no longer valid after slave stop.
      
       - Fix a couple of places where the test suite would kill a thread waiting
         inside enter_cond() in connection with debug_sync; debug_sync + kill can
         crash in rare cases due to a race with mysys_var_current_mutex in this
         case.
      
       - Fix some corner cases where we had enter_cond() but no exit_cond().
      
       - Fix that we could get failure in wait_for_prior_commit() but forget to flag
         the error with my_error().
      
       - Fix slave stop (both for normal stop and stop due to error). Now, at stop
         we pick a specific safe point (in terms of event groups executed) and make
         sure that all event groups before that point are executed to completion,
         and that no event group after start executing; this ensures a safe place to
         restart replication, even for non-transactional stuff/DDL. In error stop,
         make sure that all prior event groups are allowed to execute to completion,
         and that any later event groups that have started are rolled back, if
         possible. The old code could leave eg. T1 and T3 committed but T2 not, or
         it could even leave half a transaction not rolled back in some random
         worker, which would cause big problems when that worker was later reused
         after slave restart.
      
       - Fix the accounting of amount of events queued for one worker. Before, the
         amount was reduced immediately as soon as the events were dequeued (which
         happens all at once); this allowed twice the amount of events to be queued
         in memory for each single worker, which is not what users would expect.
      
       - Fix that an error set during execution of one event was sometimes not
         cleared before executing the next, causing problems with the error
         reporting.
      
       - Fix incorrect handling of thd->killed in worker threads.
      e90f68c0
  4. 08 Jan, 2014 1 commit
    • unknown's avatar
      MDEV-5509: Seconds_behind_master incorrect in parallel replication · 8cc6e90d
      unknown authored
      The problem was a race between the SQL driver thread and the worker threads.
      The SQL driver thread would set rli->last_master_timestamp to zero to
      mark that it has caught up with the master, while the worker threads would
      set it to the timestamp of the executed event. This can happen out-of-order
      in parallel replication, causing the "caught up" status to be overwritten
      and Seconds_Behind_Master to wrongly grow when the slave is idle.
      
      To fix, introduce a separate flag rli->sql_thread_caught_up to mark that the
      SQL driver thread is caught up. This avoids issues with worker threads
      overwriting the SQL driver thread status. In parallel replication, we then
      make SHOW SLAVE STATUS check in addition that all worker threads are idle
      before showing Seconds_Behind_Master as 0 due to slave idle.
      8cc6e90d
  5. 05 Nov, 2013 1 commit
    • unknown's avatar
      MDEV-4506: Parallel replication · c834242a
      unknown authored
      MDEV-5217: SQL thread hangs during stop if error occurs in the middle of an event group
      
      Normally, when we stop the slave SQL thread in parallel replication, we want
      the worker threads to continue processing events until the end of the current
      event group. But if we stop due to an error that prevents further events from
      being queued, such as an error reading the relay log, no more events can be
      queued for the workers, so they have to abort even if they are in the middle
      of an event group. There was a bug that we would deadlock, the workers
      waiting for more events to be queued for the event group, the SQL thread
      stopped and waiting for the workers to complete their current event group
      before exiting.
      
      Fixed by now signalling from the SQL thread to all workers when it is about
      to exit, and cleaning up in all workers when so signalled.
      
      This patch fixes one of multiple problems reported in MDEV-5217.
      c834242a
  6. 31 Oct, 2013 1 commit
    • unknown's avatar
      MDEV-5206: Incorrect slave old-style position in MDEV-4506, parallel replication. · 39df665a
      unknown authored
      In parallel replication, there are two kinds of events which are
      executed in different ways.
      
      Normal events that are part of event groups/transactions are executed
      asynchroneously by being queued for a worker thread.
      
      Other events like format description and rotate and such are executed
      directly in the driver SQL thread.
      
      If the direct execution of the other events were to update the old-style
      position, then the position gets updated too far ahead, before the normal
      events that have been queued for a worker thread have been executed. So
      this patch adds some special cases to prevent such position updates ahead
      of time, and instead queues dummy events for the worker threads, so that
      they will at an appropriate time do the position updates instead.
      
      (Also fix a race in a test case that happened to trigger while running
      tests for this patch).
      39df665a
  7. 24 Oct, 2013 1 commit
  8. 23 Oct, 2013 1 commit
    • unknown's avatar
      MDEV-4506: Parallel replication. · a09d2b10
      unknown authored
      Fix some more parts of old-style position updates.
      Now we save in rgi some coordinates for master log and relay log, so
      that in do_update_pos() we can use the right set of coordinates with
      the right events.
      
      The Rotate_log_event::do_update_pos() is fixed in the parallel case
      to not directly update relay-log.info (as Rotate event runs directly
      in the driver SQL thread, ahead of actual event execution). Instead,
      group_master_log_file is updated as part of do_update_pos() in each
      event execution.
      
      In the parallel case, position updates happen in parallel without
      any ordering, but taking care that position is not updated backwards.
      Since position update happens only after event execution this leads
      to the right result.
      
      Also fix an access-after-free introduced in an earlier commit.
      a09d2b10
  9. 17 Oct, 2013 1 commit
    • unknown's avatar
      MDEV-4506: Parallel replication: Intermediate commit. · 7681c6aa
      unknown authored
      Fix some part of update of old-style coordinates in parallel replication:
      
       - Ignore XtraDB request for old-style coordinates, not meaningful for
         parallel replication (must use GTID to get crash-safe parallel slave).
      
       - Only update relay log coordinates forward, not backwards, to ensure
         that parallel threads do not conflict with each other.
      
       - Move future_event_relay_log_pos to rgi.
      7681c6aa
  10. 08 Oct, 2013 1 commit
    • unknown's avatar
      MDEV-4506: Parallel replication. · 12c760ef
      unknown authored
      Improve STOP SLAVE in parallel mode.
      
      Now, the parallel part will queue the current event group to the
      end, and then stop queing any more events. Each worker will
      complete the current event group, and then just skip any further
      queued events.
      12c760ef
  11. 30 Sep, 2013 1 commit
  12. 23 Sep, 2013 1 commit
  13. 17 Sep, 2013 1 commit
  14. 13 Sep, 2013 1 commit
  15. 08 Jul, 2013 1 commit
    • unknown's avatar
      MDEV-4506: Parallel replication: intermediate commit. · a99356fb
      unknown authored
      Fix a bunch of issues found with locking, ordering, and non-thread-safe stuff
      in Relay_log_info.
      
      Now able to do a simple benchmark, showing 4.5 times speedup for applying a
      binlog with 10000 REPLACE statements.
      a99356fb
  16. 04 Jul, 2013 2 commits
    • unknown's avatar
      MDEV-4506: Parallel replication: Intermediate commit. · e654be38
      unknown authored
      Impement options --binlog-commit-wait-count and
      --binlog-commit-wait-usec.
      
      These options permit the DBA to deliberately increase latency
      of an individual commit to get more transactions in each
      binlog group commit. This increases the opportunity for
      parallel replication on the slave, and can also decrease I/O
      load on the master.
      
      The options also make it easier to test the parallel
      replication with mysql-test-run.
      e654be38
    • unknown's avatar
      MDEV-4506: Parallel replication: Intermediate commit. · a1cfd473
      unknown authored
      Wait for all worker threads to finish when stopping the SQL thread.
      (Only a basic wait; this still needs to be fixed to include timeout
      logic as in sql_slave_killed()).
      a1cfd473
  17. 03 Jul, 2013 1 commit
    • unknown's avatar
      MDEV-4506: Parallel replication. Intermediate commit. · 31a5edb5
      unknown authored
      Hook in the wait-for-prior-commit logic (not really tested yet).
      Clean up some resource maintenance around rpl_group_info (may still be some
      smaller issues there though).
      Add a ToDo list at the top of rpl_parallel.cc
      31a5edb5
  18. 28 Jun, 2013 1 commit
  19. 24 Jun, 2013 1 commit