1. 06 Apr, 2023 1 commit
    • Daniel Black's avatar
      MDEV-25282 Auto-shutdown on idle when socket-activated · 06080865
      Daniel Black authored
      Adds max_idle_execution system variable that corresponds
      to the time in seconds under which the mariadbd executable will
      run in an idle state (since last query) with no connections.
      
      Under systemd socket activation this variable will get a 10 minute
      default value, otherwise 0, representing no timeout. This will
      enable a service to be activated on connection and fall back to
      a shutdown state after 10 minutes of no queries. The systemd
      socket activation can restart the service on the next connection
      transparently.
      
      The maximum max_idle_execution is given by the following
      factors given its dependence on the OS system calls.
      
      Windows WaitForMultipleObjects takes a DWORD (unsigned)
      measure in milliseconds.  Poll takes a signed int milliseconds,
      and negative values are treated as infinite so we can't overflow.
      Select, the fall back if poll isn't there, takes a seconds value
      in a timeval.time_t structure. As such the interface maximums are:
      Windows: UINT_MAX / 1000
      Poll: INT_MAX / 1000
      Select: UINT_MAX (or higher)
      
      As even the smallest value here, INT_MAX(32) / 1000 is ~25 days,
      sufficient for the typical use case, its used in all environment for
      simplicity of documentation and test cases.
      
      A (non-exposed) global variable of server_last_activity is updated
      on accepted connections (when max_idle_execution !=0)
      and when the connection count (standard or extra) is down
      to <= 1 to keep the number of updates on a single variable
      low.
      
      When the main accept loop times out on the max_idle_execution
      seconds, and then the server_last_activity is checked along
      with if current connection count (standard + extra) is 0
      (in case a recently started connection hasn't finished
      a query).
      
      To make this neater, in non-Windows main accept loop moved
      code to handle_new_socket_connection that encompasses accepting
      a connection and the timeout mechanism has been separated too.
      
      Changed when looping though possible connections, loop until
      the end of the connection list and hereby assume two connection can
      occur on the same poll/select call and both will be accepted.
      
      The interactive_timeout and wait_timeout inherit the
      max_idle_execution time (if set) compared to their previous defaults.
      
      Thanks Sergei for the review.
      06080865
  2. 29 Mar, 2023 6 commits
  3. 28 Mar, 2023 5 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
    • Yuchen Pei's avatar
      MDEV-30920 Remove need_lock and table from spider_close_sys_table() · 7bd225e1
      Yuchen Pei authored
      They became obsolete after commit cfd145fa:
      
      commit cfd145fa
      Author: Nayuta Yanagisawa <nayuta.yanagisawa@hey.com>
      Date:   Fri Jan 28 01:03:06 2022 +0900
      
          MDEV-27641 Spider: remove #if MYSQL_VERSION_ID < ${VERSION}
      7bd225e1
  4. 27 Mar, 2023 6 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
    • Marko Mäkelä's avatar
      Fix ColumnStore again · 5a1f7522
      Marko Mäkelä authored
      This fixes up commit e371b1e2
      that accidentally reverted d77aaa69.
      5a1f7522
    • Marko Mäkelä's avatar
      Merge 11.0 into 11.1 · f6c5e917
      Marko Mäkelä authored
      f6c5e917
    • 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
  5. 24 Mar, 2023 7 commits
    • 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
    • Marko Mäkelä's avatar
      e371b1e2
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-29545 InnoDB: Can't find record during replace stmt · e06c6046
      Thirunarayanan Balathandayuthapani authored
      Problem:
      ========
      - InnoDB replace statement returns can't find record as result during
      bulk insert operation. InnoDB returns DB_END_OF_INDEX blindly when
      bulk transaction is visible to current transaction even though
      the search tuple is inserted as a part of current replace statement.
      
      Solution:
      =========
      row_search_mvcc(): InnoDB should allow the transaction to read
      all the rows when innodb intends to do any locking on the
      record even though bulk insert transaction changes are
      visible to the current transaction
      e06c6046
    • Marko Mäkelä's avatar
      MDEV-30900 Crash on macOS due to zero-initialized buf_dblwr.write_cond · 07460c31
      Marko Mäkelä authored
      buf_dblwr_t::init(), buf_dblwr_t::close(): Cover also write_cond,
      which was added in commit a55b951e
      without explicit initialization. On GNU/Linux, PTHREAD_COND_INITIALIZER
      is a zero-initializer. That is why the default zero initialization
      happened to work on that platform.
      07460c31
    • Tuukka Pasanen's avatar
      MDEV-30778: Remove Awk from mysql_install_db · a79abb65
      Tuukka Pasanen authored
      Commit reduces need of AWK-command at least
      for Debian mariadb-server-compat package.
      
      Commit removes need of AWK-command from
      scripts/mysql_install_db.sh script.
      
      AWK command is replace by purely Posix sh compiliant version.
      a79abb65
    • Otto Kekalainen's avatar
      Fix trivial spelling errors · 50c8ef01
      Otto Kekalainen authored
      - agressively -> aggressively
      - exising -> existing
      - occured -> occurred
      - releated -> related
      - seperated -> separated
      - sucess -> success
      - use use -> use
      
      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.
      50c8ef01
    • Daniel Black's avatar
      rpl_reporting: sprintf -> snprintf · 15ca6c5a
      Daniel Black authored
      This was failing to compile with AppleClang 14.0.0.14000029.
      
      Thanks to Arunesh Choudhary for noticing.
      15ca6c5a
  6. 23 Mar, 2023 3 commits
    • Aleksey Midenkov's avatar
      MDEV-30421 rpl_parallel_*.test cleanup · a8b616d1
      Aleksey Midenkov authored
      Moved rpl_parallel_*.inc to rpl_parallel_*.test
      a8b616d1
    • Marko Mäkelä's avatar
      Merge 11.0 into 11.1 · 9aa098c4
      Marko Mäkelä authored
      9aa098c4
    • Marko Mäkelä's avatar
      MDEV-30911 Multi-batch recovery of ROW_FORMAT=COMPRESSED table hangs · 92772485
      Marko Mäkelä authored
      In commit d6aed216 a condition at
      the start of buf_read_ahead_random() was refactored. Only the caller
      buf_read_recv_pages() was adjusted for this. We must in fact adjust
      every caller and make sure that spare blocks will be allocated
      while crash recovery is in progress. This is the simplest fix;
      ideally recovery would operate on the compressed page frame.
      
      The observed recovery hang occurred because pages 0 and 3 of a
      tablespace were being read due to buf_page_get_gen() calls by
      trx_resurrect_table_locks() before the log records for these pages
      had been applied. In buf_page_t::read_complete() we would skip
      the call to recv_recover_page() because no uncompressed page frame
      had been allocated for the block.
      92772485
  7. 22 Mar, 2023 3 commits
    • Nayuta Yanagisawa's avatar
      MDEV-28522 Delete constant SPIDER_SQL_TYPE_*_HS · 22392b36
      Nayuta Yanagisawa authored
      The HandlerSocket support of Spider has been deleted by MDEV-26858.
      Thus, the constants, SPIDER_SQL_TYPE_*_HS, are no longer necessary.
      22392b36
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 1efdf67e
      Marko Mäkelä authored
      1efdf67e
    • Marko Mäkelä's avatar
      MDEV-30882 Crash on ROLLBACK in a ROW_FORMAT=COMPRESSED table · 701399ad
      Marko Mäkelä authored
      btr_cur_upd_rec_in_place(): Avoid calling page_zip_write_rec() if we
      are not modifying any fields that are stored in compressed format.
      
      btr_cur_update_in_place_zip_check(): New function to check if a
      ROW_FORMAT=COMPRESSED record can actually be updated in place.
      
      btr_cur_pessimistic_update(): If the BTR_KEEP_POS_FLAG is not set
      (we are in a ROLLBACK and cannot write any BLOBs), ignore the potential
      overflow and let page_zip_reorganize() or page_zip_compress() handle it.
      This avoids a failure when an attempted UPDATE of an NULL column to 0 is
      rolled back. During the ROLLBACK, we would try to move a non-updated
      long column to off-page storage in order to avoid a compression failure
      of the ROW_FORMAT=COMPRESSED page.
      
      page_zip_write_trx_id_and_roll_ptr(): Remove an assertion that would fail
      in row_upd_rec_in_place() because the uncompressed page would already
      have been modified there.
      
      This is a 10.5 version of commit ff3d4395
      (different because of commit 08ba3887).
      701399ad
  8. 21 Mar, 2023 1 commit
    • Tingyao Nian's avatar
      [MDEV-30824] Fix binlog to use 'String' for setting 'character_set_client' · dccbb5a6
      Tingyao Nian authored
      Commit a923d6f4 disabled numeric setting
      of character_set_* variables with non-default values:
      
        MariaDB [(none)]> set character_set_client=224;
        ERROR 1115 (42000): Unknown character set: '224'
      
      However the corresponding binlog functionality still write numeric
      values for log event, and this will break binlog replay if the value is
      not default. Now make the server use 'String' type for
      'character_set_client' when generating binlog events
      
      Before:
      
        /*!\C utf8mb4 *//*!*/;
        SET @@session.character_set_client=224,@@session.collation_connection=224,@@session.collation_server=33/*!*/;
      
      After:
      
        /*!\C utf8mb4 *//*!*/;
        SET @@session.character_set_client=utf8mb4,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
      
      Note: prior to the previous commit, setting with '224' or '45' or
      'utf8mb4' have the same effect, as they all set the parameter to
      'utf8mb4'.
      
      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.
      dccbb5a6
  9. 20 Mar, 2023 8 commits