1. 17 Apr, 2023 21 commits
    • Sergei Golubchik's avatar
      don't do DROP SYSTEM VERSIONING online · 02627999
      Sergei Golubchik authored
      because ALTER TABLE ... DROP SYSTEM VERSIONING
      is not just a change in the table structure, it also deletes
      all historical rows
      02627999
    • Sergei Golubchik's avatar
      set read_set early, before row reads · 9d5b39a9
      Sergei Golubchik authored
      also
      
      * don't modify write_set
      * backup/restore rpl_write_set
      9d5b39a9
    • Sergei Golubchik's avatar
      b9658673
    • Sergei Golubchik's avatar
      online alter always uses ALGORITHM=COPY, LOCK=NONE · 55faba71
      Sergei Golubchik authored
      so any other value of ALGORITHM or LOCK disables online alter
      55faba71
    • Sergei Golubchik's avatar
      remove handler::open_read_view() · ccb71456
      Sergei Golubchik authored
      use ht->start_consistent_snapshot() instead
      ccb71456
    • Sergei Golubchik's avatar
      cleanup · dc10673c
      Sergei Golubchik authored
      no functional changes here
      dc10673c
    • Sergei Golubchik's avatar
      ad436585
    • Sergei Golubchik's avatar
      tests: move around, add new · f4c9fc68
      Sergei Golubchik authored
      two new tests:
      * alter table times out because of a long concurrent trx
      * alter table adds a column in the middle
      f4c9fc68
    • Nikita Malyavin's avatar
      MDEV-16329 [5/5] ALTER ONLINE TABLE · 0921adac
      Nikita Malyavin authored
      * Log rows in online_alter_binlog.
      * Table online data is replicated within dedicated binlog file
      * Cached data is written on commit.
      * Versioning is fully supported.
      * Works both wit and without binlog enabled.
      
      * For now savepoints setup is forbidden while ONLINE ALTER goes on.
        Extra support is required. We can simply log the SAVEPOINT query events
        and replicate them together with row events. But it's not implemented
        for now.
      
      * Cache flipping:
      
        We want to care for the possible bottleneck in the online alter binlog
        reading/writing in advance.
      
        IO_CACHE does not provide anything better that sequential access,
        besides, only a single write is mutex-protected, which is not suitable,
        since we should write a transaction atomically.
      
        To solve this, a special layer on top Event_log is implemented.
        There are two IO_CACHE files underneath: one for reading, and one for
        writing.
      
        Once the read cache is empty, an exclusive lock is acquired (we can wait
        for a currently active transaction finish writing), and flip() is emitted,
        i.e. the write cache is reopened for read, and the read cache is emptied,
        and reopened for writing.
      
        This reminds a buffer flip that happens in accelerated graphics
        (DirectX/OpenGL/etc).
      
        Cache_flip_event_log is considered non-blocking for a single reader and a
        single writer in this sense, with the only lock held by reader during flip.
      
        An alternative approach by implementing a fair concurrent circular buffer
        is described in MDEV-24676.
      
      * Cache managers:
        We have two cache sinks: statement and transactional.
        It is important that the changes are first cached per-statement and
        per-transaction.
        If a statement fails, then only statement data is rolled back. The
        transaction moves along, however.
      
        Turns out, there's no guarantee that TABLE well persist in
        thd->open_tables to the transaction commit moment.
        If an error occurs, tables from statement are purged.
        Therefore, we can't store te caches in TABLE. Ideally, it should be
        handlerton, but we cut the corner and store it in THD in a list.
      0921adac
    • Nikita Malyavin's avatar
      MDEV-16329 [4/5] Refactor MYSQL_BIN_LOG: extract Event_log ancestor · cbc5f79b
      Nikita Malyavin authored
      Event_log is supposed to be a basic logging class that can write events in
      a single file.
      
      MYSQL_BIN_LOG in comparison will have:
      * rotation support
      * index files
      * purging
      * gtid and transactional information handling.
      * is dedicated for a general-purpose binlog
      cbc5f79b
    • Nikita Malyavin's avatar
      MDEV-16329 [3/5] use binlog_cache_data directly in most places · 85aad292
      Nikita Malyavin authored
      * Eliminate most usages of THD::use_trans_table. Only 3 left, and they are
        at quite high levels, and really essential.
      * Eliminate is_transactional argument when possible. Lots of places are
        left though, because of some WSREP error handling in
        MYSQL_BIN_LOG::set_write_error.
      * Remove junk binlog functions from THD
      * binlog_prepare_pending_rows_event is moved to log.cc inside MYSQL_BIN_LOG
        and is not anymore template. Instead it accepls event factory with a type
        code, and a callback to a constructing function in it.
      85aad292
    • Nikita Malyavin's avatar
      MDEV-16329 [2/5] refactor binlog and cache_mngr · ee499431
      Nikita Malyavin authored
      pump up binlog and cache manager to level of binlog_log_row_internal
      ee499431
    • Nikita Malyavin's avatar
      4a1ef202
    • Nikita Malyavin's avatar
      rpl: repack table_def · b4502013
      Nikita Malyavin authored
      1. Change m_size to uint. This removes some implicit conversions.
        See unpack_row, for instance:
        uint max_cols= MY_MIN(tabledef->size(), cols->n_bits);
      2. Improve table_def memory layout by reordering columns
      b4502013
    • Nikita Malyavin's avatar
      Copy_field: add const to arguments · 6a4cf3c6
      Nikita Malyavin authored
      6a4cf3c6
    • Sergei Golubchik's avatar
      rename tests · 646c95e6
      Sergei Golubchik authored
      alter_table_online -> alter_table_locknone
      gis-alter_table_online -> gis-alter_table
      646c95e6
    • Sergei Golubchik's avatar
    • Sergei Golubchik's avatar
      cleanup: remove vcol_info->stored_in_db · 06b55eae
      Sergei Golubchik authored
      it was redundant, duplicating vcol_type == VCOL_GENERATED_STORED.
      
      Note that VCOL_DEFAULT is not "stored", "stored vcol" means that after
      rnd_next or index_read/etc the field value is already in the record[0]
      and does not need to be calculated separately
      06b55eae
    • Sergei Golubchik's avatar
      Fix recalculation of vcols in binlog_row_image=minimal · e2605344
      Sergei Golubchik authored
      unpack_row() must calculate all stored and indexed vcols
      (in fill_extra_persistent_columns()).
      
      Also Update and Delete row events must mark in read_set
      all columns needed for calculating all stored and indexed vcols.
      
      If it's done properly in do_apply_event(), it no longer needs
      to be repeated per row.
      e2605344
    • Sergei Golubchik's avatar
      cleanup: clarify ha_innobase::column_bitmaps_signal() · 0d57bdbd
      Sergei Golubchik authored
      it was created to handle the case of the concurrent
      inplace add index. So it should only work in that case,
      otherwise it's doing server's job (marks virtual column dependencies)
      and hides server's bugs. And it was redundant.
      0d57bdbd
    • Sergei Golubchik's avatar
      allow random_bytes() in virtual columns · 1516b263
      Sergei Golubchik authored
      1516b263
  2. 31 Mar, 2023 1 commit
  3. 30 Mar, 2023 4 commits
    • Robin Newhouse's avatar
      All-green GitLab CI in 11.0 branch · 9c287c0a
      Robin Newhouse authored
      Include cppcheck and FlawFinder for SAST scanning.
      Ignorelists are present for both, so only new problems will trigger a CI
      failure.
      
      All new code of the whole pull request, including one or several files
      that are either new files or modified ones, are contributed under the
      BSD-new license. I am contributing on behalf of my employer
      Amazon Web Services, Inc.
      9c287c0a
    • Vicențiu Ciorbaru's avatar
      Update pull request template to suggest making PRs editable by maintainers · b844a376
      Vicențiu Ciorbaru authored
      Often there are small "nitpicky" changes that need to be done to a PR in order to
      get it merged. To speed up the merge process, we will ask contributors
      if they are ok with the reviewer making those changes.
      
      Other fixups:
      Improve PR template rendering in browser's textarea field. Line wrapping at 80
      characters provides a bad user experience within the browser, which
      handles word wrapping separately. Thus, prefer long lines in this
      markdown file.
      
      Remove the "backwards compatibility section". While the contributor
      should ideally care about the impact of their patch on the server's
      backwards compatibility, this is an advanced topic that is better
      presented in a separate document.
      b844a376
    • Mikhail Chalov's avatar
      [MDEV-30543] New status variable: max_used_connections_time · ada39879
      Mikhail Chalov authored
      Add variable max_used_connections_time to show the time at which
      max_used_connections reached its current value. This is useful for
      troubleshooting high connection counts. MySQL 8 has this already.
      
      All new code of the whole pull request, including one or several files
      that are either new files or modified ones, are contributed under the BSD-new
      license. I am contributing on behalf of my employer Amazon Web Services.
      ada39879
    • Ahmed Ibrahim's avatar
  4. 29 Mar, 2023 5 commits
  5. 28 Mar, 2023 4 commits
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 0760ad33
      Marko Mäkelä authored
      0760ad33
    • Marko Mäkelä's avatar
      MDEV-30936 fixup · 402f36dd
      Marko Mäkelä authored
      fil_space_t::~fil_space_t(): Invoke ut_free(name) because
      doing so in the callers would trip MSAN_OPTIONS=poison_in_dtor=1
      402f36dd
    • Marko Mäkelä's avatar
      MDEV-30936 clang 15.0.7 -fsanitize=memory fails massively · dfa90257
      Marko Mäkelä authored
      handle_slave_io(), handle_slave_sql(), os_thread_exit():
      Remove a redundant pthread_exit(nullptr) call, because it
      would cause SIGSEGV.
      
      mysql_print_status(): Add MEM_MAKE_DEFINED() to work around
      some missing instrumentation around mallinfo2().
      
      que_graph_free_stat_list(): Invoke que_node_get_next(node) before
      que_graph_free_recursive(node). That is the logical and
      MSAN_OPTIONS=poison_in_dtor=1 compatible way of freeing memory.
      
      ins_node_t::~ins_node_t(): Invoke mem_heap_free(entry_sys_heap).
      
      que_graph_free_recursive(): Rely on ins_node_t::~ins_node_t().
      
      fts_t::~fts_t(): Invoke mem_heap_free(fts_heap).
      
      fts_free(): Replace with direct calls to fts_t::~fts_t().
      
      The failures in free_root() due to MSAN_OPTIONS=poison_in_dtor=1
      will be covered in MDEV-30942.
      dfa90257
    • Shivam Choudhary's avatar
      Fixed some typos in optimizer_costs.txt · 6c3b1dce
      Shivam Choudhary authored
      6c3b1dce
  6. 27 Mar, 2023 4 commits
    • Sergei Golubchik's avatar
      MDEV-19629 post-merge fixes · c2b69163
      Sergei Golubchik authored
      * it isn't "pfs" function, don't call it Item_func_pfs,
        don't use item_pfsfunc.*
      * tests don't depend on performance schema, put in the main suite
      * inherit from Item_str_ascii_func
      * use connection collation, not utf8mb3_general_ci
      * set result length in fix_length_and_dec
      * do not set maybe_null
      * use my_snprintf() where possible
      * don't set m_value.ptr on every invocation
      * update sys schema to use the format_pico_time()
      * len must be size_t (compilation error on Windows)
      * the correct function name for double->double is fabs()
      * drop volatile hack
      c2b69163
    • Ahmed Ibrahim's avatar
      d9808f79
    • Tuukka Pasanen's avatar
      MDEV-30837: Remove usage of AWK in autobake-debs.sh · 31487f4b
      Tuukka Pasanen authored
      AWK is used in autobake-debs.sh for printing information
      about created DEB packages.
      
      This can be rewrite with bash inner commands read and echo.
      31487f4b
    • Tuukka Pasanen's avatar
      MDEV-30837: Remove usage of AWK from Debian init and postinst scripts · fe32a4a5
      Tuukka Pasanen authored
      AWK in used in Debian SysV-init and postinst scripts to determine
      is there enough space starting MariaDB database or create new
      database to target destination.
      
      These AWK scripts can be rewrited to use pure SH or help
      using Coreutils which is mandatory for usage of MariaDB currently.
      
      Reasoning behind this is to get rid of one very less used dependency
      fe32a4a5
  7. 24 Mar, 2023 1 commit
    • Andrei's avatar
      MDEV-26071: rpl.rpl_perfschema_applier_status_by_worker failed in bb … · 216d99bb
      Andrei authored
      …with: Test assertion failed
      
      Problem:
      =======
      Assertion text: 'Value returned by SSS and PS table for Last_Error_Number
      should be same.'
      Assertion condition: '"1146" = "0"'
      Assertion condition, interpolated: '"1146" = "0"'
      Assertion result: '0'
      
      Analysis:
      ========
      In parallel replication when slave is started the worker pool gets
      activated and it gets cleared when slave stops. Each time the worker pool
      gets activated a backup worker pool also gets created to store worker
      specific perforance schema information in case of errors. On error, all
      relevant information is copied from rpl_parallel_thread to rli and it gets
      cleared from thread.  Then server waits for all workers to complete their
      work, during this stage performance schema table specific worker info is
      stored into the backup pool and finally the actual pool gets cleared. If
      users query the performance schema table to know the status of workers the
      information from backup pool will be used. The test simulates
      ER_NO_SUCH_TABLE error and verifies the worker information in pfs table.
      Test works fine if execution occurs in following order.
      
      Step 1. Error occurred 'worker information is copied to backup pool'.
      Step 2. handle_slave_sql invokes 'rpl_parallel_resize_pool_if_no_slaves' to
      deactivate worker pool, it marks the pool->count=0
      Step 3. PFS table is queried, since actual pool is deactivated backup pool
      information is read.
      
      If the Step 3 happens prior to Step2 the pool is yet to be deactivated and
      the actual pool is read, which doesn't have any error details as they were
      cleared. Hence test ocasionally fails.
      
      Fix:
      ===
      Upon error mark the back pool as being active so that if PFS table is
      quried since the backup pool is flagged as valid its information will be
      read, in case it is not flagged regular pool will be read.
      
      This work is one of the last pieces created by the late Sujatha Sivakumar.
      216d99bb