1. 24 Nov, 2021 3 commits
    • Eric Herman's avatar
      Remove DYNAMIC_ARRAY get_index_dynamic() · 6a282df0
      Eric Herman authored
      The DYNAMIC_ARRAY copies values in and copies values out. Without a
      comparitor function, get_index_dynamic() does not make sense.
      
      This function is not used. If we have a need for a function like it
      in the future, I propose we write a new one with unit tests showing
      how it is used and demostrating that it behaves as expected.
      6a282df0
    • Alexander Barkov's avatar
      MDEV-27042 UCA: Resetting contractions to ignorable does not work well · f9ad8072
      Alexander Barkov authored
      The weight scanner routine scanner_next() did not properly handle the cases
      when a contraction produces no weights (is ignorable).
      
      Adding a helper routine my_uca_scanner_set_weight() and using
      it in all cases:
      
      - A single ASCII character
      - A contraction starting with an ASCII character
      - A multi-byte character
      - A contraction starting with a multi-byte character
      
      Also adding two other helper routines:
      
      - my_uca_scanner_next_expansion_weight()
      - my_uca_scanner_set_weight_outside_maxchar()
      
      to avoid using scanner->wbeg directly inside scanner_next().
      This reduces the probability of similar future bugs.
      f9ad8072
    • Alexander Barkov's avatar
      Refactoring for MDEV-27042 and MDEV-27009 · 0a3d1d10
      Alexander Barkov authored
      This patch prepares the code for upcoming changes:
      
      MDEV-27009 Add UCA-14.0.0 collations
      MDEV-27042 UCA: Resetting contractions to ignorable does not work well
      
      1. Adding "const" qualifiers to return type and parameters in functions:
      - my_uca_contraction2_weight()
      - my_wmemcmp()
      - my_uca_contraction_weight()
      - my_uca_scanner_contraction_find()
      - my_uca_previous_context_find()
      - my_uca_context_weight_find()
      
      2. Adding a helper function my_uca_true_contraction_eq()
      
      3. Changing the way how scanner->wbeg is set during context weight handling.
         It was previously set inside functions:
         - my_uca_scanner_contraction_find()
         - my_uca_previous_context_find()
         Now it's set inside scanner_next(), which makes the code more symmetric
         for context-free and context-dependent sequences.
         This makes then upcoming fix for MDEV-27042 simpler.
      0a3d1d10
  2. 19 Nov, 2021 8 commits
  3. 18 Nov, 2021 9 commits
    • Vladislav Vaintroub's avatar
      xxx · 220dc1fd
      Vladislav Vaintroub authored
      220dc1fd
    • Vladislav Vaintroub's avatar
      MDEV-26713 Windows- UTF8 encoding in the installer · 2dcb8236
      Vladislav Vaintroub authored
      Workaround Windows' bug in services "ANSI" when process ANSI codepage is
      UTF8.
      They turn out to work unlike any other API .
      
      Expected behavior : strings  be converted from GetACP() to Unicode,
      and "wide" function would be then called.
      
      Actual current behavior :
      it seems to handle strings as-if they would be encoded in system-default
      ACP, rather than process-specific GetACP()
      
      Fix: redefine the OpenService,CreateService and ChangeServiceConfig
      and do ANSI-Wide conversion outselves.
      
      Tell compiler to deprecate some ANSI service functions.
      
      xxx
      2dcb8236
    • Vladislav Vaintroub's avatar
      MDEV-26713 Windows- UTF8 encoding in the installer · 68b16d80
      Vladislav Vaintroub authored
      - allow utf8 datadir, and password
      - mysql_install_db.exe does not send clear password to mysqld --bootstrap
        subprocess anymore, but hash, as server makes incorrect assumption about
        character encoding in case it is UTF8.
      - use CreateServiceW to create service, due to some Windows bug,
        the ANSI version does not currently work well with strings outside
        of ASCII range.
      68b16d80
    • Vladislav Vaintroub's avatar
    • Marko Mäkelä's avatar
      MDEV-27058: Reduce the size of buf_block_t and buf_page_t · aaef2e1d
      Marko Mäkelä authored
      buf_page_t::frame: Moved from buf_block_t::frame.
      All 'thin' buf_page_t describing compressed-only ROW_FORMAT=COMPRESSED
      pages will have frame=nullptr, while all 'fat' buf_block_t
      will have a non-null frame pointing to aligned innodb_page_size bytes.
      This eliminates the need for separate states for
      BUF_BLOCK_FILE_PAGE and BUF_BLOCK_ZIP_PAGE.
      
      buf_page_t::lock: Moved from buf_block_t::lock. That is, all block
      descriptors will have a page latch. The IO_PIN state that was used
      for discarding or creating the uncompressed page frame of a
      ROW_FORMAT=COMPRESSED block is replaced by a combination of read-fix
      and page X-latch.
      
      page_zip_des_t::fix: Replaces state_, buf_fix_count_, io_fix_, status
      of buf_page_t with a single std::atomic<uint32_t>. All modifications
      will use store(), fetch_add(), fetch_sub(). This space was previously
      wasted to alignment on 64-bit systems. We will use the following encoding
      that combines a state (partly read-fix or write-fix) and a buffer-fix
      count:
      
      buf_page_t::NOT_USED=0 (previously BUF_BLOCK_NOT_USED)
      buf_page_t::MEMORY=1 (previously BUF_BLOCK_MEMORY)
      buf_page_t::REMOVE_HASH=2 (previously BUF_BLOCK_REMOVE_HASH)
      buf_page_t::FREED=3 + fix: pages marked as freed in the file
      buf_page_t::UNFIXED=1U<<29 + fix: normal pages
      buf_page_t::IBUF_EXIST=2U<<29 + fix: normal pages; may need ibuf merge
      buf_page_t::REINIT=3U<<29 + fix: reinitialized pages (skip doublewrite)
      buf_page_t::READ_FIX=4U<<29 + fix: read-fixed pages (also X-latched)
      buf_page_t::WRITE_FIX=5U<<29 + fix: write-fixed pages (also U-latched)
      buf_page_t::WRITE_FIX_IBUF=6U<<29 + fix: write-fixed; may have ibuf
      buf_page_t::WRITE_FIX_REINIT=7U<<29 + fix: write-fixed (no doublewrite)
      
      buf_page_t::write_complete(): Change WRITE_FIX or WRITE_FIX_REINIT to
      UNFIXED, and WRITE_FIX_IBUF to IBUF_EXIST, before releasing the U-latch.
      
      buf_page_t::read_complete(): Renamed from buf_page_read_complete().
      Change READ_FIX to UNFIXED or IBUF_EXIST, before releasing the X-latch.
      
      buf_page_t::can_relocate(): If the page latch is being held or waited for,
      or the block is buffer-fixed or io-fixed, return false. (The condition
      on the page latch is new.)
      
      Outside buf_page_get_gen(), buf_page_get_low() and buf_page_free(), we
      will acquire the page latch before fix(), and unfix() before unlocking.
      
      buf_page_t::flush(): Replaces buf_flush_page(). Optimize the
      handling of FREED pages.
      
      buf_pool_t::release_freed_page(): Assume that buf_pool.mutex is held
      by the caller.
      
      buf_page_t::is_read_fixed(), buf_page_t::is_write_fixed(): New predicates.
      
      buf_page_get_low(): Ignore guesses that are read-fixed because they
      may not yet be registered in buf_pool.page_hash and buf_pool.LRU.
      
      buf_page_optimistic_get(): Acquire latch before buffer-fixing.
      
      buf_page_make_young(): Leave read-fixed blocks alone, because they
      might not be registered in buf_pool.LRU yet.
      
      recv_sys_t::recover_deferred(), recv_sys_t::recover_low():
      Possibly fix MDEV-26326, by holding a page X-latch instead of
      only buffer-fixing the page.
      aaef2e1d
    • Marko Mäkelä's avatar
      MDEV-27058: Move buf_page_t::slot to IORequest::slot · db915f73
      Marko Mäkelä authored
      MDEV-23855 and MDEV-23399 already moved some transient data fields
      from buffer pool page descriptors to IORequest, but the write buffer
      of PAGE_COMPRESSED or ENCRYPTED tables was missed. Since is only needed
      during asynchronous page write requests, it belongs to IORequest.
      db915f73
    • Marko Mäkelä's avatar
      MDEV-26769 follow-up: Remove unnecessary page locking · 02e72f7b
      Marko Mäkelä authored
      btr_cur_optimistic_latch_leaves(): Use transactional_shared_lock_guard.
      
      btr_cur_latch_leaves(): Avoid acquiring some page latches, because
      the changes are already blocked by index->lock.
      
      btr_cur_search_to_nth_level_func(): Remove a redundant variable
      retrying_for_search_prev=!!prev_tree_blocks, and avoid acquiring
      some page latches.
      02e72f7b
    • Marko Mäkelä's avatar
      MDEV-27069: heap-use-after-free in dict_stats_recalc_pool_del() · 14c5178f
      Marko Mäkelä authored
      dict_stats_recalc_pool_del(): Always reposition the iterators after
      releasing and reacquiring the mutex. Another thread could have modified
      recalc_pool, causing reallocation of the underlying memory while
      we were waiting.
      
      This fixes a regression that was caused by
      commit 45a05fda (MDEV-25919).
      14c5178f
    • Marko Mäkelä's avatar
      862eccd5
  4. 17 Nov, 2021 8 commits
    • Daniel Lenski's avatar
      Modify PR template to encourage contribution of automated tests · e36a2573
      Daniel Lenski authored
      Many recent PRs offer up shell scripts or example queries in the testing
      section, when these could be easily and usefully be converted to automated
      tests based on MTR.  (https://github.com/MariaDB/server/pull/1888 and
      https://github.com/MariaDB/server/pull/1940 are good examples of this.)
      
      This modifies the PR template to more strongly encourage the contribution of
      automated tests.
      e36a2573
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 0a168398
      Marko Mäkelä authored
      0a168398
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 5489ce0a
      Marko Mäkelä authored
      5489ce0a
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 70e788b1
      Marko Mäkelä authored
      70e788b1
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 9962cda5
      Marko Mäkelä authored
      9962cda5
    • Marko Mäkelä's avatar
      MDEV-23805 fixup: Adjsut the MDEV-16131 and MDEV-24730 tests · 878f7e38
      Marko Mäkelä authored
      MDEV-23805 simplified the treatment of empty tables during ALTER TABLE,
      which could prevent the scenarios that were previously reported and
      fixed as MDEV-16131 and MDEV-24730.
      
      With the MDEV-23805 fix, the statement
      SET DEBUG_SYNC = 'now WAIT_FOR copied';
      could occasionally time out, depending on timing.
      Apparently, there was a race condition where purge could resume
      (and empty the table) before ALTER TABLE got the chance to execute.
      We must prevent the purge of history from running before
      ALTER TABLE has started executing.
      878f7e38
    • Eugene Kosov's avatar
      MDEV-26747 improve corruption check for encrypted tables on ALTER IMPORT · ed0a224b
      Eugene Kosov authored
      fil_space_decrypt(): change signature to return status via dberr_t only.
      Also replace impossible condition with an assertion and prove it via
      test cases.
      ed0a224b
    • Igor Babaev's avatar
      MDEV-26825 Bogus error for query with two usage of CTE referring another CTE · 8f24f5fe
      Igor Babaev authored
        This bug affected queries with two or more references to a CTE referring
      another CTE if the definition of the latter contained an invocation of
      a stored function that used a base table. The bug could lead to a bogus
      error message or to an assertion failure.
        For any non-first reference to CTE cte1 With_element::clone_parsed_spec()
      is called that parses the specification of cte1 to construct the unit
      structure for this usage of cte1. If cte1 refers to another CTE cte2
      outside of the specification of cte1 then With_element::clone_parsed_spec()
      has to be called for cte2 as well. This call is made by the function
      LEX::resolve_references_to_cte() within the invocation of the function
      With_element::clone_parsed_spec() for cte1.
        When the specification of a CTE is parsed all table references encountered
      in it must be added to the global list of table references for the query.
      As the specification for the non-first usage of a CTE is parsed at a
      recursive call of the parser the function With_element::clone_parsed_spec()
      invoked at this recursive call should takes care of appending the list of
      table references encountered in the specification of this CTE cte1 to the
      list of table references created for the query. And it should do it after
      the call of LEX::resolve_references_to_cte() that resolves references to
      CTEs defined outside of the specification of cte1 because this call may
      invoke the parser again for specifications of other CTEs and  the table
      references from their specifications must ultimately appear in the global
      list of table references of the query.
        The code of With_element::clone_parsed_spec() misplaced the call of
      LEX::resolve_references_to_cte(). As a result LEX::query_tables_last used
      for the query that was supposed to point to the field 'next_global' of the
      last element in the global list of table references actually pointed to
      'next_global' of the previous element.
        The above inconsistency certainly caused serious problems when table
      references used in the stored functions invoked in cloned specifications
      of CTEs were added to the global list of table references.
      8f24f5fe
  5. 16 Nov, 2021 9 commits
  6. 13 Nov, 2021 1 commit
  7. 12 Nov, 2021 1 commit
  8. 11 Nov, 2021 1 commit