diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-25 11:02:07 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-25 11:02:07 +0200 |
commit | 3467f6376472ce695e36746ba5b3c13cb5fcbb9f (patch) | |
tree | 31432a470ddb2247e0a3e2bcadd89666e273d904 /storage | |
parent | ce141d0714207afb70911abce21c2a4055b8a9e9 (diff) | |
parent | eaeb8ec4b87882711ecb8e1c7476a6e410d5d2a9 (diff) | |
download | mariadb-git-3467f6376472ce695e36746ba5b3c13cb5fcbb9f.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage')
-rw-r--r-- | storage/heap/ha_heap.cc | 3 | ||||
-rw-r--r-- | storage/innobase/btr/btr0pcur.cc | 9 | ||||
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 23 | ||||
-rw-r--r-- | storage/innobase/include/trx0sys.h | 6 | ||||
-rw-r--r-- | storage/innobase/trx/trx0rseg.cc | 47 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 3 |
6 files changed, 51 insertions, 40 deletions
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index ff5bb4b3ec4..afbb929c372 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -363,9 +363,6 @@ int ha_heap::info(uint flag) { HEAPINFO hp_info; - if (!table) - return 0; - (void) heap_info(file,&hp_info,flag); errkey= hp_info.errkey; diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 9c5216dc015..a8db6e22c0a 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2020, MariaDB Corporation. +Copyright (c) 2016, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -151,7 +151,8 @@ before_first: ut_ad(!page_rec_is_infimum(rec)); if (UNIV_UNLIKELY(rec_is_metadata(rec, *index))) { - ut_ad(index->table->instant); + ut_ad(index->table->instant + || block->page.id.page_no() != index->page); ut_ad(page_get_n_recs(block->frame) == 1); ut_ad(page_is_leaf(block->frame)); ut_ad(!page_has_prev(block->frame)); @@ -169,7 +170,9 @@ before_first: rec = page_rec_get_next(rec); if (page_rec_is_supremum(rec)) { ut_ad(page_has_next(block->frame) - || rec_is_alter_metadata(p, *index)); + || rec_is_alter_metadata(p, *index) + || block->page.id.page_no() + != index->page); goto before_first; } } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 2734bd5a77b..97714e9dfa7 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -5907,11 +5907,13 @@ add_all_virtual: const rec_t* rec = btr_pcur_get_rec(&pcur); que_thr_t* thr = pars_complete_graph_for_exec( NULL, trx, ctx->heap, NULL); + const bool is_root = block->page.id.page_no() == index->page; dberr_t err = DB_SUCCESS; if (rec_is_metadata(rec, *index)) { ut_ad(page_rec_is_user_rec(rec)); - if (!rec_is_alter_metadata(rec, *index) + if (is_root + && !rec_is_alter_metadata(rec, *index) && !index->table->instant && !page_has_next(block->frame) && page_rec_is_last(rec, block->frame)) { @@ -5993,7 +5995,8 @@ add_all_virtual: } btr_pcur_close(&pcur); goto func_exit; - } else if (page_rec_is_supremum(rec) && !index->table->instant) { + } else if (is_root && page_rec_is_supremum(rec) + && !index->table->instant) { empty_table: /* The table is empty. */ ut_ad(fil_page_index_page_check(block->frame)); @@ -6523,6 +6526,7 @@ new_clustered_failed: } if (dict_col_name_is_reserved(field->field_name.str)) { +wrong_column_name: dict_mem_table_free(ctx->new_table); ctx->new_table = ctx->old_table; my_error(ER_WRONG_COLUMN_NAME, MYF(0), @@ -6530,6 +6534,21 @@ new_clustered_failed: goto new_clustered_failed; } + /** Note the FTS_DOC_ID name is case sensitive due + to internal query parser. + FTS_DOC_ID column must be of BIGINT NOT NULL type + and it should be in all capitalized characters */ + if (!innobase_strcasecmp(field->field_name.str, + FTS_DOC_ID_COL_NAME)) { + if (col_type != DATA_INT + || field->real_maybe_null() + || col_len != sizeof(doc_id_t) + || strcmp(field->field_name.str, + FTS_DOC_ID_COL_NAME)) { + goto wrong_column_name; + } + } + if (is_virtual) { dict_mem_table_add_v_col( ctx->new_table, ctx->heap, diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 6ba457cdc40..f20fdc250c5 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -847,8 +847,10 @@ public: #endif /** Latest recovered binlog offset */ uint64_t recovered_binlog_offset; - /** Latest recovred binlog file name */ + /** Latest recovered binlog file name */ char recovered_binlog_filename[TRX_SYS_MYSQL_LOG_NAME_LEN]; + /** FIL_PAGE_LSN of the page with the latest recovered binlog metadata */ + lsn_t recovered_binlog_lsn; /** diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index 3e29ad838c9..ed1499e1392 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -443,8 +443,13 @@ static void trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr) { - trx_rsegf_t* rseg_header = trx_rsegf_get_new( - rseg->space->id, rseg->page_no, mtr); + /* This is based on trx_rsegf_get_new(). + We need to access buf_block_t. */ + buf_block_t *block = buf_page_get( + page_id_t(rseg->space->id, rseg->page_no), 0, RW_S_LATCH, mtr); + buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); + + const trx_rsegf_t* rseg_header = TRX_RSEG + block->frame; if (mach_read_from_4(rseg_header + TRX_RSEG_FORMAT) == 0) { trx_id_t id = mach_read_from_8(rseg_header @@ -455,32 +460,20 @@ trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr) } if (rseg_header[TRX_RSEG_BINLOG_NAME]) { - const char* binlog_name = reinterpret_cast<const char*> - (rseg_header) + TRX_RSEG_BINLOG_NAME; + lsn_t lsn = std::max(block->page.newest_modification, + mach_read_from_8(FIL_PAGE_LSN + + block->frame)); compile_time_assert(TRX_RSEG_BINLOG_NAME_LEN == sizeof trx_sys.recovered_binlog_filename); - - int cmp = *trx_sys.recovered_binlog_filename - ? strncmp(binlog_name, - trx_sys.recovered_binlog_filename, - TRX_RSEG_BINLOG_NAME_LEN) - : 1; - - if (cmp >= 0) { - uint64_t binlog_offset = mach_read_from_8( - rseg_header + TRX_RSEG_BINLOG_OFFSET); - if (cmp) { - memcpy(trx_sys. - recovered_binlog_filename, - binlog_name, - TRX_RSEG_BINLOG_NAME_LEN); - trx_sys.recovered_binlog_offset - = binlog_offset; - } else if (binlog_offset > - trx_sys.recovered_binlog_offset) { - trx_sys.recovered_binlog_offset - = binlog_offset; - } + if (lsn > trx_sys.recovered_binlog_lsn) { + trx_sys.recovered_binlog_lsn = lsn; + trx_sys.recovered_binlog_offset + = mach_read_from_8( + rseg_header + + TRX_RSEG_BINLOG_OFFSET); + memcpy(trx_sys.recovered_binlog_filename, + rseg_header + TRX_RSEG_BINLOG_NAME, + TRX_RSEG_BINLOG_NAME_LEN); } #ifdef WITH_WSREP diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 1f734439ffe..aa99bc157c9 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2523,9 +2523,6 @@ int ha_maria::info(uint flag) MARIA_INFO maria_info; char name_buff[FN_REFLEN]; - if (!table) - return 0; - (void) maria_status(file, &maria_info, flag); if (flag & HA_STATUS_VARIABLE) { |