Traverse an index in the leaf page block list order and send records to adapter.
More...
#include <row0pread-adapter.h>
Traverse an index in the leaf page block list order and send records to adapter.
◆ End_fn
◆ Init_fn
◆ Load_fn
◆ Parallel_reader_adapter()
| Parallel_reader_adapter::Parallel_reader_adapter |
( |
size_t |
max_threads, |
|
|
ulint |
rowlen, |
|
|
bool |
use_reserved_threads = false |
|
) |
| |
Constructor.
- Parameters
-
| [in] | max_threads | Maximum threads to use for all scan contexts. |
| [in] | rowlen | Row length. |
| [in] | use_reserved_threads | Whether to use reserved parallel-read slots. |
◆ ~Parallel_reader_adapter()
| Parallel_reader_adapter::~Parallel_reader_adapter |
( |
| ) |
|
|
default |
◆ add_scan()
Add scan context.
- Parameters
-
| [in] | trx | Transaction used for parallel read. |
| [in] | config | (Cluster) Index scan configuration. |
| [in] | f | Callback function. |
- Returns
- error.
◆ end()
Each parallel reader thread's end function.
- Parameters
-
| [in] | reader_thread_ctx | context info related to the current thread |
- Returns
- DB_SUCCESS or error code.
◆ init()
Each parallel reader thread's init function.
- Parameters
-
| [in] | reader_thread_ctx | context info related to the current thread |
| [in] | prebuilt | prebuilt cache |
- Returns
- DB_SUCCESS or error code.
There are data members in row_prebuilt_t that cannot be accessed in multi-threaded mode e.g., blob_heap.
row_prebuilt_t is designed for single threaded access and to share it among threads is not recommended unless "you know what you are doing". This is very fragile code as it stands.
To solve the blob heap issue in prebuilt we request parallel reader thread to use blob heap per thread and we pass this blob heap to the InnoDB to MySQL row format conversion function.
◆ is_buffer_full()
| bool Parallel_reader_adapter::is_buffer_full |
( |
Thread_ctx * |
ctx | ) |
const |
|
inlineprivate |
Check if the buffer is full.
- Parameters
-
| [in] | ctx | adapter related thread context information. |
- Returns
- true if the buffer is full.
◆ max_threads()
| size_t Parallel_reader_adapter::max_threads |
( |
| ) |
const |
|
inline |
- Returns
- the number of global parallel-read slots reserved.
◆ pending()
| size_t Parallel_reader_adapter::pending |
( |
Thread_ctx * |
ctx | ) |
const |
|
inlineprivate |
Get the number of rows buffered but not sent.
- Parameters
-
| [in] | ctx | adapter related thread context information. |
- Returns
- number of buffered items.
◆ process_rows()
Convert the record in InnoDB format to MySQL format and send them.
- Parameters
-
| [in] | reader_ctx | Parallel read context. |
- Returns
- error code
◆ run()
Run the parallel scan.
- Parameters
-
| [in] | thread_contexts | Context for each of the spawned threads |
| [in] | init_fn | Callback called by each parallel load thread at the beginning of the parallel load. |
| [in] | load_fn | Callback called by each parallel load thread when processing of rows is required. |
| [in] | end_fn | Callback called by each parallel load thread when processing of rows has ended. |
- Returns
- DB_SUCCESS or error code.
◆ send_batch()
Send a batch of records.
- Parameters
-
| [in] | reader_thread_ctx | reader threads related thread context info |
| [in] | partition_id | partition ID of the index the record belongs to |
| [in] | n_recs | Number of records to send. |
- Returns
- DB_SUCCESS or error code.
◆ set()
Set up the query processing state cache.
- Parameters
-
| [in] | prebuilt | The prebuilt cache for the query. |
◆ ADAPTER_SEND_BUFFER_SIZE
| constexpr size_t Parallel_reader_adapter::ADAPTER_SEND_BUFFER_SIZE = 2 * 1024 * 1024 |
|
staticconstexprprivate |
Size of the buffer used to store InnoDB records and sent to the adapter.
◆ m_batch_size
| uint64_t Parallel_reader_adapter::m_batch_size {} |
|
private |
Number of records to be sent across to the caller in a batch.
◆ m_end_fn
| End_fn Parallel_reader_adapter::m_end_fn {} |
|
private |
Callback called by each parallel load thread when processing of rows has ended for the scan.
◆ m_init_fn
| Init_fn Parallel_reader_adapter::m_init_fn {} |
|
private |
Callback called by each parallel load thread at the beginning of the parallel load for the scan.
◆ m_load_fn
| Load_fn Parallel_reader_adapter::m_load_fn {} |
|
private |
Callback called by each parallel load thread when processing of rows is required for the scan.
◆ m_mysql_row
| MySQL_row Parallel_reader_adapter::m_mysql_row {} |
|
private |
Row meta data per scan context.
◆ m_parallel_reader
◆ m_prebuilt
Prebuilt to use for conversion to MySQL row format.
NOTE: We are sharing this because we don't convert BLOBs yet. There are data members in row_prebuilt_t that cannot be accessed in multi-threaded mode e.g., blob_heap.
row_prebuilt_t is designed for single threaded access and to share it among threads is not recommended unless "you know what you are doing". This is very fragile code as it stands.
To solve the blob heap issue in prebuilt we use per thread m_blob_heaps. Pass the blob heap to the InnoDB to MySQL row format conversion function.
◆ m_thread_ctxs
| void** Parallel_reader_adapter::m_thread_ctxs {} |
|
private |
Adapter context for each of the spawned threads.
We don't know the type of the context it's passed to us as a void *.
The documentation for this class was generated from the following files: