Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Console View


Categories: connectors experimental galera main
Legend:   Passed Failed Warnings Failed Again Running Exception Offline No data

connectors experimental galera main
Sergei Golubchik
bump the VERSION
Sergei Golubchik
MDEV-34680 post-fixes

* clarify the help text for --server-audit-file-rotate-size
* initialize cn->sync_statement, otherwise new connection randomly syncs
* and DON'T SPAM syslog
Iqbal Hassan
Cleanup#3 for MDEV-34319: DECLARE TYPE .. TABLE OF .. INDEX BY

Fixes self assignment issues e.g.
  assoc(1):= assoc(1);
  assoc(1):= assoc(2);
  assoc(1).field:= assoc(1).field;
  assoc(1).field:= assoc(2).field;
  assoc:= assoc;
  etc

Fixes null element handling and null element's field handling e.g.
  assoc(1):= NULL;
  assoc(1).f:= NULL;

Fixes crash when a missing assoc array's element is accesed in the RHS of an assignment operation.

Bulk tests for self-assign and subselect tests for associative array contributed by Alexander Barkov.
Alexander Barkov
Cleanup#1 for MDEV-34319: DECLARE TYPE .. TABLE OF .. INDEX BY

- Checking that the key expression is compatible with the INDEX BY data type
  for assignment in expressions:
    assoc_array_variable(key_expr)
    assoc_array_variable(key_expr).field

  in all contexts: SELECT, assignment target, INTO target.
  Raising an error in case it's not compatible.

- Disallowing non-constant expressions as a key,
  as the key is evaluated during the fix_fields() time.

- Disallowing stored functions as a key:
    assoc_array(stored_function())
    assoc_array(stored_function()).field

  The underlying MariaDB code is not ready to call a stored function
  during the fix_fields() time. This will be fixed in a separate MDEV.

- Removing the move Assoc_array_data's constructor.
  Using the usual constructor instead.

- Setting m_key.thread_specific and m_value.thread_specific to true
  in the Assoc_array_data constructor. This is needed to get assoc array
  element data counted by the @@session.memory_used status variable.

  Adding DBUG_ASSERTs to make sure the thread_specific flag never
  disappears in Assoc_array_data members.

- Removing my_free(item) from Field_assoc_array::element_by_key.
  It was a remainder from an earlier patch version.
  In the current patch version all Items behind an assoc array are
  created on a mem_root. It's wrong to use my_free() with them.

- Adding a helper method Field_assoc_array::assoc_tree_search()

- Fixing assoc_array_var.delete() to work as a procedure
  rather than a function. It does not need SELECT/DO any more.

- Fixing the crash in a few ctype_xxx tests, caused by the grammar change.

- Fixing compilation failure on Windows

- Adding a new method LEX::set_field_type_udt_or_typedef()
  and removing duplicate code from sql_yacc.yy

- Renaming the grammar rule field_type_all_with_composites to
  field_type_all_with_typedefs

- Removing the grammar rule assoc_array_index_types.
  Changing the grammar to "INDEX_SYM BY field_type".

  Removing the grammar rule field_type_all_with_record.
  Allow field_type_all_with_typedefs as an assoc array element.

  Catching wrong index and element data types has been moved to
  Type_handler_assoc_array::Column_definition_set_attributes().
  It raises an SQL error on things like:
  * assoc array of assoc arrays in TABLE OF
  * index by a non-supported types in INDEX BY

- Removing four methods:
  * sp_type_def_list::type_defs_add_record()
  * sp_type_def_list::type_defs_add_composite2()
  * sp_pcontext::type_defs_declare_record()
  * sp_type_def_list::type_defs_declare_composite2()
  Adding two methods instead:
  * sp_type_def_list::type_defs_add()
  * sp_pcontext::type_defs_add()
  This allows to get rid of the duplicate code detecting data type
  declarations with the same name in the same sp_pcontext frame.

- Adding new methods:
  * LEX::declare_type_assoc_array()
  * LEX::LEX::declare_type_record()
  They create a type specific sp_type_def_xxx and the call the generic
  sp_pcontext::type_defs_add().

