1. 27 Aug, 2020 2 commits
    • Marko Mäkelä's avatar
      MDEV-23585: Fix HAVE_CLMUL_INSTRUCTION · b47d61d0
      Marko Mäkelä authored
      MDEV-22641 in commit dec3f8ca
      refactored a SIMD implementation of CRC-32 for the ISO 3309 polynomial
      that uses the IA-32/AMD64 carry-less multiplication (pclmul)
      instructions. The code was previously only available in Mariabackup;
      it was changed to be a general replacement of the zlib crc32().
      
      There exist AMD64 systems where CMAKE_SYSTEM_PROCESSOR matches
      the pattern i[36]86 but not x86_64 or amd64. This would cause a
      link failure, because mysys/checksum.c would basically assume that
      the compiler support for instruction is always available on GCC-compatible
      compilers on AMD64.
      
      Furthermore, we were unnecessarily disabling the SIMD acceleration
      for 32-bit executables.
      
      Note: Until MDEV-22749 has been implemented, the PCLMUL instruction
      will not be used on Microsoft Windows.
      
      Closes: #1660
      b47d61d0
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · bb284e3f
      Marko Mäkelä authored
      bb284e3f
  2. 26 Aug, 2020 6 commits
  3. 25 Aug, 2020 11 commits
  4. 24 Aug, 2020 1 commit
  5. 23 Aug, 2020 1 commit
    • Kentoku SHIBA's avatar
      MDEV-22246 Result rows duplicated by spider engine · 2000d05c
      Kentoku SHIBA authored
      fix the following type mrr scan
      (select 0,`id`,`node` from `auto_test_remote`.`tbl_a` where (`id` <> 0) order by `id`)union all(select 1,`id`,`node` from `auto_test_remote`.`tbl_a` where (`id` <> 0) order by `id`) order by `id`
      2000d05c
  6. 24 Aug, 2020 3 commits
    • Alexander Barkov's avatar
      MDEV-23562 Assertion `time_type == MYSQL_TIMESTAMP_DATETIME' failed upon... · 329301d2
      Alexander Barkov authored
      MDEV-23562 Assertion `time_type == MYSQL_TIMESTAMP_DATETIME' failed upon SELECT from versioned table
      
      The code in vers_select_conds_t::init_from_sysvar() assumed that
      the value of the system_versioning_asof is DATETIME.
      But it also could be DATE after a query like this:
        SET system_versioning_asof = DATE(NOW());
      
      Fixing Sys_var_vers_asof::update() to convert the value
      of the assignment source to DATETIME if it returned DATE.
      
      Now vers_select_conds_t::init_from_sysvar() always gets a DATETIME value.
      329301d2
    • Alexander Barkov's avatar
    • Alexander Barkov's avatar
      MDEV-23551 Performance degratation in temporal literals in 10.4 · 04ce2935
      Alexander Barkov authored
      Problem:
      
      Queries like this showed performance degratation in 10.4 over 10.3:
      
        SELECT temporal_literal FROM t1;
        SELECT temporal_literal + 1 FROM t1;
        SELECT COUNT(*) FROM t1 WHERE temporal_column = temporal_literal;
        SELECT COUNT(*) FROM t1 WHERE temporal_column = string_literal;
      
      Fix:
      
      Replacing the universal member "MYSQL_TIME cached_time" in
      Item_temporal_literal to data type specific containers:
      - Date in Item_date_literal
      - Time in Item_time_literal
      - Datetime in Item_datetime_literal
      
      This restores the performance, and make it even better in some cases.
      See benchmark results in MDEV.
      
      Also, this change makes futher separations of Date, Time, Datetime
      from each other, which will make it possible not to derive them from
      a too heavy (40 bytes) MYSQL_TIME, and replace them to smaller data
      type specific containers.
      04ce2935
  7. 23 Aug, 2020 1 commit
    • Kentoku SHIBA's avatar
      MDEV-22246 Result rows duplicated by spider engine · 65ee216c
      Kentoku SHIBA authored
      fix the following type mrr scan
      (select 0,`id`,`node` from `auto_test_remote`.`tbl_a` where (`id` <> 0) order by `id`)union all(select 1,`id`,`node` from `auto_test_remote`.`tbl_a` where (`id` <> 0) order by `id`) order by `id`
      65ee216c
  8. 24 Aug, 2020 1 commit
  9. 23 Aug, 2020 1 commit
  10. 22 Aug, 2020 3 commits
    • Alexander Barkov's avatar
      MDEV-23537 Comparison with temporal columns is slow in MariaDB · 2e5d86f4
      Alexander Barkov authored
      Implementing methods:
      - Field::val_time_packed()
      - Field::val_datetime_packed()
      - Item_field::val_datetime_packed(THD *thd);
      - Item_field::val_time_packed(THD *thd);
      to give a faster access to temporal packed longlong representation of a Field,
      which is used in temporal Arg_comparator's to DATE, TIME, DATETIME data types.
      
      The same idea is used in MySQL-5.6+.
      
      This improves performance.
      2e5d86f4
    • Alexander Barkov's avatar
      6708e67a
    • Alexander Barkov's avatar
      MDEV-23525 Wrong result of MIN(time_expr) and MAX(time_expr) with GROUP BY · ae33ebe5
      Alexander Barkov authored
      Problem:
      
      When calculatung MIN() and MAX() in a query with GROUP BY, like this:
      
        SELECT MIN(time_expr), MAX(time_expr) FROM t1 GROUP BY i;
      
      the code in Item_sum_min_max::update_field() erroneosly used
      string format comparison, therefore '100:20:30' was considered as
      smaller than '10:20:30'.
      
      Fix:
      
      1. Implementing low level "native" related methods in class Time:
           Time::Time(const Native &native)           - convert native to Time
           Time::to_native(Native *to, uint decimals) - convert Time to native
      
         The "native" binary representation for TIME is equal to
         the binary data format of Field_timef, which is used to
         store TIME when mysql56_temporal_format is ON (default).
      
      2. Implementing Type_handler_time_common "native" related methods:
      
        Type_handler_time_common::cmp_native()
        Type_handler_time_common::Item_val_native_with_conversion()
        Type_handler_time_common::Item_val_native_with_conversion_result()
        Type_handler_time_common::Item_param_val_native()
      
      3. Implementing missing "native representation" related methods
         in Field_time and Field_timef:
      
        Field_time::store_native()
        Field_time::val_native()
        Field_timef::store_native()
        Field_timef::val_native()
      
      4. Implementing missing "native" related methods in all Items
         that can have the TIME data type:
      
        Item_timefunc::val_native()
        Item_name_const::val_native()
        Item_time_literal::val_native()
        Item_cache_time::val_native()
        Item_handled_func::val_native()
      
      5. Marking Type_handler_time_common as "native ready".
         So now Item_sum_min_max::update_field() calculates
         values using min_max_update_native_field(),
         which uses native binary representation rather than string representation.
      
         Before this change, only the TIMESTAMP data type used native
         representation to calculate MIN() and MAX().
      
      Benchmarks (see more details in MDEV):
      
        This change not only fixes the wrong result, but also
        makes a "SELECT .. MAX.. GROUP BY .." query faster:
      
        # TIME(0)
        CREATE TABLE t1 (id INT, time_col TIME) ENGINE=HEAP;
        INSERT INTO t1 VALUES (1,'10:10:10'); -- repeat this 1m times
        SELECT id, MAX(time_col) FROM t1 GROUP BY id;
      
        MySQL80: 0.159 sec
        10.3:    0.108 sec
        10.4:    0.094 sec (fixed)
      
        # TIME(6):
        CREATE TABLE t1 (id INT, time_col TIME(6)) ENGINE=HEAP;
        INSERT INTO t1 VALUES (1,'10:10:10.999999'); -- repeat this 1m times
        SELECT id, MAX(time_col) FROM t1 GROUP BY id;
      
        My80: 0.154
        10.3: 0.135
        10.4: 0.093 (fixed)
      ae33ebe5
  11. 21 Aug, 2020 10 commits
    • Ian Gilfillan's avatar
      Fix spelling mistake in error message · ee61c8c0
      Ian Gilfillan authored
      ee61c8c0
    • Yuqi Gu's avatar
      MDEV-23495: Refine Arm64 PMULL runtime check in MariaDB · 151fc0ed
      Yuqi Gu authored
      Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030).
      
      The PR #1645 offers a solution to fix this issue. But it does not consider
      the condition that the target platform does support crc32 but not support PMULL.
      
      In this condition, it should leverage the Arm64 crc32 instruction (__crc32c) and
      just only skip parallel computation (pmull/vmull) rather than skip all hardware
      crc32 instruction of computation.
      
      The PR also removes unnecessary CRC32_ZERO branch in 'crc32c_aarch64' for MariaDB,
      formats the indent and coding style.
      
      Change-Id: I76371a6bd767b4985600e8cca10983d71b7e9459
      Signed-off-by: default avatarYuqi Gu <yuqi.gu@arm.com>
      151fc0ed
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 0b4ed0b7
      Marko Mäkelä authored
      0b4ed0b7
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · aa6cb7ed
      Marko Mäkelä authored
      aa6cb7ed
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · c277bcd5
      Marko Mäkelä authored
      c277bcd5
    • Marko Mäkelä's avatar
      MDEV-22782 AddressSanitizer race condition in trx_free() · f3160ee4
      Marko Mäkelä authored
      In trx_free() we used to declare the entire trx_t unaccessible
      and then declare that some data members are accessible.
      This involves a race condition with other threads that may concurrently
      access the data members that must remain accessible.
      One type of error is "AddressSanitizer: unknown-crash", whose
      exact cause we have not determined.
      
      Another type of error (reported in MDEV-23472) is "use-after-poison",
      where the reported shadow bytes would in fact be 00, indicating that
      the memory was no longer poisoned. The poison-access-unpoison race
      condition was confirmed by "rr replay".
      
      We eliminate the race condition by invoking MEM_NOACCESS on each
      individual data member of trx_t before freeing the memory to the pool.
      The memory would not be unpoisoned until the pool is freed
      or the memory is being reused for another allocation.
      
      trx_t::free(): Replaces trx_free().
      
      trx_t::active_commit_ordered: Changed to bool, so that MEM_NOACCESS
      can be invoked. Removed some accessor functions.
      
      Pool: Remove all MEM_ instrumentation.
      
      TrxFactory: Move the MEM_ instrumentation from Pool.
      
      TrxFactory::debug(): Removed. Moved to trx_t::free(). Because
      the memory was already marked unaccessible in trx_t::free(), the
      Factory::debug() call in Pool::putl() would be unable to access it.
      
      trx_allocate_for_background(): Replaces trx_create_low().
      
      trx_t::free(): Perform all consistency checks while avoiding
      duplication, and declare most data members unaccessible.
      f3160ee4
    • Andrei Elkin's avatar
      MDEV-23511 shutdown_server 10 times out, causing server kill at shutdown · a19cb388
      Andrei Elkin authored
      Shutdown of mtr tests may be too impatient, esp on CI environment where
      10 seconds of `arg` of `shutdown_server arg` may not be enough for the clean
      shutdown to complete.
      
      This is fixed to remove explicit non-zero timeout argument to
      `shutdown_server` from all mtr tests. mysqltest computes 60 seconds default
      value for the timeout for the argless `shutdown_server` command.
      This policy is additionally ensured with a compile time assert.
      a19cb388
    • Marko Mäkelä's avatar
      MDEV-23526 InnoDB leaks memory for some static objects · d98ccbe1
      Marko Mäkelä authored
      Leaks of some members of statically allocated objects are
      not being reported by AddressSanitizer or Valgrind, but they
      can be reported by implementing SAFEMALLOC instrumentation.
      
      These leaks were identified and original fixes provided
      by Michael Widenius and Vicențiu Ciorbaru.
      d98ccbe1
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · f2739e2a
      Marko Mäkelä authored
      f2739e2a
    • Marko Mäkelä's avatar