MySQL 9.0.0
Source Code Documentation
Hash_slave_rows Class Reference

#include <rpl_utility.h>

Public Member Functions

HASH_ROW_ENTRYmake_entry ()
 Allocates an empty entry to be added to the hash table. More...
 
HASH_ROW_ENTRYmake_entry (const uchar *bi_start, const uchar *bi_ends)
 Allocates an entry to be added to the hash table. More...
 
bool put (TABLE *table, MY_BITMAP *cols, HASH_ROW_ENTRY *entry)
 Puts data into the hash table. More...
 
HASH_ROW_ENTRYget (TABLE *table, MY_BITMAP *cols)
 Gets the entry, from the hash table, that matches the data in table->record[0] and signaled using cols. More...
 
bool next (HASH_ROW_ENTRY **entry)
 Gets the entry that stands next to the one pointed to by entry. More...
 
bool del (HASH_ROW_ENTRY *entry)
 Deletes the entry pointed by entry. More...
 
bool init (void)
 Initializes the hash table. More...
 
bool deinit (void)
 De-initializes the hash table. More...
 
bool is_empty (void)
 Checks if the hash table is empty or not. More...
 
int size ()
 Returns the number of entries in the hash table. More...
 

Private Member Functions

uint make_hash_key (TABLE *table, MY_BITMAP *cols)
 Auxiliary and internal method used to create an hash key, based on the data in table->record[0] buffer and signaled as used in cols. More...
 

Private Attributes

malloc_unordered_multimap< uint, std::unique_ptr< HASH_ROW_ENTRY, hash_slave_rows_free_entry > > m_hash {key_memory_HASH_ROW_ENTRY}
 The hashtable itself. More...
 

Member Function Documentation

◆ deinit()

bool Hash_slave_rows::deinit ( void  )

De-initializes the hash table.

Returns
true if something went wrong, false otherwise.

◆ del()

bool Hash_slave_rows::del ( HASH_ROW_ENTRY entry)

Deletes the entry pointed by entry.

It also frees memory used holding entry contents. This is the way to release memory used for entry, freeing it explicitly with my_free will cause undefined behavior.

Parameters
entryPointer to the entry to be deleted.
Returns
true if something went wrong, false otherwise.

◆ get()

HASH_ROW_ENTRY * Hash_slave_rows::get ( TABLE table,
MY_BITMAP cols 
)

Gets the entry, from the hash table, that matches the data in table->record[0] and signaled using cols.

Parameters
tableThe table holding the buffer containing data used to make the entry lookup.
colsBitmap signaling which columns, from table->record[0], should be used.
Returns
a pointer that will hold a reference to the entry found. If the entry is not found then NULL shall be returned.

Save the search state in case we need to go through entries for the given key.

◆ init()

bool Hash_slave_rows::init ( void  )

Initializes the hash table.

Hashing commodity structures and functions.

Returns
true if something went wrong, false otherwise.

◆ is_empty()

bool Hash_slave_rows::is_empty ( void  )

Checks if the hash table is empty or not.

Returns
true if the hash table has zero entries, false otherwise.

◆ make_entry() [1/2]

HASH_ROW_ENTRY * Hash_slave_rows::make_entry ( )

Allocates an empty entry to be added to the hash table.

It should be called before calling member function put.

Returns
NULL if a problem occurred, a valid pointer otherwise.

◆ make_entry() [2/2]

HASH_ROW_ENTRY * Hash_slave_rows::make_entry ( const uchar bi_start,
const uchar bi_ends 
)

Allocates an entry to be added to the hash table.

It should be called before calling member function put.

Parameters
bi_startthe position to where in the rows buffer the before image begins.
bi_endsthe position to where in the rows buffer the before image ends.
Returns
NULL if a problem occurred, a valid pointer otherwise.

Filling in the preamble.

Filling in the positions.

Filling in the entry

◆ make_hash_key()

uint Hash_slave_rows::make_hash_key ( TABLE table,
MY_BITMAP cols 
)
private

Auxiliary and internal method used to create an hash key, based on the data in table->record[0] buffer and signaled as used in cols.

Parameters
tableThe table that is being scanned
colsThe read_set bitmap signaling which columns are used.
Returns
the hash key created.

◆ next()

bool Hash_slave_rows::next ( HASH_ROW_ENTRY **  entry)

Gets the entry that stands next to the one pointed to by entry.

Before calling this member function, the entry that one uses as parameter must have: 1. been obtained through get() or next() invocations; and 2. must have not been used before in a next() operation.

Parameters
[in,out]entrycontains a pointer to an entry that we can use to search for another adjacent entry (ie, that shares the same key).
Returns
true if something went wrong, false otherwise. In the case that this entry was already used in a next() operation this member function returns true and does not update the pointer.

Save the search state for next iteration (if any).

◆ put()

bool Hash_slave_rows::put ( TABLE table,
MY_BITMAP cols,
HASH_ROW_ENTRY entry 
)

Puts data into the hash table.

It calculates the key taking the data on TABLE::record as the input for hash computation.

Parameters
tableThe table holding the buffer used to calculate the key, ie, table->record[0].
colsThe read_set bitmap signaling which columns are used.
entryThe entry with the values to store.
Returns
true if something went wrong, false otherwise.

Skip blobs and BIT fields from key calculation. Handle X bits. Handle nulled fields. Handled fields not signaled.

◆ size()

int Hash_slave_rows::size ( )

Returns the number of entries in the hash table.

Returns
the number of entries in the hash table.

Member Data Documentation

◆ m_hash

malloc_unordered_multimap< uint, std::unique_ptr<HASH_ROW_ENTRY, hash_slave_rows_free_entry> > Hash_slave_rows::m_hash {key_memory_HASH_ROW_ENTRY}
private

The hashtable itself.


The documentation for this class was generated from the following files: