Commit e5858e1f authored by unknown's avatar unknown

postreview fixes

fixed bug in the pagecache which lead to assertion in multithread test


include/pagecache.h:
  post review fixes:
   - comments fixed
   - types fixed
   - keyword 'extern' added to all interface functions
mysys/mf_pagecache.c:
  postreview fixes:
   - comments fixed and added
   - types fixed
   - typo fixed
  Added write locking flag set when we took a block from LRU and going to free it (to prevent locking/using it for write)
mysys/test_pagecache_consist.c:
  pagecache size reduced (to be able reproduce problems found by Guilhem)
  typo in the comment fixed
parent 0cb46440
...@@ -119,14 +119,14 @@ typedef struct st_pagecache ...@@ -119,14 +119,14 @@ typedef struct st_pagecache
ulonglong time; /* total number of block link operations */ ulonglong time; /* total number of block link operations */
uint hash_entries; /* max number of entries in the hash table */ uint hash_entries; /* max number of entries in the hash table */
int hash_links; /* max number of hash links */ int hash_links; /* max number of hash links */
int hash_links_used; /* number of hash links currently used */ int hash_links_used; /* number of hash links taken from free links pool */
int disk_blocks; /* max number of blocks in the cache */ int disk_blocks; /* max number of blocks in the cache */
ulong blocks_used; /* maximum number of concurrently used blocks */ ulong blocks_used; /* maximum number of concurrently used blocks */
ulong blocks_unused; /* number of currently unused blocks */ ulong blocks_unused; /* number of currently unused blocks */
ulong blocks_changed; /* number of currently dirty blocks */ ulong blocks_changed; /* number of currently dirty blocks */
ulong warm_blocks; /* number of blocks in warm sub-chain */ ulong warm_blocks; /* number of blocks in warm sub-chain */
ulong cnt_for_resize_op; /* counter to block resize operation */ ulong cnt_for_resize_op; /* counter to block resize operation */
long blocks_available; /* number of blocks available in the LRU chain */ ulong blocks_available; /* number of blocks available in the LRU chain */
PAGECACHE_HASH_LINK **hash_root;/* arr. of entries into hash table buckets */ PAGECACHE_HASH_LINK **hash_root;/* arr. of entries into hash table buckets */
PAGECACHE_HASH_LINK *hash_link_root;/* memory for hash table links */ PAGECACHE_HASH_LINK *hash_link_root;/* memory for hash table links */
PAGECACHE_HASH_LINK *free_hash_list;/* list of free hash links */ PAGECACHE_HASH_LINK *free_hash_list;/* list of free hash links */
...@@ -194,32 +194,32 @@ extern my_bool pagecache_write(PAGECACHE *pagecache, ...@@ -194,32 +194,32 @@ extern my_bool pagecache_write(PAGECACHE *pagecache,
enum pagecache_page_pin pin, enum pagecache_page_pin pin,
enum pagecache_write_mode write_mode, enum pagecache_write_mode write_mode,
PAGECACHE_PAGE_LINK *link); PAGECACHE_PAGE_LINK *link);
void pagecache_unlock_page(PAGECACHE *pagecache, extern void pagecache_unlock_page(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
maria_page_no_t pageno, maria_page_no_t pageno,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
enum pagecache_page_pin pin, enum pagecache_page_pin pin,
my_bool stamp_this_page, my_bool stamp_this_page,
LSN first_REDO_LSN_for_page); LSN first_REDO_LSN_for_page);
void pagecache_unlock(PAGECACHE *pagecache, extern void pagecache_unlock(PAGECACHE *pagecache,
PAGECACHE_PAGE_LINK *link, PAGECACHE_PAGE_LINK *link,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
enum pagecache_page_pin pin, enum pagecache_page_pin pin,
my_bool stamp_this_page, my_bool stamp_this_page,
LSN first_REDO_LSN_for_page); LSN first_REDO_LSN_for_page);
void pagecache_unpin_page(PAGECACHE *pagecache, extern void pagecache_unpin_page(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
maria_page_no_t pageno); maria_page_no_t pageno);
void pagecache_unpin(PAGECACHE *pagecache, extern void pagecache_unpin(PAGECACHE *pagecache,
PAGECACHE_PAGE_LINK *link); PAGECACHE_PAGE_LINK *link);
extern int flush_pagecache_blocks(PAGECACHE *keycache, extern int flush_pagecache_blocks(PAGECACHE *keycache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
enum flush_type type); enum flush_type type);
my_bool pagecache_delete_page(PAGECACHE *pagecache, extern my_bool pagecache_delete_page(PAGECACHE *pagecache,
PAGECACHE_FILE *file, PAGECACHE_FILE *file,
maria_page_no_t pageno, maria_page_no_t pageno,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
my_bool flush); my_bool flush);
extern void end_pagecache(PAGECACHE *keycache, my_bool cleanup); extern void end_pagecache(PAGECACHE *keycache, my_bool cleanup);
C_MODE_END C_MODE_END
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <my_pthread.h> #include <my_pthread.h>
/*#define PAGE_SIZE 65536*/ /*#define PAGE_SIZE 65536*/
#define PCACHE_SIZE (PAGE_SIZE*1024*20) #define PCACHE_SIZE (PAGE_SIZE*1024*8)
#ifndef DBUG_OFF #ifndef DBUG_OFF
static const char* default_dbug_option; static const char* default_dbug_option;
...@@ -59,7 +59,7 @@ static uint flush_divider= 1000; ...@@ -59,7 +59,7 @@ static uint flush_divider= 1000;
#endif /*TEST_HIGH_CONCURENCY*/ #endif /*TEST_HIGH_CONCURENCY*/
/* check page consistemcy */ /* check page consistency */
uint check_page(uchar *buff, ulong offset, int page_locked, int page_no, uint check_page(uchar *buff, ulong offset, int page_locked, int page_no,
int tag) int tag)
{ {
......
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