diff options
Diffstat (limited to 'storage/xtradb')
24 files changed, 160 insertions, 267 deletions
diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc index 29f03549899..dca8542633f 100644 --- a/storage/xtradb/btr/btr0btr.cc +++ b/storage/xtradb/btr/btr0btr.cc @@ -2086,7 +2086,7 @@ btr_page_reorganize_low( "InnoDB: Error: page old max ins size %lu" " new max ins size %lu\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org/\n", (unsigned long) data_size1, (unsigned long) data_size2, (unsigned long) max_ins_size1, (unsigned long) max_ins_size2); diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc index 7550943de7a..1558c6d50ac 100644 --- a/storage/xtradb/dict/dict0dict.cc +++ b/storage/xtradb/dict/dict0dict.cc @@ -570,15 +570,14 @@ dict_table_close( ut_ad(mutex_own(&dict_sys->mutex)); ut_a(table->n_ref_count > 0); - --table->n_ref_count; + const bool last_handle = !--table->n_ref_count; /* Force persistent stats re-read upon next open of the table so that FLUSH TABLE can be used to forcibly fetch stats from disk if they have been manually modified. We reset table->stat_initialized only if table reference count is 0 because we do not want too frequent stats re-reads (e.g. in other cases than FLUSH TABLE). */ - if (strchr(table->name, '/') != NULL - && table->n_ref_count == 0 + if (last_handle && strchr(table->name, '/') != NULL && dict_stats_is_persistent_enabled(table)) { dict_stats_deinit(table); @@ -598,11 +597,8 @@ dict_table_close( if (!dict_locked) { table_id_t table_id = table->id; - ibool drop_aborted; - - drop_aborted = try_drop + const bool drop_aborted = last_handle && try_drop && table->drop_aborted - && table->n_ref_count == 1 && dict_table_get_first_index(table); mutex_exit(&dict_sys->mutex); @@ -642,40 +638,6 @@ dict_table_get_col_name( return(s); } -/**********************************************************************//** -Returns a column's name. -@return column name. NOTE: not guaranteed to stay valid if table is -modified in any way (columns added, etc.). */ -UNIV_INTERN -const char* -dict_table_get_col_name_for_mysql( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - const char* col_name)/*! in: MySQL table column name */ -{ - ulint i; - const char* s; - - ut_ad(table); - ut_ad(col_name); - ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - - s = table->col_names; - if (s) { - /* If we have many virtual columns MySQL key_part->fieldnr - could be larger than number of columns in InnoDB table - when creating new indexes. */ - for (i = 0; i < table->n_def; i++) { - - if (!innobase_strcasecmp(s, col_name)) { - break; /* Found */ - } - s += strlen(s) + 1; - } - } - - return(s); -} #ifndef UNIV_HOTBACKUP /** Allocate and init the autoinc latch of a given table. This function must not be called concurrently on the same table object. @@ -2151,8 +2113,9 @@ dict_table_remove_from_cache_low( } if (lru_evict && table->drop_aborted) { - /* Do as dict_table_try_drop_aborted() does. */ - + /* When evicting the table definition, + drop the orphan indexes from the data dictionary + and free the index pages. */ trx_t* trx = trx_allocate_for_background(); ut_ad(mutex_own(&dict_sys->mutex)); @@ -2163,12 +2126,8 @@ dict_table_remove_from_cache_low( trx->dict_operation_lock_mode = RW_X_LATCH; trx_set_dict_operation(trx, TRX_DICT_OP_INDEX); + row_merge_drop_indexes_dict(trx, table->id); - /* Silence a debug assertion in row_merge_drop_indexes(). */ - ut_d(table->n_ref_count++); - row_merge_drop_indexes(trx, table, TRUE); - ut_d(table->n_ref_count--); - ut_ad(table->n_ref_count == 0); trx_commit_for_mysql(trx); trx->dict_operation_lock_mode = 0; trx_free_for_background(trx); diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc index e1a95bcd427..88b5ad97277 100644 --- a/storage/xtradb/fts/fts0fts.cc +++ b/storage/xtradb/fts/fts0fts.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights reserved. +Copyright (c) 2016, 2017, 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 @@ -2644,22 +2644,23 @@ fts_get_next_doc_id( will consult the CONFIG table and user table to re-establish the initial value of the Doc ID */ - if (cache->first_doc_id != 0 || !fts_init_doc_id(table)) { - if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { - *doc_id = FTS_NULL_DOC_ID; - return(DB_SUCCESS); + if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { + if (cache->first_doc_id == FTS_NULL_DOC_ID) { + fts_init_doc_id(table); } + *doc_id = FTS_NULL_DOC_ID; + return(DB_SUCCESS); + } - /* Otherwise, simply increment the value in cache */ - mutex_enter(&cache->doc_id_lock); - *doc_id = ++cache->next_doc_id; - mutex_exit(&cache->doc_id_lock); - } else { - mutex_enter(&cache->doc_id_lock); - *doc_id = cache->next_doc_id; - mutex_exit(&cache->doc_id_lock); + if (cache->first_doc_id == FTS_NULL_DOC_ID) { + fts_init_doc_id(table); } + DEBUG_SYNC_C("get_next_FTS_DOC_ID"); + mutex_enter(&cache->doc_id_lock); + *doc_id = cache->next_doc_id++; + mutex_exit(&cache->doc_id_lock); + return(DB_SUCCESS); } @@ -3033,53 +3034,6 @@ fts_modify( } /*********************************************************************//** -Create a new document id. -@return DB_SUCCESS if all went well else error */ -UNIV_INTERN -dberr_t -fts_create_doc_id( -/*==============*/ - dict_table_t* table, /*!< in: row is of this table. */ - dtuple_t* row, /* in/out: add doc id value to this - row. This is the current row that is - being inserted. */ - mem_heap_t* heap) /*!< in: heap */ -{ - doc_id_t doc_id; - dberr_t error = DB_SUCCESS; - - ut_a(table->fts->doc_col != ULINT_UNDEFINED); - - if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) { - if (table->fts->cache->first_doc_id == FTS_NULL_DOC_ID) { - error = fts_get_next_doc_id(table, &doc_id); - } - return(error); - } - - error = fts_get_next_doc_id(table, &doc_id); - - if (error == DB_SUCCESS) { - dfield_t* dfield; - doc_id_t* write_doc_id; - - ut_a(doc_id > 0); - - dfield = dtuple_get_nth_field(row, table->fts->doc_col); - write_doc_id = static_cast<doc_id_t*>( - mem_heap_alloc(heap, sizeof(*write_doc_id))); - - ut_a(doc_id != FTS_NULL_DOC_ID); - ut_a(sizeof(doc_id) == dfield->type.len); - fts_write_doc_id((byte*) write_doc_id, doc_id); - - dfield_set_data(dfield, write_doc_id, sizeof(*write_doc_id)); - } - - return(error); -} - -/*********************************************************************//** The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. @return DB_SUCCESS or error code */ diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc index f24973e26fb..358d979fff6 100644 --- a/storage/xtradb/fts/fts0que.cc +++ b/storage/xtradb/fts/fts0que.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 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 @@ -3653,6 +3654,10 @@ fts_query_free( fts_doc_ids_free(query->deleted); } + if (query->intersection) { + fts_query_free_doc_ids(query, query->intersection); + } + if (query->doc_ids) { fts_query_free_doc_ids(query, query->doc_ids); } @@ -3677,8 +3682,6 @@ fts_query_free( rbt_free(query->word_freqs); } - ut_a(!query->intersection); - if (query->word_map) { rbt_free(query->word_map); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 062b8d14a27..9a1a387e1d7 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -5952,8 +5952,6 @@ innobase_match_index_columns( if (innodb_idx_fld >= innodb_idx_fld_end) { DBUG_RETURN(FALSE); } - - mtype = innodb_idx_fld->col->mtype; } if (col_type != mtype) { @@ -19421,7 +19419,7 @@ buffer_pool_load_now( const void* save) /*!< in: immediate result from check function */ { - if (*(my_bool*) save) { + if (*(my_bool*) save && !srv_read_only_mode) { buf_load_start(); } } @@ -19444,7 +19442,7 @@ buffer_pool_load_abort( const void* save) /*!< in: immediate result from check function */ { - if (*(my_bool*) save) { + if (*(my_bool*) save && !srv_read_only_mode) { buf_load_abort(); } } diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index d7e2c5e838d..976e5e57b60 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -237,34 +237,6 @@ innobase_need_rebuild( return(false); } - /* If alter table changes column name and adds a new - index, we need to check is this new index created - to new column name. This is because column name - changes are done normally after creating indexes. */ - if ((ha_alter_info->handler_flags - & Alter_inplace_info::ALTER_COLUMN_NAME) && - ((ha_alter_info->handler_flags - & Alter_inplace_info::ADD_INDEX) || - (ha_alter_info->handler_flags - & Alter_inplace_info::ADD_FOREIGN_KEY))) { - for (ulint i = 0; i < ha_alter_info->index_add_count; i++) { - const KEY* key = &ha_alter_info->key_info_buffer[ - ha_alter_info->index_add_buffer[i]]; - - for (ulint j = 0; j < key->user_defined_key_parts; j++) { - const KEY_PART_INFO* key_part = &(key->key_part[j]); - const Field* field = altered_table->field[key_part->fieldnr]; - - /* Field used on added index is renamed on - this same alter table. We need table - rebuild. */ - if (field && field->flags & FIELD_IS_RENAMED) { - return (true); - } - } - } - } - return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); } @@ -1551,38 +1523,49 @@ name_ok: return(0); } -/*******************************************************************//** -Create index field definition for key part */ +/** Create index field definition for key part +@param[in] new_clustered true if alter is generating a new clustered +index +@param[in] altered_table MySQL table that is being altered +@param[in] key_part MySQL key definition +@param[out] index_field index field defition for key_part */ static MY_ATTRIBUTE((nonnull(2,3))) void innobase_create_index_field_def( -/*============================*/ - const TABLE* altered_table, /*!< in: MySQL table that is - being altered, or NULL - if a new clustered index is - not being created */ - const KEY_PART_INFO* key_part, /*!< in: MySQL key definition */ - index_field_t* index_field, /*!< out: index field - definition for key_part */ - const Field** fields) /*!< in: MySQL table fields */ + bool new_clustered, + const TABLE* altered_table, + const KEY_PART_INFO* key_part, + index_field_t* index_field) { const Field* field; ibool is_unsigned; ulint col_type; + ulint innodb_fieldnr=0; DBUG_ENTER("innobase_create_index_field_def"); ut_ad(key_part); ut_ad(index_field); + ut_ad(altered_table); + + /* Virtual columns are not stored in InnoDB data dictionary, thus + if there is virtual columns we need to skip them to find the + correct field. */ + for(ulint i = 0; i < key_part->fieldnr; i++) { + const Field* table_field = altered_table->field[i]; + if (!table_field->stored_in_db) { + continue; + } + innodb_fieldnr++; + } - field = altered_table - ? altered_table->field[key_part->fieldnr] + field = new_clustered ? + altered_table->field[key_part->fieldnr] : key_part->field; - ut_a(field); - index_field->col_no = key_part->fieldnr; - index_field->col_name = altered_table ? field->field_name.str : fields[key_part->fieldnr]->field_name.str; + ut_a(field); + index_field->col_no = innodb_fieldnr; col_type = get_innobase_type_from_mysql_type(&is_unsigned, field); if (DATA_BLOB == col_type @@ -1616,10 +1599,8 @@ innobase_create_index_def( bool key_clustered, /*!< in: true if this is the new clustered index */ index_def_t* index, /*!< out: index definition */ - mem_heap_t* heap, /*!< in: heap where memory + mem_heap_t* heap) /*!< in: heap where memory is allocated */ - const Field** fields) /*!< in: MySQL table fields - */ { const KEY* key = &keys[key_number]; ulint i; @@ -1630,11 +1611,10 @@ innobase_create_index_def( DBUG_ENTER("innobase_create_index_def"); DBUG_ASSERT(!key_clustered || new_clustered); + ut_ad(altered_table); + index->fields = static_cast<index_field_t*>( mem_heap_alloc(heap, n_fields * sizeof *index->fields)); - - memset(index->fields, 0, n_fields * sizeof *index->fields); - index->ind_type = 0; index->key_number = key_number; index->n_fields = n_fields; @@ -1665,13 +1645,12 @@ innobase_create_index_def( index->ind_type |= DICT_FTS; } - if (!new_clustered) { - altered_table = NULL; - } - for (i = 0; i < n_fields; i++) { innobase_create_index_field_def( - altered_table, &key->key_part[i], &index->fields[i], fields); + new_clustered, + altered_table, + &key->key_part[i], + &index->fields[i]); } DBUG_VOID_RETURN; @@ -1997,7 +1976,7 @@ innobase_create_key_defs( /* Create the PRIMARY key index definition */ innobase_create_index_def( altered_table, key_info, primary_key_number, - TRUE, TRUE, indexdef++, heap, (const Field **)altered_table->field); + TRUE, TRUE, indexdef++, heap); created_clustered: n_add = 1; @@ -2009,7 +1988,7 @@ created_clustered: /* Copy the index definitions. */ innobase_create_index_def( altered_table, key_info, i, TRUE, FALSE, - indexdef, heap, (const Field **)altered_table->field); + indexdef, heap); if (indexdef->ind_type & DICT_FTS) { n_fts_add++; @@ -2054,7 +2033,7 @@ created_clustered: for (ulint i = 0; i < n_add; i++) { innobase_create_index_def( altered_table, key_info, add[i], FALSE, FALSE, - indexdef, heap, (const Field **)altered_table->field); + indexdef, heap); if (indexdef->ind_type & DICT_FTS) { n_fts_add++; @@ -2071,7 +2050,6 @@ created_clustered: index->fields = static_cast<index_field_t*>( mem_heap_alloc(heap, sizeof *index->fields)); - memset(index->fields, 0, sizeof *index->fields); index->n_fields = 1; index->fields->col_no = fts_doc_id_col; index->fields->prefix_len = 0; @@ -2161,7 +2139,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx /** mapping of old column numbers to new ones, or NULL */ const ulint* col_map; /** new column names, or NULL if nothing was renamed */ - const char** col_names; + const char** col_names; /** added AUTO_INCREMENT column position, or ULINT_UNDEFINED */ const ulint add_autoinc; /** default values of ADD COLUMN, or NULL */ @@ -3122,8 +3100,7 @@ prepare_inplace_alter_table_dict( for (ulint a = 0; a < ctx->num_to_add_index; a++) { ctx->add_index[a] = row_merge_create_index( - ctx->trx, ctx->new_table, - &index_defs[a], ctx->col_names); + ctx->trx, ctx->new_table, &index_defs[a]); add_key_nums[a] = index_defs[a].key_number; diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index ca2c76c31ad..94cd6f29558 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -6363,6 +6363,7 @@ i_s_sys_tables_fill_table_stats( } heap = mem_heap_create(1000); + rw_lock_s_lock(&dict_operation_lock); mutex_enter(&dict_sys->mutex); mtr_start(&mtr); @@ -6389,9 +6390,11 @@ i_s_sys_tables_fill_table_stats( err_msg); } + rw_lock_s_unlock(&dict_operation_lock); mem_heap_empty(heap); /* Get the next record */ + rw_lock_s_lock(&dict_operation_lock); mutex_enter(&dict_sys->mutex); mtr_start(&mtr); rec = dict_getnext_system(&pcur, &mtr); @@ -6399,6 +6402,7 @@ i_s_sys_tables_fill_table_stats( mtr_commit(&mtr); mutex_exit(&dict_sys->mutex); + rw_lock_s_unlock(&dict_operation_lock); mem_heap_free(heap); DBUG_RETURN(0); @@ -7690,8 +7694,6 @@ i_s_dict_fill_sys_tablespaces( { Field** fields; ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags); - ulint page_size = fsp_flags_get_page_size(flags); - ulint zip_size = fsp_flags_get_zip_size(flags); const char* file_format; const char* row_format; @@ -7708,13 +7710,11 @@ i_s_dict_fill_sys_tablespaces( fields = table_to_fill->field; - OK(fields[SYS_TABLESPACES_SPACE]->store( - static_cast<double>(space))); + OK(fields[SYS_TABLESPACES_SPACE]->store(space, true)); OK(field_store_string(fields[SYS_TABLESPACES_NAME], name)); - OK(fields[SYS_TABLESPACES_FLAGS]->store( - static_cast<double>(flags))); + OK(fields[SYS_TABLESPACES_FLAGS]->store(flags, true)); OK(field_store_string(fields[SYS_TABLESPACES_FILE_FORMAT], file_format)); @@ -7722,11 +7722,18 @@ i_s_dict_fill_sys_tablespaces( OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT], row_format)); - OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store( - static_cast<double>(page_size))); + ulint cflags = fsp_flags_is_valid(flags, space) + ? flags : fsp_flags_convert_from_101(flags); + if (cflags != ULINT_UNDEFINED) { + OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store( + fsp_flags_get_page_size(cflags), true)); - OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( - static_cast<double>(zip_size))); + OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store( + fsp_flags_get_zip_size(cflags), true)); + } else { + fields[SYS_TABLESPACES_PAGE_SIZE]->set_null(); + fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->set_null(); + } OK(schema_table_store_record(thd, table_to_fill)); diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index e872198d927..17741b324c9 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -4042,7 +4042,7 @@ ibuf_insert_to_index_page_low( (ulong) zip_size, (ulong) old_bits); fputs("InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", stderr); + " to https://jira.mariadb.org/\n", stderr); ut_ad(0); DBUG_RETURN(NULL); } @@ -4115,7 +4115,7 @@ dump: " Please run CHECK TABLE on\n" "InnoDB: your tables.\n" "InnoDB: Submit a detailed bug report to" - " http://bugs.mysql.com!\n", stderr); + " https://jira.mariadb.org/\n", stderr); DBUG_VOID_RETURN; } @@ -4291,7 +4291,7 @@ ibuf_set_del_mark( fprintf(stderr, "\nspace %u offset %u" " (%u records, index id %llu)\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org/\n", (unsigned) buf_block_get_space(block), (unsigned) buf_block_get_page_no(block), (unsigned) page_get_n_recs(page), @@ -4355,7 +4355,7 @@ ibuf_delete( fprintf(stderr, "\nspace %u offset %u" " (%u records, index id %llu)\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org/\n", (unsigned) buf_block_get_space(block), (unsigned) buf_block_get_page_no(block), (unsigned) page_get_n_recs(page), @@ -4426,7 +4426,7 @@ ibuf_restore_pos( } else { fprintf(stderr, "InnoDB: ERROR: Submit the output to" - " http://bugs.mysql.com\n" + " https://jira.mariadb.org/\n" "InnoDB: ibuf cursor restoration fails!\n" "InnoDB: ibuf record inserted to page %lu:%lu\n", (ulong) space, (ulong) page_no); @@ -4745,7 +4745,7 @@ ibuf_merge_or_delete_for_page( "InnoDB: to determine if they are corrupt" " after this.\n\n" "InnoDB: Please submit a detailed bug report" - " to http://bugs.mysql.com\n\n", + " to https://jira.mariadb.org/\n\n", (ulong) page_no, (ulong) fil_page_get_type(block->frame)); diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic index 8f5cee0fd5f..ff72f6ed20f 100644 --- a/storage/xtradb/include/data0type.ic +++ b/storage/xtradb/include/data0type.ic @@ -577,7 +577,7 @@ dtype_get_fixed_size_low( return(len); #endif /* !UNIV_HOTBACKUP */ /* Treat as variable-length. */ - /* Fall through */ + /* fall through */ case DATA_VARCHAR: case DATA_BINARY: case DATA_DECIMAL: diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index a43b04d9d1e..dda8f4d2714 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -619,17 +619,6 @@ dict_table_get_col_name( ulint col_nr) /*!< in: column number */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** -Returns a column's name. -@return column name. NOTE: not guaranteed to stay valid if table is -modified in any way (columns added, etc.). */ -UNIV_INTERN -const char* -dict_table_get_col_name_for_mysql( -/*==============================*/ - const dict_table_t* table, /*!< in: table */ - const char* col_name)/*!< in: MySQL table column name */ - __attribute__((nonnull, warn_unused_result)); -/**********************************************************************//** Prints a table data. */ UNIV_INTERN void diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h index 7aa7055640c..cd94956dc55 100644 --- a/storage/xtradb/include/fts0fts.h +++ b/storage/xtradb/include/fts0fts.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights reserved. +Copyright (c) 2016, 2017, 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 @@ -429,21 +429,6 @@ fts_update_next_doc_id( MY_ATTRIBUTE((nonnull(2))); /******************************************************************//** -Create a new document id . -@return DB_SUCCESS if all went well else error */ -UNIV_INTERN -dberr_t -fts_create_doc_id( -/*==============*/ - dict_table_t* table, /*!< in: row is of this - table. */ - dtuple_t* row, /*!< in/out: add doc id - value to this row. This is the - current row that is being - inserted. */ - mem_heap_t* heap) /*!< in: heap */ - MY_ATTRIBUTE((nonnull)); -/******************************************************************//** Create a new fts_doc_ids_t. @return new fts_doc_ids_t. */ UNIV_INTERN diff --git a/storage/xtradb/include/mtr0log.ic b/storage/xtradb/include/mtr0log.ic index d508d30fafe..8c891fac55b 100644 --- a/storage/xtradb/include/mtr0log.ic +++ b/storage/xtradb/include/mtr0log.ic @@ -216,7 +216,7 @@ mlog_write_initial_log_record_fast( "%d on page %lu of space %lu in the " "doublewrite buffer, continuing anyway.\n" "Please post a bug report to " - "bugs.mysql.com.\n", + "https://jira.mariadb.org/\n", type, offset, space); ut_ad(0); } diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h index 152a51dafc6..af21ef49cb7 100644 --- a/storage/xtradb/include/row0merge.h +++ b/storage/xtradb/include/row0merge.h @@ -108,7 +108,6 @@ struct index_field_t { ulint col_no; /*!< column offset */ ulint prefix_len; /*!< column prefix length, or 0 if indexing the whole column */ - const char* col_name; /*!< column name or NULL */ }; /** Definition of an index being created */ @@ -265,11 +264,7 @@ row_merge_create_index( /*===================*/ trx_t* trx, /*!< in/out: trx (sets error_state) */ dict_table_t* table, /*!< in: the index is on this table */ - const index_def_t* index_def, - /*!< in: the index definition */ - const char** col_names); - /*! in: column names if columns are - renamed or NULL */ + const index_def_t* index_def); /*!< in: the index definition */ /*********************************************************************//** Check if a transaction can use an index. @return TRUE if index can be used by the transaction else FALSE */ diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index ce51effbab0..8759cea9e6d 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -2478,7 +2478,7 @@ lock_rec_enqueue_waiting( dict_index_name_print(stderr, trx, index); fputs(".\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org/\n", stderr); ut_ad(0); } @@ -5226,7 +5226,7 @@ lock_table_enqueue_waiting( ut_print_name(stderr, trx, TRUE, table->name); fputs(".\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org/\n", stderr); ut_ad(0); } diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc index 33f8ec443dd..e8bae7427f4 100644 --- a/storage/xtradb/row/row0ins.cc +++ b/storage/xtradb/row/row0ins.cc @@ -1143,7 +1143,7 @@ row_ins_foreign_check_on_constraint( rec_print(stderr, clust_rec, clust_index); fputs("\n" "InnoDB: Submit a detailed bug report to" - " http://bugs.mysql.com\n", stderr); + " https://jira.mariadb.org/\n", stderr); ut_ad(0); err = DB_SUCCESS; diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc index 4eb6534161d..22ad34e5e35 100644 --- a/storage/xtradb/row/row0merge.cc +++ b/storage/xtradb/row/row0merge.cc @@ -3736,11 +3736,7 @@ row_merge_create_index( /*===================*/ trx_t* trx, /*!< in/out: trx (sets error_state) */ dict_table_t* table, /*!< in: the index is on this table */ - const index_def_t* index_def, - /*!< in: the index definition */ - const char** col_names) - /*! in: column names if columns are - renamed or NULL */ + const index_def_t* index_def) /*!< in: the index definition */ { dict_index_t* index; dberr_t err; @@ -3760,28 +3756,10 @@ row_merge_create_index( for (i = 0; i < n_fields; i++) { index_field_t* ifield = &index_def->fields[i]; - const char * col_name; - - /* - Alter table renaming a column and then adding a index - to this new name e.g ALTER TABLE t - CHANGE COLUMN b c INT NOT NULL, ADD UNIQUE INDEX (c); - requires additional check as column names are not yet - changed when new index definitions are created. Table's - new column names are on a array of column name pointers - if any of the column names are changed. */ - - if (col_names && col_names[i]) { - col_name = col_names[i]; - } else { - col_name = ifield->col_name ? - dict_table_get_col_name_for_mysql(table, ifield->col_name) : - dict_table_get_col_name(table, ifield->col_no); - } dict_mem_index_add_field( index, - col_name, + dict_table_get_col_name(table, ifield->col_no), ifield->prefix_len); } diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 0079fc79a0e..67eb1d7de94 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -569,11 +569,33 @@ next_column: /* If there is a FTS doc id column and it is not user supplied ( generated by server) then assign it a new doc id. */ - if (prebuilt->table->fts) { + if (!prebuilt->table->fts) { + return; + } + + ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED); - ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED); + doc_id_t doc_id; - fts_create_doc_id(prebuilt->table, row, prebuilt->heap); + if (!DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_FTS_HAS_DOC_ID)) { + if (prebuilt->table->fts->cache->first_doc_id + == FTS_NULL_DOC_ID) { + fts_get_next_doc_id(prebuilt->table, &doc_id); + } + return; + } + + dfield_t* fts_doc_id = dtuple_get_nth_field( + row, prebuilt->table->fts->doc_col); + + if (fts_get_next_doc_id(prebuilt->table, &doc_id) == DB_SUCCESS) { + ut_a(doc_id != FTS_NULL_DOC_ID); + ut_ad(sizeof(doc_id) == fts_doc_id->type.len); + dfield_set_data(fts_doc_id, prebuilt->ins_upd_rec_buff + + prebuilt->mysql_row_len, 8); + fts_write_doc_id(fts_doc_id->data, doc_id); + } else { + dfield_set_null(fts_doc_id); } } @@ -1048,7 +1070,10 @@ row_get_prebuilt_insert_row( prebuilt->ins_upd_rec_buff = static_cast<byte*>( mem_heap_alloc( prebuilt->heap, - prebuilt->mysql_row_len)); + DICT_TF2_FLAG_IS_SET(prebuilt->table, + DICT_TF2_FTS_HAS_DOC_ID) + ? prebuilt->mysql_row_len + 8/* FTS_DOC_ID */ + : prebuilt->mysql_row_len)); } dtuple_t* row; diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index d96d6d37844..6131129d0a6 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -2737,6 +2737,7 @@ row_sel_field_store_in_mysql_format_func( case DATA_SYS: /* These column types should never be shipped to MySQL. */ ut_ad(0); + /* fall through */ case DATA_CHAR: case DATA_FIXBINARY: @@ -3110,7 +3111,7 @@ row_sel_get_clust_rec_for_mysql( trx_print(stderr, trx, 600); fputs("\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", stderr); + " to https://jira.mariadb.org/\n", stderr); ut_ad(0); } diff --git a/storage/xtradb/row/row0umod.cc b/storage/xtradb/row/row0umod.cc index f23d7e9dc68..2e5cc14bfe1 100644 --- a/storage/xtradb/row/row0umod.cc +++ b/storage/xtradb/row/row0umod.cc @@ -653,7 +653,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( trx_print(stderr, trx, 0); fputs("\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", stderr); + " to https://jira.mariadb.org/\n", stderr); ib_logf(IB_LOG_LEVEL_WARN, "record in index %s was not found" diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc index f7aee8643ef..7c6f51f0dd1 100644 --- a/storage/xtradb/row/row0upd.cc +++ b/storage/xtradb/row/row0upd.cc @@ -1958,7 +1958,7 @@ row_upd_sec_index_entry( trx_print(stderr, trx, 0); fputs("\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", stderr); + " to https://jira.mariadb.org/\n", stderr); ut_ad(0); break; case ROW_FOUND: diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 9694e16ef08..ff3581b1c50 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -2356,7 +2356,7 @@ loop: " was greater\n" "InnoDB: than the new log sequence number " LSN_PF "!\n" "InnoDB: Please submit a bug report" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org\n", old_lsn, new_lsn); ut_ad(0); } diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc index df4a3217820..ff82bb2ad4e 100644 --- a/storage/xtradb/trx/trx0purge.cc +++ b/storage/xtradb/trx/trx0purge.cc @@ -603,7 +603,7 @@ trx_purge_rseg_get_next_history_log( "InnoDB: but its length is still" " reported as %lu! Make a detailed bug\n" "InnoDB: report, and submit it" - " to http://bugs.mysql.com\n", + " to https://jira.mariadb.org/\n", (ulong) trx_sys->rseg_history_len); ut_ad(0); } diff --git a/storage/xtradb/trx/trx0rec.cc b/storage/xtradb/trx/trx0rec.cc index 8c0904dd57b..4e0ba825ed2 100644 --- a/storage/xtradb/trx/trx0rec.cc +++ b/storage/xtradb/trx/trx0rec.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 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 @@ -771,7 +772,25 @@ trx_undo_page_report_modify( const dict_col_t* col = dict_table_get_nth_col(table, col_no); - if (col->ord_part) { + if (!col->ord_part) { + continue; + } + + if (update) { + for (i = 0; i < update->n_fields; i++) { + const dict_field_t* f + = dict_index_get_nth_field( + index, + upd_get_nth_field( + update, i) + ->field_no); + if (f->col == col) { + goto already_logged; + } + } + } + + if (TRUE) { ulint pos; /* Write field number to undo log */ @@ -822,6 +841,9 @@ trx_undo_page_report_modify( ptr += flen; } } + +already_logged: + continue; } mach_write_to_2(old_ptr, ptr - old_ptr); @@ -1000,7 +1022,7 @@ trx_undo_update_rec_get_update( fprintf(stderr, "\n" "InnoDB: but index has only %lu fields\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n" + " to https://jira.mariadb.org/\n" "InnoDB: Run also CHECK TABLE ", (ulong) dict_index_get_n_fields(index)); ut_print_name(stderr, trx, TRUE, index->table_name); diff --git a/storage/xtradb/ut/ut0dbg.cc b/storage/xtradb/ut/ut0dbg.cc index a1cad144da4..a0bd82b385a 100644 --- a/storage/xtradb/ut/ut0dbg.cc +++ b/storage/xtradb/ut/ut0dbg.cc @@ -63,7 +63,7 @@ ut_dbg_assertion_failed( fputs("InnoDB: We intentionally generate a memory trap.\n" "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com.\n" + " to https://jira.mariadb.org/\n" "InnoDB: If you get repeated assertion failures" " or crashes, even\n" "InnoDB: immediately after the mysqld startup, there may be\n" |