Commit graph

199175 commits

Author SHA1 Message Date
Daniel Black
9e457cbe50 MDEV-32439 INSERT IGNORE on constraints result in ERROR rather than warning
INSERT IGNORE had a pecular undocumented case that when one row was
inserted, there was an error rather than a warning.

As LOAD DATA IGNORE, UPDATE IGNORE, INSERT IGNORE SELECT, and INSERT
IGNORE VALUES (single row, for foreign key violation) all behave the same
way with a warning lets keep the behaviour normalized.

In compatibility, previously a error was generated, now a warning is
generated.

This behaviour is now consistent with MySQL-8.0 too.
2023-11-14 16:28:11 +11:00
Alexander Barkov
b0379ea4b3 Cleanup: Adding "const" to the member Spvar_definition::m_column_type_ref
and to related methods and their parameters:
- The return value of Spvar_definition::m_column_type_ref()
- The parameter of Spvar_definition::set_column_type_ref()
- The method Qualified_column_ident::resolve_type_ref()
- The parameter of LEX::sp_variable_declarations_column_type_finalize()
2023-11-10 12:45:55 +04:00
Kristian Nielsen
b8f9f796ff MDEV-31273: Precompute binlog checksums
Compute binlog checksums (when enabled) already when writing events
into the statement or transaction caches, where before it was done
when the caches are copied to the real binlog file. This moves the
checksum computation outside of holding LOCK_log, improving
scalabitily.

At stmt/trx cache write time, the final end_log_pos values are not
known, so with this patch these will be set to 0. Events that are
written directly to the binlog file (not through stmt/trx cache) keep
the correct end_log_pos value. The GTID and COMMIT/XID events at the
start and end of event groups are written directly, so the zero
end_log_pos is only for events in the middle of event groups, which
do not negatively affect replication.

An option --binlog-legacy-event-pos, off by default, is provided to
disable this behavior to provide backwards compatibility with any
external applications that might rely on end_log_pos in events in the
middle of event groups.

Checksums cannot be pre-computed when binlog encryption is enabled, as
encryption relies on correct end_log_pos to provide part of the
nonce/IV.

Checksum pre-computation is also disabled for WSREP/Galera, as it uses
events differently in its write-sets and so on. Extending pre-computation of
checksums to Galera where it makes sense could be added in a future patch.

The current --binlog-checksum configuration is saved in
binlog_cache_data at transaction start and used to pre-compute
checksums in cache, if applicable. When the cache is later copied to
the binlog, a check is made if the saved value still matches the
configured global value; if so, the events are block-copied directly
into the binlog file. If --binlog-checksum was changed during the
transaction, events are re-written to the binlog file one-by-one and
the checksums recomputed/discarded as appropriate.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-10-27 19:57:43 +02:00
Kristian Nielsen
24c923d498 MDEV-31273: Refactor MYSQL_BIN_LOG::write_cache()
Preparatory patch for pre-computing binlog checksums outside of holding
LOCK_log.

The existing code for MYSQL_BIN_LOG::write_cache() was needlessly complex
and very hard to understand and modify for handling the new case where
pre-computed checksums are already present in the IO_CACHE.

Greatly simplify the logic by replacing the (implicit) state machine with
direct code that pulls the events one by one from the IO_CACHE. This removes
a lot of state flags and avoids duplicate code for handling full vs. split
headers.

This also removes the need for the CacheWriter class. As a bonus, this fixes
the bug that CacheWriter::write() was completely ignoring write errors. No
other functional changes are done with this patch, only code cleanup.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-10-26 20:49:18 +02:00
Kristian Nielsen
8eee9806fb MDEV-31273: Eliminate Log_event::checksum_alg
This is a preparatory commit for pre-computing checksums outside of
holding LOCK_log, no functional changes.

Which checksum algorithm is used (if any) when writing an event does not
belong in the event, it is a property of the log being written to.

Instead decide the checksum algorithm when constructing the
Log_event_writer object, and store it there.

