diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-10-28 07:50:05 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-10-28 07:50:05 +0300 |
commit | 657bcf928eb1c6a80ee2c82f0dcdd59ab02927e4 (patch) | |
tree | c692f1600c06da934cf44240228516eed88c868f /storage | |
parent | e97b785d764f85009412947600195001be01a706 (diff) | |
parent | 563daec123728f69dc56d898d1d8b198e9e2d411 (diff) | |
download | mariadb-git-657bcf928eb1c6a80ee2c82f0dcdd59ab02927e4.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/fsp/fsp0sysspace.cc | 12 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 78 | ||||
-rw-r--r-- | storage/innobase/include/row0mysql.h | 10 | ||||
-rw-r--r-- | storage/innobase/include/univ.i | 6 | ||||
-rw-r--r-- | storage/innobase/include/ut0byte.ic | 6 | ||||
-rw-r--r-- | storage/innobase/pars/pars0grm.cc | 4 | ||||
-rw-r--r-- | storage/innobase/pars/pars0grm.y | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0ftsort.cc | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0ins.cc | 15 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.cc | 2 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.cc | 5 | ||||
-rw-r--r-- | storage/innobase/row/row0vers.cc | 2 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.c | 5 | ||||
-rw-r--r-- | storage/rocksdb/ha_rocksdb.h | 16 | ||||
-rw-r--r-- | storage/test_sql_discovery/mysql-test/sql_discovery/simple.test | 1 |
16 files changed, 72 insertions, 102 deletions
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 451187a35d9..6aa0f5edb9a 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 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 @@ -676,13 +677,18 @@ SysTablespace::file_not_found( { file.m_exists = false; - if (srv_read_only_mode && !m_ignore_read_only) { + if (m_ignore_read_only) { + } else if (srv_read_only_mode) { ib::error() << "Can't create file '" << file.filepath() << "' when --innodb-read-only is set"; - return(DB_ERROR); + } else if (srv_force_recovery && space_id() == TRX_SYS_SPACE) { + ib::error() << "Can't create file '" << file.filepath() + << "' when --innodb-force-recovery is set"; + return DB_ERROR; + } - } else if (&file == &m_files.front()) { + if (&file == &m_files.front()) { /* First data file. */ ut_a(!*create_new_db); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d3138bbd6b9..32636dbb41b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -20980,48 +20980,6 @@ innobase_rename_vc_templ( table->vc_templ->tb_name = t_tbname; } -/** Get the updated parent field value from the update vector for the -given col_no. -@param[in] foreign foreign key information -@param[in] update updated parent vector. -@param[in] col_no base column position of the child table to check -@return updated field from the parent update vector, else NULL */ -static -dfield_t* -innobase_get_field_from_update_vector( - dict_foreign_t* foreign, - upd_t* update, - ulint col_no) -{ - dict_table_t* parent_table = foreign->referenced_table; - dict_index_t* parent_index = foreign->referenced_index; - ulint parent_field_no; - ulint parent_col_no; - ulint prefix_col_no; - - for (ulint i = 0; i < foreign->n_fields; i++) { - if (dict_index_get_nth_col_no(foreign->foreign_index, i) - != col_no) { - continue; - } - - parent_col_no = dict_index_get_nth_col_no(parent_index, i); - parent_field_no = dict_table_get_nth_col_pos( - parent_table, parent_col_no, &prefix_col_no); - - for (ulint j = 0; j < update->n_fields; j++) { - upd_field_t* parent_ufield - = &update->fields[j]; - - if (parent_ufield->field_no == parent_field_no) { - return(&parent_ufield->new_val); - } - } - } - - return (NULL); -} - /** Allocate a heap and record for calculating virtual fields @@ -21104,9 +21062,10 @@ void innobase_report_computed_value_failed(dtuple_t *row) @param[in] ifield index field @param[in] thd MySQL thread handle @param[in,out] mysql_table mysql table object +@param[in,out] mysql_rec MariaDB record buffer @param[in] old_table during ALTER TABLE, this is the old table or NULL. -@param[in] parent_update update vector for the parent row +@param[in] update update vector for the row, if any @param[in] foreign foreign key information @return the field filled with computed value, or NULL if just want to store the value in passed in "my_rec" */ @@ -21122,8 +21081,7 @@ innobase_get_computed_value( TABLE* mysql_table, byte* mysql_rec, const dict_table_t* old_table, - upd_t* parent_update, - dict_foreign_t* foreign) + const upd_t* update) { byte rec_buf2[REC_VERSION_56_MAX_INDEX_COL_LEN]; byte* buf; @@ -21136,6 +21094,8 @@ innobase_get_computed_value( ulint ret = 0; + dict_index_t *clust_index= dict_table_get_first_index(index->table); + ut_ad(index->table->vc_templ); ut_ad(thd != NULL); ut_ad(mysql_table); @@ -21165,14 +21125,16 @@ innobase_get_computed_value( = index->table->vc_templ->vtempl[col_no]; const byte* data; - if (parent_update != NULL) { - /** Get the updated field from update vector - of the parent table. */ - row_field = innobase_get_field_from_update_vector( - foreign, parent_update, col_no); + if (update) { + ulint clust_no = dict_col_get_clust_pos(base_col, + clust_index); + if (const upd_field_t *uf = upd_get_field_by_field_no( + update, clust_no, false)) { + row_field = &uf->new_val; + } } - if (row_field == NULL) { + if (!row_field) { row_field = dtuple_get_nth_field(row, col_no); } @@ -21901,21 +21863,13 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row) mem_heap_t *local_heap= NULL; for (ulint col_no= 0; col_no < dict_table_get_n_v_cols(table); col_no++) { - const dict_v_col_t *v_col= dict_table_get_nth_v_col(table, col_no); for (ulint i= 0; i < unsigned(v_col->num_base); i++) - { - dict_col_t *base_col= v_col->base_col[i]; - if (base_col->ind == table->vers_end) - { + if (v_col->base_col[i]->ind == table->vers_end) innobase_get_computed_value(row, v_col, clust_index, &local_heap, table->heap, NULL, thd, mysql_table, - mysql_table->record[0], NULL, NULL, NULL); - } - } + mysql_table->record[0], NULL, NULL); } - if (local_heap) - { + if (UNIV_LIKELY_NULL(local_heap)) mem_heap_free(local_heap); - } } diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index aa72a1f822a..3e5a7a77333 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -910,11 +910,12 @@ void innobase_report_computed_value_failed(dtuple_t *row); @param[in,out] local_heap heap memory for processing large data etc. @param[in,out] heap memory heap that copies the actual index row @param[in] ifield index field -@param[in] thd MySQL thread handle -@param[in,out] mysql_table mysql table object +@param[in] thd connection handle +@param[in,out] mysql_table MariaDB table handle +@param[in,out] mysql_rec MariaDB record buffer @param[in] old_table during ALTER TABLE, this is the old table or NULL. -@param[in] parent_update update vector for the parent row +@param[in] update update vector for the parent row @param[in] foreign foreign key information @return the field filled with computed value */ dfield_t* @@ -929,8 +930,7 @@ innobase_get_computed_value( TABLE* mysql_table, byte* mysql_rec, const dict_table_t* old_table, - upd_t* parent_update, - dict_foreign_t* foreign); + const upd_t* update); /** Get the computed value by supplying the base column values. @param[in,out] table the table whose virtual column diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 3d73c80f789..2a18d17823f 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -234,6 +234,12 @@ easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */ # define UNIV_INTERN #endif +#if defined(__GNUC__) && (__GNUC__ >= 11) +# define ATTRIBUTE_ACCESS(X) __attribute__((access X)) +#else +# define ATTRIBUTE_ACCESS(X) +#endif + #ifndef MY_ATTRIBUTE #if defined(__GNUC__) # define MY_ATTRIBUTE(A) __attribute__(A) diff --git a/storage/innobase/include/ut0byte.ic b/storage/innobase/include/ut0byte.ic index e6e60f07886..6dd48090c3a 100644 --- a/storage/innobase/include/ut0byte.ic +++ b/storage/innobase/include/ut0byte.ic @@ -77,7 +77,7 @@ ut_uint64_align_up( /*********************************************************//** The following function rounds up a pointer to the nearest aligned address. @return aligned pointer */ -UNIV_INLINE +UNIV_INLINE ATTRIBUTE_ACCESS((none,1)) void* ut_align( /*=====*/ @@ -97,7 +97,7 @@ ut_align( The following function rounds down a pointer to the nearest aligned address. @return aligned pointer */ -UNIV_INLINE +UNIV_INLINE ATTRIBUTE_ACCESS((none,1)) void* ut_align_down( /*==========*/ @@ -117,7 +117,7 @@ ut_align_down( The following function computes the offset of a pointer from the nearest aligned address. @return distance from aligned pointer */ -UNIV_INLINE +UNIV_INLINE ATTRIBUTE_ACCESS((none,1)) ulint ut_align_offset( /*============*/ diff --git a/storage/innobase/pars/pars0grm.cc b/storage/innobase/pars/pars0grm.cc index 7e10a783310..10d0d0becd7 100644 --- a/storage/innobase/pars/pars0grm.cc +++ b/storage/innobase/pars/pars0grm.cc @@ -79,6 +79,10 @@ que_node_t */ #include "que0que.h" #include "row0sel.h" +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wfree-nonheap-object" +#endif + #define YYSTYPE que_node_t* /* #define __STDC__ */ diff --git a/storage/innobase/pars/pars0grm.y b/storage/innobase/pars/pars0grm.y index 625ed41bbd4..3fb0865f608 100644 --- a/storage/innobase/pars/pars0grm.y +++ b/storage/innobase/pars/pars0grm.y @@ -38,6 +38,10 @@ que_node_t */ #include "que0que.h" #include "row0sel.h" +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wfree-nonheap-object" +#endif + #define YYSTYPE que_node_t* /* #define __STDC__ */ diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 811a08b6a58..b45b5d171ff 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1791,8 +1791,6 @@ row_fts_merge_insert( } exit: - dict_table_close(aux_table, FALSE, FALSE); - fts_sql_commit(trx); trx->op_info = ""; @@ -1802,6 +1800,8 @@ exit: error = ins_ctx.btr_bulk->finish(error); UT_DELETE(ins_ctx.btr_bulk); + dict_table_close(aux_table, FALSE, FALSE); + trx->free(); mem_heap_free(heap); diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index ae105743d45..d3ef1c89c4a 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -864,7 +864,6 @@ row_ins_invalidate_query_cache( innobase_invalidate_query_cache(thr_get_trx(thr), name); } - /** Fill virtual column information in cascade node for the child table. @param[out] cascade child update node @param[in] rec clustered rec of child table @@ -911,6 +910,11 @@ row_ins_foreign_fill_virtual( if (!record) { return DB_OUT_OF_MEMORY; } + ut_ad(!node->is_delete + || (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)); + ut_ad(foreign->type & (DICT_FOREIGN_ON_DELETE_SET_NULL + | DICT_FOREIGN_ON_UPDATE_SET_NULL + | DICT_FOREIGN_ON_UPDATE_CASCADE)); for (ulint i = 0; i < n_v_fld; i++) { @@ -926,7 +930,7 @@ row_ins_foreign_fill_virtual( dfield_t* vfield = innobase_get_computed_value( update->old_vrow, col, index, &vc.heap, update->heap, NULL, thd, mysql_table, - record, NULL, NULL, NULL); + record, NULL, NULL); if (vfield == NULL) { return DB_COMPUTE_VALUE_FAILED; @@ -942,16 +946,11 @@ row_ins_foreign_fill_virtual( upd_field_set_v_field_no(upd_field, i, index); - bool set_null = - node->is_delete - ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) - : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL); - dfield_t* new_vfield = innobase_get_computed_value( update->old_vrow, col, index, &vc.heap, update->heap, NULL, thd, mysql_table, record, NULL, - set_null ? update : node->update, foreign); + update); if (new_vfield == NULL) { return DB_COMPUTE_VALUE_FAILED; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index e99710abe38..6abfa848658 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -600,8 +600,8 @@ error: row_field = innobase_get_computed_value( row, v_col, clust_index, v_heap, NULL, ifield, trx->mysql_thd, - my_table, vcol_storage.innobase_record, - old_table, NULL, NULL); + my_table, vcol_storage.innobase_record, + old_table, NULL); if (row_field == NULL) { *err = DB_COMPUTE_VALUE_FAILED; diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 08401831d16..fbdb03e19b4 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -329,7 +329,7 @@ row_sel_sec_rec_is_for_clust_rec( &heap, NULL, NULL, thr_get_trx(thr)->mysql_thd, thr->prebuilt->m_mysql_table, - record, NULL, NULL, NULL); + record, NULL, NULL); if (vfield == NULL) { innobase_report_computed_value_failed(row); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 73d35cb92a2..d187f18b05c 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1153,7 +1153,7 @@ row_upd_build_difference_binary( dfield_t* vfield = innobase_get_computed_value( update->old_vrow, col, index, &vc.heap, heap, NULL, thd, mysql_table, record, - NULL, NULL, NULL); + NULL, NULL); if (vfield == NULL) { *error = DB_COMPUTE_VALUE_FAILED; return(NULL); @@ -2179,8 +2179,7 @@ row_upd_store_v_row( node->row, col, index, &vc.heap, node->heap, NULL, thd, mysql_table, - record, NULL, NULL, - NULL); + record, NULL, NULL); if (vfield == NULL) { return false; } diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index a5ef82405d4..d1ff7bc540e 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -490,7 +490,7 @@ row_vers_build_clust_v_col( dfield_t *vfield = innobase_get_computed_value( row, col, clust_index, &vc.heap, heap, NULL, thd, maria_table, record, NULL, - NULL, NULL); + NULL); if (vfield == NULL) { innobase_report_computed_value_failed(row); ut_ad(0); diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index aa4afaaec1a..b601a25966a 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -3398,10 +3398,9 @@ static uint16 translog_get_chunk_header_length(uchar *chunk) DBUG_PRINT("info", ("TRANSLOG_CHUNK_LNGTH = 3")); DBUG_RETURN(3); break; - default: - DBUG_ASSERT(0); - DBUG_RETURN(0); /* Keep compiler happy */ } + DBUG_ASSERT(0); + DBUG_RETURN(0); /* Keep compiler happy */ } diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index cadbd9abfe9..56111c7dfb9 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -448,15 +448,13 @@ class ha_rocksdb : public my_core::handler { } } - /** @brief - The name that will be used for display purposes. - */ - const char *table_type() const /*override*/ { - DBUG_ENTER_FUNC(); - // MariaDB: this function is not virtual, however ha_innodb - // declares it (and then never uses!) psergey-merge-todo:. - DBUG_RETURN(rocksdb_hton_name); - } + /* + MariaDB: this function: + + const char *table_type() const + + is non-virtual in class handler, so there's no point to override it. + */ /* The following is only used by SHOW KEYS: */ const char *index_type(uint inx) override { diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test index 90eea753a38..a8c7ef9a6bb 100644 --- a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test +++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test @@ -29,6 +29,7 @@ show warnings; set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2'; --error ER_SQL_DISCOVER_ERROR select * from t1; +--replace_result 1289 1290 "The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working" "The MariaDB server is running with the --skip-partition option so it cannot execute this statement" show warnings; set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)'; |