Encapsulates a log block of size QUEUE_BLOCK_SIZE, enqueued by the producer, dequeued by the consumer and written into the redo log archive file.
More...
|
| Block () |
| Constructor initializes the byte array to all 0's and sets that the log block is not the last log block enqueued (is_final_block = false). More...
|
|
| ~Block () |
| Destructor initializes the byte array to all 0's and sets that the log block is not the last log block enqueued (is_final_block = false). More...
|
|
Block & | operator= (const Block &)=default |
|
void | reset () |
| Resets the data in the log block, initializing the byte array to all 0's and sets that the block is not the last log block enqueued (is_final_block = false) More...
|
|
const byte * | get_queue_block () const |
| Get the byte array of size QUEUE_BLOCK_SIZE associated with this object. More...
|
|
bool | put_log_block (const byte block[], const size_t pos) |
| Copy a log block from the given position inside the input byte array. More...
|
|
bool | get_is_final_block () const |
| Return the is_final_block flag. More...
|
|
void | set_is_final_block (const bool is_final_block) |
| Set the is_final_block flag. More...
|
|
bool | full () const |
| Return if the log block is full. More...
|
|
Encapsulates a log block of size QUEUE_BLOCK_SIZE, enqueued by the producer, dequeued by the consumer and written into the redo log archive file.
◆ Block()
Constructor initializes the byte array to all 0's and sets that the log block is not the last log block enqueued (is_final_block = false).
◆ ~Block()
Destructor initializes the byte array to all 0's and sets that the log block is not the last log block enqueued (is_final_block = false).
◆ full()
bool meb::Block::full |
( |
| ) |
const |
|
inline |
Return if the log block is full.
Condition is (m_offset == QUEUE_BLOCK_SIZE). Since we increment m_offset by OS_FILE_LOG_BLOCK_SIZE only, the equivalent condition is (m_offset > QUEUE_BLOCK_SIZE - OS_FILE_LOG_BLOCK_SIZE). The latter one convinces the fortify tool, that we will never overrun the buffer, while the first one is insufficient for the tool.
- Return values
-
true | if the log block has QUEUE_BLOCK_SIZE bytes. |
false | otherwise. |
◆ get_is_final_block()
bool meb::Block::get_is_final_block |
( |
| ) |
const |
|
inline |
Return the is_final_block flag.
- Return values
-
true | if the is_final_block flag is true. false if the is_final_block flag is false. |
◆ get_queue_block()
const byte * meb::Block::get_queue_block |
( |
| ) |
const |
|
inline |
Get the byte array of size QUEUE_BLOCK_SIZE associated with this object.
- Return values
-
byte[] | The byte array of size QUEUE_BLOCK_SIZE in this object. |
◆ operator=()
◆ put_log_block()
bool meb::Block::put_log_block |
( |
const byte |
block[], |
|
|
const size_t |
pos |
|
) |
| |
|
inline |
Copy a log block from the given position inside the input byte array.
Note that a complete log block is of size OS_FILE_LOG_BLOCK_SIZE. A log block could also be of size less than OS_FILE_LOG_BLOCK_SIZE, in which case it is overwritten in the next iteration of log writing by InnoDB.
- Parameters
-
[in] | block | The byte array containing the log block to be stored in this log block object. |
[in] | pos | The position inside the byte array from which a log block should be copied. |
- Return values
-
true | if a complete redo log block (multiple of OS_FILE_LOG_BLOCK_SIZE) was copied. |
false | otherwise. |
◆ reset()
void meb::Block::reset |
( |
void |
| ) |
|
|
inline |
Resets the data in the log block, initializing the byte array to all 0's and sets that the block is not the last log block enqueued (is_final_block = false)
◆ set_is_final_block()
void meb::Block::set_is_final_block |
( |
const bool |
is_final_block | ) |
|
|
inline |
Set the is_final_block flag.
- Parameters
-
[in] | is_final_block | the state of the is_final_block flag. |
◆ m_block
The bytes in the log block object.
◆ m_is_final_block
bool meb::Block::m_is_final_block {false} |
|
private |
Flag indicating if this is the last block enqueued by the producer.
◆ m_is_flush_block
bool meb::Block::m_is_flush_block {false} |
Whether this block is a flush block.
A flush block is made from the current temporary block redo_log_archive_tmp_block on a flush request. A flush block may be full or not, depending on the current work of the "producer". To avoid races set this variable only under the log writer mutex. The "consumer" shall not update its file write offset when it writes a flush block. The next regular block shall overwrite it.
◆ m_offset
size_t meb::Block::m_offset {0} |
|
private |
Offset inside the byte array of the log block object at which the next redo log block should be written.
The documentation for this class was generated from the following file: