maria:bb-10.3-MDEV-17516

Last commit made on 2023-01-31
Get this branch:
git clone -b bb-10.3-MDEV-17516 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.3-MDEV-17516
Repository:
lp:maria

Recent commits

f981b53... by Brandon Nesterenko

MDEV-17516 Regression

Replication lag issue using parallel replication

Test showing that after restart, SBM will start at
0, and then increase as soon as the IO thread
queues an event

2ed598e... by Sergey Petrunia

Added comments re JOIN::all_fields, JOIN::fields_list

c456303... by Ian Gilfillan <email address hidden>

Update 10.3 HELP tables

074bef4... by Igor Babaev

MDEV-30248 Infinite sequence of recursive calls when processing embedded CTE

This patch fixes the patch for bug MDEV-30248 that unsatisfactorily
resolved the problem of resolution of references to CTE. In some cases
when such a reference has the same table name as the name of one of
CTEs containing this reference the reference could be resolved incorrectly
that led to an invalid select tree where units could be mutually dependent.
This in its turn could lead to an infinite sequence of recursive calls or
to falls into infinite loops.

The patch also removes LEX::resolve_references_to_cte_in_hanging_cte() as
with the new code for resolution of CTE references the call of this
function is not needed anymore.

Approved by Oleksandr Byelkin <email address hidden>

f18c2b6... by Sergey Petrunia

MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null |

(Initial patch by Varun Gupta. Amended and added comments).

When the query has both
1. Aggregate functions that require sorting data by group, and
2. Window functions

we need to use two temporary tables. The first temp.table will hold the
join output. Then it is passed to filesort(). Reading it in sorted
order allows to compute the aggregate functions.

Then, we need to write their values into the second temp. table. Then,
Window Function computation step can pass that to filesort() and read
them in the order it needs.

Failure to create the second temp. table would cause an assertion
failure: window function could would not find where to get the values
of the aggregate functions.

00150ff... by Vicențiu Ciorbaru

Fix connect bson.cpp warning

The ptyp variable is unused.

244bf37... by Vicențiu Ciorbaru

Fix mroonga warning of use-after-free

567b681... by Mikhail Chalov <email address hidden>

Minimize unsafe C functions usage - replace strcat() and strcpy() (and strncat() and strncpy()) with custom safe_strcat() and safe_strcpy() functions

The MariaDB code base uses strcat() and strcpy() in several
places. These are known to have memory safety issues and their usage is
discouraged. Common security scanners like Flawfinder flags them. In MariaDB we
should start using modern and safer variants on these functions.

This is similar to memory issues fixes in 19af1890b56c6c147c296479bb6a4ad00fa59dbb
and 9de9f105b5cb88249acc39af73d32af337d6fd5f but now replace use of strcat()
and strcpy() with safer options strncat() and strncpy().

However, add '\0' forcefully to make sure the result string is correct since
for these two functions it is not guaranteed what new string will be null-terminated.

Example:

    size_t dest_len = sizeof(g->Message);
    strncpy(g->Message, "Null json tree", dest_len); strncat(g->Message, ":",
    sizeof(g->Message) - strlen(g->Message)); size_t wrote_sz = strlen(g->Message);
    size_t cur_len = wrote_sz >= dest_len ? dest_len - 1 : wrote_sz;
    g->Message[cur_len] = '\0';

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

-- Reviewer and co-author Vicențiu Ciorbaru <email address hidden>
-- Reviewer additions:
* The initial function implementation was flawed. Replaced with a simpler
  and also correct version.
* Simplified code by making use of snprintf instead of chaining strcat.
* Simplified code by removing dynamic string construction in the first
  place and using static strings if possible. See connect storage engine
  changes.

ea27017... by Igor Babaev

MDEV-30052 Crash with a query containing nested WINDOW clauses

Use SELECT_LEX to save lists for ORDER BY and GROUP BY before parsing
WINDOW clauses / specifications. This is needed for proper parsing
of a nested WINDOW clause when a WINDOW clause is used in a subquery
contained in another WINDOW clause.

Fix assignment of empty SQL_I_List to another one (in case of empty list
next shoud point on first).

6fe882c... by Eric Herman

Add my_afree after my_alloca in early return case

The code already had a call to `my_afree` in the normal return case,
but failed to do so in the early return case.