Commit graph

198322 commits

Author SHA1 Message Date
Oleksandr Byelkin
d2fdba94cf Merge branch '10.9' into 10.10 2023-08-08 14:47:16 +02:00
Oleksandr Byelkin
27dc4cd1fc Merge branch '10.6' into 10.9 2023-08-08 13:28:26 +02:00
Oleksandr Byelkin
d28d636f57 Merge branch '10.5' into 10.6 2023-08-08 13:20:58 +02:00
Oleksandr Byelkin
8852afe317 Merge branch '10.4' into 10.5 2023-08-08 11:24:42 +02:00
Thirunarayanan Balathandayuthapani
0ede90dd31 MDEV-31869 Server aborts when table does drop column
- InnoDB aborts when table is dropping the column. This is
caused by 5f09b53bdb (MDEV-31086).
While iterating the altered table fields, we fail to consider
the dropped columns.
2023-08-08 13:24:23 +05:30
Yuchen Pei
4d6eaf5974
MDEV-31524 spider fixup fixup: re-remove some default param setting 2023-08-08 15:40:30 +10:00
Oleksandr Byelkin
45b7a01002 Merge branch '10.9' into 10.10 2023-08-07 10:34:52 +02:00
Oleksandr Byelkin
214654118a Merge branch '10.6' into 10.9 2023-08-07 10:33:32 +02:00
Oleksandr Byelkin
4bc9d50f2f Merge branch '10.5' into 10.6 2023-08-07 10:32:05 +02:00
Sergei Golubchik
8adb6107ce MDEV-31853 Assertion failure in Column_definition::check_vcol_for_key upon adding FK
when validating vcol's (default, check, etc) in ALTER TABLE
vcol_info->flags are modified in place. This means that if ALTER TABLE
fails for any reason we need to restore them to their original values.

(mroonga was freeing the memory on ::reset() but not on ::close())
2023-08-06 20:08:51 +02:00
Oleksandr Byelkin
ced243a099 Merge branch '10.9' into 10.10 2023-08-05 20:34:09 +02:00
Oleksandr Byelkin
998edc374e Merge branch '10.6' into 10.9 2023-08-04 13:27:20 +02:00
Oleksandr Byelkin
c7b6707fe1 Merge branch '10.5' into 10.6 2023-08-04 12:14:00 +02:00
Yuchen Pei
10eff9c809
MDEV-31524 Post-merge fixup 2023-08-04 18:38:51 +10:00
Oleksandr Byelkin
6eb69434c7 Roksdb test postmerge fix 2023-08-04 10:30:30 +02:00
Oleksandr Byelkin
9aef479ac8 fix postmerge view protocol test 2023-08-04 10:24:40 +02:00
Oleksandr Byelkin
6b8310c27a fix postmerge 32bit tests 2023-08-04 10:11:03 +02:00
Oleksandr Byelkin
34a8e78581 Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
Oleksandr Byelkin
5ea5291d97 Merge branch '10.5' into 10.6 2023-08-04 07:52:54 +02:00
Oleg Smirnov
8e8c020fb3 MDEV-31743 Server crash in store_length, assertion failure in Type_handler_string_result::sort_length
After MDEV-21580 the truncation of SORT_FIELD::length
  set_if_smaller(sortorder->length, thd->variables.max_sort_length)

became conditional:
  if (is_variable_sized())
    set_if_smaller(length, thd->variables.max_sort_length)

To provide correct functioning of is_variable_sized() SORT_FIELD::type
must be set properly. This commit adds the necessary initialization
of SORT_FIELD::type to JOIN_TAB::remove_duplicates() as it is done
in filesort's sortlength() function.

DBUG_ASSERT is added to sortlength() just in case to prevent
a possible uint32 overflow
2023-08-03 18:03:31 +07:00
Marko Mäkelä
a89527e127 MDEV-31827 InnoDB multi-batch recovery stops prematurely
recv_scan_log(): On recv_sys_t::PREMATURE_EOF, keep reading more log
if recv_sys.lsn < recv_sys.scanned_lsn.

recv_recovery_from_checkpoint_start(): Add a safety check to abort
crash recovery if recv_sys.lsn is not recv_sys.scanned_lsn.

This fixes a serious database corruption bug that was introduced by
commit 2f9e264781 (MDEV-29911).
2023-08-02 19:28:12 +03:00
Sergei Golubchik
61acb43689 MDEV-31822 ALTER TABLE ENGINE=x started failing instead of producing warning on unsupported TRANSACTIONAL=1
make TRANSACTIONAL table option behave similar to other engine-defined
table options. If the engine doesn't suport it:
* if specified expicitly in CREATE or ALTER - it's ER_UNKNOWN_OPTION
* an error or a warning depending on sql_mode IGNORE_BAD_TABLE_OPTIONS
* in ALTER TABLE from the engine that suppors it to the engine that
  doesn't - silently preserved (no warning)
