Commit graph

188909 commits

Author SHA1 Message Date
Monty
3775e7cc00 Fixed that file_key_management works with BUILD scripts 2020-03-24 21:00:03 +02:00
Monty
120b73a069 Speed up writing to encrypted binlogs
MDEV-21604

Added "virtual" low level write function encrypt_or_write that is set
to point to either normal or encrypted write functions.

This patch also fixes a possible memory leak if writing to binary log fails.
2020-03-24 21:00:03 +02:00
Monty
91ab42a823 Clean up and speed up interfaces for binary row logging
MDEV-21605 Clean up and speed up interfaces for binary row logging
MDEV-21617 Bug fix for previous version of this code

The intention is to have as few 'if' as possible in ha_write() and
related functions. This is done by pre-calculating once per statement the
row_logging state for all tables.

Benefits are simpler and faster code both when binary logging is disabled
and when it's enabled.

Changes:
- Added handler->row_logging to make it easy to check it table should be
  row logged. This also made it easier to disabling row logging for system,
  internal and temporary tables.
- The tables row_logging capabilities are checked once per "statements
  that updates tables" in THD::binlog_prepare_for_row_logging() which
  is called when needed from THD::decide_logging_format().
- Removed most usage of tmp_disable_binlog(), reenable_binlog() and
  temporary saving and setting of thd->variables.option_bits.
- Moved checks that can't change during a statement from
  check_table_binlog_row_based() to check_table_binlog_row_based_internal()
- Removed flag row_already_logged (used by sequence engine)
- Moved binlog_log_row() to a handler::
- Moved write_locked_table_maps() to THD::binlog_write_table_maps() as
  most other related binlog functions are in THD.
- Removed binlog_write_table_map() and binlog_log_row_internal() as
  they are now obsolete as 'has_transactions()' is pre-calculated in
  prepare_for_row_logging().
- Remove 'is_transactional' argument from binlog_write_table_map() as this
  can now be read from handler.
- Changed order of 'if's in handler::external_lock() and wsrep_mysqld.h
  to first evaluate fast and likely cases before more complex ones.
- Added error checking in ha_write_row() and related functions if
  binlog_log_row() failed.
- Don't clear check_table_binlog_row_based_result in
  clear_cached_table_binlog_row_based_flag() as it's not needed.
- THD::clear_binlog_table_maps() has been replaced with
  THD::reset_binlog_for_next_statement()
- Added 'MYSQL_OPEN_IGNORE_LOGGING_FORMAT' flag to open_and_lock_tables()
  to avoid calculating of binary log format for internal opens. This flag
  is also used to avoid reading statistics tables for internal tables.
