1. 28 Jun, 2023 10 commits
    • Yuchen Pei's avatar
      MDEV-31421 Fix spider test cleanup · 4e0cec38
      Yuchen Pei authored
      This fixes mdev_26541.test, and the new clean_up_spider.inc will be
      useful for other tests where part of deinit_spider does not apply,
      e.g. those testing spider initialisation only.
      4e0cec38
    • Yuchen Pei's avatar
      MDEV-22979 MDEV-27233 MDEV-28218 Fixing spider init bugs · 7d1f6656
      Yuchen Pei authored
      Fix spider init bugs (MDEV-22979, MDEV-27233, MDEV-28218) while
      preventing regression on old ones (MDEV-30370, MDEV-29904)
      
      Two things are changed:
      
      First, Spider initialisation is made fully synchronous, i.e. it no
      longer happens in a background thread. Adapted from the original fix
      by nayuta for MDEV-27233. This change itself would cause failure when
      spider is initialised early, by plugin-load-add, due to dependency on
      Aria and udf function creation, which are fixed in the second and
      third parts below. Requires SQL Service, thus porting earlier versions
      requires MDEV-27595
      
      Second, if spider is initialised before udf_init(), create udf by
      inserting into `mysql.func`, otherwise do it by `CREATE FUNCTION` as
      usual. This change may be generalised in MDEV-31401.
      
      Also factor out some clean-up queries from deinit_spider.inc for use
      of spider init tests.
      
      A minor caveat is that early spider initialisation will fail if the
      server is bootstrapped for the first time, due to missing `mysql`
      database which needs to be created by the bootstrap script.
      7d1f6656
    • Yuchen Pei's avatar
      MDEV-27095 clean up spd_init_query.h · 868fbef0
      Yuchen Pei authored
      Removing procedures that were created and dropped during init.
      
      This also fixes a race condition where mtr test with
      plugin-load-add=ha_spider.so causes post test check to fail as it
      expects the procedures to still be there.
      868fbef0
    • Yuchen Pei's avatar
      MDEV-27095 installing one spider plugin should not trigger others · e1688e9f
      Yuchen Pei authored
      There are several plugins in ha_spider: spider, spider_alloc_mem,
      spider_wrapper_protocols, spider_rewrite etc.
      
      INSTALL PLUGIN foo SONAME ha_spider causes all the other ones to be
      installed by the init queries where foo is any of the plugins.
      
      This introduces unnecessary complexiy. For example it reads
      mysql.plugins to find all other plugins, causing the hack of moving
      spider plugin init to a separate thread.
      
      To install all spider related plugins, install soname ha_spider should
      be used instead.
      
      This also fixes spurious rows in mysql.plugin when installing say only
      the spider plugin with `plugin-load-add=SPIDER=ha_spider.so`:
      
      select * from mysql.plugin;
      name	dl
      spider_alloc_mem	ha_spider.so # should not be here
      spider_wrapper_protocols	ha_spider.so # should not be here
      
      Adapted from part of the reverted commit
      c160a115.
      e1688e9f
    • Yuchen Pei's avatar
      MDEV-31400 Simple plugin dependency resolution · 48ce21a5
      Yuchen Pei authored
      We introduce simple plugin dependency. A plugin init function may
      return HA_ERR_RETRY_INIT. If this happens during server startup when
      the server is trying to initialise all plugins, the failed plugins
      will be retried, until no more plugins succeed in initialisation or
      want to be retried.
      
      This will fix spider init bugs which is caused in part by its
      dependency on Aria for initialisation.
      
      The reason we need a new return code, instead of treating every
      failure as a request for retry, is that it may be impossible to clean
      up after a failed plugin initialisation. Take InnoDB for example, it
      has a global variable `buf_page_cleaner_is_active`, which may not
      satisfy an assertion during a second initialisation try, probably
      because InnoDB does not expect the initialisation to be called
      twice. A test that may fail because of this is
      `encryption.corrupted_during_recovery`, see for example[1], which is
      tested at 73835f64b7fc245d38812380685aca03bef72bb5, a previous commit
      where we retry every failed plugin.
      
      [1] https://buildbot.mariadb.org/#/builders/369/builds/10107/steps/7/logs/stdio
      48ce21a5
    • Yuchen Pei's avatar
      MDEV-30542 Fixing spider/bugfix.self_reference_multi · 4917b790
      Yuchen Pei authored
      The server needs to have a unique name
      4917b790
    • Yuchen Pei's avatar
      MDEV-31101 Spider: temporarily disable mdev_29904.test · 340a3da8
      Yuchen Pei authored
      Will re-enable once MDEV-31101 is no longer blocked by MDEV-22979,
      as the patch for the latter might fix the former.
      340a3da8
    • Yuchen Pei's avatar
      MDEV-29447 MDEV-26285 MDEV-31338 Refactor spider_db_mbase_util::open_item_func · 1f7b95e5
      Yuchen Pei authored
      spider_db_mbase_util::open_item_func() is a monster function.
      It is difficult to maintain while it is expected that we need to
      modify it when a new SQL function or a new func_type is added.
      
      We split the function into two distinct functions: one handles the
      case of str != NULL and the other handles the case of str == NULL.
      
      This refactoring was done in a conservative way because we do not
      have comprehensive tests on the function.
      
      It also fixes MDEV-29447 and MDEV-31338 where field items that are
      arguments of a func item may be used before created / initialised.
      
      Note this commit is adapted from a patch by Nayuta for MDEV-26285.
      1f7b95e5
    • Yuchen Pei's avatar
      MDEV-30435 MDEV-30981 Fix ubsan errors w.r.t. memcpy in spd_trx.cc · 39c49f06
      Yuchen Pei authored
      Extract the indexed string memcopy pattern in spd_trx.cc to a static
      inline function.
      
      Also updated the ubsan check in mdev_26541.test (h/t roel).
      39c49f06
    • Yuchen Pei's avatar
      MDEV-31463 Spider should check connection before setting lock wait timeout · 5ef27d27
      Yuchen Pei authored
      When setting the server lockwait timeout, spider should do some basic
      checks first, like whether the remote server is still reachable. So
      instead of directly calling spider_db_mbase::exec_query(), it should
      call spider_db_query().
      
      The reset of the lock wait timeout does not need to do such checks,
      because they happen after the successfully setting the lock wait
      timeout, implying the checks have been passed already.
      5ef27d27
  2. 26 Jun, 2023 1 commit
  3. 25 Jun, 2023 2 commits
  4. 21 Jun, 2023 2 commits
  5. 18 Jun, 2023 1 commit
  6. 08 Jun, 2023 14 commits
  7. 07 Jun, 2023 10 commits
    • Oleksandr Byelkin's avatar
      Merge branch '10.6' into 10.6.14 · 04f0b955
      Oleksandr Byelkin authored
      04f0b955
    • Monty's avatar
      MDEV-30944 Range_rowid_filter::fill() leaves file->keyread at MAX_KEY · ded4ed32
      Monty authored
      This test case exposed 2 different bugs:
      - When replacing a range with an index scan on a covering key
        in test_if_skip_sort_order() we didn't disable filtering.
        Filtering does not make much sense in this case.
        - Fixed by disabling filtering in this case.
      - Range_rowid_filter::fill() did not take into account that keyread
        could already active, which caused an assert when it tried to
        activate another keyread.
        - Fixed by remembering old keyread state at start and restoring it
          at end.
      
      Other things:
      - ha_start_keyread() allowed multiple calls. This is wrong, especially
        as we do no check if the index changed!
        I added an assert() to ensure that we don't call it there is already
        an active keyread.
      - ha_end_keyread() always called ha_extra(), even if keyread was not
        active.  Added a check to avoid the extra call.
      ded4ed32
    • Monty's avatar
      3ea8f306
    • Monty's avatar
      MDEV-31356: Range cost calculations does not take into account join_buffer · 07b02ab4
      Monty authored
      This patch also fixes
      MDEV-31391 Assertion `((best.records_out) == 0.0 ... failed
      
      Cost changes caused by this change:
      - range queries with join buffer now have a notable smaller cost.
      - range ranges are bit more expensive as the MULTI_RANGE_COST is now
        properly applied to it in all cases (this extra cost is equal to a
        key lookup).
      - table scan cost is slight smaller as we now assume data is cached in
        the engine after the first scan pass. (We did this before for range
        scans and other access methods).
      - partition tables had wrong values for max_row_blocks and
        max_index_blocks.  Correcting this, causes range access on
        partitioned tables to have slightly higher cost because of the
        increased estimated IO.
      - Using first match + join buffer caused 'filtered' to be calcualted
        wrong.  (Only affected EXPLAIN, not query costs).
      - Added cost_without_join_buffer to optimizer_trace.
      - check_quick_select() adjusted the number of rows according to persistent
        statistics, but did not adjust cost. Now fixed.
      
      The big change in the patch are:
      
      - In best_access_path(), where we now are using storing the cost in
        'ALL_READ_COST cost' and only converting it to a double at the end.
         This allows us to more exactly calculate the effect of the join_cache.
      - In JOIN_TAB::estimate_scan_time(), store the cost also in a
        ALL_READ_COST object.
      
      One of effect if this change is that when joining very small tables:
      
      t1    some_access_method
      t2    range
      t3    ALL         Use join buffer
      
      This is swiched to
      
      t1      some_access_method
      t3      ALL
      t2      range      use join buffer
      
      Both plans has the same cost, but as table scan in this case has less
      cost than rang, the table scan will be considered first and thus have
      precidence.
      
      Test case changes:
      - optimizer_trace          - Addition of cost_without_join_buffer
      - subselect_mat_cost_bugs  - Small tables and scan versus range
      - range & range_mrr_icp    - Range + join_cache is faster than ref
      - optimizer_trace          - cost_without_join_buffer, smaller scan cost,
                                   range setup cost.
      - mrr                      - range+join_buffer used as smaller cost
      07b02ab4
    • Daniel Bartholomew's avatar
    • Daniel Bartholomew's avatar
      bump the VERSION · 5b0fe277
      Daniel Bartholomew authored
      5b0fe277
    • Daniel Bartholomew's avatar
    • Daniel Bartholomew's avatar
      bump the VERSION · d6335d42
      Daniel Bartholomew authored
      d6335d42
    • Marko Mäkelä's avatar
      Merge mariadb-10.5.21 into 10.5 · 609b4e99
      Marko Mäkelä authored
      609b4e99
    • Daniel Bartholomew's avatar
      bump the VERSION · a2aaf26a
      Daniel Bartholomew authored
      a2aaf26a