- m_key_def.sp_prepare_create_field() inside
  Field_assoc_array::create_fields() is now called for all key data types
  (not only for integers)

- Removing the assignment of key_def->charset in
  Type_handler_assoc_array::sp_variable_declarations_finalize().
  The charset is now evaluated in m_key_def.sp_prepare_create_field().

- Fixing Item_assoc_array::get_key() to set the character set of the "key"
  to utf8mb3 instead of binary

- Fixing Field_assoc_array::copy_and_convert_key() to set the key length
  limit in terms of the character length as specified in
  INDEX BY VARCHAR(N), instead of octet length. This is needed to make
  keys with multi-byte characters work correctly.
  Also it now raises different errors depending on the reason of the
  key conversion failures:
  * ER_INVALID_CHARACTER_STRING
  * ER_CANNOT_CONVERT_CHARACTER

- Changing the prototype for Type_handler_composite::key_to_lex_cstring() to

  virtual LEX_CSTRING key_to_lex_cstring(THD *thd,
                                          const sp_rcontext_addr &var,
                                          Item **key,
                                          String *buffer) const;
  * Now it returns a LEX_CSTRING, instead of getting it as an out parameter.
  * Gets an sp_rcontext_addr instead of "name" and "def"
  * Gets a String buffer which can be used to be passed to val_str(),
    or for character set conversion purposes.

- Removing Field_assoc_array::m_key_def, as all required information
  is available from Field_assoc_array::m_key_field.
  In Field_assoc_array::create_fields turning m_key_def to a local variable
  key_def.

- Fixing Field_assoc_array::copy_and_convert_key() to follow MariaDB coding
  style: only constants can be passed by-reference, not-constants should
  be passed by-pointer.

- Adding DBUG_ASSERTs into Type_handler_assoc_array::get_item()
  and Type_handler_assoc_array::get_or_create_item() that the passed
  key in "name" is well formed according to the charset of INDEX BY.

- Changing the error ER_TOO_LONG_KEY to ER_WRONG_STRING_LENGTH.
  The former prints length limit in bytes, which is not applicable
  for INDEX BY values, because its limit is in characters.
  Also, the latter is more verbose.

- Fixing the problem that these wrong uses of an assoc array variable:

    BEGIN
      assoc_var;
      assoc_var(1);
    END;

  raised a weird error message:
    ERROR 1054 (42S22): Unknown column 'assoc_var' in '(null)'

  Now a more readable parse error is raised.

- Adding a "Duplicate key" warning for the cases when assigning
  between two assoc arrays rejects some records due to different
  collations in their INDEX BY key definitions.

- Disallow INDEX OF propagation from VARCHAR to TEXT.
  The underlying code cannot handle TEXT.
  Adding tests.

- Adding a helper class StringBufferKey to pass to val_str() when
  a key value is evaluated.
  Fixing all val_str() calls to val_str(&buffer), as the former is
  not desirable.

- Fixing a wrong use of args[0]->null_value in
  Item_func_assoc_array_exists::val_bool()

- Fixing a problem that using TABLE OF TEXT crashed the server.
  Thanks to Iqbal Hassan for the proposed patch.

- Changes in Qualified_ident:
  * Fixing the Qualified_ident constructors to get all parst as
    Lex_ident_cli_st, rather than the first part as Lex_ident_cli_st
    with the following parts Lex_ident_sys.
    This makes the code more symmetric.
  * Fixing the grammar in sql_yacc.yy accordinly.
  * Fixing the data type storing the possition in the client query
    from "const char *" to Lex_ident_cli.
  * Adding a new method Qualified_ident::is_sane().
    It allows to reduce the code side in sql_yacc.yy.
    Thanks to Iqbal Hassan for the idea.

- Replacing qs_append() to append_ulonglong() in:
  * Item_method_func::print()
  * Item_splocal_assoc_array_element::print()
  * Item_splocal_assoc_array_element_field::print()

  These methods do not use reserve()/alloc(), so calling qs_append()
  was wrong and caused a crash.