Introduce a client-only Log_event::read_checksum_alg to be able to
print the checksum read, and a
Format_description_log_event::source_checksum_alg which is the
checksum algorithm (if any) to use when reading events from a log.

Also eliminate some redundant `enum` keywords on the enum_binlog_checksum_alg
type.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-10-26 20:45:35 +02:00
Kristian Nielsen
77bd1beac8 MDEV-31273: Replace Log_event::writer with function parameter
This is a preparatory patch for precomputing binlog checksums outside
of holding LOCK_log, no functional changes.

Replace Log_event::writer with just passing the writer object as a
function parameter to Log_event::write().

This is mainly for code clarity. Having to set ev->writer before every
call to ev->write() is error-prone (what if it's forgotten in some
code place?), while passing it as parameter as usual makes it explicit
how the dataflow is.

As a minor point, it also improves the code, as the compiler now can
save the function parameter in a register across nested calls (when it
is a class member, compiler needs to reload across nested calls in
case the object would be modified during the call).

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-10-26 20:01:45 +02:00
Sergei Golubchik
d8dda7c14f 11.4 branch 2023-10-09 13:43:10 +02:00
Vladislav Vaintroub
5fc19e7137 MDEV-32252 addendum - refactor CPackWixConfig.cmake
Refactor CPackWixConfig.cmake so that it complains about unknown CPack
components.

This would prevent missing components,or discrepancy between MSI and ZIP
content, whenever new components are added or renamed.

Also, remove some old stuff, and use macros add_component_group() and
add_component() to reduce the verbosity.
2023-10-04 09:30:01 +02:00
Otto Kekalainen
2407243688 Deb: Include type_test.so and others in mariadb-test package
Move files to the mariadb-test package that are created during the build
but were not included in the package yet.
2023-10-04 10:02:21 +03:00
Sergei Golubchik
4c3584b510 MDEV-32104 add removed command line options back as noops 2023-09-30 14:43:12 +02:00
Sergei Golubchik
df4bfefbb8 compile-time deprecation reminders
remove old deprecation helpers that were not used anywhere.

create new deprecation helpers and enforce their usage

this also removes inconsistencies in reporting deprecation:
sometimes it was ER_WARN_DEPRECATED_SYNTAX (1287),
sometimes ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT (1681),
sometimes a warning, sometimes a note.

