MySQL 26.7.0
Source Code Documentation
ib::fil::Tablespace_node_handle_interface Class Referenceabstract

#include <fil0tablespace_node_handle_interface.h>

Inheritance diagram for ib::fil::Tablespace_node_handle_interface:
[legend]

Public Types

enum class  Status { SUCCESS = 0 , IO_ERROR }
 
enum class  Status_IO {
  SUCCESS = 0 , IO_DECRYPT_FAIL , CORRUPTION , IO_OVERFLOW ,
  OUT_OF_MEMORY , IO_DECOMPRESS_FAIL , IO_NO_PUNCH_HOLE , UNSUPPORTED ,
  IO_ERROR
}
 
using byte = unsigned char
 
using Page_number = uint32_t
 Type used for numbering the pages in the node. More...
 
using Callback = std::function< void(dberr_t io_result)>
 

Public Member Functions

virtual ~Tablespace_node_handle_interface ()=default
 Closes the opened node handle. More...
 
virtual bool needs_flushes_for_durability () const =0
 Returns true if the node must be flushed in general to ensure data durability. More...
 
virtual Status flush ()=0
 Ensures any data written so far to this tablespace node before this call will be made durable and will survive either software or hardware crash. More...
 
virtual Status truncate (Page_number size)=0
 Truncate the node storage to the given size. More...
 
virtual Status fill_range_with_zeros (Page_number first_page, Page_number number_of_pages, bool optimize_writes)=0
 Makes the number_of_pages pages, starting with page number first_page contain all zeros. More...
 
virtual Status_IO read_page (IORequest req, byte *buffer, Page_number page_no)=0
 Reads a requested page synchronously. More...
 
virtual Status_IO read_page_async (IORequest req, byte *buffer, Page_number page_no, Callback callback)=0
 Reads a requested page asynchronously. More...
 
virtual Status_IO write_page (IORequest req, byte *buffer, size_t buffer_len, Page_number page_no)=0
 Writes a requested page synchronously. More...
 
virtual Status_IO write_page_async (IORequest req, byte *buffer, size_t buffer_len, Page_number page_no, Callback callback)=0
 Writes a requested page asynchronously. More...
 

Member Typedef Documentation

◆ byte

◆ Callback

using ib::fil::Tablespace_node_handle_interface::Callback = std::function<void(dberr_t io_result)>

◆ Page_number

Type used for numbering the pages in the node.

Member Enumeration Documentation

◆ Status

Enumerator
SUCCESS 
IO_ERROR 

◆ Status_IO

Enumerator
SUCCESS 
IO_DECRYPT_FAIL 
CORRUPTION 
IO_OVERFLOW 
OUT_OF_MEMORY 
IO_DECOMPRESS_FAIL 
IO_NO_PUNCH_HOLE 
UNSUPPORTED 
IO_ERROR 

Constructor & Destructor Documentation

◆ ~Tablespace_node_handle_interface()

virtual ib::fil::Tablespace_node_handle_interface::~Tablespace_node_handle_interface ( )
virtualdefault

Closes the opened node handle.

Member Function Documentation

◆ fill_range_with_zeros()

virtual Status ib::fil::Tablespace_node_handle_interface::fill_range_with_zeros ( Page_number  first_page,
Page_number  number_of_pages,
bool  optimize_writes 
)
pure virtual

Makes the number_of_pages pages, starting with page number first_page contain all zeros.

This can be use to efficiently extend the node size. It may be implemented more efficiently than actually writing buffers with zeros, but only if optimize_writes is set to true.

Parameters
[in]first_pageNumber of page in node from to be overwritten with zeros.
[in]number_of_pagesNumber of pages to overwrite with zeros.
[in]optimize_writesIf true the implementation can use faster and possibly less robust way to zero the range.
Returns
SUCCESS if zeroed successfully, error code otherwise.

Implemented in ib::fil::Tablespace_node_handle.

◆ flush()

virtual Status ib::fil::Tablespace_node_handle_interface::flush ( )
pure virtual

Ensures any data written so far to this tablespace node before this call will be made durable and will survive either software or hardware crash.

Implemented in ib::fil::Tablespace_node_handle.

◆ needs_flushes_for_durability()

virtual bool ib::fil::Tablespace_node_handle_interface::needs_flushes_for_durability ( ) const
pure virtual

Returns true if the node must be flushed in general to ensure data durability.

Returns
true if flush is needed, false otherwise.

Implemented in ib::fil::Tablespace_node_handle.

◆ read_page()

virtual Status_IO ib::fil::Tablespace_node_handle_interface::read_page ( IORequest  req,
byte buffer,
Page_number  page_no 
)
pure virtual

Reads a requested page synchronously.

Before the page is returned, the page will be decrypted and decompressed, depending on information present in the page header.

The size of the buffer in bytes should be at least the tablespace physical page size which was passed to tablespaces_nodes::open() or calculated from flags passed to tablespaces_nodes::create().

Parameters
[in]reqIO request type, compression and encryption information.
[out]bufferA buffer where to read the data in. It must be aligned in memory to physical page size. It must be able to store physical page size bytes. The memory pointed is managed by the caller and must remain valid until the call finishes. TODO : buffer to be replaced with std::span.
[in]page_noOffset from the first page in the node to read from.
Returns
Status_IO::SUCCESS on successful read, otherwise error code

Implemented in ib::fil::Tablespace_node_handle.

◆ read_page_async()

virtual Status_IO ib::fil::Tablespace_node_handle_interface::read_page_async ( IORequest  req,
byte buffer,
Page_number  page_no,
Callback  callback 
)
pure virtual

Reads a requested page asynchronously.

After the operation is completed, successfully or not, the callback is called with the result error code, probably in a different thread. If the request is successful, it will always be called from a different thread in context that has no latches taken.

Before the page is returned, the page will be decrypted and decompressed, depending on information present in the page header.

The size of the buffer in bytes should be at least the tablespace physical page size which was passed to tablespaces_nodes::open() or calculated from flags passed to tablespaces_nodes::create().

Parameters
[in]reqIO request type, compression and encryption information.
[out]bufferA buffer where to read the data in. It must be aligned in memory to physical page size. It must be able to store physical page size bytes. The memory pointed is managed by the caller and must remain valid until the callback is being called. TODO : buffer to be replaced with std::span.
[in]page_noOffset from the first page in the node to read from.
[in]callbackA callback to be called exactly once when the result of this IO operation is known. It may be a success if the read or write succeeded or a subset of dberr_t errors if the read could not be executed or if it failed. It can be called synchronously in this thread before returning from this method, or can be executed asynchronously from another thread, when sync is false, before or after this call returns.
Returns
Status_IO::SUCCESS if IO was successfully posted, error code otherwise

Implemented in ib::fil::Tablespace_node_handle.

◆ truncate()

virtual Status ib::fil::Tablespace_node_handle_interface::truncate ( Page_number  size)
pure virtual

Truncate the node storage to the given size.

Parameters
[in]sizeExpected size in pages of node after truncation. If the size provided is more than or equal to the current size of the node storage, return success.
Returns
SUCCESS if truncated successfully, error code otherwise.

Implemented in ib::fil::Tablespace_node_handle.

◆ write_page()

virtual Status_IO ib::fil::Tablespace_node_handle_interface::write_page ( IORequest  req,
byte buffer,
size_t  buffer_len,
Page_number  page_no 
)
pure virtual

Writes a requested page synchronously.

The page will be encrypted and compressed, below this implementation depending on information present in the page header.

If punch hole is supported and requested, this API implementation punches the hole depending on input buffer compression metadata (check Punch Hole Optimization), the capability of Implementation and settings in IORequest.

If compression/encryption is to be done, the input buffer may be modified accordingly with post encryption/compression metadata (eg : Page type, compression info).

The size of the buffer in bytes should be at most the tablespaces physical page size which was passed to tablespaces_nodes::open() or calculated from flags passed to tablespaces_nodes::create(). In other words, buffer_len must not be greater than the tablespace physical page size. In case of punch hole, the buffer_len can be less than physical page size but it must be divisible by 512. And the buffer will be written out and rest of the page will be hole-punched.

Parameters
[in]reqIO request type, compression and encryption information.
[out]bufferA buffer containing the data to be written. Data from this buffer might be copied and the copy transformed before writing it. It must be aligned in memory to the OS block size (UNIV_SECTOR_SIZE). The memory pointed is managed by the caller and must remain valid until the call returns.
[in]buffer_lenSize of the buffer to be written. It always has to be a multiply of OS block size (UNIV_SECTOR_SIZE). In case of write of an already compressed data, it is a length of the compressed data buffer. Otherwise it should be physical page size. Actual number of bytes written can be smaller if the tablespace has compression enabled and data was not compressed already. TODO : buffer and buffer_len to be replaced with std::span.
[in]page_noOffset from the first page in the node to write to.
Returns
Status_IO::SUCCESS on successful write, otherwise error code

Implemented in ib::fil::Tablespace_node_handle.

◆ write_page_async()

virtual Status_IO ib::fil::Tablespace_node_handle_interface::write_page_async ( IORequest  req,
byte buffer,
size_t  buffer_len,
Page_number  page_no,
Callback  callback 
)
pure virtual

Writes a requested page asynchronously.

After the operation is completed, successfully or not, the callback is called with the result error code, probably in a different thread. If the request is successful, it will always be called from a different thread in context that has no latches taken.

The page will be encrypted and compressed, below this implementation depending on information present in the page header.

If punch hole is supported and requested, this API implementation punches the hole depending on input buffer compression metadata (check Punch Hole Optimization), the capability of Implementation and settings in IORequest.

If compression/encryption is to be done, the input buffer may be modified accordingly with post encryption/compression metadata (eg : Page type, compression info).

The size of the buffer in bytes should be at most the tablespaces physical page size which was passed to tablespaces_nodes::open() or calculated from flags passed to tablespaces_nodes::create(). In other words, buffer_len must not be greater than the tablespace physical page size. In case of punch hole, the buffer_len can be less than physical page size but it must be divisible by 512. And the buffer will be written out and rest of the page will be hole-punched.

Parameters
[in]reqIO request type, compression and encryption information.
[out]bufferA buffer containing the data to be written. Data from this buffer might be copied and the copy transformed before writing it. It must be aligned in memory to the OS block size (UNIV_SECTOR_SIZE). The memory pointed is managed by the caller and must remain valid until the callback is being called.
[out]buffer_lenSize of the buffer to be written. It must be aligned to OS block size (UNIV_SECTOR_SIZE). In case of write of an already compressed data, it is a length of the compressed data buffer. Otherwise it should be physical page size. Actual number of bytes written can be smaller if the tablespace has compression enabled and data was not compressed already. TODO : buffer and buffer_len to be replaced with std::span.
[in]page_noOffset from the first page in the node to write to.
[in]callbackA callback to be called exactly once when the result of this IO operation is known. It may be a success if the read or write succeeded or a subset of dberr_t errors if the write could not be executed or if it failed. It can be called synchronously in this thread before returning from this method, or can be executed asynchronously from another thread, when sync is false, before or after this call returns.
Returns
Status_IO::SUCCESS if IO was successfully posted, error code otherwise

Implemented in ib::fil::Tablespace_node_handle.


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