- Changing the output formats of these methods:
  * Item_splocal_assoc_array_element::print()
  * Item_splocal_assoc_array_element_field::print()
  not to print the key two times.
  Also moving the `@123` part (the variable offset) immediately
  after the variabl name and before the `[key]` part.

- Fixing a memory leak happened when trying to insert a duplicate
  key into an assoc array. Also adding a new "THD *" parameter to
  Field_assoc_array::insert_element(). Thanks to Iqbal Hassan for the fix.
  Adding a test into sp-assoc-array-ctype.test.

- In  Field_assoc_array::create_fields: m_element_field->field_name is now
  set for all element data types (not only for records).
  This fixed a wrong variable name in warnings. Adding tests.

- Adding tests:
  * Adding tests for assoc array elements in UNIONs.

  * Copying from an assoc array with a varchar key
    to an assoc array with a shorter varchar key.

  * A relatively big associative array.

  * Memory usage for x86_64.

  * Package variable as assoc array keys.

  * Character set conversion

  * TABLE OF TEXT

  * TABLE OF VARCHAR(>64k bytes) propagation to TABLE OF TEXT.

  * TEXT element fields in an array of records.

  * VARCHAR->TEXT propagation in elements in an array of records.

  * Some more tests
ParadoxV5
Merge branch 'MDEV-37316' into bb-19248-libmariadb

Step 1 “MDEV-37321 Link `sql/*` to Connector/C” redone
with a lesser impact for the [reined in scope][scope].
Now runs again because Connector/C is unused despite linked.

[scope]: https://jira.mariadb.org/browse/MDEV-37316?focusedCommentId=311839#comment-311839
Sergei Golubchik
MDEV-21376 fix the test for windows, fix --help text

we generally don't write long and short options |-separated in the
help text. otherwise it should've been

  with --all-databases|-A or --wildcards|-L --databases|-B.

or

  with --all-databases|-A or --wildcards --databases|-L -B.
Sergei Golubchik
12.2 branch
Sergei Golubchik
update engines/funcs.rpl_stm_reset_slave

in 12.0 temp table replication was changed, mixed behaves as row
in this test, not as statement
Oleksandr Byelkin
MDEV-13817 add support for oracle left join syntax - the ( + )

Parser changes made by Alexander Barkov <[email protected]>.

Part of the tests made by Iqbal Hassan <[email protected]>.
Initially marking with ORA_JOIN flag made also by
Iqbal Hassan <[email protected]>.

Main idea is that parser mark fields with (+) with a flag
(ORA_JOIN).

During Prepare the flag bring to the new created items if needed.

Later after preparing (fix_firlds()) WHERE confition the
relations betweel the tables analyzed and tables reordered
so to make JOIN/LEFT JOIN operators in chain equivalent to
the query with oracle outer join operator (+).

Then the flags of (+) removed.
Sergei Golubchik
Merge branch '10.11' into 11.4
Oleg Smirnov
MDEV-35856: implement index hints

Part of an umbrella task MDEV-33281 for implementing optimizer hints.

This commit introduces hints affecting the use of indexes:
  - JOIN_INDEX, NO_JOIN_INDEX
  - GROUP_INDEX, NO_GROUP_INDEX
  - ORDER_INDEX, NO_ORDER_INDEX
  - INDEX, NO_INDEX

Syntax of index hints:
  hint_name([@query_block_name] tbl_name [index_name [, index_name] ...])
  hint_name(tbl_name@query_block_name [index_name [, index_name] ...])

JOIN_INDEX, NO_JOIN_INDEX: Forces the server to use or ignore the specified
index or indexes for any access method, such as ref, range, index_merge,
and so on. Equivalent to FORCE INDEX FOR JOIN, IGNORE INDEX FOR JOIN.

GROUP_INDEX, NO_GROUP_INDEX: Enable or disable the specified index or indexes
for index scans for GROUP BY operations. Equivalent to the index hints
FORCE INDEX FOR GROUP BY, IGNORE INDEX FOR GROUP BY.

