Skip to content

Commit 96c4b9d

Browse files
committed
MDEV-11782 preparation: Remove recv_sys_t::last_block.
We can use log_sys->buf instead of recv_sys->last_block during crash recovery. Remove the redundant buffer.
1 parent 412ee03 commit 96c4b9d

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

storage/innobase/include/log0recv.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,6 @@ struct recv_sys_t{
214214
ibool apply_batch_on;
215215
/*!< this is TRUE when a log rec application
216216
batch is running */
217-
byte* last_block;
218-
/*!< possible incomplete last recovered log
219-
block */
220-
byte* last_block_buf_start;
221-
/*!< the nonaligned start address of the
222-
preceding buffer */
223217
byte* buf;/*!< buffer for parsing log records */
224218
ulint len;/*!< amount of data in buf */
225219
lsn_tparse_start_lsn;

storage/innobase/log/log0recv.cc

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ recv_sys_close(void)
474474
}
475475

476476
ut_free(recv_sys->buf);
477-
ut_free(recv_sys->last_block_buf_start);
478477

479478
ut_ad(!recv_writer_thread_active);
480479
mutex_free(&recv_sys->writer_mutex);
@@ -512,7 +511,6 @@ recv_sys_mem_free(void)
512511
}
513512

514513
ut_free(recv_sys->buf);
515-
ut_free(recv_sys->last_block_buf_start);
516514
ut_free(recv_sys);
517515
recv_sys = NULL;
518516
}
@@ -631,12 +629,6 @@ recv_sys_init(
631629
recv_sys->apply_log_recs = FALSE;
632630
recv_sys->apply_batch_on = FALSE;
633631

634-
recv_sys->last_block_buf_start = static_cast<byte*>(
635-
ut_malloc_nokey(2 * OS_FILE_LOG_BLOCK_SIZE));
636-
637-
recv_sys->last_block = static_cast<byte*>(ut_align(
638-
recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE));
639-
640632
recv_sys->found_corrupt_log = false;
641633
recv_sys->found_corrupt_fs = false;
642634
recv_sys->mlog_checkpoint_lsn = 0;
@@ -680,12 +672,10 @@ recv_sys_debug_free(void)
680672
hash_table_free(recv_sys->addr_hash);
681673
mem_heap_free(recv_sys->heap);
682674
ut_free(recv_sys->buf);
683-
ut_free(recv_sys->last_block_buf_start);
684675

685676
recv_sys->buf = NULL;
686677
recv_sys->heap = NULL;
687678
recv_sys->addr_hash = NULL;
688-
recv_sys->last_block_buf_start = NULL;
689679

690680
/* wake page cleaner up to progress */
691681
if (!srv_read_only_mode) {
@@ -708,25 +698,24 @@ void
708698
recv_synchronize_groups(void)
709699
/*=========================*/
710700
{
711-
lsn_tstart_lsn;
712-
lsn_tend_lsn;
713-
lsn_trecovered_lsn;
714-
715-
recovered_lsn = recv_sys->recovered_lsn;
701+
const lsn_t recovered_lsn = recv_sys->recovered_lsn;
716702

717703
/* Read the last recovered log block to the recovery system buffer:
718704
the block is always incomplete */
719705

720-
start_lsn = ut_uint64_align_down(recovered_lsn,
721-
OS_FILE_LOG_BLOCK_SIZE);
722-
end_lsn = ut_uint64_align_up(recovered_lsn, OS_FILE_LOG_BLOCK_SIZE);
706+
const lsn_t start_lsn = ut_uint64_align_down(recovered_lsn,
707+
OS_FILE_LOG_BLOCK_SIZE);
708+
const lsn_t end_lsn = ut_uint64_align_up(recovered_lsn,
709+
OS_FILE_LOG_BLOCK_SIZE);
723710

724-
ut_a(start_lsn != end_lsn);
711+
ut_ad(start_lsn != end_lsn);
725712

726-
log_group_read_log_seg(recv_sys->last_block,
713+
log_group_read_log_seg(log_sys->buf,
727714
UT_LIST_GET_FIRST(log_sys->log_groups),
728715
start_lsn, end_lsn);
729716

717+
ut_ad(UT_LIST_GET_LEN(log_sys->log_groups) == 1);
718+
730719
for (log_group_t* group = UT_LIST_GET_FIRST(log_sys->log_groups);
731720
group;
732721
group = UT_LIST_GET_NEXT(log_groups, group)) {
@@ -3404,8 +3393,6 @@ recv_recovery_from_checkpoint_start(
34043393
srv_start_lsn = recv_sys->recovered_lsn;
34053394
}
34063395

3407-
ut_memcpy(log_sys->buf, recv_sys->last_block, OS_FILE_LOG_BLOCK_SIZE);
3408-
34093396
log_sys->buf_free = (ulint) log_sys->lsn % OS_FILE_LOG_BLOCK_SIZE;
34103397
log_sys->buf_next_to_write = log_sys->buf_free;
34113398
log_sys->write_lsn = log_sys->lsn;

0 commit comments

Comments
 (0)