/** Open FTS INDEX_[1..6] table for the given auxiliary index.
@return DB_SUCCESS or error code */
dberr_t open_aux_table(uint8_t aux_index) noexcept;
/** Open a deletion table (DELETED, BEING_DELETED, etc.). @paramtable_typedeletiontabletype
@return DB_SUCCESS or error code */
dberr_t open_deletion_table(FTSDeletionTable table_type) noexcept;
/** Helper to convert deletion table enum to string name */ staticconstchar* get_deletion_table_name(
FTSDeletionTable table_type) noexcept;
/** Table lock operation */
/** Acquire a lock on an opened INDEX_[1..6] table. RetrieslockwaitonceviaQueryExecutor.
@return DB_SUCCESS or error code */
dberr_t lock_aux_tables(uint8_t aux_index, lock_mode mode) noexcept;
/** Acquire a lock on an opened common FTS table. RetrieslockwaitonceviaQueryExecutor.
@return DB_SUCCESS or error code */
dberr_t lock_common_tables(uint8_t index, lock_mode mode) noexcept;
/** Create search tuple for a word @paramtabletupletobecreatedforthistable @paramwordwordtocreatetuplefor @paramheapmemoryheap
@return search tuple or nullptr if word is empty */
dtuple_t* create_word_search_tuple(
dict_table_t *table, const fts_string_t *word,
mem_heap_t *heap) noexcept; public: /** Open all auxiliary tables
@return DB_SUCCESS or error code */
dberr_t open_all_aux_tables(dict_index_t *fts_index) noexcept;
/** Open all deletion tables (DELETED, BEING_DELETED, etc.)
@return DB_SUCCESS or error code */
dberr_t open_all_deletion_tables() noexcept;
/** Open FTS CONFIG table for configuration operations.
@return DB_SUCCESS or error code */
dberr_t open_config_table() noexcept;
/** Create executor bound to trx and FTS table/index. @paramtrxtransaction
@param fts_table FTS table */
FTSQueryExecutor(trx_t *trx, const dict_table_t *fts_table);
/** Release any opened table handles and executor resources. */
~FTSQueryExecutor();
/** High level DML operation on FTS TABLE */
/** Insert a row into auxiliary INDEX_[1..6] table. Expects(word,first_doc_id,trx_id,roll_ptr,last_doc_id, doc_count,ilist). @paramaux_indexauxiliarytableindex @paramaux_datadatatobeinserted
@return DB_SUCCESS or error code */
dberr_t insert_aux_record(uint8_t aux_index, const fts_aux_data_t *aux_data) noexcept;
/** Insert a single doc_id into a common table (e.g. DELETED, ...) @paramtbl_namecommontablename @paramdoc_iddocumentidtobeinserted
@return DB_SUCCESS or error code */
dberr_t insert_common_record(constchar *tbl_name, doc_id_t doc_id) noexcept;
/** Insert a key/value into CONFIG table. @paramkeykeyfortheconfigtable @paramvaluevalueforthekey
@return DB_SUCCESS or error code */
dberr_t insert_config_record(constchar *key, constchar *value) noexcept;
/** Delete one word row from INDEX_[1..6] by (word). @paramaux_indexauxiliarytableindex @paramaux_dataauxiliarytablerecord
@return DB_SUCCESS or error code */
dberr_t delete_aux_record(uint8_t aux_index, const fts_aux_data_t *aux_data) noexcept;
/** Delete a single doc_id row from a common table by (doc_id). @paramtbl_namecommontablename @paramdoc_iddocumentidtobedeleted
@return DB_SUCCESS or error code */
dberr_t delete_common_record(constchar *tbl_name, doc_id_t doc_id) noexcept;
/** Delete all rows from a common table.
@return DB_SUCCESS or error code */
dberr_t delete_all_common_records(constchar *tbl_name) noexcept;
/** Delete a key from CONFIG table by (key).
@return DB_SUCCESS or error code */
dberr_t delete_config_record(constchar *key) noexcept;
/** Upsert a key/value in CONFIG table. Replaces'value'ifkeyexists,insertsotherwise.
@return DB_SUCCESS or error code */
dberr_t update_config_record(constchar *key, constchar *value) noexcept;
/** Select-for-update CONFIG row by 'key'
@return DB_SUCCESS or error code */
dberr_t read_config_with_lock( constchar *key, RecordCallback &callback) noexcept;
/** Read all rows from given COMMON table
Callback is invoked for processing the record */
dberr_t read_all_common(constchar *tbl_name,
RecordCallback &callback) noexcept;
mem_heap_t *get_heap() const noexcept
{ return m_executor.get_heap(); }
/** Callback class for reading common table records
(DELETED, BEING_DELETED, DELETED_CACHE, BEING_DELETED_CACHE) */ class CommonTableReader : public RecordCallback
{ private: /** Heap owning m_doc_ids when this reader allocates
its own vector; */
mem_heap_t *m_heap; /** Destination for extracted doc_ids */
ib_vector_t *m_doc_ids;
/** Build the row consumer shared by both constructors.
@return processor appending each extracted doc_id to m_doc_ids */
RecordProcessor make_processor();
public: /** Accumulate doc_ids into the vector */
CommonTableReader();
/** Push doc_ids directly into a caller-supplied ib_vector
@param dest destination vector to append doc_ids to */ explicit CommonTableReader(ib_vector_t *dest);
~CommonTableReader();
/** @return number of doc_ids collected so far */
ulint size() const { return ib_vector_size(m_doc_ids); }
/** @param n element index
@return the n'th collected doc_id */
doc_id_t get(ulint n) const
{ return *static_cast<const doc_id_t*>(ib_vector_get_const(m_doc_ids, n)); }
/** Discard collected doc_ids so the reader can be reused. */ void clear() { ib_vector_reset(m_doc_ids); }
/** Fast common table field extraction for known table format. Structure:(doc_idBIGINTUNSIGNED)-alwaysknownschema @paramrecrecordtoextractfrom @paramindexcommontableindex @paramdoc_idoutputdoc_idvalue
@return true if extraction successful */ staticbool extract_common_fields( const rec_t *rec, const dict_index_t *index,
doc_id_t *doc_id);
};
/** Callback class for reading FTS config table records */ class ConfigReader : public RecordCallback
{ public:
span<constchar> value_span;
ConfigReader();
/** Direct config key comparison - compares first field with tuple value. @paramsearch_tuplesearchtuplecontainingtargetkey @paramrecrecordtocompare @paramindexconfigtableindex
@return comparison action */ static RecordCompareAction compare_config_key( const dtuple_t *search_tuple, const rec_t *rec, const dict_index_t *index, const rec_offs *offsets);
};
/** Type alias for FTS record processor function */ using FTSRecordProcessor= std::function<
dberr_t(const rec_t*, const dict_index_t*, const rec_offs*, void*)>;
/** Callback class for reading FTS auxiliary index table records */ class AuxRecordReader : public RecordCallback
{ private: void *user_arg;
ulint *total_memory;
AuxCompareMode compare_mode; /* Optional shared heap. When it is allocated, every fts_word_t allocatedviadefault_word_processorstoresitstext,heap_alloc, nodesvectorinthiswordsheapinsteadofprivatemem_heap_t
per word. It is used for information schema read query */
mem_heap_t* m_words_heap= nullptr;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.