Skip to content
Permalink
Browse files
MDEV-12353 preparation: Remove UNIV_LOG_LSN_DEBUG
The debug instrumentation with the MLOG_LSN pseudo-record has not been
used for debugging for years. Let us remove this code now.
It would have to be removed as part of MDEV-12353 or MDEV-14425 anyway,
when implementing a new redo log file format.
  • Loading branch information
dr-m committed Dec 17, 2019
1 parent 3c77181 commit fb4a897
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 103 deletions.
@@ -28,9 +28,6 @@ Created 12/9/1995 Heikki Tuuri
#include "srv0mon.h"
#include "ut0crc32.h"

#ifdef UNIV_LOG_LSN_DEBUG
#include "mtr0types.h"
#endif /* UNIV_LOG_LSN_DEBUG */
extern ulong srv_log_buffer_size;

/************************************************************//**
@@ -288,32 +285,7 @@ log_reserve_and_write_fast(
ut_ad(log_mutex_own());
ut_ad(len > 0);

#ifdef UNIV_LOG_LSN_DEBUG
/* Append a MLOG_LSN record after mtr_commit(), except when
the last bytes could be a MLOG_CHECKPOINT marker. We have special
handling when the log consists of only a single MLOG_CHECKPOINT
record since the latest checkpoint, and appending the
MLOG_LSN would ruin that.

Note that a longer redo log record could happen to end in what
looks like MLOG_CHECKPOINT, and we could be omitting MLOG_LSN
without reason. This is OK, because writing the MLOG_LSN is
just a 'best effort', aimed at finding log corruption due to
bugs in the redo log writing logic. */
const ulint lsn_len
= len >= SIZE_OF_MLOG_CHECKPOINT
&& MLOG_CHECKPOINT == static_cast<const char*>(str)[
len - SIZE_OF_MLOG_CHECKPOINT]
? 0
: 1
+ mach_get_compressed_size(log_sys.lsn >> 32)
+ mach_get_compressed_size(log_sys.lsn & 0xFFFFFFFFUL);
#endif /* UNIV_LOG_LSN_DEBUG */

const ulint data_len = len
#ifdef UNIV_LOG_LSN_DEBUG
+ lsn_len
#endif /* UNIV_LOG_LSN_DEBUG */
+ log_sys.buf_free % OS_FILE_LOG_BLOCK_SIZE;

if (data_len >= log_sys.trailer_offset()) {
@@ -326,24 +298,6 @@ log_reserve_and_write_fast(

*start_lsn = log_sys.lsn;

#ifdef UNIV_LOG_LSN_DEBUG
if (lsn_len) {
/* Write the LSN pseudo-record. */
byte* b = &log_sys.buf[log_sys.buf_free];

*b++ = MLOG_LSN | (MLOG_SINGLE_REC_FLAG & *(const byte*) str);

/* Write the LSN in two parts,
as a pseudo page number and space id. */
b += mach_write_compressed(b, log_sys.lsn >> 32);
b += mach_write_compressed(b, log_sys.lsn & 0xFFFFFFFFUL);
ut_a(b - lsn_len == &log_sys.buf[log_sys.buf_free]);

::memcpy(b, str, len);

len += lsn_len;
} else
#endif /* UNIV_LOG_LSN_DEBUG */
memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>(log_sys.buf + log_sys.buf_free,
str, len);

@@ -123,11 +123,6 @@ enum mlog_id_t {
/** initialize an ibuf bitmap page (used in MariaDB 10.2 and 10.3) */
MLOG_IBUF_BITMAP_INIT = 27,

#ifdef UNIV_LOG_LSN_DEBUG
/** Current LSN */
MLOG_LSN = 28,
#endif /* UNIV_LOG_LSN_DEBUG */

/** write a string to a page */
MLOG_WRITE_STRING = 30,

@@ -199,9 +199,6 @@ using the call command. */
assertions. */
#define UNIV_LRU_DEBUG /* debug the buffer pool LRU */
#define UNIV_HASH_DEBUG /* debug HASH_ macros */
#define UNIV_LOG_LSN_DEBUG /* write LSN to the redo log;
this will break redo log file compatibility, but it may be useful when
debugging redo log application problems. */
#define UNIV_IBUF_DEBUG /* debug the insert buffer */
#define UNIV_PERF_DEBUG /* debug flag that enables
light weight performance
@@ -1369,11 +1369,6 @@ recv_parse_or_apply_log_rec_body(
const byte* old_ptr = ptr;

switch (type) {
#ifdef UNIV_LOG_LSN_DEBUG
case MLOG_LSN:
/* The LSN is checked in recv_parse_log_rec(). */
break;
#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES:
case MLOG_MEMSET:
#ifdef UNIV_DEBUG
@@ -2361,20 +2356,6 @@ recv_parse_log_rec(
}

switch (*ptr) {
#ifdef UNIV_LOG_LSN_DEBUG
case MLOG_LSN | MLOG_SINGLE_REC_FLAG:
case MLOG_LSN:
new_ptr = mlog_parse_initial_log_record(
ptr, end_ptr, type, space, page_no);
if (new_ptr != NULL) {
const lsn_t lsn = static_cast<lsn_t>(
*space) << 32 | *page_no;
ut_a(lsn == recv_sys.recovered_lsn);
}

*type = MLOG_LSN;
return(new_ptr - ptr);
#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_MULTI_REC_END:
case MLOG_DUMMY_RECORD:
*type = static_cast<mlog_id_t>(*ptr);
@@ -2560,9 +2541,6 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)

switch (*ptr) {
case MLOG_CHECKPOINT:
#ifdef UNIV_LOG_LSN_DEBUG
case MLOG_LSN:
#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_DUMMY_RECORD:
single_rec = true;
break;
@@ -2650,13 +2628,6 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
return(true);
}
break;
#ifdef UNIV_LOG_LSN_DEBUG
case MLOG_LSN:
/* Do not add these records to the hash table.
The page number and space id fields are misused
for something else. */
break;
#endif /* UNIV_LOG_LSN_DEBUG */
default:
switch (store) {
case STORE_NO:
@@ -2822,13 +2793,6 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
case MLOG_MULTI_REC_END:
/* Found the end mark for the records */
goto loop;
#ifdef UNIV_LOG_LSN_DEBUG
case MLOG_LSN:
/* Do not add these records to the hash table.
The page number and space id fields are misused
for something else. */
break;
#endif /* UNIV_LOG_LSN_DEBUG */
case MLOG_INDEX_LOAD:
recv_mlog_index_load(space, page_no, old_lsn);
break;
@@ -3834,11 +3798,6 @@ static const char* get_mlog_string(mlog_id_t type)
case MLOG_IBUF_BITMAP_INIT:
return("MLOG_IBUF_BITMAP_INIT");

#ifdef UNIV_LOG_LSN_DEBUG
case MLOG_LSN:
return("MLOG_LSN");
#endif /* UNIV_LOG_LSN_DEBUG */

case MLOG_WRITE_STRING:
return("MLOG_WRITE_STRING");

@@ -1226,14 +1226,6 @@ dberr_t srv_start(bool create_new_db)
ib::info() << "!!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!";
#endif

#ifdef UNIV_LOG_LSN_DEBUG
ib::info() << "!!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!";
#endif /* UNIV_LOG_LSN_DEBUG */

#if defined(COMPILER_HINTS_ENABLED)
ib::info() << "Compiler hints enabled.";
#endif /* defined(COMPILER_HINTS_ENABLED) */

#ifdef _WIN32
ib::info() << "Mutexes and rw_locks use Windows interlocked functions";
#else

0 comments on commit fb4a897

Please sign in to comment.