/** Log an initialization of a string of bytes. @param[in]bbufferpage @param[in]ofsbyteoffsetfromb->frame @param[in]lenlengthofthedatatowrite
@param[in] val the data byte to write */ inlinevoid mtr_t::memset(const buf_block_t &b, ulint ofs, ulint len, byte val)
{
ut_ad(len);
set_modified(b); if (!is_logged()) return;
/** Initialize a repeating string of bytes. @param[in,out]bbufferpage @param[in]ofsbyteoffsetfromb->frame @param[in]lenlengthofthedatatowrite,inbytes @param[in]strthestringtowrite
@param[in] size size of str, in bytes */ inlinevoid mtr_t::memset(const buf_block_t *b, ulint ofs, size_t len, constvoid *str, size_t size)
{
ut_ad(ofs <= ulint(srv_page_size));
ut_ad(ofs + len <= ulint(srv_page_size));
ut_ad(len > size); /* use mtr_t::memcpy() for shorter writes */
size_t s= 0; while (s < len)
{
::memcpy(ofs + s + b->page.frame, str, size);
s+= len;
}
::memcpy(ofs + s + b->page.frame, str, len - s);
memset(*b, ofs, len, str, size);
}
/** Log a write of a byte string to a page. @param[in]bbufferpage @param[in]offsetbyteoffsetfromb->frame @param[in]strthedatatowrite
@param[in] len length of the data to write */ inlinevoid mtr_t::memcpy(const buf_block_t &b, ulint offset, ulint len)
{
ut_ad(len);
ut_ad(offset <= ulint(srv_page_size));
ut_ad(offset + len <= ulint(srv_page_size));
memcpy_low(b, uint16_t(offset), &b.page.frame[offset], len);
}
/** Log a write of a byte string to a page. @paramblockpage @paramoffsetbyteoffsetwithinpage @paramdatadatatobewritten
@param len length of the data, in bytes */ inlinevoid mtr_t::memcpy_low(const buf_block_t &block, uint16_t offset, constvoid *data, size_t len)
{
ut_ad(len);
set_modified(block); if (!is_logged()) return; if (len < mtr_buf_t::MAX_DATA_SIZE - (1 + 3 + 3 + 5 + 5))
{
byte *end= log_write<WRITE>(block.page.id(), &block.page, len, true,
offset);
::memcpy(end, data, len);
m_log.close(end + len);
} else
{
m_log.close(log_write<WRITE>(block.page.id(), &block.page, len, false,
offset));
m_log.push(static_cast<const byte*>(data), static_cast<uint32_t>(len));
}
m_last_offset= static_cast<uint16_t>(offset + len);
}
/** Log that a string of bytes was copied from the same page. @param[in]bbufferpage @param[in]ddestinationoffsetwithinthepage @param[in]ssourceoffsetwithinthepage
@param[in] len length of the data to copy */ inlinevoid mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len)
{
ut_ad(d >= 8);
ut_ad(s >= 8);
ut_ad(len);
ut_ad(s <= ulint(srv_page_size));
ut_ad(s + len <= ulint(srv_page_size));
ut_ad(s != d);
ut_ad(d <= ulint(srv_page_size));
ut_ad(d + len <= ulint(srv_page_size));
set_modified(b); if (!is_logged()) return;
static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency");
size_t lenlen= (len < MIN_2BYTE ? 1 : len < MIN_3BYTE ? 2 : 3); /* The source offset is encoded relative to the destination offset,
with the sign in the least significant bit. */ if (s > d)
s= (s - d) << 1; else
s= (d - s) << 1 | 1; /* The source offset 0 is not possible. */
s-= 1 << 1;
size_t slen= (s < MIN_2BYTE ? 1 : s < MIN_3BYTE ? 2 : 3);
byte *l= log_write<MEMMOVE>(b.page.id(), &b.page, lenlen + slen, true, d);
l= mlog_encode_varint(l, len);
l= mlog_encode_varint(l, s);
m_log.close(l);
m_last_offset= static_cast<uint16_t>(d + len);
}
/** Write log for appending an undo log record. @paramblockundopage @paramdatarecordwithintheundopage
@param len length of the undo record, in bytes */ inlinevoid mtr_t::undo_append(const buf_block_t &block, constvoid *data, size_t len)
{
ut_ad(len > 2);
set_modified(block); if (!is_logged()) return; constbool small= len + 1 < mtr_buf_t::MAX_DATA_SIZE - (1 + 3 + 3 + 5 + 5);
byte *end= log_write<EXTENDED>(block.page.id(), &block.page, len + 1, small); if (UNIV_LIKELY(small))
{
*end++= UNDO_APPEND;
::memcpy(end, data, len);
m_log.close(end + len);
} else
{
m_log.close(end);
*m_log.push<byte*>(1)= UNDO_APPEND;
m_log.push(static_cast<const byte*>(data), static_cast<uint32_t>(len));
}
m_last_offset= FIL_PAGE_TYPE;
}
/** Trim the end of a tablespace.
@param id first page identifier that will not be in the file */ inlinevoid mtr_t::trim_pages(const page_id_t id)
{ if (!is_logged()) return;
byte *l= log_write<EXTENDED>(id, nullptr, 1, true);
*l++= TRIM_PAGES;
m_log.close(l);
set_trim_pages();
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.