diff options
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/fsp/fsp0sysspace.cc | 13 | ||||
-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 |
13 files changed, 62 insertions, 91 deletions
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index fd5ac3c368f..98b3ae38097 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 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 @@ -677,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 9c8a1e1f350..972ef1a01b6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -20725,48 +20725,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 @@ -20849,9 +20807,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" */ @@ -20867,8 +20826,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; @@ -20881,6 +20839,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); @@ -20910,14 +20870,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); } @@ -21864,21 +21826,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 cbb544f60c1..51afbedd649 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -915,11 +915,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* @@ -934,8 +935,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 ab9d4d296ad..f1e355ade4d 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -235,6 +235,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 f7c07ec1ca9..8d1dbad22cb 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 c191b972cd0..a63dd90e9c2 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -861,7 +861,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 @@ -908,6 +907,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++) { @@ -923,7 +927,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; @@ -939,16 +943,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 ac08a5e11e9..a81e47edaf5 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 2145ca6b06e..a7ceb1f3f85 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -332,7 +332,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 c8b098be5fa..9f631128b08 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1079,7 +1079,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); @@ -2162,8 +2162,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); |