1. 10 Oct, 2018 5 commits
  2. 09 Oct, 2018 5 commits
    • Sergei Petrunia's avatar
      MDEV-16577: rocksdb.issue255 fails in buildbot · 8b371e4b
      Sergei Petrunia authored
      Make the testcase stable
      8b371e4b
    • Alexander Barkov's avatar
      MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in... · 5646c431
      Alexander Barkov authored
      MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning
      
      The problem happened because {{Field_xxx::store(longlong nr, bool unsigned_val)}} erroneously passed {{unsigned_flag}} to the {{usec}} parameter of this constructor:
      {code:cpp}
      Datetime(int *warn, longlong sec, ulong usec, date_conv_mode_t flags)
      {code}
      
      1. Changing Time and Datetime constructors to accept data as Sec6 rather than as
      longlong/double/my_decimal, so it's not possible to do such mistakes
      in the future. Additional good effect of these changes:
      - This reduced some amount of similar code (minus ~35 lines).
      - The code now does not rely on the fact that "unsigned_flag" is
         not important inside Datetime().
        The constructor always gets all three parts: sign, integer part,
        fractional part. The simple the better.
      
      2. Fixing Field_xxx::store() to use the new Datetime constructor format.
         This change actually fixes the problem.
      
      3. Adding "explicit" keyword to all Sec6 constructors,
      to avoid automatic hidden conversion from double/my_decimal to Sec6,
      as well as from longlong/ulonglong through double to Sec6.
      
      4. Change#1 caused (as a dependency) changes in a few places
         with code like this:
      
        bool neg= nr < 0 && !unsigned_val;
        ulonglong value= m_neg ? (ulonglong) -nr : (ulonglong) nr;
      
      These fragments relied on a non-standard behavior with
      the operator "minus" applied to the lowest possible negative
      signed long long value. This can lead to different results
      depending on the platform and compilation flags.
      We have fixed such bugs a few times already.
      So instead of modifying the old wrong code to a new wrong code,
      replacing all such fragments to use Longlong_hybrid,
      which correctly handles this special case with -LONGLONG_MIN
      in its method abs().
      This also reduced the amount of similar code
      (1 or 2 new lines instead 3 old lines in all 6 such fragments).
      
      5. Removing ErrConvInteger(longlong nr, bool unsigned_flag= false)
         and adding ErrConvInteger(Longlong_hybrid) instead, to encourage
         use of safe Longlong_hybrid instead of unsafe pairs nr+neg.
      
      6. Removing unused ErrConvInteger from Item_cache_temporal::get_date()
      5646c431
    • Vladislav Vaintroub's avatar
      MDEV-17279 Windows : link C runtime dynamically · f4cdf90d
      Vladislav Vaintroub authored
      Changed the build to use /MD flag so that DDL version of C runtime is used.
      
      To make sure MariaDB is always runnable on target system, include
      redistributable CRT libraries into installer.
      
      For MSI package, use Microsoft's merge modules.
      For ZIP  use "applocal" approach,i.e place redistributable dlls
      into the bin directory of the package(via InstallRequiredSystemLibraries
      cmake module) The space overhead of libraries in negligible, ~ 3MB unpacked.
      
      There are 2 cases, where we still link C runtime statically
      
      - Upgrade wizard, it uses MFC, and we link statically to avoid
      redistribute also whole MFC (for this single application, does not
      make much sense).
      
      - MSI installer's custom action dll wixca.dll.Here, we need static link
      so that MSI won't fail on a target system that does not have VC++2015
      runtime already installed.
      f4cdf90d
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 43ee6915
      Marko Mäkelä authored
      43ee6915
    • Alexander Barkov's avatar
      MDEV-17400 The result of TIME('42949672965959-01') depends on architecture · c57bbb25
      Alexander Barkov authored
      - Fixing portabibily problems in sql-common/my_time.c
        (and additionally in sql/sql_time.cc)
      
      - Re-enabling func_time.test
        Now all new chunks added in MDEV-17351 work fine on all platforms.
      c57bbb25
  3. 08 Oct, 2018 7 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16980 Wrongly set tablename len while opening the · e9d9ca8c
      Thirunarayanan Balathandayuthapani authored
      			table for purge thread
      
      Problem:
      =======
      	Purge tries to fetch mdl lock for the whole table even though it tries
      to open one of the partition. But table name length was wrongly set to indicate
      the partition name too.
      
      Solution:
      ========
      - Table name length should identify the table name only not the partition name.
      e9d9ca8c
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16980 Wrongly set tablename len while opening the · 7d4beb72
      Thirunarayanan Balathandayuthapani authored
      		table for purge thread
      
      Problem:
      =======
      	Purge tries to fetch mdl lock for the whole table even though it tries
      to open one of the partition. But table name length was wrongly set to indicate
      the partition name too.
      
      Solution:
      ========
      - Table name length should identify the table name only not the partition name.
      7d4beb72
    • Igor Babaev's avatar
      MDEV-17381 Wrong query result with LATERAL DERIVED optimization · 85953617
      Igor Babaev authored
                and join_cache_level=6
      
      This bug was fixed by the patch for mdev-17382 applied to 5.5.
      85953617
    • Alexander Barkov's avatar
    • Igor Babaev's avatar
      MDEV-17382 Hash join algorithm should not be used to join materialized · e2535dcc
      Igor Babaev authored
                 derived table / view by equality
      
      Now rows of a materialized derived table are always put into a
      temporary table before join operation. If BNLH is used to join this
      table with the result of a partial join then both operands of the
      join are actually put into main memory. In most cases this is not
      efficient.
      We could avoid this by sending the rows of the derived table directly
      to the join operation. However this kind of data flow is not supported
      yet.
      Fixed by not allowing usage of hash join algorithm to join a materialized
      derived table if it's joined by an equality predicate of the form
      f=e where f is a field of the derived table.
      
      Change for the test case in 10.3: splitting must be turned off to preserve
      the explain.
      e2535dcc
    • Alexander Barkov's avatar
      MDEV-17351 Wrong results for GREATEST,TIMESTAMP,ADDTIME with an out-of-range TIME-alike argument · b639fe2b
      Alexander Barkov authored
      Problems:
      
      Functions LEAST() and GREATEST() in TIME context, as well as functions
      TIMESTAMP(a,b) and ADDTIME(a,b), returned confusing results when the
      input TIME-alike value in a number or in a string was out of the TIME
      supported range.
      
      In case of TIMESTAMP(a,b) and ADDTIME(a,b), the second argument
      value could get extra unexpected digits. For example, in:
          ADDTIME('2001-01-01 00:00:00', 10000000)  or
          ADDTIME('2001-01-01 00:00:00', '1000:00:00')
      the second argument was converted to '838:59:59.999999'
      with six fractional digits, which contradicted "decimals"
      previously set to 0 in fix_length_and_dec().
      These unexpected fractional digits led to confusing function results.
      
      Changes:
      1. GREATEST(), LEAST()
      
         - fixing Item_func_min_max::get_time_native()
         to respect "decimals" set by fix_length_and_dec().
         If a value of some numeric or string time-alike argument
         goes outside of the TIME range and gets limited to '838:59:59.999999',
         it's now right-truncated to the correct fractional precision.
      
         - fixing, Type_handler_temporal_result::Item_func_min_max_fix_attributes()
         to take into account arguments' time_precision() or datetime_precision(),
         rather than rely on "decimals" calculated by the generic implementation
         in Type_handler::Item_func_min_max_fix_attributes(). This makes
         GREATEST() and LEAST() return better data types, with the same
         fractional precision with what TIMESTAMP(a,b) and ADDTIME(a,b) return
         for the same arguments, and with DATE(a) and TIMESTAMP(a).
      
      2. Item_func_add_time and Item_func_timestamp
      
         It was semantically wrong to apply the limit of the TIME data type
         to the argument "b", which plays the role of "INTERVAL DAY TO SECOND" here.
         Changing the code to fetch the argument "b" as INTERVAL rather than as TIME.
      
         The low level routine calc_time_diff() now gets the interval
         value without limiting to '838:59:59.999999', so in these examples:
           ADDTIME('2001-01-01 00:00:00', 10000000)
           ADDTIME('2001-01-01 00:00:00', '1000:00:00')
         calc_time_diff() gets '1000:00:00' as is.  The SQL function result
         now gets limited to the supported result data type range
         (datetime or time) inside calc_time_diff(), which now calculates
         the return value using the real fractional digits that
         came directly from the arguments (without the effect of limiting
         to the TIME range), so the result does not have any unexpected
         fractional digits any more.
      
         Detailed changes in TIMESTAMP() and ADDTIME():
      
         - Adding a new class Interval_DDhhmmssff. It's similar to Time, but:
           * does not try to parse datetime format, as it's not needed for
             functions TIMESTAMP() and ADDTIME().
           * does not cut values to '838:59:59.999999'
      
           The maximum supported Interval_DDhhmmssff's hard limit is
           'UINT_MAX32:59:59.999999'. The maximum used soft limit is:
           - '87649415:59:59.999999'   (in 'hh:mm:ss.ff' format)
           - '3652058 23:59:59.999999' (in 'DD hh:mm:ss.ff' format)
           which is a difference between:
           - TIMESTAMP'0001-01-01 00:00:00' and
           - TIMESTAMP'9999-12-31 23:59:59.999999'
           (the minimum datetime that supports arithmetic, and the
           maximum possible datetime value).
      
         - Fixing get_date() methods in the classes related to functions
           ADDTIME(a,b) and TIMESTAMP(a,b) to use the new class Interval_DDhhmmssff
           for fetching data from the second argument, instead of get_date().
      
         - Fixing fix_length_and_dec() methods in the classes related
           to functions ADDTIME(a,b) and TIMESTAMP(a,b) to use
           Interval_DDhhmmssff::fsp(item) instead of item->time_precision()
           to get the fractional precision of the second argument correctly.
      
         - Splitting the low level function str_to_time() into smaller pieces
           to reuse the code. Adding a new function str_to_DDhhmmssff(), to
           parse "INTERVAL DAY TO SECOND" values.
      
         After these changes, functions TIMESTAMP() and ADDTIME()
         return much more predictable results, in terms of fractional
         digits, and in terms of the overall result.
      
         The full ranges of DATETIME and TIME values are now covered by TIMESTAMP()
         and ADDTIME(), so the following can now be calculated:
      
          SELECT ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59.999999');
          -> '9999-12-31 23:59:59.999999'
      
          SELECT TIMESTAMP(DATE'0001-01-01', '87649415:59:59.999999')
          -> '9999-12-31 23:59:59.999999'
      
          SELECT ADDTIME(TIME'-838:59:59.999999', '1677:59:59.999998');
          -> '838:59:59.999999'
      b639fe2b
    • Igor Babaev's avatar
      MDEV-17382 Hash join algorithm should not be used to join materialized · 1ebe841f
      Igor Babaev authored
                 derived table / view by equality
      
      Now rows of a materialized derived table are always put into a
      temporary table before join operation. If BNLH is used to join this
      table with the result of a partial join then both operands of the
      join are actually put into main memory. In most cases this is not
      efficient.
      We could avoid this by sending the rows of the derived table directly
      to the join operation. However this kind of data flow is not supported
      yet.
      Fixed by not allowing usage of hash join algorithm to join a materialized
      derived table if it's joined by an equality predicate of the form
      f=e where f is a field of the derived table.
      1ebe841f
  4. 07 Oct, 2018 1 commit
    • Igor Babaev's avatar
      MDEV-17360 Server crashes in optimize_keyuse · d03581bf
      Igor Babaev authored
      This was a bug in the code of MDEV-12387 "Push conditions into materialized
      subqueries". The bug manifested itself in rather rare situations. An
      affected query must contain IN subquery predicate whose left operand
      was an outer field of a mergeable derived table or view and right operand
      was a materialized subquery.
      The erroneous code in fact stripped off the Item_direct_ref wrapper from
      the left operand of the IN subquery predicate when building equalities
      produced by the conversion of the predicate into a semi-join. As a result
      the left operand was not considered as an outer reference anymore and
      used_tables() was calculated incorrectly. This caused a crash in the
      function optimize_keyuse().
      d03581bf
  5. 06 Oct, 2018 1 commit
  6. 05 Oct, 2018 13 commits
  7. 04 Oct, 2018 4 commits
  8. 03 Oct, 2018 4 commits
    • Vladislav Vaintroub's avatar
      AWS KMS plugin : more detailed message when API calls fail. · 753117fe
      Vladislav Vaintroub authored
      Output API function name, exception name, exception text
      753117fe
    • Vladislav Vaintroub's avatar
      Update libmariadb · f67e0504
      Vladislav Vaintroub authored
      f67e0504
    • Marko Mäkelä's avatar
      MDEV-11369: Implement accurate checks for the metadata record · ae4f464f
      Marko Mäkelä authored
      Because changes of the FIL_PAGE_TYPE or PAGE_INSTANT in the root
      page are not undo-logged, it is possible that the fields suggest
      that instant ADD COLUMN is in effect, even though no metadata
      record exists. If the fields are set, proceed to fetch the
      metadata record. If the metadata record does not exist, return
      success if !index->is_instant().
      
      Also, check that the "infimum" and "supremum" records carry the
      strings in the root page. In a later format that supports instant
      DROP COLUMN, we will have to store more information in the root
      page, so that index->n_core_null_bytes can be determined accurately.
      ae4f464f
    • Marko Mäkelä's avatar
      MDEV-11369: Implement stricter checks for the metadata record · c134f565
      Marko Mäkelä authored
      btr_cur_instant_init_low(): If columns were instantly added and dropped,
      then index->is_instant() might not hold even though the root page type
      was FIL_PAGE_TYPE_INSTANT. MariaDB 10.3 must refuse to open such files,
      because instant DROP COLUMN is not supported.
      
      Also, refuse to open the table if the metadata record has
      wrong info OR status bits. Previously, we only refused to open
      if both bits were wrong.
      c134f565