* it is commented out in SHOW CREATE unless IGNORE_BAD_TABLE_OPTIONS
2023-08-02 14:45:31 +02:00
Sergei Golubchik
da09ae05a9 MDEV-18114 Foreign Key Constraint actions don't affect Virtual Column
* invoke check_expression() for all vcol_info's in
  mysql_prepare_create_table() to check for FK CASCADE
* also check for SET NULL and SET DEFAULT
* to check against existing FKs when a vcol is added in ALTER TABLE,
  old FKs must be added to the new_key_list just like other indexes are
* check columns recursively, if vcol1 references vcol2,
  flags of vcol2 must be taken into account
* remove check_table_name_processor(), put that logic under
  check_vcol_func_processor() to avoid walking the tree twice
2023-08-02 14:45:31 +02:00
Marko Mäkelä
8760fe11b8 MDEV-31791: Recovery on memory-mapped log occasionally fails
recv_ring::copy_if_needed(): If the record wraps around the
memory-mapped ib_logfile0, do copy it also if len==0
(the record consists only of a header, like FREE_PAGE and INIT_PAGE
records do).

recv_sys_t::parse(): Invoke recv_ring::copy_if_needed() for INIT_PAGE
and FREE_PAGE records, so that if these records wrap around the
memory-mapped ib_logfile0, they will be correctly copied to
recv_sys.pages.

Together with commit 0d175968d1 (MDEV-31354)
this fixes occasional failures of the test innodb.recovery_memory.
2023-08-02 11:52:00 +03:00
Sergei Golubchik
ab1191c039 cleanup: key->key_create_info.check_for_duplicate_indexes -> key->old
mark old keys in the ALTER TABLE with the `old` flag, not with
the `key_create_info.check_for_duplicate_indexes`.

This allows to mark old foreign keys too.
2023-08-01 22:43:16 +02:00
Sergei Golubchik
0c9794d022 cleanup: Item_field::check_vcol_func_processor()
to declutter Item_field::check_vcol_func_processor(), move alter_info
specific part of it into Alter_info::check_vcol_field()
2023-08-01 22:43:16 +02:00
Sergei Golubchik
b8233b38da cleanup: put db/table_name into Alter_info
also, prefer Lex_table_name and Lex_ident over LEX_CSTRING
2023-08-01 22:43:16 +02:00
Sergei Golubchik
2f6d464fec cleanup: reorder enum_fk_option 2023-08-01 22:43:16 +02:00
Sergei Golubchik
f7a9f446d7 cleanup: remove unused keyinfo flag
HA_UNIQUE_CHECK was
* only used internally by MyISAM/Aria
* only used for internal temporary tables (for DISTINCT)
* never saved in frm
* saved in MYI/MAD but only for temporary tables
* only set, never checked

it's safe to remove it and free the bit (there are only 16 of them)
2023-08-01 22:43:16 +02:00
Sergei Golubchik
383baa812e cleanup: invert return code 2023-08-01 22:42:24 +02:00
Sergei Golubchik
010f535b7f cleanup: remove redundant arguments 2023-08-01 22:33:56 +02:00
Sergei Golubchik
bf5cc31d4c cleanup: cosmetic changes 2023-08-01 22:33:53 +02:00
Sergei Petrunia
691e964d23 MDEV-31764: ASAN use-after-poison in trace_engine_stats in ANALYZE JSON
Do not attempt to produce "r_engine_stats" on the temporary (=work) tables.
These tables may be
- re-created during the query execution
- freed during the query execution (This is done e.g. in JOIN::cleanup(),
  before we produce ANALYZE FORMAT=JSON output).

