Commit 17bda90a authored by unknown's avatar unknown

Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-maria

into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-maria.hasky


storage/maria/ma_key_recover.c:
  Auto merged
parents 4dcbe2cb 40d08699
...@@ -168,15 +168,15 @@ void lf_pinbox_destroy(LF_PINBOX *pinbox); ...@@ -168,15 +168,15 @@ void lf_pinbox_destroy(LF_PINBOX *pinbox);
lock_wrap(lf_pinbox_get_pins, LF_PINS *, lock_wrap(lf_pinbox_get_pins, LF_PINS *,
(LF_PINBOX *pinbox, void *stack_end), (LF_PINBOX *pinbox, void *stack_end),
(pinbox, stack_end), (pinbox, stack_end),
&pinbox->pinarray.lock); &pinbox->pinarray.lock)
lock_wrap_void(lf_pinbox_put_pins, lock_wrap_void(lf_pinbox_put_pins,
(LF_PINS *pins), (LF_PINS *pins),
(pins), (pins),
&pins->pinbox->pinarray.lock); &pins->pinbox->pinarray.lock)
lock_wrap_void(lf_pinbox_free, lock_wrap_void(lf_pinbox_free,
(LF_PINS *pins, void *addr), (LF_PINS *pins, void *addr),
(pins, addr), (pins, addr),
&pins->pinbox->pinarray.lock); &pins->pinbox->pinarray.lock)
/* /*
memory allocator, lf_alloc-pin.c memory allocator, lf_alloc-pin.c
...@@ -211,7 +211,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *allocator); ...@@ -211,7 +211,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *allocator);
lock_wrap(lf_alloc_new, void *, lock_wrap(lf_alloc_new, void *,
(LF_PINS *pins), (LF_PINS *pins),
(pins), (pins),
&pins->pinbox->pinarray.lock); &pins->pinbox->pinarray.lock)
/* /*
extendible hash, lf_hash.c extendible hash, lf_hash.c
......
...@@ -146,7 +146,7 @@ static int lock_compatibility_matrix[10][10]= ...@@ -146,7 +146,7 @@ static int lock_compatibility_matrix[10][10]=
One should never get N from it, we assert the impossibility One should never get N from it, we assert the impossibility
*/ */
static enum lock_type lock_combining_matrix[10][10]= static enum lockman_lock_type lock_combining_matrix[10][10]=
{/* N S X IS IX SIX LS LX SLX LSIX */ {/* N S X IS IX SIX LS LX SLX LSIX */
{ N, S, X, IS, IX, SIX, S, SLX, SLX, SIX}, /* N */ { N, S, X, IS, IX, SIX, S, SLX, SLX, SIX}, /* N */
{ S, S, X, S, SIX, SIX, S, SLX, SLX, SIX}, /* S */ { S, S, X, S, SIX, SIX, S, SLX, SLX, SIX}, /* S */
...@@ -249,7 +249,7 @@ static int lockfind(LOCK * volatile *head, LOCK *node, ...@@ -249,7 +249,7 @@ static int lockfind(LOCK * volatile *head, LOCK *node,
uint64 resource, cur_resource; uint64 resource, cur_resource;
intptr cur_link; intptr cur_link;
my_bool cur_active, compatible, upgrading, prev_active; my_bool cur_active, compatible, upgrading, prev_active;
enum lock_type lock, prev_lock, cur_lock; enum lockman_lock_type lock, prev_lock, cur_lock;
uint16 loid, cur_loid; uint16 loid, cur_loid;
int cur_flags, flags; int cur_flags, flags;
...@@ -596,13 +596,13 @@ static inline uint calc_hash(uint64 resource) ...@@ -596,13 +596,13 @@ static inline uint calc_hash(uint64 resource)
*/ */
enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo, enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo,
uint64 resource, uint64 resource,
enum lock_type lock) enum lockman_lock_type lock)
{ {
int res; int res;
uint csize, bucket, hashnr; uint csize, bucket, hashnr;
LOCK *node, * volatile *el, *blocker; LOCK *node, * volatile *el, *blocker;
LF_PINS *pins= lo->pins; LF_PINS *pins= lo->pins;
enum lock_type old_lock; enum lockman_lock_type old_lock;
DBUG_ASSERT(lo->loid); DBUG_ASSERT(lo->loid);
lf_rwlock_by_pins(pins); lf_rwlock_by_pins(pins);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
SLX - Shared + Loose eXclusive SLX - Shared + Loose eXclusive
LSIX - Loose Shared + Intention eXclusive LSIX - Loose Shared + Intention eXclusive
*/ */
enum lock_type { N, S, X, IS, IX, SIX, LS, LX, SLX, LSIX, LOCK_TYPE_LAST }; enum lockman_lock_type { N, S, X, IS, IX, SIX, LS, LX, SLX, LSIX, LOCK_TYPE_LAST };
struct lockman_lock; struct lockman_lock;
...@@ -66,7 +66,7 @@ void lockman_init(LOCKMAN *, loid_to_lo_func *, uint); ...@@ -66,7 +66,7 @@ void lockman_init(LOCKMAN *, loid_to_lo_func *, uint);
void lockman_destroy(LOCKMAN *); void lockman_destroy(LOCKMAN *);
enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo, enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo,
uint64 resource, uint64 resource,
enum lock_type lock); enum lockman_lock_type lock);
int lockman_release_locks(LOCKMAN *, LOCK_OWNER *); int lockman_release_locks(LOCKMAN *, LOCK_OWNER *);
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
......
...@@ -222,6 +222,7 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file) ...@@ -222,6 +222,7 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file)
bitmap->block_size= share->block_size; bitmap->block_size= share->block_size;
bitmap->file.file= file; bitmap->file.file= file;
bitmap->file.callback_data= (uchar*) share; bitmap->file.callback_data= (uchar*) share;
bitmap->file.write_fail= &maria_page_write_failure;
if (share->temporary) if (share->temporary)
{ {
bitmap->file.read_callback= &maria_page_crc_check_none; bitmap->file.read_callback= &maria_page_crc_check_none;
......
...@@ -5604,11 +5604,13 @@ my_bool create_new_data_handle(MARIA_SORT_PARAM *param, File new_file) ...@@ -5604,11 +5604,13 @@ my_bool create_new_data_handle(MARIA_SORT_PARAM *param, File new_file)
pagecache_file_init(new_info->s->bitmap.file, &maria_page_crc_check_bitmap, pagecache_file_init(new_info->s->bitmap.file, &maria_page_crc_check_bitmap,
(new_info->s->options & HA_OPTION_PAGE_CHECKSUM ? (new_info->s->options & HA_OPTION_PAGE_CHECKSUM ?
&maria_page_crc_set_normal : &maria_page_crc_set_normal :
&maria_page_filler_set_bitmap), new_info->s); &maria_page_filler_set_bitmap),
&maria_page_write_failure, new_info->s);
pagecache_file_init(new_info->dfile, &maria_page_crc_check_data, pagecache_file_init(new_info->dfile, &maria_page_crc_check_data,
(new_info->s->options & HA_OPTION_PAGE_CHECKSUM ? (new_info->s->options & HA_OPTION_PAGE_CHECKSUM ?
&maria_page_crc_set_normal : &maria_page_crc_set_normal :
&maria_page_filler_set_normal), new_info->s); &maria_page_filler_set_normal),
&maria_page_write_failure, new_info->s);
change_data_file_descriptor(new_info, new_file); change_data_file_descriptor(new_info, new_file);
maria_lock_database(new_info, F_EXTRA_LCK); maria_lock_database(new_info, F_EXTRA_LCK);
if ((sort_info->param->testflag & T_UNPACK) && if ((sort_info->param->testflag & T_UNPACK) &&
......
...@@ -1330,6 +1330,17 @@ static my_bool translog_close_log_file(TRANSLOG_FILE *file) ...@@ -1330,6 +1330,17 @@ static my_bool translog_close_log_file(TRANSLOG_FILE *file)
} }
/**
@brief Dummy function for write failure (the log to not use
pagecache writing)
*/
void translog_dummy_write_failure(uchar *data __attribute__((unused)))
{
return;
}
/** /**
@brief Initializes TRANSLOG_FILE structure @brief Initializes TRANSLOG_FILE structure
...@@ -1342,7 +1353,8 @@ static void translog_file_init(TRANSLOG_FILE *file, uint32 number, ...@@ -1342,7 +1353,8 @@ static void translog_file_init(TRANSLOG_FILE *file, uint32 number,
my_bool is_sync) my_bool is_sync)
{ {
pagecache_file_init(file->handler, &translog_page_validator, pagecache_file_init(file->handler, &translog_page_validator,
&translog_dummy_callback, file); &translog_dummy_callback,
&translog_dummy_write_failure, file);
file->number= number; file->number= number;
file->was_recovered= 0; file->was_recovered= 0;
file->is_sync= is_sync; file->is_sync= is_sync;
...@@ -2399,9 +2411,9 @@ static my_bool translog_recover_page_up_to_sector(uchar *page, uint16 offset) ...@@ -2399,9 +2411,9 @@ static my_bool translog_recover_page_up_to_sector(uchar *page, uint16 offset)
*/ */
static my_bool static my_bool
translog_dummy_callback(__attribute__((unused)) uchar *page, translog_dummy_callback(uchar *page __attribute__((unused)),
__attribute__((unused)) pgcache_page_no_t page_no, pgcache_page_no_t page_no __attribute__((unused)),
__attribute__((unused)) uchar* data_ptr) uchar* data_ptr __attribute__((unused)))
{ {
return 0; return 0;
} }
......
...@@ -1538,6 +1538,7 @@ static void set_data_pagecache_callbacks(PAGECACHE_FILE *file, ...@@ -1538,6 +1538,7 @@ static void set_data_pagecache_callbacks(PAGECACHE_FILE *file,
MARIA_SHARE *share) MARIA_SHARE *share)
{ {
file->callback_data= (uchar*) share; file->callback_data= (uchar*) share;
file->write_fail= &maria_page_write_failure;
if (share->temporary) if (share->temporary)
{ {
file->read_callback= &maria_page_crc_check_none; file->read_callback= &maria_page_crc_check_none;
......
...@@ -613,7 +613,10 @@ static uint pagecache_fwrite(PAGECACHE *pagecache, ...@@ -613,7 +613,10 @@ static uint pagecache_fwrite(PAGECACHE *pagecache,
lsn= lsn_korr(buffer + PAGE_LSN_OFFSET); lsn= lsn_korr(buffer + PAGE_LSN_OFFSET);
DBUG_ASSERT(LSN_VALID(lsn)); DBUG_ASSERT(LSN_VALID(lsn));
if (translog_flush(lsn)) if (translog_flush(lsn))
{
(*filedesc->write_fail)(filedesc->callback_data);
DBUG_RETURN(1); DBUG_RETURN(1);
}
} }
DBUG_PRINT("info", ("write_callback: 0x%lx data: 0x%lx", DBUG_PRINT("info", ("write_callback: 0x%lx data: 0x%lx",
(ulong) filedesc->write_callback, (ulong) filedesc->write_callback,
...@@ -624,8 +627,13 @@ static uint pagecache_fwrite(PAGECACHE *pagecache, ...@@ -624,8 +627,13 @@ static uint pagecache_fwrite(PAGECACHE *pagecache,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(my_pwrite(filedesc->file, buffer, pagecache->block_size, if (my_pwrite(filedesc->file, buffer, pagecache->block_size,
(pageno)<<(pagecache->shift), flags)); (pageno)<<(pagecache->shift), flags))
{
(*filedesc->write_fail)(filedesc->callback_data);
DBUG_RETURN(1);
}
DBUG_RETURN(0);
} }
......
...@@ -85,6 +85,7 @@ typedef struct st_pagecache_file ...@@ -85,6 +85,7 @@ typedef struct st_pagecache_file
uchar *data); uchar *data);
my_bool (*write_callback)(uchar *page, pgcache_page_no_t offset, my_bool (*write_callback)(uchar *page, pgcache_page_no_t offset,
uchar *data); uchar *data);
void (*write_fail)(uchar *data);
uchar *callback_data; uchar *callback_data;
} PAGECACHE_FILE; } PAGECACHE_FILE;
...@@ -257,9 +258,10 @@ extern void pagecache_unpin_by_link(PAGECACHE *pagecache, ...@@ -257,9 +258,10 @@ extern void pagecache_unpin_by_link(PAGECACHE *pagecache,
/* PCFLUSH_ERROR and PCFLUSH_PINNED. */ /* PCFLUSH_ERROR and PCFLUSH_PINNED. */
#define PCFLUSH_PINNED_AND_ERROR (PCFLUSH_ERROR|PCFLUSH_PINNED) #define PCFLUSH_PINNED_AND_ERROR (PCFLUSH_ERROR|PCFLUSH_PINNED)
#define pagecache_file_init(F,RC,WC,D) \ #define pagecache_file_init(F,RC,WC,WF,D) \
do{ \ do{ \
(F).read_callback= (RC); (F).write_callback= (WC); \ (F).read_callback= (RC); (F).write_callback= (WC); \
(F).write_fail= (WF); \
(F).callback_data= (uchar*)(D); \ (F).callback_data= (uchar*)(D); \
} while(0) } while(0)
......
...@@ -290,3 +290,13 @@ my_bool maria_page_filler_set_none(uchar *page __attribute__((unused)), ...@@ -290,3 +290,13 @@ my_bool maria_page_filler_set_none(uchar *page __attribute__((unused)),
{ {
return 0; return 0;
} }
/**
@brief Write failure callback (mark table as corrupted)
@param data_ptr Write callback data pointer (pointer to MARIA_SHARE)
*/
void maria_page_write_failure (uchar* data_ptr)
{
maria_mark_crashed_share((MARIA_SHARE *)data_ptr);
}
...@@ -110,7 +110,8 @@ int maria_panic(enum ha_panic_function flag) ...@@ -110,7 +110,8 @@ int maria_panic(enum ha_panic_function flag)
pagecache_file_init(info->s->kfile, &maria_page_crc_check_index, pagecache_file_init(info->s->kfile, &maria_page_crc_check_index,
(info->s->options & HA_OPTION_PAGE_CHECKSUM ? (info->s->options & HA_OPTION_PAGE_CHECKSUM ?
&maria_page_crc_set_index : &maria_page_crc_set_index :
&maria_page_filler_set_normal), info->s); &maria_page_filler_set_normal),
&maria_page_write_failure, info->s);
} }
if (info->dfile.file < 0) if (info->dfile.file < 0)
{ {
...@@ -122,7 +123,8 @@ int maria_panic(enum ha_panic_function flag) ...@@ -122,7 +123,8 @@ int maria_panic(enum ha_panic_function flag)
pagecache_file_init(info->dfile, &maria_page_crc_check_data, pagecache_file_init(info->dfile, &maria_page_crc_check_data,
(share->options & HA_OPTION_PAGE_CHECKSUM ? (share->options & HA_OPTION_PAGE_CHECKSUM ?
&maria_page_crc_set_normal: &maria_page_crc_set_normal:
&maria_page_filler_set_normal), share); &maria_page_filler_set_normal),
&maria_page_write_failure, share);
info->rec_cache.file= info->dfile.file; info->rec_cache.file= info->dfile.file;
} }
} }
......
...@@ -67,7 +67,7 @@ uint warnings; /**< count of warnings */ ...@@ -67,7 +67,7 @@ uint warnings; /**< count of warnings */
#define prototype_redo_exec_hook_dummy(R) \ #define prototype_redo_exec_hook_dummy(R) \
static int exec_REDO_LOGREC_ ## R(const TRANSLOG_HEADER_BUFFER *rec \ static int exec_REDO_LOGREC_ ## R(const TRANSLOG_HEADER_BUFFER *rec \
__attribute ((unused))) __attribute__ ((unused)))
#define prototype_undo_exec_hook(R) \ #define prototype_undo_exec_hook(R) \
static int exec_UNDO_LOGREC_ ## R(const TRANSLOG_HEADER_BUFFER *rec, TRN *trn) static int exec_UNDO_LOGREC_ ## R(const TRANSLOG_HEADER_BUFFER *rec, TRN *trn)
......
...@@ -1673,7 +1673,8 @@ static int maria_sort_records(HA_CHECK *param, ...@@ -1673,7 +1673,8 @@ static int maria_sort_records(HA_CHECK *param,
pagecache_file_init(info->dfile, &maria_page_crc_check_data, pagecache_file_init(info->dfile, &maria_page_crc_check_data,
(share->options & HA_OPTION_PAGE_CHECKSUM ? (share->options & HA_OPTION_PAGE_CHECKSUM ?
&maria_page_crc_set_normal : &maria_page_crc_set_normal :
&maria_page_filler_set_normal), share); &maria_page_filler_set_normal),
&maria_page_write_failure, share);
info->state->del=0; info->state->del=0;
info->state->empty=0; info->state->empty=0;
share->state.dellink= HA_OFFSET_ERROR; share->state.dellink= HA_OFFSET_ERROR;
......
...@@ -1090,4 +1090,6 @@ extern my_bool maria_page_filler_set_normal(uchar *page, ...@@ -1090,4 +1090,6 @@ extern my_bool maria_page_filler_set_normal(uchar *page,
extern my_bool maria_page_filler_set_none(uchar *page, extern my_bool maria_page_filler_set_none(uchar *page,
pgcache_page_no_t page_no, pgcache_page_no_t page_no,
uchar *data_ptr); uchar *data_ptr);
extern void maria_page_write_failure(uchar* data_ptr);
extern PAGECACHE *maria_log_pagecache; extern PAGECACHE *maria_log_pagecache;
...@@ -162,7 +162,7 @@ static const int lock_compatibility_matrix[10][10]= ...@@ -162,7 +162,7 @@ static const int lock_compatibility_matrix[10][10]=
One should never get N from it, we assert the impossibility One should never get N from it, we assert the impossibility
*/ */
static const enum lock_type lock_combining_matrix[10][10]= static const enum lockman_lock_type lock_combining_matrix[10][10]=
{/* N S X IS IX SIX LS LX SLX LSIX */ {/* N S X IS IX SIX LS LX SLX LSIX */
{ N, N, N, N, N, N, N, N, N, N}, /* N */ { N, N, N, N, N, N, N, N, N, N}, /* N */
{ N, S, X, S, SIX, SIX, S, SLX, SLX, SIX}, /* S */ { N, S, X, S, SIX, SIX, S, SLX, SLX, SIX}, /* S */
...@@ -269,13 +269,13 @@ void remove_from_wait_queue(TABLE_LOCK *lock, LOCKED_TABLE *table) ...@@ -269,13 +269,13 @@ void remove_from_wait_queue(TABLE_LOCK *lock, LOCKED_TABLE *table)
*/ */
enum lockman_getlock_result enum lockman_getlock_result
tablockman_getlock(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo, tablockman_getlock(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo,
LOCKED_TABLE *table, enum lock_type lock) LOCKED_TABLE *table, enum lockman_lock_type lock)
{ {
TABLE_LOCK *old, *new, *blocker, *blocker2; TABLE_LOCK *old, *new, *blocker, *blocker2;
TABLE_LOCK_OWNER *wait_for; TABLE_LOCK_OWNER *wait_for;
ulonglong deadline; ulonglong deadline;
struct timespec timeout; struct timespec timeout;
enum lock_type new_lock; enum lockman_lock_type new_lock;
enum lockman_getlock_result res; enum lockman_getlock_result res;
int i; int i;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
*/ */
#ifndef _lockman_h #ifndef _lockman_h
/* QQ: TODO remove N-locks */ /* QQ: TODO remove N-locks */
enum lock_type { N, S, X, IS, IX, SIX, LS, LX, SLX, LSIX, LOCK_TYPE_LAST }; enum lockman_lock_type { N, S, X, IS, IX, SIX, LS, LX, SLX, LSIX, LOCK_TYPE_LAST };
enum lockman_getlock_result { enum lockman_getlock_result {
NO_MEMORY_FOR_LOCK=1, DEADLOCK, LOCK_TIMEOUT, NO_MEMORY_FOR_LOCK=1, DEADLOCK, LOCK_TIMEOUT,
GOT_THE_LOCK, GOT_THE_LOCK,
...@@ -74,7 +74,7 @@ typedef struct { ...@@ -74,7 +74,7 @@ typedef struct {
void tablockman_init(TABLOCKMAN *, loid_to_tlo_func *, uint); void tablockman_init(TABLOCKMAN *, loid_to_tlo_func *, uint);
void tablockman_destroy(TABLOCKMAN *); void tablockman_destroy(TABLOCKMAN *);
enum lockman_getlock_result tablockman_getlock(TABLOCKMAN *, TABLE_LOCK_OWNER *, enum lockman_getlock_result tablockman_getlock(TABLOCKMAN *, TABLE_LOCK_OWNER *,
LOCKED_TABLE *, enum lock_type); LOCKED_TABLE *, enum lockman_lock_type);
void tablockman_release_locks(TABLOCKMAN *, TABLE_LOCK_OWNER *); void tablockman_release_locks(TABLOCKMAN *, TABLE_LOCK_OWNER *);
void tablockman_init_locked_table(LOCKED_TABLE *, int); void tablockman_init_locked_table(LOCKED_TABLE *, int);
void tablockman_destroy_locked_table(LOCKED_TABLE *); void tablockman_destroy_locked_table(LOCKED_TABLE *);
......
...@@ -157,7 +157,7 @@ pthread_mutex_t rt_mutex; ...@@ -157,7 +157,7 @@ pthread_mutex_t rt_mutex;
int Nrows= 100; int Nrows= 100;
int Ntables= 10; int Ntables= 10;
int table_lock_ratio= 10; int table_lock_ratio= 10;
enum lock_type lock_array[6]= {S, X, LS, LX, IS, IX}; enum lockman_lock_type lock_array[6]= {S, X, LS, LX, IS, IX};
char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"}; char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
char *res2str[4]= { char *res2str[4]= {
"DIDN'T GET THE LOCK", "DIDN'T GET THE LOCK",
......
...@@ -166,7 +166,7 @@ pthread_mutex_t rt_mutex; ...@@ -166,7 +166,7 @@ pthread_mutex_t rt_mutex;
int Nrows= 100; int Nrows= 100;
int Ntables= 10; int Ntables= 10;
int table_lock_ratio= 10; int table_lock_ratio= 10;
enum lock_type lock_array[6]= {S, X, LS, LX, IS, IX}; enum lockman_lock_type lock_array[6]= {S, X, LS, LX, IS, IX};
char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"}; char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
char *res2str[]= { char *res2str[]= {
"DIDN'T GET THE LOCK", "DIDN'T GET THE LOCK",
......
...@@ -193,7 +193,7 @@ pthread_mutex_t rt_mutex; ...@@ -193,7 +193,7 @@ pthread_mutex_t rt_mutex;
int Nrows= 100; int Nrows= 100;
int Ntables= 10; int Ntables= 10;
int table_lock_ratio= 10; int table_lock_ratio= 10;
enum lock_type lock_array[6]= {S, X, LS, LX, IS, IX}; enum lockman_lock_type lock_array[6]= {S, X, LS, LX, IS, IX};
const char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"}; const char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
const char *res2str[]= { const char *res2str[]= {
0, 0,
......
...@@ -57,19 +57,31 @@ static uint flush_divider= 1000; ...@@ -57,19 +57,31 @@ static uint flush_divider= 1000;
#endif /*TEST_READERS*/ #endif /*TEST_READERS*/
#endif /*TEST_HIGH_CONCURENCY*/ #endif /*TEST_HIGH_CONCURENCY*/
/** /**
@brief Dummy pagecache callback. @brief Dummy pagecache callback.
*/ */
static my_bool static my_bool
dummy_callback(__attribute__((unused)) uchar *page, dummy_callback(uchar *page __attribute__((unused)),
__attribute__((unused)) pgcache_page_no_t page_no, pgcache_page_no_t page_no __attribute__((unused)),
__attribute__((unused)) uchar* data_ptr) uchar* data_ptr __attribute__((unused)))
{ {
return 0; return 0;
} }
/**
@brief Dummy pagecache callback.
*/
static void
dummy_fail_callback(uchar* data_ptr __attribute__((unused)))
{
return;
}
/* /*
Get pseudo-random length of the field in (0;limit) Get pseudo-random length of the field in (0;limit)
...@@ -333,7 +345,8 @@ int main(int argc __attribute__((unused)), ...@@ -333,7 +345,8 @@ int main(int argc __attribute__((unused)),
errno); errno);
exit(1); exit(1);
} }
pagecache_file_init(file1, &dummy_callback, &dummy_callback, NULL); pagecache_file_init(file1, &dummy_callback, &dummy_callback,
&dummy_fail_callback, NULL);
DBUG_PRINT("info", ("file1: %d", file1.file)); DBUG_PRINT("info", ("file1: %d", file1.file));
if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0) if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0)
{ {
......
...@@ -60,19 +60,30 @@ static struct file_desc simple_delete_flush_test_file[]= ...@@ -60,19 +60,30 @@ static struct file_desc simple_delete_flush_test_file[]=
{ 0, 0} { 0, 0}
}; };
/** /**
@brief Dummy pagecache callback. @brief Dummy pagecache callback.
*/ */
static my_bool static my_bool
dummy_callback(__attribute__((unused)) uchar *page, dummy_callback(uchar *page __attribute__((unused)),
__attribute__((unused)) pgcache_page_no_t page_no, pgcache_page_no_t page_no __attribute__((unused)),
__attribute__((unused)) uchar* data_ptr) uchar* data_ptr __attribute__((unused)))
{ {
return 0; return 0;
} }
/**
@brief Dummy pagecache callback.
*/
static void
dummy_fail_callback(uchar* data_ptr __attribute__((unused)))
{
return;
}
/* /*
Recreate and reopen a file for test Recreate and reopen a file for test
...@@ -520,7 +531,8 @@ int main(int argc __attribute__((unused)), ...@@ -520,7 +531,8 @@ int main(int argc __attribute__((unused)),
errno); errno);
exit(1); exit(1);
} }
pagecache_file_init(file1, &dummy_callback, &dummy_callback, NULL); pagecache_file_init(file1, &dummy_callback, &dummy_callback,
&dummy_fail_callback, NULL);
my_close(tmp_file, MYF(0)); my_close(tmp_file, MYF(0));
my_delete(file2_name, MYF(0)); my_delete(file2_name, MYF(0));
......
...@@ -20,19 +20,31 @@ static char *first_translog_file= (char*)"maria_log.00000001"; ...@@ -20,19 +20,31 @@ static char *first_translog_file= (char*)"maria_log.00000001";
static char *file1_name= (char*)"page_cache_test_file_1"; static char *file1_name= (char*)"page_cache_test_file_1";
static PAGECACHE_FILE file1; static PAGECACHE_FILE file1;
/** /**
@brief Dummy pagecache callback. @brief Dummy pagecache callback.
*/ */
static my_bool static my_bool
dummy_callback(__attribute__((unused)) uchar *page, dummy_callback(uchar *page __attribute__((unused)),
__attribute__((unused)) pgcache_page_no_t page_no, pgcache_page_no_t page_no __attribute__((unused)),
__attribute__((unused)) uchar* data_ptr) uchar* data_ptr __attribute__((unused)))
{ {
return 0; return 0;
} }
/**
@brief Dummy pagecache callback.
*/
static void
dummy_fail_callback(uchar* data_ptr __attribute__((unused)))
{
return;
}
int main(int argc __attribute__((unused)), char *argv[]) int main(int argc __attribute__((unused)), char *argv[])
{ {
uint pagen; uint pagen;
...@@ -124,7 +136,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -124,7 +136,8 @@ int main(int argc __attribute__((unused)), char *argv[])
errno); errno);
exit(1); exit(1);
} }
pagecache_file_init(file1, &dummy_callback, &dummy_callback, NULL); pagecache_file_init(file1, &dummy_callback, &dummy_callback,
&dummy_fail_callback, NULL);
if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0) if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0)
{ {
fprintf(stderr, "Got error during file1 chmod() (errno: %d)\n", fprintf(stderr, "Got error during file1 chmod() (errno: %d)\n",
......
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