Commit 37dc087f authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12353: Remove bogus comments and clean up code

This is a fixup for commit 7ae21b18.

It turns out that even if we in the future made LSN
count mini-transactions instead of bytes, we will need
both start LSN and end LSN, which must exactly match
between mtr_t::commit() and log_phys_t::apply().

log_rec_t::lsn: Restore the const qualifier.

log_phys_t::append(): Remove the lsn parameter. Both the start
and end LSN must remain unchanged. We can only append log from
the same mini-transaction to a single log record snippet.
If we combined the log from mini-transactions A and B, it could
happen that the FIL_PAGE_LSN of the page is somewhere between
A.start_lsn and B.start_lsn. In that case, also the log of B
would be wrongly skipped.

recv_sys_t::add(): Assert that if the start LSN matches, also
the end LSN will match.
parent dd87a8b3
......@@ -124,10 +124,7 @@ struct log_rec_t
/** next record */
log_rec_t *next;
/** mtr_t::commit_lsn() of the mini-transaction */
lsn_t lsn;
protected:
void set_lsn(lsn_t end_lsn) { ut_ad(lsn <= end_lsn); lsn= end_lsn; }
const lsn_t lsn;
};
struct recv_dblwr_t {
......
......@@ -105,10 +105,8 @@ bool recv_writer_thread_active;
/** Stored physical log record with logical LSN (@see log_t::FORMAT_10_5) */
struct log_phys_t : public log_rec_t
{
#if 1 // MDEV-14425 FIXME: remove this!
/** start LSN of the mini-transaction (not necessarily of this record) */
const lsn_t start_lsn;
#endif
private:
/** length of the record, in bytes */
uint16_t len;
......@@ -148,12 +146,10 @@ struct log_phys_t : public log_rec_t
/** Append a record to the log.
@param recs log to append
@param size size of the log, in bytes
@param lsn the commit LSN of the record */
void append(const byte *recs, size_t size, lsn_t lsn)
@param size size of the log, in bytes */
void append(const byte *recs, size_t size)
{
ut_ad(start_lsn < lsn);
set_lsn(lsn);
reinterpret_cast<byte*>(memcpy(end(), recs, size))[size]= 0;
len+= static_cast<uint16_t>(size);
}
......@@ -1495,10 +1491,9 @@ inline void recv_sys_t::add(const page_id_t page_id,
log_phys_t *tail= static_cast<log_phys_t*>(recs.log.last());
if (!tail)
break;
#if 1 // MDEV-14425 FIXME: remove this!
if (tail->start_lsn != start_lsn)
break;
#endif
ut_ad(tail->lsn == lsn);
buf_block_t *block= UT_LIST_GET_LAST(blocks);
ut_ad(block);
const size_t used= static_cast<uint16_t>(block->page.access_time - 1) + 1;
......@@ -1511,7 +1506,7 @@ inline void recv_sys_t::add(const page_id_t page_id,
append:
UNIV_MEM_ALLOC(end + 1, len);
/* Append to the preceding record for the page */
tail->append(l, len, lsn);
tail->append(l, len);
return;
}
if (end <= &block->frame[used - ALIGNMENT] || &block->frame[used] >= end)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment