diff options
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 3 | ||||
-rw-r--r-- | storage/innobase/fts/fts0fts.cc | 49 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 67 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.h | 6 | ||||
-rw-r--r-- | storage/innobase/include/fts0fts.h | 23 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 16 |
6 files changed, 38 insertions, 126 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 667f3d6bd37..abb633b51b4 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -3565,6 +3565,7 @@ fail_err: << ib::hex(thr ? thr->graph->trx->id : 0) << ' ' << rec_printer(entry).str()); DBUG_EXECUTE_IF("do_page_reorganize", + if (n_recs) btr_page_reorganize(page_cursor, index, mtr);); /* Now, try the insert */ diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 0efaf794af2..fbd7dda3787 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -231,18 +231,6 @@ fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ doc_id_t doc_id); /*!< in: doc id */ -/******************************************************************//** -Update the last document id. This function could create a new -transaction to update the last document id. -@return DB_SUCCESS if OK */ -static -dberr_t -fts_update_sync_doc_id( -/*===================*/ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id, /*!< in: last document id */ - trx_t* trx) /*!< in: update trx, or NULL */ - MY_ATTRIBUTE((nonnull(1))); /** Tokenize a document. @param[in,out] doc document to tokenize @@ -2541,27 +2529,6 @@ fts_get_max_cache_size( #endif /*********************************************************************//** -Update the next and last Doc ID in the CONFIG table to be the input -"doc_id" value (+ 1). We would do so after each FTS index build or -table truncate */ -void -fts_update_next_doc_id( -/*===================*/ - trx_t* trx, /*!< in/out: transaction */ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id) /*!< in: DOC ID to set */ -{ - table->fts->cache->synced_doc_id = doc_id; - table->fts->cache->next_doc_id = doc_id + 1; - - table->fts->cache->first_doc_id = table->fts->cache->next_doc_id; - - fts_update_sync_doc_id( - table, table->fts->cache->synced_doc_id, trx); - -} - -/*********************************************************************//** Get the next available document id. @return DB_SUCCESS if OK */ dberr_t @@ -2719,17 +2686,17 @@ func_exit: return(error); } -/*********************************************************************//** -Update the last document id. This function could create a new +/** Update the last document id. This function could create a new transaction to update the last document id. -@return DB_SUCCESS if OK */ -static +@param table table to be updated +@param doc_id last document id +@param trx update trx or null +@retval DB_SUCCESS if OK */ dberr_t fts_update_sync_doc_id( -/*===================*/ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id, /*!< in: last document id */ - trx_t* trx) /*!< in: update trx, or NULL */ + const dict_table_t* table, + doc_id_t doc_id, + trx_t* trx) { byte id[FTS_MAX_ID_LEN]; pars_info_t* info; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 07076f0660c..75ad5e55607 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2678,63 +2678,6 @@ overflow: return(~(ulonglong) 0); } -/********************************************************************//** -Reset the autoinc value in the table. -@return DB_SUCCESS if all went well else error code */ -UNIV_INTERN -dberr_t -ha_innobase::innobase_reset_autoinc( -/*================================*/ - ulonglong autoinc) /*!< in: value to store */ -{ - dberr_t error; - - error = innobase_lock_autoinc(); - - if (error == DB_SUCCESS) { - - dict_table_autoinc_initialize(m_prebuilt->table, autoinc); - m_prebuilt->table->autoinc_mutex.unlock(); - } - - return(error); -} - -/*******************************************************************//** -Reset the auto-increment counter to the given value, i.e. the next row -inserted will get the given value. This is called e.g. after TRUNCATE -is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is -returned by storage engines that don't support this operation. -@return 0 or error code */ -UNIV_INTERN -int -ha_innobase::reset_auto_increment( -/*==============================*/ - ulonglong value) /*!< in: new value for table autoinc */ -{ - DBUG_ENTER("ha_innobase::reset_auto_increment"); - - dberr_t error; - - update_thd(ha_thd()); - - error = row_lock_table_autoinc_for_mysql(m_prebuilt); - - if (error != DB_SUCCESS) { - DBUG_RETURN(convert_error_code_to_mysql( - error, m_prebuilt->table->flags, m_user_thd)); - } - - /* The next value can never be 0. */ - if (value == 0) { - value = 1; - } - - innobase_reset_autoinc(value); - - DBUG_RETURN(0); -} - /*********************************************************************//** Initializes some fields in an InnoDB transaction object. */ static @@ -9103,16 +9046,6 @@ ha_innobase::delete_row( error, m_prebuilt->table->flags, m_user_thd)); } -/** Delete all rows from the table. -@return error number or 0 */ - -int -ha_innobase::delete_all_rows() -{ - DBUG_ENTER("ha_innobase::delete_all_rows"); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} - /**********************************************************************//** Removes a new lock set on a row, if it was not read optimistically. This can be called after a row has been read in the processing of an UPDATE or a DELETE diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index d27ff67b64c..c522ae753a6 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -105,8 +105,6 @@ public: double read_time(uint index, uint ranges, ha_rows rows) override; - int delete_all_rows() override; - int write_row(const uchar * buf) override; int update_row(const uchar * old_data, const uchar * new_data) override; @@ -239,7 +237,6 @@ public: ulonglong nb_desired_values, ulonglong* first_value, ulonglong* nb_reserved_values) override; - int reset_auto_increment(ulonglong value) override; bool get_error_message(int error, String *buf) override; @@ -449,7 +446,6 @@ protected: dberr_t innobase_lock_autoinc(); ulonglong innobase_peek_autoinc(); dberr_t innobase_set_max_autoinc(ulonglong auto_inc); - dberr_t innobase_reset_autoinc(ulonglong auto_inc); /** Resets a query execution 'template'. @see build_template() */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 09f47c071da..d3cfa5b23df 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -402,17 +402,6 @@ fts_get_next_doc_id( /*================*/ const dict_table_t* table, /*!< in: table */ doc_id_t* doc_id);/*!< out: new document id */ -/*********************************************************************//** -Update the next and last Doc ID in the CONFIG table to be the input -"doc_id" value (+ 1). We would do so after each FTS index build or -table truncate */ -void -fts_update_next_doc_id( -/*===================*/ - trx_t* trx, /*!< in/out: transaction */ - const dict_table_t* table, /*!< in: table */ - doc_id_t doc_id) /*!< in: DOC ID to set */ - MY_ATTRIBUTE((nonnull(2))); /******************************************************************//** Create a new fts_doc_ids_t. @@ -964,4 +953,16 @@ bool fts_check_aux_table(const char *name, table_id_t *table_id, index_id_t *index_id); +/** Update the last document id. This function could create a new +transaction to update the last document id. +@param table table to be updated +@param doc_id last document id +@param trx update trx or null +@retval DB_SUCCESS if OK */ +dberr_t +fts_update_sync_doc_id(const dict_table_t *table, + doc_id_t doc_id, + trx_t *trx) +MY_ATTRIBUTE((nonnull(1))); + #endif /*!< fts0fts.h */ diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index a81e47edaf5..008bea1a95c 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2861,7 +2861,21 @@ wait_again: err = fts_sync_table(const_cast<dict_table_t*>(new_table)); if (err == DB_SUCCESS) { - fts_update_next_doc_id(NULL, new_table, max_doc_id); + new_table->fts->cache->synced_doc_id = max_doc_id; + + /* Update the max value as next FTS_DOC_ID */ + if (max_doc_id >= new_table->fts->cache->next_doc_id) { + new_table->fts->cache->next_doc_id = + max_doc_id + 1; + } + + new_table->fts->cache->first_doc_id = + new_table->fts->cache->next_doc_id; + + err= fts_update_sync_doc_id( + new_table, + new_table->fts->cache->synced_doc_id, + NULL); } } |