ORDER_INDEX, NO_ORDER_INDEX: Causes the server to use or to ignore
the specified index or indexes for sorting rows. Equivalent to
FORCE INDEX FOR ORDER BY, IGNORE INDEX FOR ORDER BY.

INDEX, NO_INDEX: Acts as the combination of JOIN_INDEX, GROUP_INDEX
and ORDER_INDEX, forcing the server to use the specified index or indexes
for any and all scopes, or as the combination of NO_JOIN_INDEX, NO_GROUP_INDEX
and NO_ORDER_INDEX, which causes the server to ignore the specified index
or indexes for any and all scopes. Equivalent to FORCE INDEX, IGNORE INDEX.

Two kinds of index hints were introduced during implementation:
the global kind for [NO_]INDEX hint, and the non-global kind for all others.

Possible conflicts which will generate warnings:
- for a table level hint
  - a hint of the same type or the opposite kind has already been specified
    for the same table
- for a index level hint
  - the same type of hint has already been specified for the same
    table or for the same index, OR
  - the opposite kind of hint has already been specified for the
    same index
- For a multi index hint like JOIN_INDEX(t1 i1, i2, i3), it conflicts
    with a previous hint if any of the JOIN_INDEX(t1 i1), JOIN_INDEX(t1 i2),
    JOIN_INDEX(t1 i3) conflicts with a previous hint
Alexey Botchkov
MDEV-21376 mysqldump should support wildcards.

Now --wildcards (-L) option is supported by mysqldump.
So user can specify patterns for database names or table names
to dump.
ParadoxV5
MDEV-37321 Link `sql/*` to Connector/C

This commit links the `libmariadb` (C Connector) _shared_ library to
the `sql` and, by dependency, the `mariadb-backup` targets. It excludes
`MYSQL_SERVER` and `extra/mariabackup` from `mariadb_capi_rename.h`,
which reroutes repeated `libmariadb` functions found in `libmysql`.

Utilizing the C Connector solves the divergence from the
actively-maintained library at the core. It’s a decade-old ambition.

There are no build conflicts between `libmysql` & co. and `libmariadb`
outside of `mariadb_capi_rename.h`, so there are no code changes.
However, this switch lost the functionalities of the client library, so
the next step is to compare the two libraries and fix at the code level.
We shall deduplicate the older libraries after remaining areas migrate.
Sergei Golubchik
Merge branch '11.4' into 11.8
Pekka Lampio
MDEV-36077: Galera feature: Retry applying writesets at slaves

