summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/fts/fts0fts.cc49
-rw-r--r--storage/innobase/include/fts0fts.h23
-rw-r--r--storage/innobase/row/row0merge.cc16
3 files changed, 35 insertions, 53 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index acab4791d8b..c9610d29a55 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -243,18 +243,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
@@ -2553,27 +2541,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
@@ -2731,17 +2698,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/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 7a7c13a5384..326734c84c9 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.
@@ -976,4 +965,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 6abfa848658..d6ace914c23 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -2862,7 +2862,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);
}
}