mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Fixes for bugs (my_atomic and Maria log handler) observed on
Solaris 10 Sparc 64bit. include/my_atomic.h: Prototypes in the non-inline (extern) case were wrong: they were missing "U_a" i.e. "volatile *". Caused a segfault in my_atomic-t on Solaris10 Sparc 64. storage/maria/ma_loghandler.c: Move "buffer" array up in the struct, to get it aligned on long-boundary so that page cache can use bmove512() (it was not aligned and bmove512() was used, causing SIGBUS on Solaris10 Sparc 64). storage/maria/unittest/ma_pagecache_consist.c: doing *(uint*)(charbuff)=something is not ok on sparc machines, we must use int4store/uint4korr. Fixes a SIGBUS on Solaris10 Sparc 64.
This commit is contained in:
parent
eeb2ec1691
commit
788b95bc72
3 changed files with 30 additions and 20 deletions
|
@ -184,19 +184,19 @@ STATIC_INLINE void my_atomic_store ## S( \
|
|||
#else /* no inline functions */
|
||||
|
||||
#define make_atomic_add(S) \
|
||||
extern int ## S my_atomic_add ## S(Uv_ ## S, U_ ## S);
|
||||
extern int ## S my_atomic_add ## S(Uv_ ## S U_a, U_ ## S U_v);
|
||||
|
||||
#define make_atomic_fas(S) \
|
||||
extern int ## S my_atomic_fas ## S(Uv_ ## S, U_ ## S);
|
||||
extern int ## S my_atomic_fas ## S(Uv_ ## S U_a, U_ ## S U_v);
|
||||
|
||||
#define make_atomic_cas(S) \
|
||||
extern int my_atomic_cas ## S(Uv_ ## S, Uv_ ## S, U_ ## S);
|
||||
extern int my_atomic_cas ## S(Uv_ ## S U_a, Uv_ ## S U_cmp, U_ ## S U_set);
|
||||
|
||||
#define make_atomic_load(S) \
|
||||
extern int ## S my_atomic_load ## S(Uv_ ## S);
|
||||
extern int ## S my_atomic_load ## S(Uv_ ## S U_a);
|
||||
|
||||
#define make_atomic_store(S) \
|
||||
extern void my_atomic_store ## S(Uv_ ## S, U_ ## S);
|
||||
extern void my_atomic_store ## S(Uv_ ## S U_a, U_ ## S U_v);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -84,6 +84,11 @@ typedef struct st_translog_file
|
|||
/* log write buffer descriptor */
|
||||
struct st_translog_buffer
|
||||
{
|
||||
/*
|
||||
Cache for current log. Comes first to be aligned for bmove512() in
|
||||
pagecache_inject()
|
||||
*/
|
||||
uchar buffer[TRANSLOG_WRITE_BUFFER];
|
||||
LSN last_lsn;
|
||||
/* This buffer offset in the file */
|
||||
TRANSLOG_ADDRESS offset;
|
||||
|
@ -148,8 +153,6 @@ struct st_translog_buffer
|
|||
With file and offset it allow detect buffer changes
|
||||
*/
|
||||
uint8 ver;
|
||||
/* Cache for current log. */
|
||||
uchar buffer[TRANSLOG_WRITE_BUFFER];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -102,20 +102,26 @@ static uint get_len(uint limit)
|
|||
}
|
||||
|
||||
|
||||
/* check page consistency */
|
||||
/*
|
||||
Check page's consistency: layout is
|
||||
4 bytes: number 'num' of records in this page, then num occurences of
|
||||
{ 4 bytes: record's length 'len'; then 4 bytes unchecked ('tag') then
|
||||
'len' bytes each equal to the record's sequential number in this page,
|
||||
modulo 256 }, then zeroes.
|
||||
*/
|
||||
uint check_page(uchar *buff, ulong offset, int page_locked, int page_no,
|
||||
int tag)
|
||||
{
|
||||
uint end= sizeof(uint);
|
||||
uint num= *((uint *)buff);
|
||||
uint num= uint4korr(buff);
|
||||
uint i;
|
||||
DBUG_ENTER("check_page");
|
||||
|
||||
for (i= 0; i < num; i++)
|
||||
{
|
||||
uint len= *((uint *)(buff + end));
|
||||
uint len= uint4korr(buff + end);
|
||||
uint j;
|
||||
end+= sizeof(uint) + sizeof(uint);
|
||||
end+= 4 + 4;
|
||||
if (len + end > TEST_PAGE_SIZE)
|
||||
{
|
||||
diag("incorrect field header #%u by offset %lu\n", i, offset + end);
|
||||
|
@ -169,17 +175,18 @@ err:
|
|||
void put_rec(uchar *buff, uint end, uint len, uint tag)
|
||||
{
|
||||
uint i;
|
||||
uint num= *((uint *)buff);
|
||||
uint num;
|
||||
num= uint4korr(buff);
|
||||
if (!len)
|
||||
len= 1;
|
||||
if (end + sizeof(uint)*2 + len > TEST_PAGE_SIZE)
|
||||
if (end + 4*2 + len > TEST_PAGE_SIZE)
|
||||
return;
|
||||
*((uint *)(buff + end))= len;
|
||||
end+= sizeof(uint);
|
||||
*((uint *)(buff + end))= tag;
|
||||
end+= sizeof(uint);
|
||||
int4store(buff + end, len);
|
||||
end+= 4;
|
||||
int4store(buff + end, tag);
|
||||
end+= 4;
|
||||
num++;
|
||||
*((uint *)buff)= num;
|
||||
int4store(buff, num);
|
||||
for (i= end; i < (len + end); i++)
|
||||
{
|
||||
buff[i]= (uchar) num % 256;
|
||||
|
@ -276,7 +283,7 @@ static void *test_thread_reader(void *arg)
|
|||
|
||||
DBUG_PRINT("info", ("Thread %s ended\n", my_thread_name()));
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
ok(1, "reader%d: done\n", param);
|
||||
ok(1, "reader%d: done", param);
|
||||
thread_count--;
|
||||
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
@ -297,7 +304,7 @@ static void *test_thread_writer(void *arg)
|
|||
|
||||
DBUG_PRINT("info", ("Thread %s ended\n", my_thread_name()));
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
ok(1, "writer%d: done\n", param);
|
||||
ok(1, "writer%d: done", param);
|
||||
thread_count--;
|
||||
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
|
Loading…
Add table
Reference in a new issue