summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/lockman.c27
-rw-r--r--storage/maria/ma_blockrec.c11
-rw-r--r--storage/maria/ma_check.c36
-rw-r--r--storage/maria/ma_key.c6
-rw-r--r--storage/maria/ma_packrec.c2
-rw-r--r--storage/maria/ma_rkey.c3
-rw-r--r--storage/maria/ma_sort.c3
-rw-r--r--storage/maria/ma_sp_defs.h4
-rw-r--r--storage/maria/ma_sp_key.c4
-rw-r--r--storage/maria/ma_test_all.res91
-rw-r--r--storage/maria/ma_unique.c2
-rw-r--r--storage/maria/tablockman.c6
-rw-r--r--storage/maria/tablockman.h2
-rw-r--r--storage/maria/trnman.c2
-rw-r--r--storage/maria/unittest/lockman2-t.c21
-rw-r--r--storage/maria/unittest/ma_control_file-t.c12
-rw-r--r--storage/maria/unittest/trnman-t.c5
17 files changed, 133 insertions, 104 deletions
diff --git a/storage/maria/lockman.c b/storage/maria/lockman.c
index 7672fadb068..fdacda84875 100644
--- a/storage/maria/lockman.c
+++ b/storage/maria/lockman.c
@@ -1,6 +1,7 @@
-#warning TODO - allocate everything from dynarrays !!! (benchmark)
-#warning TODO instant duration locks
-#warning automatically place S instead of LS if possible
+/* QQ: TODO - allocate everything from dynarrays !!! (benchmark) */
+/* QQ: TODO instant duration locks */
+/* QQ: #warning automatically place S instead of LS if possible */
+
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -218,7 +219,7 @@ typedef struct lockman_lock {
struct lockman_lock *lonext;
intptr volatile link;
uint32 hashnr;
-#warning TODO - remove hashnr from LOCK
+ /* QQ: TODO - remove hashnr from LOCK */
uint16 loid;
uchar lock; /* sizeof(uchar) <= sizeof(enum) */
uchar flags;
@@ -428,9 +429,11 @@ static int lockinsert(LOCK * volatile *head, LOCK *node, LF_PINS *pins,
}
if (res & LOCK_UPGRADE)
cursor.upgrade_from->flags|= IGNORE_ME;
-#warning is this OK ? if a reader has already read upgrade_from, \
- it may find it conflicting with node :(
-#warning another bug - see the last test from test_lockman_simple()
+ /*
+ QQ: is this OK ? if a reader has already read upgrade_from,
+ it may find it conflicting with node :(
+ - see the last test from test_lockman_simple()
+ */
}
} while (res == REPEAT_ONCE_MORE);
@@ -673,7 +676,7 @@ enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo,
belong to _some_ LOCK_OWNER. It means, we can never free() a LOCK_OWNER,
if there're other active LOCK_OWNERs.
*/
-#warning race condition here
+ /* QQ: race condition here */
pthread_mutex_lock(wait_for_lo->mutex);
if (DELETED(blocker->link))
{
@@ -749,7 +752,7 @@ int lockman_release_locks(LOCKMAN *lm, LOCK_OWNER *lo)
}
#ifdef MY_LF_EXTRA_DEBUG
-static char *lock2str[]=
+static const char *lock2str[]=
{ "N", "S", "X", "IS", "IX", "SIX", "LS", "LX", "SLX", "LSIX" };
/*
NOTE
@@ -764,8 +767,9 @@ void print_lockhash(LOCKMAN *lm)
intptr next= el->link;
if (el->hashnr & 1)
{
- printf("0x%08x { resource %llu, loid %u, lock %s",
- el->hashnr, el->resource, el->loid, lock2str[el->lock]);
+ printf("0x%08lx { resource %lu, loid %u, lock %s",
+ (long) el->hashnr, (ulong) el->resource, el->loid,
+ lock2str[el->lock]);
if (el->flags & IGNORE_ME) printf(" IGNORE_ME");
if (el->flags & UPGRADED) printf(" UPGRADED");
if (el->flags & ACTIVE) printf(" ACTIVE");
@@ -781,4 +785,3 @@ void print_lockhash(LOCKMAN *lm)
}
}
#endif
-
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 6eac151d76e..f1345b2c2f3 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -967,7 +967,8 @@ static my_bool write_full_pages(MARIA_HA *info,
my_off_t position;
DBUG_ENTER("write_full_pages");
DBUG_PRINT("enter", ("length: %lu page: %lu page_count: %lu",
- length, (ulong) block->page, block->page_count));
+ (ulong) length, (ulong) block->page,
+ (ulong) block->page_count));
info->keybuff_used= 1;
page= block->page;
@@ -988,7 +989,7 @@ static my_bool write_full_pages(MARIA_HA *info,
page= block->page;
page_count= block->page_count - 1;
DBUG_PRINT("info", ("page: %lu page_count: %lu",
- (ulong) block->page, block->page_count));
+ (ulong) block->page, (ulong) block->page_count));
position= (page + page_count + 1) * block_size;
if (info->state->data_file_length < position)
@@ -2387,18 +2388,18 @@ int _ma_read_block_record2(MARIA_HA *info, byte *record,
blob_buffer+= blob_length;
break;
}
-#ifdef EXTRA_DEBUG
default:
+#ifdef EXTRA_DEBUG
DBUG_ASSERT(0); /* purecov: deadcode */
- goto err;
#endif
+ goto err;
}
continue;
}
if (row_extents)
{
- DBUG_PRINT("info", ("Row read: page_count: %lu extent_count: %lu",
+ DBUG_PRINT("info", ("Row read: page_count: %u extent_count: %u",
extent.page_count, extent.extent_count));
*extent.tail_positions= 0; /* End marker */
if (extent.page_count)
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 682ce276a5b..ccce19de994 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -1078,6 +1078,10 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend,
char llbuff[22],llbuff2[22],llbuff3[22];
DBUG_ENTER("check_dynamic_record");
+ LINT_INIT(left_length);
+ LINT_INIT(start_recpos);
+ LINT_INIT(to);
+
pos= 0;
while (pos < info->state->data_file_length)
{
@@ -1096,7 +1100,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend,
(flag ? 0 : READING_NEXT) | READING_HEADER))
{
_ma_check_print_error(param,
- "got error: %d when reading datafile at position: %s",
+ "got error: %d when reading datafile at "
+ "position: %s",
my_errno, llstr(start_block, llbuff));
DBUG_RETURN(1);
}
@@ -1309,7 +1314,8 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend,
start_recpos= pos;
param->splits++;
VOID(_ma_pack_get_block_info(info, &info->bit_buff, &block_info,
- &info->rec_buff, -1, start_recpos));
+ &info->rec_buff, &info->rec_buff_size, -1,
+ start_recpos));
pos=block_info.filepos+block_info.rec_len;
if (block_info.rec_len < (uint) info->s->min_pack_length ||
block_info.rec_len > (uint) info->s->max_pack_length)
@@ -1727,7 +1733,7 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
param->used= param->link_used= param->splits= param->del_length= 0;
param->tmp_record_checksum= param->glob_crc= 0;
param->err_count= 0;
- LINT_INIT(left_length); LINT_INIT(start_recpos); LINT_INIT(to);
+
error= 0;
param->empty= info->s->pack.header_length;
@@ -2206,7 +2212,7 @@ static int writekeys(MARIA_SORT_PARAM *sort_param)
}
/* Remove checksum that was added to glob_crc in sort_get_next_record */
if (sort_param->calc_checksum)
- sort_param->glob_crc-= info->cur_row.checksum;
+ sort_param->sort_info->param->glob_crc-= info->cur_row.checksum;
DBUG_PRINT("error",("errno: %d",my_errno));
DBUG_RETURN(-1);
} /* writekeys */
@@ -2317,8 +2323,7 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, my_string name)
param->temp_filename);
DBUG_RETURN(-1);
}
- if (new_header_length &&
- maria_filecopy(param, new_file,share->kfile,0L,
+ if (maria_filecopy(param, new_file,share->kfile,0L,
(ulong) share->base.keystart, "headerblock"))
goto err;
@@ -3070,8 +3075,9 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
param->temp_filename);
goto err;
}
- if (maria_filecopy(param, new_file,info->dfile,0L,new_header_length,
- "datafile-header"))
+ if (new_header_length &&
+ maria_filecopy(param, new_file,info->dfile,0L,new_header_length,
+ "datafile-header"))
goto err;
if (param->testflag & T_UNPACK)
restore_data_file_type(share);
@@ -3814,16 +3820,18 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
if (left_length < block_info.data_len || ! block_info.data_len)
{
_ma_check_print_info(param,
- "Found block with too small length at %s; Skipped",
- llstr(sort_param->start_recpos,llbuff));
+ "Found block with too small length at %s; "
+ "Skipped",
+ llstr(sort_param->start_recpos,llbuff));
goto try_next;
}
if (block_info.filepos + block_info.data_len >
sort_param->read_cache.end_of_file)
{
_ma_check_print_info(param,
- "Found block that points outside data file at %s",
- llstr(sort_param->start_recpos,llbuff));
+ "Found block that points outside data file "
+ "at %s",
+ llstr(sort_param->start_recpos,llbuff));
goto try_next;
}
/*
@@ -3923,7 +3931,9 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
}
sort_param->start_recpos=sort_param->pos;
if (_ma_pack_get_block_info(info, &sort_param->bit_buff, &block_info,
- &sort_param->rec_buff, -1, sort_param->pos))
+ &sort_param->rec_buff,
+ &sort_param->rec_buff_size, -1,
+ sort_param->pos))
DBUG_RETURN(-1);
if (!block_info.rec_len &&
sort_param->pos + MEMMAP_EXTRA_MARGIN ==
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index deab2b9c983..036fd305c4d 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -64,7 +64,7 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, byte *key,
TODO: nulls processing
*/
#ifdef HAVE_SPATIAL
- DBUG_RETURN(sp_make_key(info,keynr, key,record,filepos));
+ DBUG_RETURN(_ma_sp_make_key(info,keynr, key,record,filepos));
#else
DBUG_ASSERT(0); /* maria_open should check that this never happens*/
#endif
@@ -113,10 +113,10 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, byte *key,
}
else
{
- byte *end= pos + length;
+ const byte *end= pos + length;
while (pos < end && pos[0] == ' ')
pos++;
- length=(uint) (end-pos);
+ length= (uint) (end-pos);
}
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index 6e481c0bc6d..7c875e7b91d 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -1288,7 +1288,7 @@ _ma_mempack_get_block_info(MARIA_HA *maria,
header+= read_pack_length((uint) maria->s->pack.version, header,
&info->blob_len);
/* _ma_alloc_rec_buff sets my_errno on error */
- if (_ma_alloc_buffer(rec_buff_p, rec_buff_size,
+ if (_ma_alloc_buffer(rec_buff_p, rec_buff_size_p,
info->blob_len + maria->s->base.extra_rec_buff_size))
return 0; /* not enough memory */
bit_buff->blob_pos= (uchar*) *rec_buff_p;
diff --git a/storage/maria/ma_rkey.c b/storage/maria/ma_rkey.c
index 17eae760a3a..ad27d3c286c 100644
--- a/storage/maria/ma_rkey.c
+++ b/storage/maria/ma_rkey.c
@@ -123,7 +123,8 @@ int maria_rkey(MARIA_HA *info, byte *buf, int inx, const byte *key,
value.
*/
if (search_flag == HA_READ_KEY_EXACT &&
- ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
+ ha_key_cmp(keyinfo->seg, (uchar*) key_buff,
+ (uchar*) info->lastkey, use_key_length,
SEARCH_FIND, not_used))
{
my_errno= HA_ERR_KEY_NOT_FOUND;
diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c
index b63f99379ea..9134645f847 100644
--- a/storage/maria/ma_sort.c
+++ b/storage/maria/ma_sort.c
@@ -534,8 +534,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
(ulonglong) info->state->records);
}
my_free((gptr) sinfo->sort_keys,MYF(0));
- my_free(_ma_get_rec_buff_ptr(info, sinfo->rec_buff),
- MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sinfo->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
sinfo->sort_keys=0;
}
diff --git a/storage/maria/ma_sp_defs.h b/storage/maria/ma_sp_defs.h
index 8b9dd204ded..6aac741bb2c 100644
--- a/storage/maria/ma_sp_defs.h
+++ b/storage/maria/ma_sp_defs.h
@@ -41,8 +41,8 @@ enum wkbByteOrder
wkbNDR = 1 /* Little Endian */
};
-uint sp_make_key(register MARIA_HA *info, uint keynr, byte *key,
- const byte *record, my_off_t filepos);
+uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, byte *key,
+ const byte *record, my_off_t filepos);
#endif /*HAVE_SPATIAL*/
#endif /* _SP_DEFS_H */
diff --git a/storage/maria/ma_sp_key.c b/storage/maria/ma_sp_key.c
index 79345550dd9..b365f8deb0f 100644
--- a/storage/maria/ma_sp_key.c
+++ b/storage/maria/ma_sp_key.c
@@ -37,8 +37,8 @@ static void get_double(double *d, const byte *pos)
float8get(*d, pos);
}
-uint sp_make_key(register MARIA_HA *info, uint keynr, byte *key,
- const byte *record, my_off_t filepos)
+uint _ma_sp_make_key(register MARIA_HA *info, uint keynr, byte *key,
+ const byte *record, my_off_t filepos)
{
HA_KEYSEG *keyseg;
MARIA_KEYDEF *keyinfo = &info->s->keyinfo[keynr];
diff --git a/storage/maria/ma_test_all.res b/storage/maria/ma_test_all.res
index 7ffd3378b51..57b0feeeae8 100644
--- a/storage/maria/ma_test_all.res
+++ b/storage/maria/ma_test_all.res
@@ -1,53 +1,62 @@
-maria_chk: MARIA file test1
-maria_chk: warning: Size of indexfile is: 8192 Should be: 16384
-MARIA-table 'test1' is usable but should be fixed
+Running tests with dynamic row format
+Running tests with static row format
+Running tests with block row format
ma_test2 -s -L -K -R1 -m2000 ; Should give error 135
-Error: 135 in write at record: 1105
+Error: 135 in write at record: 1099
got error: 135 when using MARIA-database
+./maria_chk -sm test2 will warn that 'Datafile is almost full'
maria_chk: MARIA file test2
-maria_chk: warning: Datafile is almost full, 65532 of 65534 used
+maria_chk: warning: Datafile is almost full, 65516 of 65534 used
MARIA-table 'test2' is usable but should be fixed
-Commands Used count Errors Recover errors
-open 1 0 0
-write 50 0 0
-update 5 0 0
-delete 50 0 0
-close 1 0 0
-extra 6 0 0
-Total 113 0 0
-Commands Used count Errors Recover errors
-open 2 0 0
-write 100 0 0
-update 10 0 0
-delete 100 0 0
-close 2 0 0
-extra 12 0 0
-Total 226 0 0
-
-real 0m0.994s
-user 0m0.432s
-sys 0m0.184s
-
-real 0m2.153s
-user 0m1.196s
-sys 0m0.228s
-
-real 0m1.483s
-user 0m0.772s
+
+real 0m0.808s
+user 0m0.584s
+sys 0m0.212s
+
+real 0m0.780s
+user 0m0.584s
+sys 0m0.176s
+
+real 0m0.809s
+user 0m0.616s
sys 0m0.180s
-real 0m1.992s
-user 0m1.180s
+real 0m1.356s
+user 0m1.140s
sys 0m0.188s
-real 0m2.028s
+real 0m0.783s
+user 0m0.600s
+sys 0m0.176s
+
+real 0m1.390s
user 0m1.184s
sys 0m0.152s
-real 0m1.878s
-user 0m1.028s
-sys 0m0.136s
+real 0m1.875s
+user 0m1.632s
+sys 0m0.244s
+
+real 0m1.313s
+user 0m1.148s
+sys 0m0.160s
+
+real 0m1.846s
+user 0m1.644s
+sys 0m0.188s
+
+real 0m1.875s
+user 0m1.632s
+sys 0m0.212s
+
+real 0m1.819s
+user 0m1.672s
+sys 0m0.124s
+
+real 0m2.117s
+user 0m1.816s
+sys 0m0.292s
-real 0m1.980s
-user 0m1.116s
-sys 0m0.192s
+real 0m1.871s
+user 0m1.636s
+sys 0m0.196s
diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c
index b79c5558933..5d0133c8ac1 100644
--- a/storage/maria/ma_unique.c
+++ b/storage/maria/ma_unique.c
@@ -26,7 +26,7 @@ my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, byte *record,
MARIA_KEYDEF *key= &info->s->keyinfo[def->key];
byte *key_buff= info->lastkey2;
DBUG_ENTER("_ma_check_unique");
- DBUG_PRINT("enter",("unique_hash: %lu", unique_hash));
+ DBUG_PRINT("enter",("unique_hash: %lu", (ulong) unique_hash));
maria_unique_store(record+key->seg->start, unique_hash);
_ma_make_key(info,def->key,key_buff,record,0);
diff --git a/storage/maria/tablockman.c b/storage/maria/tablockman.c
index d8dffa09a5e..810c6c12ea4 100644
--- a/storage/maria/tablockman.c
+++ b/storage/maria/tablockman.c
@@ -1,5 +1,5 @@
-#warning TODO - allocate everything from dynarrays !!! (benchmark)
-#warning automatically place S instead of LS if possible
+/* QQ: TODO - allocate everything from dynarrays !!! (benchmark) */
+/* QQ: automatically place S instead of LS if possible */
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -219,7 +219,7 @@ static const enum lockman_getlock_result getlock_result[10][10]=
*/
struct st_table_lock {
-#warning do we need upgraded_from ?
+ /* QQ: do we need upgraded_from ? */
struct st_table_lock *next_in_lo, *upgraded_from, *next, *prev;
struct st_locked_table *table;
uint16 loid;
diff --git a/storage/maria/tablockman.h b/storage/maria/tablockman.h
index 4498e7027b4..2c6fb6996a3 100644
--- a/storage/maria/tablockman.h
+++ b/storage/maria/tablockman.h
@@ -33,7 +33,7 @@
LSIX - Loose Shared + Intention eXclusive
*/
#ifndef _lockman_h
-#warning 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_getlock_result {
NO_MEMORY_FOR_LOCK=1, DEADLOCK, LOCK_TIMEOUT,
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index f289f6fcc5b..37978e4ff76 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -351,8 +351,8 @@ void trnman_end_trn(TRN *trn, my_bool commit)
those lists, and thus nobody may want to free them. Now we don't
need a mutex to access free_me list
*/
+ /* QQ: send them to the purge thread */
while (free_me)
-#warning XXX send them to the purge thread
{
TRN *t= free_me;
free_me= free_me->next;
diff --git a/storage/maria/unittest/lockman2-t.c b/storage/maria/unittest/lockman2-t.c
index 2a8090ab9ac..01af1a03d22 100644
--- a/storage/maria/unittest/lockman2-t.c
+++ b/storage/maria/unittest/lockman2-t.c
@@ -171,10 +171,12 @@ void run_test(const char *test, pthread_handler handler, int n, int m)
static void reinit_tlo(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo)
{
+#ifdef NOT_USED_YET
TABLE_LOCK_OWNER backup= *lo;
+#endif
tablockman_release_locks(lm, lo);
- /*
+#ifdef NOT_USED_YET
pthread_mutex_destroy(lo->mutex);
pthread_cond_destroy(lo->cond);
bzero(lo, sizeof(*lo));
@@ -183,7 +185,8 @@ static void reinit_tlo(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo)
lo->cond= backup.cond;
lo->loid= backup.loid;
pthread_mutex_init(lo->mutex, MY_MUTEX_INIT_FAST);
- pthread_cond_init(lo->cond, 0);*/
+ pthread_cond_init(lo->cond, 0);
+#endif
}
pthread_mutex_t rt_mutex;
@@ -191,8 +194,8 @@ int Nrows= 100;
int Ntables= 10;
int table_lock_ratio= 10;
enum lock_type lock_array[6]= {S, X, LS, LX, IS, IX};
-char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
-char *res2str[]= {
+const char *lock2str[6]= {"S", "X", "LS", "LX", "IS", "IX"};
+const char *res2str[]= {
0,
"OUT OF MEMORY",
"DEADLOCK",
@@ -200,6 +203,7 @@ char *res2str[]= {
"GOT THE LOCK",
"GOT THE LOCK NEED TO LOCK A SUBRESOURCE",
"GOT THE LOCK NEED TO INSTANT LOCK A SUBRESOURCE"};
+
pthread_handler_t test_lockman(void *arg)
{
int m= (*(int *)arg);
@@ -215,13 +219,16 @@ pthread_handler_t test_lockman(void *arg)
for (x= ((int)(intptr)(&m)); m > 0; m--)
{
- x= (x*3628273133 + 1500450271) % 9576890767; /* three prime numbers */
+ /* three prime numbers */
+ x= (uint) ((x*LL(3628273133) + LL(1500450271)) % LL(9576890767));
row= x % Nrows + Ntables;
table= row % Ntables;
locklevel= (x/Nrows) & 3;
if (table_lock_ratio && (x/Nrows/4) % table_lock_ratio == 0)
- { /* table lock */
- res= tablockman_getlock(&tablockman, lo1, ltarray+table, lock_array[locklevel]);
+ {
+ /* table lock */
+ res= tablockman_getlock(&tablockman, lo1, ltarray+table,
+ lock_array[locklevel]);
DIAG(("loid %2d, table %d, lock %s, res %s", loid, table,
lock2str[locklevel], res2str[res]));
if (res < GOT_THE_LOCK)
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index beb86843dd3..49575378c78 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -42,7 +42,7 @@ char file_name[FN_REFLEN];
LSN expect_checkpoint_lsn;
uint32 expect_logno;
-static int delete_file();
+static int delete_file(myf my_flags);
/*
Those are test-specific wrappers around the module's API functions: after
calling the module's API functions they perform checks on the result.
@@ -91,7 +91,7 @@ int main(int argc,char *argv[])
get_options(argc,argv);
diag("Deleting control file at startup, if there is an old one");
- RET_ERR_UNLESS(0 == delete_file()); /* if fails, can't continue */
+ RET_ERR_UNLESS(0 == delete_file(0)); /* if fails, can't continue */
diag("Tests of normal conditions");
ok(0 == test_one_log(), "test of creating one log");
@@ -111,7 +111,7 @@ int main(int argc,char *argv[])
}
-static int delete_file()
+static int delete_file(myf my_flags)
{
RET_ERR_UNLESS(fn_format(file_name, CONTROL_FILE_BASE_NAME,
maria_data_root, "", MYF(MY_WME)) != NullS);
@@ -119,7 +119,7 @@ static int delete_file()
Maybe file does not exist, ignore error.
The error will however be printed on stderr.
*/
- my_delete(file_name, MYF(MY_WME));
+ my_delete(file_name, my_flags);
expect_checkpoint_lsn= CONTROL_FILE_IMPOSSIBLE_LSN;
expect_logno= CONTROL_FILE_IMPOSSIBLE_FILENO;
@@ -365,7 +365,7 @@ static int test_bad_size()
int fd;
/* A too short file */
- RET_ERR_UNLESS(delete_file() == 0);
+ RET_ERR_UNLESS(delete_file(MYF(MY_WME)) == 0);
RET_ERR_UNLESS((fd= my_open(file_name,
O_BINARY | O_RDWR | O_CREAT,
MYF(MY_WME))) >= 0);
@@ -378,7 +378,7 @@ static int test_bad_size()
RET_ERR_UNLESS(my_close(fd, MYF(MY_WME)) == 0);
/* Leave a correct control file */
- RET_ERR_UNLESS(delete_file() == 0);
+ RET_ERR_UNLESS(delete_file(MYF(MY_WME)) == 0);
RET_ERR_UNLESS(create_or_open_file() == CONTROL_FILE_OK);
RET_ERR_UNLESS(close_file() == 0);
diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c
index 3c70d10c440..7d97794b685 100644
--- a/storage/maria/unittest/trnman-t.c
+++ b/storage/maria/unittest/trnman-t.c
@@ -35,7 +35,7 @@ int litmus;
pthread_handler_t test_trnman(void *arg)
{
int m= (*(int *)arg);
- uint x, y, i, j, n;
+ uint x, y, i, n;
TRN *trn[MAX_ITER];
pthread_mutex_t mutexes[MAX_ITER];
pthread_cond_t conds[MAX_ITER];
@@ -48,7 +48,7 @@ pthread_handler_t test_trnman(void *arg)
for (x= ((int)(intptr)(&m)); m > 0; )
{
- y= x= (x*3628273133 + 1500450271) % 9576890767; /* three prime numbers */
+ y= x= (x*LL(3628273133) + LL(1500450271)) % LL(9576890767); /* three prime numbers */
m-= n= x % MAX_ITER;
for (i= 0; i < n; i++)
{
@@ -65,7 +65,6 @@ pthread_handler_t test_trnman(void *arg)
trnman_end_trn(trn[i], y & 1);
}
}
-end:
for (i= 0; i < MAX_ITER; i++)
{
pthread_mutex_destroy(&mutexes[i]);