diff options
author | unknown <bell@pwbook.sanja.is.com.ua> | 2007-09-27 17:57:40 +0300 |
---|---|---|
committer | unknown <bell@pwbook.sanja.is.com.ua> | 2007-09-27 17:57:40 +0300 |
commit | 396c5434295e6ed1830923def33d2143df273e75 (patch) | |
tree | fb303a89f95ee7f3035f39d5b14c755d49b7d41e | |
parent | 7492e2ca8e4005495963f9b5e42b1c0038c86972 (diff) | |
parent | 0de4c5562339eb0af9303eb33526a6dde717f5a7 (diff) | |
download | mariadb-git-396c5434295e6ed1830923def33d2143df273e75.tar.gz |
Merge pwbook.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria
into pwbook.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-logref
-rw-r--r-- | storage/maria/ma_loghandler.c | 30 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.h | 4 | ||||
-rwxr-xr-x | storage/maria/ma_pagecache.c | 13 | ||||
-rw-r--r-- | storage/maria/ma_pagecache.h | 6 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 2 |
5 files changed, 28 insertions, 27 deletions
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index e30c8c6627f..e52be8be427 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -640,22 +640,25 @@ static void translog_check_cursor(struct st_buffer_cursor *cursor) translog_filename_by_fileno() file_no Number of the log we want to open path Pointer to buffer where file name will be - stored (must be FN_REFLEN bytes at least + stored (must be FN_REFLEN bytes at least) RETURN pointer to path */ static char *translog_filename_by_fileno(uint32 file_no, char *path) { - char file_name[10 + 8 + 1]; /* See fallowing my_sprintf() call */ - char *res; + char buff[11], *end; + uint length; DBUG_ENTER("translog_filename_by_fileno"); DBUG_ASSERT(file_no <= 0xfffffff); - my_sprintf(file_name, (file_name, "maria_log.%08u", file_no)); - res= fn_format(path, file_name, log_descriptor.directory, "", MYF(MY_WME)); - DBUG_PRINT("info", ("Path: '%s' path: 0x%lx res: 0x%lx", - res, (ulong) path, (ulong) res)); - DBUG_RETURN(res); + + /* log_descriptor.directory is already formated */ + end= strxmov(path, log_descriptor.directory, "maria_log.0000000", NullS); + length= (uint) (int10_to_str(file_no, buff, 10) - buff); + strmov(end-length+1, buff); + + DBUG_PRINT("info", ("Path: '%s' path: 0x%lx", path, (ulong) res)); + DBUG_RETURN(path); } @@ -986,10 +989,11 @@ static void translog_mark_file_finished(uint32 file) { int i; struct st_file_counter *fc_ptr; - DBUG_ENTER("translog_mark_file_finished"); DBUG_PRINT("enter", ("file: %lu", (ulong) file)); + LINT_INIT(fc_ptr); + pthread_mutex_lock(&log_descriptor.unfinished_files_lock); DBUG_ASSERT(log_descriptor.unfinished_files.elements > 0); @@ -2310,7 +2314,7 @@ my_bool translog_unlock() */ static uchar *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, uchar *buffer, - PAGECACHE_PAGE_LINK *direct_link) + PAGECACHE_BLOCK_LINK **direct_link) { TRANSLOG_ADDRESS addr= *(data->addr), in_buffers; uint cache_index; @@ -2490,7 +2494,7 @@ static uchar *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, uchar *buffer, */ -static void translog_free_link(PAGECACHE_PAGE_LINK *direct_link) +static void translog_free_link(PAGECACHE_BLOCK_LINK *direct_link) { DBUG_ENTER("translog_free_link"); DBUG_PRINT("info", ("Direct link: 0x%lx", @@ -5692,7 +5696,7 @@ int translog_read_record_header(LSN lsn, TRANSLOG_HEADER_BUFFER *buff) { uchar buffer[TRANSLOG_PAGE_SIZE], *page; translog_size_t res, page_offset= LSN_OFFSET(lsn) % TRANSLOG_PAGE_SIZE; - PAGECACHE_PAGE_LINK direct_link; + PAGECACHE_BLOCK_LINK *direct_link; TRANSLOG_ADDRESS addr; TRANSLOG_VALIDATOR_DATA data; DBUG_ENTER("translog_read_record_header"); @@ -5963,7 +5967,7 @@ static void translog_destroy_reader_data(struct st_translog_reader_data *data) SYNOPSIS translog_read_record_header() lsn log record serial number (address of the record) - offset From the beginning of the record beginning (read§ + offset From the beginning of the record beginning (read by translog_read_record_header). length Length of record part which have to be read. buffer Buffer where to read the record part (have to be at diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h index c53132916ec..b13984d88ef 100644 --- a/storage/maria/ma_loghandler.h +++ b/storage/maria/ma_loghandler.h @@ -182,8 +182,8 @@ typedef struct st_translog_scanner_data TRANSLOG_ADDRESS horizon; TRANSLOG_ADDRESS last_file_page; /* Last page on in this file */ uchar *page; /* page content pointer */ - /* direct link on the current page or NULL if it is not supported/requested */ - PAGECACHE_PAGE_LINK direct_link; + /* direct link on the current page or NULL if not supported/requested */ + PAGECACHE_BLOCK_LINK *direct_link; /* offset of the chunk in the page */ translog_size_t page_offset; /* set horizon only once at init */ diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 27c9ceaa0f1..4b0ccd2c9c8 100755 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -2755,10 +2755,9 @@ void pagecache_unlock_by_link(PAGECACHE *pagecache, */ void pagecache_unpin_by_link(PAGECACHE *pagecache, - PAGECACHE_PAGE_LINK *link, + PAGECACHE_BLOCK_LINK *block, LSN lsn) { - PAGECACHE_BLOCK_LINK *block= (PAGECACHE_BLOCK_LINK *)link; DBUG_ENTER("pagecache_unpin_by_link"); DBUG_PRINT("enter", ("block: 0x%lx fd: %u page: %lu", (ulong) block, @@ -3212,13 +3211,13 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, enum pagecache_page_lock lock, enum pagecache_page_pin pin, enum pagecache_write_mode write_mode, - PAGECACHE_PAGE_LINK *link, + PAGECACHE_BLOCK_LINK **link, uint offset, uint size, pagecache_disk_read_validator validator, uchar* validator_data) { PAGECACHE_BLOCK_LINK *block= NULL; - PAGECACHE_PAGE_LINK fake_link; + PAGECACHE_BLOCK_LINK *fake_link; int error= 0; int need_lock_change= write_lock_change_table[lock].need_lock_change; DBUG_ENTER("pagecache_write_part"); @@ -3234,10 +3233,10 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, DBUG_ASSERT(lock != PAGECACHE_LOCK_LEFT_READLOCKED); DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK); DBUG_ASSERT(offset + size <= pagecache->block_size); + if (!link) link= &fake_link; - else - *link= 0; + *link= 0; restart: @@ -3362,7 +3361,7 @@ restart: if (pin == PAGECACHE_PIN_LEFT_UNPINNED || pin == PAGECACHE_UNPIN) unreg_request(pagecache, block, 1); else - *link= (PAGECACHE_PAGE_LINK)block; + *link= block; if (block->status & PCBLOCK_ERROR) error= 1; diff --git a/storage/maria/ma_pagecache.h b/storage/maria/ma_pagecache.h index 7318cc08040..23a443a5b97 100644 --- a/storage/maria/ma_pagecache.h +++ b/storage/maria/ma_pagecache.h @@ -91,8 +91,6 @@ typedef struct st_pagecache_page PAGECACHE_PAGE; struct st_pagecache_hash_link; typedef struct st_pagecache_hash_link PAGECACHE_HASH_LINK; -typedef PAGECACHE_BLOCK_LINK * PAGECACHE_PAGE_LINK; /* To be removed */ - #include <wqueue.h> typedef my_bool (*pagecache_disk_read_validator)(uchar *page, uchar *data); @@ -205,7 +203,7 @@ extern my_bool pagecache_write_part(PAGECACHE *pagecache, enum pagecache_page_lock lock, enum pagecache_page_pin pin, enum pagecache_write_mode write_mode, - PAGECACHE_PAGE_LINK *link, + PAGECACHE_BLOCK_LINK **link, uint offset, uint size, pagecache_disk_read_validator validator, @@ -228,7 +226,7 @@ extern void pagecache_unpin(PAGECACHE *pagecache, pgcache_page_no_t pageno, LSN lsn); extern void pagecache_unpin_by_link(PAGECACHE *pagecache, - PAGECACHE_PAGE_LINK *link, + PAGECACHE_BLOCK_LINK *link, LSN lsn); extern int flush_pagecache_blocks(PAGECACHE *keycache, PAGECACHE_FILE *file, diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index adcb35a5e0e..bac83db4f51 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -632,7 +632,7 @@ typedef struct st_maria_s_param /* Used to store reference to pinned page */ typedef struct st_pinned_page { - PAGECACHE_PAGE_LINK link; + PAGECACHE_BLOCK_LINK *link; enum pagecache_page_lock unlock; } MARIA_PINNED_PAGE; |