MySQL 9.1.0
Source Code Documentation
SimulatedAIOHandler Class Reference

Simulated AIO handler for reaping IO requests. More...

Public Member Functions

 SimulatedAIOHandler (AIO *array, ulint segment)
 Constructor. More...
 
 ~SimulatedAIOHandler ()
 Destructor. More...
 
void init (ulint n_slots)
 Reset the state of the handler. More...
 
Slotcheck_completed (ulint *n_reserved)
 Check if there is a slot for which the i/o has already been done. More...
 
bool select ()
 If there are at least 2 seconds old requests, then pick the oldest one to prevent starvation. More...
 
void merge ()
 Check if there are several consecutive blocks to read or write. More...
 
ulint allocate_buffer ()
 We have now collected n_consecutive I/O requests in the array; allocate a single buffer which can hold all data, and perform the I/O. More...
 
void copy_to_buffer (ulint len)
 We have to compress the individual pages and punch holes in them on a page by page basis when writing to tables that can be compressed at the IO level. More...
 
void io ()
 Do the I/O with ordinary, synchronous i/o functions: More...
 
void io_complete ()
 Do the decompression of the pages read in. More...
 
void done ()
 Mark the i/os done in slots. More...
 
Slotfirst_slot ()
 
ulint check_pending (ulint global_segment, os_event_t event)
 Wait for I/O requests. More...
 

Private Types

typedef std::vector< Slot * > slots_t
 

Private Member Functions

void read (Slot *slot)
 Do the file read. More...
 
void write (Slot *slot)
 Do the file write. More...
 
bool adjacent (const Slot *s1, const Slot *s2) const
 
bool merge_adjacent (Slot *&current)
 
bool select_lowest_offset ()
 There were no old requests. More...
 
void select_if_older (Slot *slot)
 Select the slot if it is older than the current oldest slot. More...
 
bool select_oldest ()
 Select th oldest slot in the array. More...
 

Private Attributes

std::chrono::steady_clock::duration m_oldest
 
ulint m_n_elems
 
os_offset_t m_lowest_offset
 
AIOm_array
 
ulint m_n_slots
 
ulint m_segment
 
slots_t m_slots
 
bytem_buf
 

Detailed Description

Simulated AIO handler for reaping IO requests.

Member Typedef Documentation

◆ slots_t

typedef std::vector<Slot *> SimulatedAIOHandler::slots_t
private

Constructor & Destructor Documentation

◆ SimulatedAIOHandler()

SimulatedAIOHandler::SimulatedAIOHandler ( AIO array,
ulint  segment 
)
inline

Constructor.

Parameters
[in,out]arrayThe AIO array
[in]segmentLocal segment in the array

◆ ~SimulatedAIOHandler()

SimulatedAIOHandler::~SimulatedAIOHandler ( )
inline

Destructor.

Member Function Documentation

◆ adjacent()

bool SimulatedAIOHandler::adjacent ( const Slot s1,
const Slot s2 
) const
inlineprivate
Returns
true if the slots are adjacent and can be merged

◆ allocate_buffer()

ulint SimulatedAIOHandler::allocate_buffer ( )
inline

We have now collected n_consecutive I/O requests in the array; allocate a single buffer which can hold all data, and perform the I/O.

Returns
the length of the buffer

◆ check_completed()

Slot * SimulatedAIOHandler::check_completed ( ulint n_reserved)
inline

Check if there is a slot for which the i/o has already been done.

Parameters
[out]n_reservedNumber of reserved slots
Returns
the first completed slot that is found.

◆ check_pending()

ulint SimulatedAIOHandler::check_pending ( ulint  global_segment,
os_event_t  event 
)

Wait for I/O requests.

Parameters
[in]global_segmentThe global segment
[in,out]eventWait on event if no active requests
Returns
the number of slots
the number of slots

◆ copy_to_buffer()

void SimulatedAIOHandler::copy_to_buffer ( ulint  len)
inline

We have to compress the individual pages and punch holes in them on a page by page basis when writing to tables that can be compressed at the IO level.

Parameters
[in]lenValue returned by allocate_buffer

◆ done()

void SimulatedAIOHandler::done ( )
inline

Mark the i/os done in slots.

◆ first_slot()

Slot * SimulatedAIOHandler::first_slot ( )
inline
Returns
the first slot in the consecutive array

◆ init()

void SimulatedAIOHandler::init ( ulint  n_slots)
inline

Reset the state of the handler.

Parameters
[in]n_slotsNumber of pending AIO operations supported

◆ io()

void SimulatedAIOHandler::io ( )
inline

Do the I/O with ordinary, synchronous i/o functions:

◆ io_complete()

void SimulatedAIOHandler::io_complete ( )
inline

Do the decompression of the pages read in.

◆ merge()

void SimulatedAIOHandler::merge ( )
inline

Check if there are several consecutive blocks to read or write.

Merge them if found.

◆ merge_adjacent()

bool SimulatedAIOHandler::merge_adjacent ( Slot *&  current)
inlineprivate
Returns
true if merge limit reached or no adjacent slots found.

◆ read()

void SimulatedAIOHandler::read ( Slot slot)
inlineprivate

Do the file read.

Parameters
[in,out]slotSlot that has the IO context

◆ select()

bool SimulatedAIOHandler::select ( )
inline

If there are at least 2 seconds old requests, then pick the oldest one to prevent starvation.

If several requests have the same age, then pick the one at the lowest offset.

Returns
true if request was selected

◆ select_if_older()

void SimulatedAIOHandler::select_if_older ( Slot slot)
inlineprivate

Select the slot if it is older than the current oldest slot.

Parameters
[in]slotThe slot to check

◆ select_lowest_offset()

bool SimulatedAIOHandler::select_lowest_offset ( )
inlineprivate

There were no old requests.

Look for an I/O request at the lowest offset in the array (we ignore the high 32 bits of the offset in these heuristics)

◆ select_oldest()

bool SimulatedAIOHandler::select_oldest ( )
inlineprivate

Select th oldest slot in the array.

Returns
true if oldest slot found

◆ write()

void SimulatedAIOHandler::write ( Slot slot)
inlineprivate

Do the file write.

Parameters
[in,out]slotSlot that has the IO context

Member Data Documentation

◆ m_array

AIO* SimulatedAIOHandler::m_array
private

◆ m_buf

byte* SimulatedAIOHandler::m_buf
private

◆ m_lowest_offset

os_offset_t SimulatedAIOHandler::m_lowest_offset
private

◆ m_n_elems

ulint SimulatedAIOHandler::m_n_elems
private

◆ m_n_slots

ulint SimulatedAIOHandler::m_n_slots
private

◆ m_oldest

std::chrono::steady_clock::duration SimulatedAIOHandler::m_oldest
private

◆ m_segment

ulint SimulatedAIOHandler::m_segment
private

◆ m_slots

slots_t SimulatedAIOHandler::m_slots
private

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