- (Also, make save_explain_data() functions not set handler_for_stats
  to point to handler objects that do not have handler->handler_stats set.
  If the storage engine is not collecting handler_stats, it will not have
  them when we're producing ANALYZE FORMAT=JSON output, either).
2023-08-01 22:32:54 +03:00
Oleksandr Byelkin
138717b16f New CC 3.3 2023-08-01 16:40:10 +02:00
Oleksandr Byelkin
6bf8483cac Merge branch '10.5' into 10.6 2023-08-01 15:08:52 +02:00
Marko Mäkelä
72928e640e MDEV-27593: Crashing on I/O error is unhelpful
buf_page_t::write_complete(), buf_page_write_complete(),
IORequest::write_complete(): Add a parameter for passing
an error code. If an error occurred, we will release the
io-fix, buffer-fix and page latch but not reset the
oldest_modification field. The block would remain in
buf_pool.LRU and possibly buf_pool.flush_list, to be written
again later, by buf_flush_page_cleaner(). If all page writes
start consistently failing, all write threads should eventually
hang in log_free_check() because the log checkpoint cannot
be advanced to make room in the circular write-ahead-log ib_logfile0.

IORequest::read_complete(): Add a parameter for passing
an error code. If a read operation fails, we report the error
and discard the page, just like we would do if the page checksum
was not validated or the page could not be decrypted.
This only affects asynchronous reads, due to linear or random read-ahead
or crash recovery. When buf_page_get_low() invokes buf_read_page(),
that will be a synchronous read, not involving this code.

This was tested by randomly injecting errors in
write_io_callback() and read_io_callback(), like this:

  if (!ut_rnd_interval(100))
    cb->m_err= 42;
2023-08-01 14:39:29 +03:00
Marko Mäkelä
96cfdb8710 MDEV-31816 fixup: Relax a debug assertion
buf_LRU_free_page(): The block may also be in the IBUF_EXIST state
when executing the test innodb.innodb_bulk_create_index_debug.
2023-08-01 13:22:16 +03:00
Oleksandr Byelkin
65405308a1 Merge branch '10.4' into 10.5 2023-08-01 11:52:13 +02:00
Marko Mäkelä
d794d3484b MDEV-31816 buf_LRU_free_page() does not preserve ROW_FORMAT=COMPRESSED block state
buf_LRU_free_page(): When we are discarding the uncompressed copy of a
ROW_FORMAT=COMPRESSED page, buf_page_t::can_relocate() must have ensured
that the block descriptor state is one of FREED, UNFIXED, REINIT.
Do not overwrite the state with UNFIXED. We do not want to write back
pages that were actually freed, and we want to avoid doublewrite for
pages that were (re)initialized by log records written since the latest
checkpoint. Last but not least, we do not want crashes like those that
commit dc1bd1802a (MDEV-31386)
was supposed to fix.

The test innodb_zip.wl5522_zip should typically cover all 3 states.

This bug is a regression due to
commit aaef2e1d8c (MDEV-27058).
2023-08-01 09:58:15 +03:00
Sergei Golubchik
ab10a675ac MDEV-31092 mysqldump --force doesn't ignore error as it should
failed SHOW CREATE FUNCTION means we don't dump this function,
but should still try to dump all other functions
2023-07-31 22:46:47 +02:00
Sergei Golubchik
4dd38f9f39 MDEV-31800 Problem with open ranges on prefix blobs keys
don't construct open ranges from prefix blob keys for < (less than)
just as it's already done for > (greater than)

because prefix KEY_PART doesn't create prefix Field for blobs
(see open_table_from_share() near "Create a new field for the key part"),
so stored_field_cmp_to_item() will compare the original field to the
value not taking the prefix length into account.
2023-07-31 22:46:47 +02:00
Sergei Golubchik
4da80a41f6 Fix double definition of CRYPTO_cleanup_all_ex_data 2023-07-31 17:44:07 +02:00
Aleksey Midenkov
69b118a346 Revert "MDEV-30528 Assertion in dtype_get_at_most_n_mbchars"
This reverts commit add0c01bae

Duplicates must be avoided in FTS_DOC_ID_INDEX
2023-07-31 16:57:18 +03:00
Thirunarayanan Balathandayuthapani
941af1fa58 MDEV-31803 InnoDB aborts during recovery when immediate_scrub_data_uncompressed is enabled
Problem:
========
 - InnoDB scans the complete redo log to ensure that there is
no corruption and to find the end of the log. During this scan,
InnoDB saves all the freed ranges, but it doesn't save
recovered size. Later, InnoDB recovery applies partial
redo logs and IO thread tries to flush the all freed
ranges which was noted during previous complete scan of redo logs.

Fix:
====
 InnoDB should store the freed pages only when InnoDB stores
 the redo log records.
2023-07-31 16:42:23 +05:30
Oleksandr Byelkin
4235c133ae Merge branch '10.4' into 10.5 2023-07-31 10:14:46 +02:00
Marko Mäkelä
f182de2ec8 MDEV-30159 fixup: Plug a memory leak in the test 2023-07-31 09:28:28 +03:00
Kristian Nielsen
a4b9e9b95f Fix rpl.rpl_rotate_logs to work with --repeat
(It's not using include/rpl_init.inc, so it needs to reset the GTID position
explicitly).

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-07-30 22:00:43 +02:00
Kristian Nielsen
d632c85bb7 MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT
A simple "SET SESSION gtid_seq_no= DEFAULT" did not work, it would straight
up crash the server! Also, explicitly setting gtid_seq_no to 0 gave an error
in --gtid-strict-mode=1.

Setting to DEFAULT or 0 should disable any prior setting of
gtid_seq_no, so that the next transaction is allocated the next GTID
in sequence, as normal.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-07-30 22:00:43 +02:00
Monty
055f2e308b Fix of4cb0d43ac63761174a39cea892c176b9cfa6edfc after merge in 10.5 2023-07-30 08:41:54 +02:00
Julius Goryavsky
7f9468795d galera: two tests are returned to the disabled list 2023-07-29 08:06:21 +02:00