1. 11 Aug, 2020 1 commit
    • Marko Mäkelä's avatar
      After-merge fix of a result · 909d362f
      Marko Mäkelä authored
      In the merge eae968f6, it turns out that
      I had accidentally initiated an in-source build in the past, and
      $MYSQL_TZINFO_TO_SQL was pointing to a stale copy of the executable in
      the source directory, instead of the correct one in the build directory.
      909d362f
  2. 10 Aug, 2020 13 commits
  3. 08 Aug, 2020 1 commit
    • Alexander Barkov's avatar
      MDEV-23415 Server crash or Assertion `dec_length <= str_length' failed in... · fe555b9c
      Alexander Barkov authored
      MDEV-23415 Server crash or Assertion `dec_length <= str_length' failed in Item_func_format::val_str_ascii
      
      Problem:
      
      The crash happened in FORMAT(double, dec>=31, 'de_DE').
      
      The patch for MDEV-23118 (commit 0041dacc)
      did not take into account that String::set_real() has a limit of 31
      (FLOATING_POINT_DECIMALS) fractional digits. So for the range of 31..38
      digits, set_real() switches to use:
      - my_fcvt() - decimal point notation, e.g. 1.9999999999
      - my_gcvt() - scientific notation,    e.g. 1e22
      
      my_gcvt() returned a shorter string than Item_func_format::val_str_ascii()
      expected to get after the my_fcvt() call, so it crashed on assert.
      
      Solution:
      
      We cannot extend set_real() to use the my_fcvt() mode for the range of
      31..38 fractional digits, because set_real() is used in a lot of places
      and such a change will break everything.
      
      Introducing String::set_fcvt() which always prints using my_fcvt()
      for the whole range of decimals 0..38, supported by the FORMAT() function.
      fe555b9c
  4. 07 Aug, 2020 2 commits
  5. 06 Aug, 2020 7 commits
  6. 05 Aug, 2020 3 commits
    • Varun Gupta's avatar
      MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after... · 1e31d748
      Varun Gupta authored
      MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after DELETE with subquery with ROLLUP
      
      The issue here is when records are read from the temporary file
      (filesort result in this case) via a cache(rr_from_cache).
      The cache is initialized with init_rr_cache.
      For correlated subquery the cache allocation is happening at each execution
      of the subquery but the deallocation happens only once and that was
      when the query execution was done.
      
      So generally for subqueries we do two types of cleanup
      
      1) Full cleanup: we should free all resources of the query(like temp tables).
         This is done generally when the query execution is complete or the subquery
         re-execution is not needed (case with uncorrelated subquery)
      
      2) Partial cleanup: Minor cleanup that is required if
         the subquery needs recalculation. This is done for all the structures that
         need to be allocated for each execution (example SORT_INFO for filesort
         is allocated for each execution of the correlated subquery).
      
      The fix here would be free the cache used by rr_from_cache in the partial
      cleanup phase.
      1e31d748
    • Alexander Barkov's avatar
      MDEV-23118 FORMAT(d1,dec) where dec=0/38 and d1 is DECIMAL(38,38) gives incorrect results · 0041dacc
      Alexander Barkov authored
      FORMAT() can print more integer digits (than the argument has)
      if rounding happens:
      
        FORMAT(9.9,0) -> '10'
      
      The old code did not take this into account.
      
      Fix:
      
      1. One extra digit is needed in case of rounding
      
      - If args[1] is a not-NULL constant, then reserve space for one extra integer
        digit if the requested number of decimals is less than args[0]->decimals.
      
      - Otherwise, reserve space for one extra integer digit if
        args[0]->decimals is not 0, because rounding can potentially happen
        (depending on the exact data in arguments).
      
      2. One extra digit is also needed if the argument has no integer digits,
         e.g. in a data type like DECIMAL(38,38).
      
      The conditions 1 and 2 are ORed.
      
      3. Fixing FORMAT_MAX_DECIMALS from 30 to 38. This was forgotten in 10.2.1
         (when the limit for the number of fractional digits in DECIMAL was extended).
      0041dacc
    • Alexander Barkov's avatar
      MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result · 0e80f5a6
      Alexander Barkov authored
      Skip leading zeros when converting a string to decimal_t.
      0e80f5a6
  7. 04 Aug, 2020 13 commits
    • Sergei Golubchik's avatar
      4ed4cf02
    • Sergei Golubchik's avatar
      a09a06d5
    • Elena Stepanova's avatar
      8d462523
    • Jan Lindström's avatar
      Add wait conditions for cluster size. · 14a5f73c
      Jan Lindström authored
      14a5f73c
    • Sergei Golubchik's avatar
      5.6.49-89.0 · 2adaaeba
      Sergei Golubchik authored
      2adaaeba
    • Marko Mäkelä's avatar
      MDEV-23345 Assertion not_redundant() == old.not_redundant() · 9a156e1a
      Marko Mäkelä authored
      In commit fd9ca2a7 (MDEV-23295)
      we added a debug assertion, which caught a similar bug.
      
      prepare_inplace_alter_table_dict(): If we had promised that
      ALGORITHM=INPLACE or ALGORITHM=NOCOPY is supported, we must
      preserve the ROW_FORMAT.
      9a156e1a
    • Marko Mäkelä's avatar
      MDEV-23101 fixup: Remove redundant code · 91caf130
      Marko Mäkelä authored
      lock_rec_has_to_wait_in_queue(): Remove an obviously redundant assertion
      that was added in commit a8ec4586
      and also enclose a Galera-specific condition in #ifdef WITH_WSREP.
      91caf130
    • Sachin's avatar
      MDEV-23089 rpl_parallel2 fails in 10.5 · e3c18b8e
      Sachin authored
      Problem:- rpl_parallel2 was failing non-deterministically
      Analysis:-
      When FLUSH TABLES WITH READ LOCK is executed, it will allow all worker
      threads to complete their ongoing transactions and then it will pause them.
      At this state FTWRL will proceed to acquire global read lock. FTWRL first
      blocks threads from starting new commits, then upgrades the lock to block
      commit of existing transactions.
        Step1:
          FLUSH TABLES WITH READ LOCK - Blocks new commits
        Step2:
          * STOP SLAVE command enables 'force_abort=1' which unblocks workers,
            they continue to execute events.
          * T1: Waits in 'record_gtid' call to update 'gtid_slave_pos' table with
            its current GTID, but it is blocked becuase of Step1.
          * T2: Holds COMMIT lock and waits for T1 to commit.
        Step3:
          FLUSH TABLES WITH READ LOCK - Waiting to get BLOCK_COMMIT.
      This results in deadlock. When STOP SLAVE command allows paused workers to
      proceed, workers should skip the execution of all further events, similar
      to 'conservative' parallel mode.
      Solution:-
      We will assign 1 to skip_event_group when we are aborted in do_ftwrl_wait.
      rpl_parallel_entry->pause_sub_id is only reset when force_abort is off in
      rpl_pause_after_ftwrl.
      e3c18b8e
    • Alexander Barkov's avatar
      MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds · d4967659
      Alexander Barkov authored
      Lex_input_stream::scan_ident_delimited() could go beyond the end
      of the input when a starting backtick (`) delimiter did not have a
      corresponding ending backtick.
      
      Fix: catch the case when yyGet() returns 0, which means
      either eof-of-query or straight 0x00 byte inside backticks,
      and make the parser fail on syntax error, displaying the left
      backtick as the syntax error place.
      
      In case of filename in a script like this:
      
      SET CHARACTER_SET_CLIENT=17; -- 17 is 'filename'
      SELECT doc.`Children`.0 FROM t1;
      
      the ending backtick was not recognized as such because my_charlen() returns 0 for
      a straight backtick (backticks must normally be encoded as @0060 in filename).
      
      The same fix works for 'filename': the execution skips the backtick
      and reaches the end of the query, then yyGet() returns 0.
      This fix is OK for now. But eventually 'filename' should either be disallowed
      as a parser character set, or fixed to handle encoded punctuation properly.
      d4967659
    • Rucha Deodhar's avatar
      MDEV-23082: ER_TABLEACCESS_DENIED_ERROR error message is truncated, · 5fb07d22
      Rucha Deodhar authored
      and inaccurately
      
      Analysis: The list of all privileges is 118 characters wide. However, the
      format of error message was: "%-.32s command denied to user...". get_length()
      sets the maximum width to 32 characters. As a result, only first 32
      characters of list of privilege are stored.
      Fix: Changing the format to "%-.100T..." so that get_length() sets width to
      100. Hence, first 100 characters of the list of privilege are stored and the
      type specifier 'T' appends '...' so that truncation can be seen.
      5fb07d22
    • Rucha Deodhar's avatar
      MDEV-14836: Assertion `m_status == DA_ERROR' failed in · 745fa255
      Rucha Deodhar authored
      Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
      
      open_normal_and_derived_table() fails because the query was already killed
      as rows examined by the query are more than the limit. However, this isn't a
      real error.
      Fix: Check if there is actually an error before calling thd->sql_errno()
      and later send a warning in handle_select() if no real error.
      745fa255
    • Jan Lindström's avatar
      87b1625b
    • Alexander Barkov's avatar
      MDEV-23388 Assertion `args[0]->decimals == 0' failed in Item_func_round::fix_arg_int · 100f0c96
      Alexander Barkov authored
      Type_handler_temporal_result::Item_func_min_max_fix_attributes()
      in an expression GREATEST(string,date), e.g:
      
        SELECT GREATEST('1', CAST('2020-12-12' AS DATE));
      
      incorrectly evaluated decimals as 6 (like for DATETIME).
      
      Adding a separate virtual implementation:
        Type_handler_date_common::Item_func_min_max_fix_attributes()
      This makes the code simpler.
      100f0c96