it should always be
* ER_WARN_DEPRECATED_SYNTAX
* a warning (because it's something actionable, not purely informational)
2023-09-30 14:43:12 +02:00
Sergei Golubchik
ceb1bd19ad remove a test that became meaningless in 2009
after fb175a1beb
2023-09-30 14:43:12 +02:00
Sergei Golubchik
52a0cd3c2e remove Silence_deprecated_warning
it was introduced in ff8651c4ec to suppress deprecated
warnings for CALL under the flawed logic that "It's doesn't
make sense to print out deprecated syntax warnings when the
routine is being executed because this kind of warning only
matters when the routine is being created".

Which is incorrect, a feature might become deprecated after
the routine was created and a user has to know that to be able
to update the procedure before it stops working when a
deprecated feature is removed.
2023-09-30 14:43:12 +02:00
Sergei Golubchik
6b9e1220ee MDEV-31811 deprecate old_mode values
mark non-default values of old_mode as deprecated.
print a warning when they're set from the command line and in SQL.
2023-09-30 14:43:12 +02:00
Sergei Golubchik
82174dae06 MDEV-32104 remove deprecated features
In particular:

* @@debug
  deprecated since 5.5.37
* sr_YU locale
  deprecated since 10.0.11
* "engine_condition_pushdown" in the @@optimizer_switch
  deprecated since 10.1.1
* @@date_format, @@datetime_format, @@time_format, @@max_tmp_tables
  deprecated since  10.1.2
* @@wsrep_causal_reads
  deprecated since 10.1.3
* "parser" in mroonga table comment
  deprecated since 10.2.11
2023-09-30 14:43:12 +02:00
Sergei Golubchik
4f9396b9f8 MDEV-31474 KDF() function
KDF(key_str, salt [, {info | iterations} [, kdf_name [, width ]]])

kdf_name is "hkdf" or "pbkdf2_hmac" (default).

width (in bits) can be any number divisible by 8,
by default it's taken from @@block_encryption_mode

iterations must be positive, and is 1000 by default

OpenSSL 1.0 doesn't support HKDF, so it'll return NULL.
This OpenSSL version is still used in SLES 12 and CentOS 7
2023-09-30 14:43:12 +02:00
Sergei Golubchik
03c68f402f ErrConvStringQ helper
like ErrConvString, but puts the string in 'single quotes'
2023-09-30 14:13:09 +02:00
Sergei Golubchik
3c9ecf4b76 MDEV-31231 fix windows packaging
followup for 7ba9c7fb84
2023-09-30 14:13:05 +02:00
Sergei Golubchik
a8d2e2300e MDEV-31231 fixes for MariaDB-connect-engine* rpms
* don't introduce random four-space-gaps into the middle of description
  (meaning, nicely aligned wrapped string in the code gets ugly
  in the rpm)
* remove obsolete comment
* MariaDB-connect-engine is a required package for MariaDB-connect-engine-jdbc
  not "recommended"
* don't recommend both mariadb-java-client and mysql-connector-java
* in fact, don't recommend anything, it works badly for old rpm < 4.13,
  installs something that user may not want, and install redundand deps.
  Let's rethink how to do it meaningfully. And not break tests.

followup for 7ba9c7fb84
2023-09-30 14:13:01 +02:00
Sergei Golubchik
49b5a2b360 Revert "MDEV-30610 Update RocksDB to v8.1.1"
Not ready yet, it fails its own test suite

This reverts commit 485c9b1fb3
2023-09-30 14:12:55 +02:00
Sergei Golubchik
3928c7e29a Merge branch '11.2' into 11.3 2023-09-30 14:12:12 +02:00
Sergei Golubchik
872ed5342d fix a sporadic failure of main.alter_table_online_debug on windows
first seen in daca468c68
2023-09-30 11:13:08 +02:00
Sergei Golubchik
37e854f34a Merge branch '11.1' into 11.2 2023-09-29 16:01:59 +02:00
Sergei Golubchik
05d850d4b3 Merge branch '11.0' into 11.1 2023-09-29 13:58:47 +02:00
Sergei Golubchik
3f6bccb888 Merge branch '10.11' into 11.0 2023-09-29 12:24:54 +02:00
Vladislav Vaintroub
8044606a67 MDEV-32252 "Backup Utilities" not available to install on windows
Commit 738d4604b7 changed component name
from "backup" to "Backup". Use the new name now.
2023-09-27 15:00:27 +02:00
Alexey Botchkov
daca468c68 MDEV-32243 Make older compilers happy with log.h.
Fix the Cache_flip_event_log constructor.
2023-09-25 14:42:10 +04:00
Sergei Golubchik
034848c6c2 Merge branch '10.10' into 10.11 2023-09-24 19:41:43 +02:00
Sergei Golubchik
11c69177e9 fix galera.galera_as_slave_gtid_myisam for 10.10+ 2023-09-24 19:32:04 +02:00
Vladislav Vaintroub
905c3d61e1 MDEV-25870 followup - some Windows ARM64 improvements
- optimize atomic store64/load64 implementation.
- allow CRC32 optimization. Do not allow pmull yet, as this fails like in
  https://stackoverflow.com/questions/54048837/how-to-perform-polynomial-multiplication-using-arm64
2023-09-24 11:20:38 +02:00
Sergei Golubchik
970c885d1a Merge branch '11.1' into 11.2 2023-09-24 09:38:34 +02:00
Sergei Golubchik
f031889ae4 Merge branch '11.0' into 11.1 2023-09-24 01:46:43 +02:00
Sergei Golubchik
9880006b5b update wsrep.wsrep_provider_plugin_defaults to 26.4.16 2023-09-23 23:02:20 +02:00
Nikita Malyavin
e9573c0596 fix rdb_i_s.cc build 2023-09-21 14:35:49 +04:00
Nikita Malyavin
28b4037242 Merge branch '11.2' into 11.3 2023-09-21 14:15:04 +04:00
Alexander Barkov
d75ef02ac2 MDEV-32220 sql_yacc.yy: unify the drop_routine rule
- Removing two copies of the drop_routine.
  Adding a shared and much simplified version.

- Removing LEX metods:
      bool stmt_drop_function(const DDL_options_st &options,
                              const Lex_ident_sys_st &db,
                              const Lex_ident_sys_st &name);

      bool stmt_drop_function(const DDL_options_st &options,
                              const Lex_ident_sys_st &name);

      bool stmt_drop_procedure(const DDL_options_st &options,
                               sp_name *name);

  The code inside the methods was very similar.
  Adding one method instead:

      bool stmt_drop_routine(const Sp_handler *sph,
                          const DDL_options_st &options,
                          const Lex_ident_sys_st &db,
                          const Lex_ident_sys_st &name);

- Adding a new virtual method Sp_handler:sqlcom_drop().
  It helped to unify the code inside the new stmt_drop_routine().
2023-09-21 08:58:21 +04:00
Alexander Barkov
1988512804 MDEV-32219 Shift/reduce grammar conflict: GRANT .. ON FUNCTION
Resolving the shift/reduce conflict conflict in:

GRANT ..  ON /*ambiguity*/ FUNCTION f1 TO foo@localhost;
GRANT ... ON /*ambiguity*/ [TABLE] function TO foo@localhost;

and in

REVOKE ..  ON /*ambiguity*/ FUNCTION f1 TO foo@localhost;
REVOKE ... ON /*ambiguity*/ [TABLE] function TO foo@localhost;

using a new %prec directive.
2023-09-21 06:39:43 +04:00
Marko Mäkelä
030ee26787 MDEV-32044 Mariadb crash after upgrading to 11.0.3
ibuf_bitmap_buffered(): A new predicate, to check if the
IBUF_BITMAP_BUFFERED bit for a particular page is set.

ibuf_merge(): If ibuf_bitmap_buffered() does not hold,
skip the records for the page. One reason why we might have
this situation is the bug that was fixed in
commit 34c283ba1b (MDEV-32132).
2023-09-19 18:07:10 +03:00
Lena Startseva
d515fa72a0 MDEV-31795: main.flush_corruption times out with view-protocol
Fixed tests:
main.flush_corruption - disabled service connection for some queries
since it is necessary that the query SELECT pass in the same session
2023-09-15 18:04:22 +07:00
Andrew Hutchings
8d9bc61d0b Update mysqltest-break.test
This test does not work in embedded and I cannot see an obvious way of fixing that. The test not running in embedded is not the end of the world here.
2023-09-14 06:58:20 +01:00
Dwarf Mason
9f8c5e01ae Add break statement in mysqltest 2023-09-14 06:58:20 +01:00
Alexander Barkov
f5aae71661 MDEV-31606 Refactor check_db_name() to get a const argument
Problem:
Under terms of MDEV-27490, we'll update Unicode version used
to compare identifiers to 14.0.0. Unlike in the old Unicode version,
in the new version a string can grow during lower-case. We cannot
perform check_db_name() inplace any more.

Change summary:

- Allocate memory to store lower-cased identifiers in memory root

- Removing check_db_name() performing both in-place lower-casing and validation
  at the same time. Splitting it into two separate stages:
  * creating a memory-root lower-cased copy of an identifier
    (using new MEM_ROOT functions and Query_arena wrapper methods)
  * performing validation on a constant string
    (using Lex_ident_fs methods)

Implementation details:

- Adding a mysys helper function to allocate lower-cased strings on MEM_ROOT:

    lex_string_casedn_root()

  and a Query_arena wrappers for it:

    make_ident_casedn()
    make_ident_opt_casedn()

- Adding a Query_arena method to perform both MEM_ROOT lower-casing and
  database name validation at the same time:

    to_ident_db_internal_with_error()

  This method is very close to the old (pre-11.3) check_db_name(),
  but performs lower-casing to a newly allocated MEM_ROOT
  memory (instead of performing lower-casing the original string in-place).

- Adding a Table_ident method which additionally handles derived table names:

    to_ident_db_internal_with_error()

- Removing the old check_db_name()
2023-09-13 11:04:27 +04:00
Sergei Petrunia
e987b9350c MDEV-31496: Make optimizer handle UCASE(varchar_col)=...
(Review input addressed)
(Added handling of UPDATE/DELETE and partitioning w/o index)

If the properties of the used collation allow, do the following
equivalent rewrites:

1. UPPER(key_col)=expr  ->  key_col=expr
   expr=UPPER(key_col)  ->  expr=key_col
   (also rewrite both sides of the equality at the same time)

2. UPPER(key_col) IN (constant-list)  -> key_col IN (constant-list)

- Mark utf8mb{3,4}_general_ci as collations that allow this.
- Add optimizer_switch='sargable_casefold=ON' to control this.
  (ON by default in this patch)
- Cover the rewrite in Optimizer Trace, rewrite name is
  "sargable_casefold_removal".
2023-09-12 17:14:43 +03:00
Thirunarayanan Balathandayuthapani
eece7f135f - Rename the DBUG_EXECUTE_IF from sys_shrink_buffer_pool_full to
sys_shrink_buffer_pool to make it as generic name.
2023-09-11 18:11:45 +05:30
Monty
e39ed5d76f Updated sql-bench to run with PostgreSQL 14.9
- Updated capabilities for PostgreSQL in server.cfg
- Updated test-ATIS & test-table-elimination to work with PostgreSQL
- Updated test-transaction test to also work with non transactional tables

Other things:
- Added test of tables with many keys in test-insert
- Added 2 new GROUP BY .. ORDER BY test
2023-09-09 15:14:45 +03:00
Monty
69c420be3d Added support for --skip-secure-file-priv
This works the same as secure-file-priv="", but is more obvious way to
turn of secure-file-priv.
2023-09-09 15:14:44 +03:00
Sergei Golubchik
0b6de3d1ce avoid "'sh' is not recognized..." error in mtr on windows 2023-09-08 19:19:16 +02:00
Sergei Golubchik
9b9067fcc0 mtr: s/mysqltest_embedded/mariadb-test-embedded/
avoid deprecation warning
2023-09-08 17:36:35 +02:00
Alexander Barkov
8ad1e26b1b MDEV-32081 Remove my_casedn_str() from get_canonical_filename()
- Moving get_canonical_filename() from a public function to a method in handler.
- Adding a helper method is_canonical_filename() to handler.
- Adding helper methods left(), substr(), starts_with() to Lex_cstring.
- Adding helper methods is_sane(), buffer_overlaps(),
  max_data_size() to CharBuffer.
- Adding append_casedn() to CharBuffer. It implements the main functionality
  that replaces the being removed my_casedn_str() call.
- Adding a class Table_path_buffer,
  a descendant of CharBuffer with size FN_REFLEN.
- Changing get_canonical_filename() to get a pointer to Table_path_buffer
  instead just a pointer to char.
- Changing the data type of the "path" parameter and the return type of
  get_canonical_filename() from char* to Lex_cstring.
2023-09-04 09:36:44 +04:00
Alexander Barkov
5de23b1d6f MDEV-31505 Deprecate mariabackup --innobackupex mode
1. "mariabackup --innobackupex" now prints a new warning:
       '--innobackupex' is deprecated and will be removed in a future release

2. "mariabackup --innobackupex" does not print this wrong warning any more:
        --innobackupex: Deprecated program name.
          It will be removed in a future release,
          use '/path/to/mariadb-backup' instead
2023-09-04 05:53:49 +04:00