A new Galera feature that allows retrying of applying of writesets at
slave nodes (codership/mysql-wsrep-bugs/#1619). Currently replication
applying stops for first non ignored failure occurring in event
applying, and node will do emergency abort (or start inconsistency
voting). Some failures, however, can be concurrency related, and
applying may succeed if the operation is tried at later time.

This feature introduces a new dynamic global option variable
"wsrep_applier_retry_count" that controls the retry-applying feature:
a zero value disables retrying and a positive value sets the maximum
number of retry attempts. The default value for this option is zero,
which means that this feature is disabled by default.

Signed-off-by: Julius Goryavsky <[email protected]>
Sergei Golubchik
Merge branch '11.8' into 12.0

main/statistics_json.result is updated for f8ba5ced551 (MDEV-36099)

The test uses 'delete from t1' in many places and then populates
the table again. The natural order of rows in a MyISAM table is well
defined and the test was implicitly relying on that.

before f8ba5ced551 delete was deleting rows one by one, using
ha_myisam::delete_row() because the connection was stuck in rbr mode.
This caused rows to be shown in the reverse insertion order (because of
the delete link list).

MDEV-36099 fixes this bug and the server now correctly uses
ha_myisam::delete_all_rows(). This makes rows to be shown in the
insertion order as expected.
Alexander Barkov
MDEV-36705 Preparations for associative arrays (MDEV-34319)

- Moving the definition of "class Type_handler_row" into a new file
  sql_type_row.h. Also moving *some* of its methods into sql_type_row.cc.
  The rest of the methods will be moved in the patch for MDEV-34319.
  Moving the definition of my_var_sp_row_field into sql_type_row.cc.

- Fixing the grammar for function_call_generic to get the first
  production as "ident_cli_func" rather than "ident_func".
  The upcoming patch needs to know the position of the function name
  within the client query.

- Adding new data types to store data types defined by "TYPE" declarations:

  * sp_type_def
  * sp_type_def_list

  sp_pcontext now derives from sp_type_def_list

- A new virtual method in Field:

  virtual Item_field *make_item_field_spvar(THD *thd,
                                            const Spvar_definition &def);
  Using it in sp_rcontext::init_var_items().

- Fixing my_var_sp to get sp_rcontext_addr in the parameter
  instead of two separate parameters (rcontext_handler + offset).

- Adding new virtual methods in my_var:

  virtual bool set_row(THD *thd, List<Item> &select_list);

  It's used when a select_list record is assigned to a
  single composite variable, such as ROW, specified in the INTO clause.
  Using it in select_dumpvar::send_data().

  virtual bool check_assignability(THD *thd,
                                  const List<Item> &select_list,
                                  bool *assign_as_row) const;

  It's used to check if the select_list is compatible with
  a single INTO variable, in select_dumpvar::prepare().

- Fixing LEX methods create_outvar() to get identifiers
  a Lex_ident_sys_st values instead of generic LEX_CSTRING values.

- Adding virtual methods in Type_handler:

  // Used in Item_func_null_predicate::check_arguments()
  virtual bool has_null_predicate() const;

  // Used in LEX::sp_variable_declarations_finalize()
  virtual bool sp_variable_declarations_finalize(THD *thd,
                                                LEX *lex, int nvars,
                                                const Column_definition &def)
                                                                        const;
  // Handle SELECT 1 INTO spvar;
  virtual my_var *make_outvar(THD *thd,
                              const Lex_ident_sys_st &name,
                              const sp_rcontext_addr &addr,
                              sp_head *sphead,
                              bool validate_only) const;

  // Handle SELECT 1 INTO spvar.field;
  virtual my_var *make_outvar_field(THD *thd,
                                    const Lex_ident_sys_st &name,
                                    const sp_rcontext_addr &addr,
                                    const Lex_ident_sys_st &field,
                                    sp_head *sphead,
                                    bool validate_only) const;

  // create the value in: DECLARE var rec_t DEFAULT rec_t(1,'c');
  virtual Item *make_typedef_constructor_item(THD *thd,
                                              const sp_type_def &def,
                                              List<Item> *arg_list) const;

- A new helper method:
  Row_definition_list *Row_definition_list::deep_copy(THD *thd) const;
ParadoxV5
MDEV-37321 Link `sql/*` to Connector/C

This commit links the `libmariadb` (the C Connector) _shared_ library to
the `sql` and, by dependency, the `mariadb-backup` targets.
The commit does _not_ migrate any code to `libmariadb` yet –
that will be the next step of the MDEV-37316 series of tasks.

Though to prepare for that migration, the commit also excludes
`-DLIBMARIADB` from `mariadb_capi_rename.h`, the shim header that
reroutes repeated `libmariadb` functions found in .
By defining `LIBMARIADB` (included in `libmariadb/include/mysql.h`),
components inside and outside `sql/` can opt in to link to `libmariadb`
functions over the `libmysql` copies.

Excluding the actual migration, there are no conflicts between
`libmysql` & co. and `libmariadb` outside of `mariadb_capi_rename.h`,
so there are no code changes. (There *were* definition conflicts when
linking with the _static_ library `mariadbclient`.)
Alexander Barkov
MDEV-36850 SIGSEGV in Item_sp_variable::save_in_field | fill_record

Thanks to Sergei Golubchik for the idea and a working prototype of this patch.

Problem:

Inside these methods:
- Item_splocal_assoc_array_element::append_for_log()
- Item_splocal_assoc_array_element_field::append_for_log()

an expression like this:

  first_names(nick || CONVERT(' ' USING ucs2)

was converted to:

  first_names(nick || CONVERT(CONVERT(' ' USING ucs2) USING latin1)

i.e. an automatic CONVERT(... USING latin1) was added, as expected.

In the end of append_for_log() the destructor of
Item_change_list_savepoint_raii restored the Item changes, so
the automatically added CONVERT(..USING latin1) was removed from
the tree and the tree changed back to:

  first_names(nick || CONVERT(' ' USING ucs2)

But all Item_splocal_assoc_array_element* Items were left in the fixed state.

Later, duing the INSERT, a concatenation of the SP variable `nick`
and the space character in UCS2 evaluated 'Michael\x00\x20' instead
of the expected 'Michael\x20', so the assoc array
element with the given key was not found.

Note:

Item_change_list_savepoint_raii was needed to make this DBUG_ASSERT in
sp_lex_keeper::reset_lex_and_exec_core() happy:
  DBUG_ASSERT(thd->Item_change_list::is_empty());

The fix:

- Removing Item_change_list_savepoint_raii from the implementations of
  Item_splocal_assoc_array_element*::append_for_log()
  Removing the class Item_change_list_savepoint_raii as it's not needed
  any more.

- Relaxing the DBUG_ASSERT() in sp_lex_keeper::reset_lex_and_exec_core() to:
  DBUG_ASSERT(dbug_rqp_are_fixed(instr) || thd->Item_change_list::is_empty());

  where dbug_rqp_are_fixed() is a new debug function to check that
  all Rewritable_query_parameter's in instr::free_list are fixed.
bsrikanth-mariadb
MDEV-36523: Load basic stats from trace into optimizer

This task loads the stats of the tables that are used in a query, from the trace into the optimizer.
This feature is also controlled by optimizer_record_context, and is not enabled by default. The stats
such as num_of_records present in the table, indexes if present then their names, along with the average number of records_per_key with in each index are loaded from the trace. Additionally, stats from range analysis i.e. ranges, and the corresponding number of records are also loaded from the trace.

The trace context which is in JSON format is firstly set into the session variable optimizer_trace_stored_context. Later, when a user issues a query, the contents of optimizer_trace_stored_context variable is parsed and an in memory representation is build using the class Optimizer_Trace_Stored_Context_Extractor. This class is then used by the optimizer to update and save original values of the tables, indexes, and range stats in the methods "set_statistics_for_table()" of sql_statistics.cc, and "check_quick_select()" of opt_range.cc. After the query gets finished, the statistics that were updated in the optimizer are restored back to the saved original values.

The entry point for parsing the json structure is in "mysql_execute_command()" of sql_parse.cc, and similarly exit point i.e. to restore the saved stats of the optimizer is at the end of the same method.
Sergei Golubchik
fix tests for --view

bead24b7f3df has unintentionally enabled many tests for --view.
these tests never run with --view before and needed fixing.
Oleg Smirnov
MDEV-37292 Hint NO_INDEX() disables all indexes if none of given index names is resolved

When a hint has a list of index names, for example,
  `NO_INDEX(t1 idx1, idx2)`
there is a possibility that some or all of the listed index names will
not be resolved. If none of them are resolved, the hint becomes a table-level
hint, for example, `NO_INDEX(t1)`, which erroneously disables all indexes
of `t1` instead of disabling only some of them.

This commit addresses this issue by adding an additional check: a hint
containing a list of index names is considered resolved only when at least one
of the listed names is resolved successfully.
ParadoxV5
Replace MYSQL_SERVER & MARIABACKUP with LIBMARIADB

(Not-)renaming based on `LIBMARIADB` rather than `MYSQL_SERVER` allows
me to limit the impact to only the components that are ready to migrate
to Connector/C, including excluding `mariabackup` simply because it’s
not in the `sql` directory.
Alexey Botchkov
MDEV-34680 Asynchronous and Buffered Logging for Audit Plugin.

Buffering with the IO_CACHE added to the file logger.
Sergei Golubchik
Merge branch '12.0' into 12.1

wsrep.wsrep_off: update the result file after c4cad8d50c2
Vladislav Vaintroub
MDEV-37339 errors about caching_sha2_password on server startup (WolfSSL)

With WolfSSL, the plugins is statically compiled, and enabled,
and defaults to autogenerating ssl keys, which was left unimplemented.
Thus, it spits out some [ERROR] on every startup.

Fixed by removing a couple some ifdefs. Allowed tcp_nossl to run on
Windows.

As WolfSSL is missing some APIs with FILE*, use related API that
accept BIO
, i.e
- BIO_new_file() instead of fopen()
- BIO_free instead of fclose()
- PEM_write_bio_PrivateKey() instead of PEM_write_PrivateKey()
- etc

A note about BIO and error reporting:
BIO_new_file sets the errno, therefore FILE_ERROR macro
produces good expected error messages, while SSL_ERROR unfortunately
creates something incomprehensible. Thus, FILE_ERROR is left in place
where it was used previously (fopen errors)

Curiously, removing APIs with FILE*, solves another bug MDEV-37343,
where server on Windows dies with obscure message as plugins tries to use
this function. OpenSSL_Applink supposed to be official solution against
such problems, but I could not get it to work properly, no matter how
much I tried. Avoiding APIs with FILE* in first place works best
ParadoxV5
give backup its own rename.h define to avoid phony EMBEDDED_LIBRARY
Pekka Lampio
MDEV-36554: Assertion `is_wsrep() == wsrep_on(mysql_thd)' failed in void trx_t::commit_in_memory(const mtr_t*)

This bug fix prevents debug assertion failure when Galera feature
retry applying is enabled. This patch introduces also a general
mechanism for temporarily disabling some debug assertions in InnoDB
code.

Signed-off-by: Julius Goryavsky <[email protected]>
ParadoxV5
Merge branch 'MDEV-37316' into bb-19248-libmariadb

Step 1 “MDEV-37321 Link `sql/*` to Connector/C” done
Oleksandr Byelkin
Add Flags to Item::walk.

Removed hack passing flags through parametes.

Order of arguments changed to prevent uncontrolled merge
(also this order looks better)
Alexander Barkov
Cleanup#2 for MDEV-34319: DECLARE TYPE .. TABLE OF .. INDEX BY - packed_col_length

Additional small cleanup (forgoten in the previous commit):
- Item_splocal_assoc_array_element_field::fix_fields()
  Fixing the error message for:
    SELECT marks('a').name; -- marks is a TABLE OF VARCHAR(10)
  From: ERROR 42S22: Unknown column '1' in 'SELECT'
  To:  ERROR 42S22: Unknown column 'name' in 'marks'

Fixing wrong results of packed_col_length(): it returned a wrong result for:
- CHAR(N)
- BINARY(N)
- MEDIUMBLOB
- LONGBLOB

Note, this method was not used. Now it's used by the assoc array data type.

Details:

- Cleanup: adding "const" qualifier to:

  * Field::pack()
  * Field::max_packed_col_length()
  * Field::packed_col_length()

- Removing the "max_length" argument from Field::pack().
  The caller passed either UINT_MAX or Field::max_data_length() to it.
  So it was never used to limit the destination size and only
  made the code more complicated and confusing.

- Removing arguments from packed_col_length().
  Now it calculates the value for the Field, using its "ptr",
  and assuming the entire value will be packed,
  without limiting the destination size.

- Fixing Field_blob::packed_col_length(). It worked fine only for
  TINYBLOB and BLOB, and did not work for MEDIUMBLOB and LONGBLOB.

- Overriding Field_char::packed_col_length().
  Using the inherited method was wrong - it implemented
  variable length data behavior.

- Overriding Field_string::max_data_length(). It was also incorrect.
  Implementing fixed size behavior.
  Moving the old implementation of Field_longstring::max_data_length()
  to Field_varstring::max_data_length().

- Fixing class StringPack:
  * Removing the "length" argument from StringPack::packed_col_length().
    It now assumes that the packed length for the entire data buffer
    is needed, without limiting the destination size.

  * Fixing StringPack::packed_col_length() to implement fixed dat size behavior.
    It erroneously implemented VARCHAR style behavor
    (assumed that the length was stored in the leading 1 or 2 bytes).

  * Adding a helper method length_bytes(). Reusing it in packed_col_length()
    and max_packed_col_length().

  * Moving a part the method pack() into a new method trimmed_length().
    Reusing it in pack() and packed_col_length().

  * Rewriting the code in trimmed_length() in a more straightforward way.
    It was hard to understand what it was doing.
    Adding a comment.

- Adding a test sp-assoc-array-pack-debug.test covering packed_col_length()
  and pack() for various data types.
Monty
MDEV-36980 Assertion `thd->mdl_context.is_lock_owner()...fails in close_thread_table

The problem is that a few constructs are missing from atomic create table
patch that is not yet committed:

- table_creation_was_logged is now set to 1 when logging create temporary.
- Testing for BINLOG_FORMAT_STMT changed to binlog_create_tmp_table() to
  take create_tmp_table_binlog_formats value into account.
- When logging the table creation of temporary tables to the binlog, the
  source table was used instead of the newly temporary table.
Sergei Golubchik
fix sporadic failures of rpl.rpl_drop_temp test

the test forces create_tmp_table_binlog_formats="statement,mixed",
so CREATE TEMPORARY TABLE is always logged, and the test should
thus always wait for it
Pekka Lampio
MDEV-36554 addendum: Assertion `is_wsrep() == wsrep_on(mysql_thd)' failed in void trx_t::commit_in_memory(const mtr_t*)

Modified the bug fix for MDEV-36554 by replacing the general
mechanishm for disabling assertions in InnoDB code with solution
specific to this rollback issue.

The appliers sets a flag in the applier thread for the duration of the
local rollback. This is used in InnoDB code to detect a local
rollback.

Signed-off-by: Julius Goryavsky <[email protected]>
ParadoxV5
Merge branch 'main' into bb-19248-libmariadb
Iqbal Hassan
MDEV-34319: DECLARE TYPE .. TABLE OF .. INDEX BY in stored routines

This patch adds support for associative arrays in stored procedures
for sql_mode=ORACLE.
The syntax follows Oracle's PL/SQL syntax for associative arrays -
TYPE assoc_array_t IS TABLE OF VARCHAR2(100) INDEX BY INTEGER;
or
TYPE assoc_array_t IS TABLE OF record_t INDEX BY VARCHAR2(100);
where record_t is a record type.

The following functions were added for associative arrays:
- COUNT - Retrieve the number of elements within the arra
- EXISTS - Check whether given key exists in the array
- FIRST - Retrieve the first key in the array
- LAST - Retrieve the last key in the array
- PRIOR - Retrieve the key before the given key
- NEXT - Retrieve the key after the given key
- DELETE - Remove the element with the given key or remove all elements
if no key is given

The arrays/elements can be initialized with the following methods:
- Constructor
i.e. array:= assoc_array_t('key1'=>1, 'key2'=>2, 'key3'=>3)
- Assignment
i.e. array(key):= record_t(1, 2)
- SELECT INTO
i.e. SELECT x INTO array(key)

TODOs:
- Nested tables are not supported yet.
i.e. TYPE assoc_array_t IS TABLE OF other_assoc_array_t INDEX BY INTEGER;
- Associative arrays comparisons are not supported yet.
Sergei Golubchik
mtr: make wait_for_line_count_in_file.inc leave traces in the log
Sergei Golubchik
MDEV-37160 When >=2 clients are in use, the server_audit_file_buffer_size setting is not honored

initialize cn->sync_statement everywhere where cn->thread_id is

followup for ef3c843c172 and 7251cbca518
Alexander Barkov
MDEV-36954 Improve error handling when a function-method/procedure-method is missing in stored routines

Fixing a confusing error message:

Unknown column 'assoc_array_var' in 'unknown_method'

to a clearer:

FUNCTION/PROCEDURE assoc_array_var.unknown_method does not exist
Sergei Golubchik
MDEV-34817 perfschema.lowercase_fs_off fails on buildbot

initialize counters when constructing a new PFS_program object