- Added OPTION_BINLOG_LOG_OFF as a simple way to turn of binlog temporary
  for create (instead of using THD::sql_log_bin_off.
- Removed flag THD::sql_log_bin_off (not needed anymore)
- Speed up THD::decide_logging_format() by remembering if blackhole engine
  is used and avoid a loop over all tables if it's not used
  (the common case).
- THD::decide_logging_format() is not called anymore if no tables are used
  for the statement. This will speed up pure stored procedure code with
  about 5%+ according to some simple tests.
- We now get annotated events on slave if a CREATE ... SELECT statement
  is transformed on the slave from statement to row logging.
- In the original code, the master could come into a state where row
  logging is enforced for all future events if statement could be used.
  This is now partly fixed.

Other changes:
- Ensure that all tables used by a statement has query_id set.
- Had to restore the row_logging flag for not used tables in
  THD::binlog_write_table_maps (not normal scenario)
- Removed injector::transaction::use_table(server_id_type sid, table tbl)
  as it's not used.
- Cleaned up set_slave_thread_options()
- Some more DBUG_ENTER/DBUG_RETURN, code comments and minor indentation
  changes.
- Ensure we only call THD::decide_logging_format_low() once in
  mysql_insert() (inefficiency).
- Don't annotate INSERT DELAYED
- Removed zeroing pos_in_table_list in THD::open_temporary_table() as it's
  already 0
2020-03-24 21:00:03 +02:00
Monty
f51df1dc78 Fixed valgrind warning 2020-03-24 21:00:02 +02:00
Monty
4ef437558a Improve update handler (long unique keys on blobs)
MDEV-21606 Improve update handler (long unique keys on blobs)
MDEV-21470 MyISAM and Aria start_bulk_insert doesn't work with long unique
MDEV-21606 Bug fix for previous version of this code
MDEV-21819 2 Assertion `inited == NONE || update_handler != this'

- Move update_handler from TABLE to handler
- Move out initialization of update handler from ha_write_row() to
  prepare_for_insert()
- Fixed that INSERT DELAYED works with update handler
- Give an error if using long unique with an autoincrement column
- Added handler function to check if table has long unique hash indexes
- Disable write cache in MyISAM and Aria when using update_handler as
  if cache is used, the row will not be inserted until end of statement
  and update_handler would not find conflicting rows.
- Removed not used handler argument from
  check_duplicate_long_entries_update()
- Syntax cleanups
  - Indentation fixes
  - Don't use single character indentifiers for arguments
2020-03-24 21:00:02 +02:00
Monty
736998cb75 Cleanups & indentation changes
- Only indentation changes in sql_rename.cc
- Ignore some WSREP error messages when there isn't a internet connection
- Force restart of stat_tables_part.test to make result stable
- Fixed compiler warnings in CONNECT
2020-03-24 21:00:02 +02:00
Monty
6a9e24d046 Added support for replication for S3
MDEV-19964 S3 replication support

Added new configure options:
s3_slave_ignore_updates
"If the slave has shares same S3 storage as the master"

s3_replicate_alter_as_create_select
"When converting S3 table to local table, log all rows in binary log"

This allows on to configure slaves to have the S3 storage shared or
independent from the master.

Other thing:
Added new session variable '@@sql_if_exists' to force IF_EXIST to DDL's.
2020-03-24 21:00:02 +02:00
Monty
e5de1e26e7 Ignore mariadb-config.1 2020-03-24 20:47:41 +02:00
Sergey Vojtovich
da82e75901 handler::rebind()
- rename PFS specific rebind_psi() to generic rebind()
- call rebind independently of PFS compilation status
- allow rebind() return an error
2020-03-24 20:47:41 +02:00
Monty
bff79492c5 Added IF EXISTS to RENAME TABLE and ALTER TABLE 2020-03-24 20:47:41 +02:00
Marko Mäkelä
5f5c63e0fe Merge 10.4 into 10.5 2020-03-24 09:54:08 +02:00
mkaruza
a940151eec
MDEV-21988: Assertion failure mysqld: bool trans_commit_stmt(THD*): Assertion `thd->in_active_multi_stmt_transaction() || thd->m_transaction_psi == __null' failed. (#1476)
Set temporary `SERVER_STATUS_IN_TRANS` so assert is not triggered in `trans_commit_stmt`.
2020-03-24 09:47:41 +02:00
Marko Mäkelä
efc97eff31 Fix clang -Wsometimes-uninitialized 2020-03-24 09:35:59 +02:00
Marko Mäkelä
8b647d6960 MDEV-22020: Fix spider/bugfix.return_found_rows_update
The test failed to specify default-character-set when
invoking the client. The compile-time default parameters of the
client could be overridden by configuration files in /etc/mysql.
Let us explicitly specify --default-character-set.
2020-03-24 09:35:36 +02:00
Sergei Golubchik
fbfd4fafd4 autobake-deb.sh: include symlinks in the final listing 2020-03-24 02:39:32 +01:00
Rasmus Johansson
79b8901711 MDEV-22009 mysqlhotcopy tool and wsrep scripts not found
main.mysqlhotcopy_myisam cannot find mysqlhotcopy tool

wsrep scripts are not executable in CMAKE_CURRENT_BINARY_DIR
2020-03-24 02:39:32 +01:00
Sergei Golubchik
e4afd3c337 MDEV-22003 mysql_config disappeared from 10.5 (e.g. binary tarball or source build)
* generate and install mysql_config
* symlink mariadb_config (from C/C) to mariadb-config

also:
* .gitignore generated mariadb-config.1
* remove obsolete compiler flag from C/C
2020-03-24 02:39:32 +01:00
Sergei Golubchik
73edb6ffd4 Revert "MDEV-21303 Make executables MariaDB named"
This reverts commit 5d1b8f4152.

because since 306e439c6d manpages use troff aliases
instead of symlinks, so they should not be symlinked.
2020-03-24 02:39:32 +01:00
Otto Kekäläinen
4b1f608569 Travis-CI: Optimize the selection of tests to be smaller and more diverse
Drop excess jobs while still making sure there is a good variation of
running all test suites, gcc and clang versions.

Also introduce testing on architectures arm64 and ppc64le.
2020-03-23 21:28:29 +00:00
Otto Kekäläinen
b0140c084e Travis-CI: Mac OS X build improvements
- Properly define build dependencies via addons/homebrew, but still keep
  secondary Homebrew run until OS X builds fully work.
- Remove references to OS X bugs that are already closed.
- As long as the OS X build does not work, it is enough to attempt to run
  just one of them, no need for many in parallel. It will just waste
  resources and slow down the job from finishing quickly.
2020-03-23 21:28:29 +00:00
Otto Kekäläinen
a5d73d4d72 Travis-CI: Refactor .travis.yml and document
This further simplifies and cleans up the Travis-CI file without making
any major functional changes.

With this structure .travis.yml is much easier to read and thanks to the
added documentation next developers are less likely to mess it up again
as they can more easily see how the jobs matrix work.

Number of jobs:
- before: 33 (with 7 ignored)
- after:  33 (with 7 ignored)

This partially reverts commits c12609d and 193bc89.

Remove unnecessary dependencies that nothing uses: dpatch libzmq-dev

Install extra build dependencies from a PPA specifically tailored for
Travis-CI use and which ensures all architectures are supported (in this
case s390x is needed and was not available from mariadb.org repos).

Validated with https://config.travis-ci.com/explore
2020-03-23 21:28:29 +00:00
Otto Kekäläinen
20ddc1e086 Travis-CI: No-change cleanup of bad syntax in .travis-ci.yml
This is first step in refactoring the Travis-CI file, which had become a
mess. This commit has no functional changes, just syntactical cleanup
and simplification.

Dependencies list has not changes, it is just sorted alphabetically so
it is easier to compare to e.g. debian/control file list.
2020-03-23 21:28:29 +00:00
Eugene Kosov
ed6168f7ce cleanup: group deprecated:: code together 2020-03-23 22:46:02 +03:00
Eugene Kosov
194c5b6ad2 MDEV-21990 Issue a message on changing deprecated innodb_log_files_in_group
innodb_init_params(): make sure that srv_n_log_files == 1 always
2020-03-23 20:36:01 +03:00
Eugene Kosov
8fdb695690 fix formatting and remove outdated comment 2020-03-23 20:36:01 +03:00
Alexander Barkov
faab0d31a3 MDEV-22012 Allow SET TIMESTAMP for users with GRANT BINLOG REPLAY when --secure-timestamp=replication 2020-03-23 17:47:06 +04:00
Sergei Golubchik
02fe997505 fix a nondeterminism in perfschema.statement_program_non_nested test
when selecting from perfschema, filter out statements
used by the test istself in wait_condition.inc, because they,
by design, can be repeated unpredictable number of times.
2020-03-23 10:45:08 +01:00
Marko Mäkelä
121a5e8d07 Minor buffer pool cleanup
btr_blob_free(): Compare page_id_t directly.

buf_pool_watch_unset(): Avoid unnecessarily buf_pool.mutex acquisition.

Clean up some comments as well.
2020-03-23 10:50:30 +02:00
Marko Mäkelä
82c465f68e MDEV-21962: Minor cleanup
Remove unnecessary buf_pool_t:: qualifiers. In comments,
replace buf_pool::mutex with buf_pool.mutex.

Remove an outdated comment about a planned buffer pool resizing feature.
It is already implemented in MariaDB 10.2.2 (and MySQL 5.7.9).
2020-03-23 10:50:30 +02:00
Marko Mäkelä
3b25083785 Merge 10.4 into 10.5 2020-03-23 10:50:14 +02:00
Vladislav Vaintroub
1a4998e982 MDEV-21303 postfixes 2020-03-23 09:22:29 +01:00
Thirunarayanan Balathandayuthapani
f7599f4799 MDEV-21792 Server aborts upon attempt to create foreign key on spatial field
- mbmaxlen is always 0 for binary field. Ignore the assert of checking
field->prefix_len % field->col->mbmaxlen == 0.
2020-03-23 13:18:00 +05:30
Sergei Golubchik
5d1b8f4152 MDEV-21303 Make executables MariaDB named
fix manpages in Debian
2020-03-21 20:20:29 +01:00
Rasmus Johansson
9e1b3af4a4 MDEV-21303 Make executables MariaDB named
To change all executables to have a mariadb name I had to:
- Do name changes in every CMakeLists.txt that produces executables
- CREATE_MARIADB_SYMLINK was removed and GET_SYMLINK added by Wlad to reuse the function in other places also
- The scripts/CMakeLists.txt could make use of GET_SYMLINK instead of introducing redundant code, but I thought I'll leave that for next release
- A lot of changes to debian/.install and debian/.links files due to swapping of real executable and symlink. I did not however change the name of the manpages, so the real name is still mysql there and mariadb are symlinks.
- The Windows part needed a change now when we made the executables mariadb -named. MSI (and ZIP) do not support symlinks and to not break backward compatibility we had to include mysql named binaries also. Done by Wlad
2020-03-21 20:20:29 +01:00
Sergey Vojtovich
81f700015e Cleanup my_atomic.h includes
my_atomic.h is included indirectly anyways.
2020-03-21 20:11:44 +04:00
Sergey Vojtovich
6acddd5367 global_query_id: my_atomic to Atomic_counter 2020-03-21 19:58:44 +04:00
Sergey Vojtovich
62687801ff tc_active_instances: my_atomic to std::atomic 2020-03-21 18:37:19 +04:00
Sergey Vojtovich
3b3f931570 Discovery counters: my_atomic to Atomic_counter 2020-03-21 18:37:15 +04:00
Sergey Vojtovich
a39d92ca57 gtid_pos_table: my_atomic to std::atomic 2020-03-21 17:36:38 +04:00
Sergey Vojtovich
4d9977e5ff default_gtid_pos_table: my_atomic to std::atomic 2020-03-21 15:55:00 +04:00
Marko Mäkelä
6fb59d525b MDEV-742: Fix clang -Winconsistent-missing-override 2020-03-21 12:39:58 +02:00
Marko Mäkelä
2559075bda Correct a result 2020-03-21 12:36:55 +02:00
Marko Mäkelä
5203bc10f1 Merge 10.4 into 10.5 2020-03-21 11:37:10 +02:00
Marko Mäkelä
76cdc1d73e Remove a misleading copyright message
The code that commit bb24fa31fa
moved to a separate file assume_aligned.h was introduced in
commit 25e2a556de and developed
by employees of MariaDB Corporation.
2020-03-21 10:25:54 +02:00
Daniele Sciascia
9394cc8914
MDEV-21675: Data inconsistency after multirow insert rollback (#1474)
* Remove dead code

* MDEV-21675 Data inconsistency after multirow insert rollback

This patch fixes data inconsistencies that happen after rollback of
multirow inserts, with binlog disabled.
For example, statements such as `INSERT INTO t1 VALUES (1,'a'),(1,'b')`
that fail with duplicate key error. In such cases the whole statement
is rolled back. However, with wsrep_emulate_binlog in effect, the
IO_CACHE would not be truncated, and the pending rows events would be
replicated to the rest of the cluster. In the above example, it would
result in row (1,'a') being replicated, whereas locally the statement
is rolled back entirely. Making the cluster inconsistent.
The patch changes the code so that prior to statement rollback,
pending rows event are removed and the stmt cache reset.
That patch also introduces MTR tests that excercise multirow insert
statements for regular, and streaming replication.
2020-03-21 09:17:28 +02:00
Marko Mäkelä
bd3c8f47cd Merge 10.3 into 10.4 2020-03-20 22:06:55 +02:00
Marko Mäkelä
fd5c36bed5 MDEV-21959: Fix a type mismatch on 64-bit systems 2020-03-20 21:41:39 +02:00
Marko Mäkelä
44298e4dea Merge 10.2 into 10.3
Also, clean up the test innodb_gis.geometry a little further.
2020-03-20 18:12:17 +02:00
Eugene Kosov
bb24fa31fa move my_assume_aligned() to a separate header 2020-03-20 18:47:35 +03:00
Marko Mäkelä
9f7b8625e6 MDEV-14431: Fix ulong/ulonglong type mismatch 2020-03-20 17:46:43 +02:00