1. 27 Jun, 2013 5 commits
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · befacafd
      Sergey Petrunya authored
      - Let Query Plan Footprint store join buffer type 
        in binary form, not string.
      - Same for LooseScan type.
      befacafd
    • Sergey Petrunya's avatar
      More of code cleanup · 5422098b
      Sergey Petrunya authored
      5422098b
    • Sergey Petrunya's avatar
      Code cleanup · c0f7efb1
      Sergey Petrunya authored
      c0f7efb1
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · d634638c
      Sergey Petrunya authored
      - If a subquery is correlated wrt a const table, it will change from
        being a "DEPENDENT SUBQUERY" into "SUBQUERY", at the end of its parent's 
        JOIN::optimize() call.  Handle this, update the subquery's QPF.
      - Make show_explain.test to work
         = "Query plan already deleted" does not happen anymore.
         = Handle special case of queries that don't have top-level selects, like 
           SET x = (SELECT ...)
      
      d634638c
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · 8b7bbcf4
      Sergey Petrunya authored
      - Make query plan be re-saved after the first join execution
        (saving it after JOIN::cleanup is too late because EXPLAIN output 
         is currently produced before that)
      - Handle QPF allocation/deallocation for edge cases, like unsuccessful
        BINLOG command.
      - Work around the problem with UNION's direct subselects not being visible.
      - Update test results ("Using temporary; Using filesort" are now always printed 
        last in the Extra column)
      - This cset gets rid of memory leaks/crashes. Some result mismatches still remain.
      8b7bbcf4
  2. 26 Jun, 2013 1 commit
  3. 21 Jun, 2013 3 commits
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · 79392b93
      Sergey Petrunya authored
      - Support "using index for group-by (scanning) " queries
      79392b93
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · cebdf3de
      Sergey Petrunya authored
      - Handle another specific case where there the JOIN 
        never had a query plan, but had multiple join->cleanup(full=true) calls
      - The idea that there can only be MAX_TABLES subuqeries/unions was 
        wrong. Switch QPF_query to using a Dynamic_array.
        = make Dynamic_array template support size growth. its underlying
          DYNAMIC_ARRAY supports it. (this part will need more polishing)
      cebdf3de
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · af5e128e
      Sergey Petrunya authored
      - Handle statements inside SPs:
        = regular statements
        = SET command, which does not have its own statement.
      
      - Handle execution of subquery from range optimizer: 
        allocate subquery QPFs on the same MEM_ROOT as the whole 
        query plan was allocated.
      af5e128e
  4. 20 Jun, 2013 3 commits
    • Sergey Petrunya's avatar
      Switching [EXPLAIN] UPDATE/DELETE to rely on query plan footprints. · ab4a13b2
      Sergey Petrunya authored
      This requires that subselect's footprints are saved before it is deleted.
      
      Attempt to save select's QPF exposes one to a variety of edge cases:
      - the select may be a UNION's "fake select" which has no valid id
      - optimization may fail in the middle (but subsequent JOIN::optimize() calls
        will succeed, despite the fact that there never was a query plan)
      ab4a13b2
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · 52cfa54c
      Sergey Petrunya authored
      Single table UPDATE/DELETE
      - Correctly print type=SIMPLE vs type=PRIMARY
      - Handle UPDATE/DELETE of mergeable VIEWs: we get the 
        VIEW's select as the first subquery. 
        (MySQL 5.6 doesn't print it because it finds that the
         subquery is not attached to any select)
      52cfa54c
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring · 0a560289
      Sergey Petrunya authored
      - Introduce back QueryPlan/QueryPlanFootprint separation for 
        single-table UPDATEs/DELETEs
      - Create an empty QueryPlanFootprint for all kinds of queries
      
      0a560289
  5. 19 Jun, 2013 1 commit
  6. 18 Jun, 2013 4 commits
  7. 17 Jun, 2013 2 commits
    • Sergey Petrunya's avatar
      [SHOW] EXPLAIN UPDATE/DELETE, code reordering · d97ca5f5
      Sergey Petrunya authored
      - Add further details, the goal is to pass the testsuite
      - SJM-nests are not printed correctly yet.
      d97ca5f5
    • Sergey Petrunya's avatar
      SHOW EXPLAIN UPDATE/DELETE · 03691a77
      Sergey Petrunya authored
      - Introduce "Query Plan Footprints" (abbrev. QPFs)
        QPF is a part of query plan that is 
        1. sufficient to produce EXPLAIN output,
        2. can be used to produce EXPLAIN output even after its subquery/union
           was executed and deleted
        3. is cheap to save so that we can always save query plans
      
      - This patch doesn't fully address #2, we make/save strings for 
        a number of EXPLAIN's columns.  This will be fixed.
      
      03691a77
  8. 27 May, 2013 3 commits
  9. 25 May, 2013 1 commit
  10. 24 May, 2013 1 commit
    • unknown's avatar
      MDEV-4475: Replication from MariaDB 10.0 to 5.5 does not work · 416aed25
      unknown authored
      The problem was the Gtid_list event which is logged to the binlog in
      10.0 and is not understood by the 5.5 server.
      
      This event is supposed to be replaced with a dummy event for 5.5
      servers. But the very first event logged in the very first binlog
      has an empty list of GTID, which makes the event too short to be
      replacable with an empty event.
      
      The fix is to pad the empty Gtid_list event to be big enough to
      be replacable by a dummy event.
      416aed25
  11. 22 May, 2013 1 commit
    • unknown's avatar
      MDEV-26: Global transaction ID. · 1cd6eb5f
      unknown authored
      Change of user interface to be more logical and more in line with expectations
      to work similar to old-style replication.
      
      User can now explicitly choose in CHANGE MASTER whether binlog position is
      taken into account (master_gtid_pos=current_pos) or not (master_gtid_pos=
      slave_pos) when slave connects to master.
      
      @@gtid_pos is replaced by three separate variables @@gtid_slave_pos (can
      be set by user, replicated GTIDs only), @@gtid_binlog_pos (read only), and
      @@gtid_current_pos (a combination of the two, most recent GTID within each
      domain). mysql.rpl_slave_state is renamed to mysql.gtid_slave_pos to match.
      
      This fixes MDEV-4474.
      1cd6eb5f
  12. 16 May, 2013 1 commit
    • unknown's avatar
      Fix race condition in binlog dump thread during server shutdown. · d795bc9f
      unknown authored
      There was missing a check for THD::killed after THD::enter_cond(). This could
      cause the binlog dump thread to miss the kill signal during server shutdown
      and hang until it was force-closed.
      
      Also fix a race in a test case that occasionally fails in Buildbot.
      d795bc9f
  13. 15 May, 2013 1 commit
    • unknown's avatar
      MDEV-26: Global transaction ID. · 9fae9930
      unknown authored
      Implement START SLAVE UNTIL master_gtid_pos = "<GTID position>".
      
      Add test cases, including a test showing how to use this to promote
      a new master among a set of slaves.
      9fae9930
  14. 10 May, 2013 2 commits
    • Michael Widenius's avatar
      Merge of patch lp:~ahiguti100/maria/handlersocket-fix-78 by Akira Higuchi · 7202c21b
      Michael Widenius authored
      A bugfix of HandlerSocket is not applied to mariadb yet
      7202c21b
    • Michael Widenius's avatar
      Added some fixes that should make MyISAM & Aria REPAIR work with more than 4G records · 53d44ad1
      Michael Widenius authored
      - If one specifies --force twice to myisamchk and aria_chk, then we will try to finnish the repair even if sort_buffer would be too small.
        This was done by dynamically allocate buffer handler objects as long as memory lasts.
      - New option for myisamchk and aria_chk: create-missing-keys
      - Changed default size of myisam_sort_buffer_size from 8M to 128M.
      - Changed default size of sort_buffer_size in aria_chk from 128M to 256M.
      - Increased information in error message about 'sort_buffer_size' beeing to small.
      - Print also to 'show warnings' if repair was retried.
      - Increased size of internal sort-buffer-readers from 16K to 128K
      - Changed printing of 'number of records' to use %ll instead of casting to long
      - Changed buffer sizes for myisam and aria to use MY_ALIGN_DOWN() to get same number of bytes allocated on different machines.
      
      
      
      
      
      include/my_global.h:
        Added MY_ALIGN_DOWN() to get previous alignment (for big memory areas)
      include/myisam.h:
        Increased size of types to be able to handle more records
      include/myisamchk.h:
        Increased size of types to be able to handle more records
        Added T_FORCE_SORT_MEMORY to force repair to work even if sort_buffer would not be big enough
      mysql-test/r/myisam.result:
        Updated result
      mysql-test/r/mysqld--help.result:
        Updated result
      mysql-test/r/repair.result:
        Updated result
      mysql-test/suite/maria/maria.result:
        Added test cases for some fixed bugs in MyISAM to verify that Aria doesn't have them too.
      mysql-test/suite/maria/maria.test:
        Added test cases for some fixed bugs in MyISAM to verify that Aria doesn't have them too.
      mysql-test/suite/maria/maria3.result:
        Updated result after sort buffer size increase
      mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result:
        Updated result after sort buffer size increase
      mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic.result:
        Updated result after sort buffer size increase
      mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic.test:
        Updated result after sort buffer size increase
      mysql-test/t/myisam.test:
        Fixed error messages to not print system specific data
      mysql-test/t/repair.test:
        Fixed error messages to not print system specific data
      storage/maria/ha_maria.cc:
        Print also to 'show warnings' if repair was retried
        Changed default size of sort_buffer_size from 128M to 256M (same as in mysqld)
      storage/maria/ma_check.c:
        Renamed USE_BUFFER_INIT -> PAGE_BUFFER_INIT
      storage/maria/ma_sort.c:
        Increased size of internal sort-buffer-readers from 16K to 128K
        Increased size of types to be able to handle more records
        Added support for T_FORCE_SORT_MEMORY
        Don't allocate too many extra BUFFPEK at a time (they are probably not needed)
        Improved error message for "sort_buffer_size is too small"
        Changed printing of 'number of records' to use %ll instead of casting to long
        Fixed bug where maria_update_key_parts() was called too early.
        Fixed bug in detecting result from read_to_buffer().
        Added 'out of memory' checking when calling 'alloc_dynamic()'.
      storage/maria/maria_chk.c:
        Added --create-missing-keys
        If one specifies --force twice then we will try to finnish the repair even if sort_buffer would be too small.
        check_param.sort_buffer_length varialble was used with wrong type.
      storage/maria/maria_def.h:
        Increased size of types to be able to handle more records
        Use MY_ALIGN_DOWN() to get same number of bytes allocated on different machines
        Renamed USE_BUFFER_INIT -> PAGE_BUFFER_INIT
      storage/maria/maria_ftdump.c:
        Renamed USE_BUFFER_INIT -> PAGE_BUFFER_INIT
      storage/maria/maria_read_log.c:
        Use PAGE_BUFFER_INIT for page cache
      storage/myisam/ha_myisam.cc:
        Changed default size of myisam_sort_buffer_size from 8M to 128M
      storage/myisam/mi_check.c:
        Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
      storage/myisam/myisam_ftdump.c:
        Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
      storage/myisam/myisamchk.c:
        Added --create-missing-keys
        If one specifies --force twice then we will try to finnish the repair even if sort_buffer would be too small.
        check_param.sort_buffer_length varialble was used with wrong type.
        Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
      storage/myisam/myisamdef.h:
        Increased SORT_BUFFER_INIT to 64M
        (speeds up repair a lot and most machines have nowadays a lot of memory)
        Use MY_ALIGN_DOWN() to get same number of bytes allocated on different machines
        Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
      storage/myisam/sort.c:
        Increased size of internal sort-buffer-readers from 16K to 128K
        Increased size of types to be able to handle more records
        Added support for T_FORCE_SORT_MEMORY
        Don't allocate too many extra BUFFPEK at a time (they are probably not needed)
        Improved error message for "sort_buffer_size is too small"
        Changed printing of 'number of records' to use %ll instead of casting to long
        Fixed bug in detecting result from read_to_buffer().
        Added 'out of memory' checking when calling 'alloc_dynamic()'.
      53d44ad1
  15. 06 May, 2013 1 commit
  16. 05 May, 2013 1 commit
    • Michael Widenius's avatar
      Fixed errors and compiler warnings found by buildbot · 5333dafa
      Michael Widenius authored
      Solaris fixes:
      - Fixed that wait_timeout_func and wait_timeout tests works on solaris
      - We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO).
      - Fixed that compile-solaris-amd64-debug works (before that we got a wrong ELF class: ELFCLASS64 on linkage)
      - Added missing sync_with_master
      Other bug fixes:
      - Free memory for rpl_global_gtid_binlog_state before exit() to avoid 'accessing uninitalized mutex' error.
      
      
      
      BUILD/FINISH.sh:
        Fixed issues on Solaris with ksh
      BUILD/compile-solaris-amd64-debug:
        Added missing -m64 flag
      configure.cmake:
        We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO)
      mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test:
        - Added missing sync_with_master (fix by knielsen)
      sql-common/client.c:
        Added () to get rid of compiler warning
      sql/item_strfunc.cc:
        Fixed compiler warning
      sql/log.cc:
        Free memory for static variable rpl_global_gtid_binlog_state before exit()
        - If we are compiling with safemalloc, we would try to call sf_free() for some members after sf_terminate() was called, which would result of trying to access the uninitalized mutex 'sf_mutex'
      sql/multi_range_read.cc:
        Fixed compiler warnings of converting double to ulong.
      sql/opt_range.cc:
        Fixed compiler warnings of converting double to ulong or uint
        - Better to have all variables that can be number of rows as 'ha_rows'
      sql/rpl_gtid.cc:
        Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
      sql/rpl_gtid.h:
        Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
      sql/set_var.cc:
        Fixed compiler warning
      sql/sql_join_cache.cc:
        Fixed compiler warnings of converting double to uint
      sql/sql_show.cc:
        Added cast to get rid of compiler warning
      sql/sql_statistics.cc:
        Remove code that didn't do anything.
        (store_record() with record[0] is a no-op)
      storage/xtradb/os/os0file.c:
        Added  __attribute__ ((unused))
      support-files/compiler_warnings.supp:
        Ignore warnings from atomic_add_64_nv
        (was not able to fix this with a cast as the macro is a bit different between systems)
      vio/viosocket.c:
        Added more DBUG_PRINT
      5333dafa
  17. 03 May, 2013 1 commit
    • unknown's avatar
      MDEV-4473: mysql_binlog_send() starts sending events from wrong GTID position... · 5aa0d185
      unknown authored
      MDEV-4473: mysql_binlog_send() starts sending events from wrong GTID position in some master failover scenarios
      
      Suppose binlog file X has in its Gtid_list_event: 0-1-3,0-2-5, and suppose the
      slave requests to start replicating after 0-1-3.
      
      In this case the bug was that master would start sending events from the start
      of X. This is wrong, because 0-2-4 and 0-2-5 are contained in X-1, and are
      needed by the slave. So these events were lost.
      
      On the other hand, if the slave requested 0-2-5, then it _is_ correct to start
      sending from the beginning of binlog file X, because 0-2-5 is the last GTID
      logged in earlier binlogs. The difference is that 0-2-5 is the last of the
      GTIDs in the Gtid_list_event. The problem was that the code did not check that
      the matched GTID was the last one in the list.
      
      Fixed by checking if the gtid requested by slave that matches a gtid in the
      Gtid_list_event is the last event for that domain in the list. If not, go back
      to a prior binlog to ensure all needed events are sent to slave.
      
      mysql-test/include/show_events.inc:
        Backport --let $binlog_file=LAST, used by MDEV-4473 test case.
      5aa0d185
  18. 02 May, 2013 2 commits
    • Michael Widenius's avatar
      Instead of writing "Errcode" to the log for Slave errors, use "Internal MariaDB error code" · eb75edfb
      Michael Widenius authored
      This makes it clear that the error code has nothing to do with errno.
      
      
      mysql-test/include/mtr_warnings.sql:
        Fixed suppression for new slave error messages
      mysql-test/lib/My/Test.pm:
        Use 'send' instead of 'print' to avoid errors about "wrong class ... back attempt"
      mysql-test/lib/v1/mtr_report.pl:
        Fixed suppression for new slave error messages
      mysql-test/mysql-test-run.pl:
        Fixed suppression for new slave error messages
        Removed warning from perl 5.16.2 about arrays
      mysql-test/r/flush_read_lock.result:
        Fixed suppression for new slave error messages
      sql/rpl_reporting.cc:
        Instead of writing "Errcode" to the log for Slave errors, use "Internal MariaDB error code"
      eb75edfb
    • Michael Widenius's avatar
      Fixed: MDEV-4352; LOAD DATA was not multi-source safe · 8cdb118a
      Michael Widenius authored
      - Calls to cleanup_load_tmpdir() could delete temporary files for another master connection
      - Concurrent LOAD DATA commands from two master connections could use the same file name
      
      Other bug fixes:
      - Enlarge buffer for connection names with 'special characters' one can't store in filenames
      
      Optimization:
      - Don't do 'lower case' of connection names. We can use cmp_connection_name, where we already have the connection name in lower case.
      
      
      mysql-test/suite/multi_source/load_data.result:
        Test case for MDEV-4352
      mysql-test/suite/multi_source/load_data.test:
        Test case for MDEV-4352
      sql/log_event.cc:
        Fixed: MDEV-4352
        - Calls to cleanup_load_tmpdir() could delete temporary files for another master connection
        - Concurrent LOAD DATA commands from two master connections could use the same file name
        
        The fix was to add the connection name (if one exists) to all slave temporary files used by LOAD DATA
      sql/rpl_mi.cc:
        Enlarge buffer for connection names with 'special characters' one can't store in filenames
        Use mi->cmp_connection_name for connection file names.
      sql/rpl_rli.cc:
        Use mi->cmp_connection_name for connection file names.
      sql/slave.cc:
        Removed not needed empty line
      sql/sql_const.h:
        Added MAX_FILENAME_MBWIDTH to be able to calculate buffer length for connection_names stored in file names
      sql/sql_repl.cc:
        Use mi->cmp_connection_name for connection file names.
      8cdb118a
  19. 29 Apr, 2013 1 commit
  20. 25 Apr, 2013 1 commit
    • unknown's avatar
      Fix more failures in buildbot. · ced65e21
      unknown authored
      Server shutdown timeout of 10 seconds in test cases is too little for heavily
      loaded test servers.
      
      Fix innodb_bug12902967 to not fail with wrong error log output if we have
      warnings about too few AIO handles for InnoDB.
      
      Fix typo which could lead to unnecessarily replacing GTID event with dummy
      event.
      ced65e21
  21. 24 Apr, 2013 1 commit
    • unknown's avatar
      Add missing check for thd->killed in mysql_binlog_send(). · 6b97512b
      unknown authored
      The slave dump thread running on the master only checked thd->killed whenever
      it reached the end of a binlog file, not between events. This could
      unnecessarily delay server shutdown.
      
      This was found by code inspection while tracking down some occasional "forcing
      close of thread..." errors in Buildbot. Hopefully this will fix the failures,
      but the fix is correct in any case.
      
      Also increase the wait during server shutdown, 2 seconds is a bit tight in
      case of heavy I/O stall, and it seems better to delay shutdown a bit than
      force-kill threads unnecessarily.
      
      Also fix some races in test cases that restart the mysqld server. The .expect
      file should be changed with --append_file, --remove_file + --write_file
      creates a short window where mysqld can error out due to .expect file missing.
      6b97512b
  22. 22 Apr, 2013 3 commits