summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@desktop.sanja.is.com.ua>2007-10-12 08:11:28 +0300
committerunknown <bell@desktop.sanja.is.com.ua>2007-10-12 08:11:28 +0300
commit5eb78c518cc8a013fdf33c5c5f8b39cd42f6f736 (patch)
treeb15048becaadbd41c8da4d36e38cd0adf9dfa743
parent212c7dfecc11c28487d4ff2c539038da279a5661 (diff)
downloadmariadb-git-5eb78c518cc8a013fdf33c5c5f8b39cd42f6f736.tar.gz
translog_next_LSN() changed to support pointer to the page end
which can happen when you save address of horizon
-rw-r--r--storage/maria/ma_loghandler.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index c82b716d858..fe5fbb06a09 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -5427,8 +5427,10 @@ translog_get_next_chunk(TRANSLOG_SCANNER_DATA *scanner)
uint16 len;
DBUG_ENTER("translog_get_next_chunk");
- if ((len= translog_get_total_chunk_length(scanner->page,
- scanner->page_offset)) == 0)
+ if (translog_scanner_eop(scanner))
+ len= TRANSLOG_PAGE_SIZE - scanner->page_offset;
+ else if ((len= translog_get_total_chunk_length(scanner->page,
+ scanner->page_offset)) == 0)
DBUG_RETURN(1);
scanner->page_offset+= len;
@@ -6625,6 +6627,20 @@ LSN translog_next_LSN(TRANSLOG_ADDRESS addr, TRANSLOG_ADDRESS horizon)
DBUG_RETURN(LSN_IMPOSSIBLE);
translog_init_scanner(addr, 0, &scanner, 1);
+ /* addr can point not to a chunk beginning but to a page end */
+ if (translog_scanner_eop(&scanner))
+ {
+ if (translog_get_next_chunk(&scanner))
+ {
+ result= LSN_ERROR;
+ goto out;
+ }
+ if (scanner.page == END_OF_LOG)
+ {
+ result= LSN_IMPOSSIBLE;
+ goto out;
+ }
+ }
chunk_type= scanner.page[scanner.page_offset] & TRANSLOG_CHUNK_TYPE;
DBUG_PRINT("info", ("type: %x byte: %x", (uint) chunk_type,
@@ -6657,6 +6673,7 @@ out:
DBUG_RETURN(result);
}
+
/**
@brief returns the LSN of the first record starting in this log