mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
compiler warnings
trnman: remove old lockman code trnman: replace trid_to_committed_trn hash with trid_to_trn storage/maria/ma_blockrec.c: compiler warnings storage/maria/ma_loghandler.c: compiler warnings storage/maria/ma_write.c: compiler warnings storage/maria/trnman.c: remove old lockman code replace trid_to_committed_trn hash with trid_to_trn storage/maria/trnman.h: remove old lockman code replace trid_to_committed_trn hash with trid_to_trn storage/maria/unittest/ma_test_loghandler-t.c: compiler warnings storage/maria/unittest/ma_test_loghandler_multigroup-t.c: compiler warnings storage/maria/unittest/ma_test_loghandler_multithread-t.c: compiler warnings
This commit is contained in:
parent
01ecf1f36b
commit
8347290482
8 changed files with 72 additions and 142 deletions
|
@ -3094,7 +3094,7 @@ static my_bool write_block_record(MARIA_HA *info,
|
|||
info->rec_buff);
|
||||
log_pos= store_page_range(log_pos, head_block+1, block_size,
|
||||
(ulong) block_length, &extents);
|
||||
log_array_pos->str= (char*) info->rec_buff;
|
||||
log_array_pos->str= info->rec_buff;
|
||||
log_array_pos->length= block_length;
|
||||
log_entry_length+= block_length;
|
||||
log_array_pos++;
|
||||
|
@ -5408,7 +5408,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
|
|||
log_parts++;
|
||||
|
||||
/* Stored bitmap over packed (zero length or all-zero fields) */
|
||||
log_parts->str= (char *) info->cur_row.empty_bits;
|
||||
log_parts->str= info->cur_row.empty_bits;
|
||||
log_parts->length= share->base.pack_bytes;
|
||||
row_length+= log_parts->length;
|
||||
log_parts++;
|
||||
|
@ -5416,7 +5416,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
|
|||
if (share->base.max_field_lengths)
|
||||
{
|
||||
/* Store length of all not empty char, varchar and blob fields */
|
||||
log_parts->str= (char *) field_lengths - 2;
|
||||
log_parts->str= field_lengths - 2;
|
||||
log_parts->length= info->cur_row.field_lengths_length+2;
|
||||
int2store(log_parts->str, info->cur_row.field_lengths_length);
|
||||
row_length+= log_parts->length;
|
||||
|
@ -5428,8 +5428,8 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
|
|||
/*
|
||||
Store total blob length to make buffer allocation easier during UNDO
|
||||
*/
|
||||
log_parts->str= (char *) info->length_buff;
|
||||
log_parts->length= (uint) (ma_store_length((uchar *) log_parts->str,
|
||||
log_parts->str= info->length_buff;
|
||||
log_parts->length= (uint) (ma_store_length((uchar *) log_parts->str,
|
||||
info->cur_row.blob_length) -
|
||||
(uchar*) log_parts->str);
|
||||
row_length+= log_parts->length;
|
||||
|
@ -5442,7 +5442,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
|
|||
column < end_column;
|
||||
column++)
|
||||
{
|
||||
log_parts->str= (char*) record + column->offset;
|
||||
log_parts->str= record + column->offset;
|
||||
log_parts->length= column->length;
|
||||
row_length+= log_parts->length;
|
||||
log_parts++;
|
||||
|
@ -5493,7 +5493,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
|
|||
default:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
log_parts->str= (char*) column_pos;
|
||||
log_parts->str= column_pos;
|
||||
log_parts->length= column_length;
|
||||
row_length+= log_parts->length;
|
||||
log_parts++;
|
||||
|
@ -5512,8 +5512,8 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
|
|||
*/
|
||||
if (blob_length)
|
||||
{
|
||||
char *blob_pos;
|
||||
memcpy_fixed((uchar*) &blob_pos, record + column->offset + size_length,
|
||||
uchar *blob_pos;
|
||||
memcpy_fixed(&blob_pos, record + column->offset + size_length,
|
||||
sizeof(blob_pos));
|
||||
log_parts->str= blob_pos;
|
||||
log_parts->length= blob_length;
|
||||
|
@ -5612,7 +5612,7 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
|
|||
{
|
||||
field_data= ma_store_length(field_data,
|
||||
(uint) (column - share->columndef));
|
||||
log_parts->str= (char*) oldrec + column->offset;
|
||||
log_parts->str= oldrec + column->offset;
|
||||
log_parts->length= column->length;
|
||||
row_length+= column->length;
|
||||
log_parts++;
|
||||
|
@ -5719,7 +5719,7 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
|
|||
(ulong) (column - share->columndef));
|
||||
field_data= ma_store_length(field_data, (ulong) old_column_length);
|
||||
|
||||
log_parts->str= (char*) old_column_pos;
|
||||
log_parts->str= old_column_pos;
|
||||
log_parts->length= old_column_length;
|
||||
row_length+= old_column_length;
|
||||
log_parts++;
|
||||
|
@ -5730,10 +5730,9 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
|
|||
|
||||
/* Store length of field length data before the field/field_lengths */
|
||||
field_lengths= (uint) (field_data - start_field_data);
|
||||
start_log_parts->str= ((char*)
|
||||
(start_field_data -
|
||||
start_log_parts->str= ((start_field_data -
|
||||
ma_calc_length_for_store_length(field_lengths)));
|
||||
ma_store_length((uchar *) start_log_parts->str, field_lengths);
|
||||
ma_store_length((uchar*)start_log_parts->str, field_lengths);
|
||||
start_log_parts->length= (size_t) (field_data - start_log_parts->str);
|
||||
row_length+= start_log_parts->length;
|
||||
DBUG_RETURN(row_length);
|
||||
|
|
|
@ -5172,9 +5172,9 @@ static void translog_relative_LSN_encode(struct st_translog_parts *parts,
|
|||
{
|
||||
LEX_CUSTRING *part;
|
||||
uint lsns_len= lsns * LSN_STORE_SIZE;
|
||||
char buffer_src[MAX_NUMBER_OF_LSNS_PER_RECORD * LSN_STORE_SIZE];
|
||||
char *buffer= buffer_src;
|
||||
const char *cbuffer;
|
||||
uchar buffer_src[MAX_NUMBER_OF_LSNS_PER_RECORD * LSN_STORE_SIZE];
|
||||
uchar *buffer= buffer_src;
|
||||
const uchar *cbuffer;
|
||||
|
||||
DBUG_ENTER("translog_relative_LSN_encode");
|
||||
|
||||
|
@ -5249,7 +5249,7 @@ static void translog_relative_LSN_encode(struct st_translog_parts *parts,
|
|||
DBUG_PRINT("info", ("new length of LSNs: %lu economy: %d",
|
||||
(ulong)part->length, economy));
|
||||
parts->total_record_length-= economy;
|
||||
part->str= (char*)dst_ptr;
|
||||
part->str= dst_ptr;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -5959,7 +5959,7 @@ static my_bool translog_write_fixed_record(LSN *lsn,
|
|||
DBUG_ASSERT(parts->current != 0); /* first part is left for header */
|
||||
part= parts->parts + (--parts->current);
|
||||
parts->total_record_length+= (translog_size_t) (part->length= 1 + 2);
|
||||
part->str= (char*)chunk1_header;
|
||||
part->str= chunk1_header;
|
||||
*chunk1_header= (uchar) (type | TRANSLOG_CHUNK_FIXED);
|
||||
int2store(chunk1_header + 1, short_trid);
|
||||
|
||||
|
@ -7717,7 +7717,7 @@ int translog_assign_id_to_share(MARIA_HA *tbl_info, TRN *trn)
|
|||
is not realpath-ed, etc) which is good: the log can be moved to another
|
||||
directory and continue working.
|
||||
*/
|
||||
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= share->open_file_name;
|
||||
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= (uchar*)share->open_file_name;
|
||||
/**
|
||||
@todo if we had the name's length in MARIA_SHARE we could avoid this
|
||||
strlen()
|
||||
|
|
|
@ -1826,7 +1826,7 @@ my_bool _ma_log_change(MARIA_HA *info, my_off_t page, const uchar *buff,
|
|||
log_pos[0]= KEY_OP_CHECK;
|
||||
int2store(log_pos+1, page_length);
|
||||
int4store(log_pos+3, crc);
|
||||
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= (char *) log_pos;
|
||||
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos;
|
||||
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
|
||||
extra_length+= 7;
|
||||
translog_parts++;
|
||||
|
|
|
@ -44,7 +44,7 @@ static pthread_mutex_t LOCK_trn_list;
|
|||
static TRN *pool;
|
||||
|
||||
/* a hash for committed transactions that maps trid to a TRN structure */
|
||||
static LF_HASH trid_to_committed_trn;
|
||||
static LF_HASH trid_to_trn;
|
||||
|
||||
/* an array that maps short_trid of an active transaction to a TRN structure */
|
||||
static TRN **short_trid_to_active_trn;
|
||||
|
@ -92,24 +92,6 @@ default_trnman_end_trans_hook(TRN *trn __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
NOTE
|
||||
Just as short_id doubles as loid, this function doubles as
|
||||
short_trid_to_LOCK_OWNER. See the compile-time assert below.
|
||||
*/
|
||||
|
||||
#ifdef NOT_USED
|
||||
static TRN *short_trid_to_TRN(uint16 short_trid)
|
||||
{
|
||||
TRN *trn;
|
||||
compile_time_assert(offsetof(TRN, locks) == 0);
|
||||
my_atomic_rwlock_rdlock(&LOCK_short_trid_to_trn);
|
||||
trn= my_atomic_loadptr((void **)&short_trid_to_active_trn[short_trid]);
|
||||
my_atomic_rwlock_rdunlock(&LOCK_short_trid_to_trn);
|
||||
return (TRN *)trn;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uchar *trn_get_hash_key(const uchar *trn, size_t *len,
|
||||
my_bool unused __attribute__ ((unused)))
|
||||
{
|
||||
|
@ -165,17 +147,13 @@ int trnman_init(TrID initial_trid)
|
|||
|
||||
pool= 0;
|
||||
global_trid_generator= initial_trid;
|
||||
lf_hash_init(&trid_to_committed_trn, sizeof(TRN*), LF_HASH_UNIQUE,
|
||||
lf_hash_init(&trid_to_trn, sizeof(TRN*), LF_HASH_UNIQUE,
|
||||
0, 0, trn_get_hash_key, 0);
|
||||
DBUG_PRINT("info", ("pthread_mutex_init LOCK_trn_list"));
|
||||
pthread_mutex_init(&LOCK_trn_list, MY_MUTEX_INIT_FAST);
|
||||
my_atomic_rwlock_init(&LOCK_short_trid_to_trn);
|
||||
my_atomic_rwlock_init(&LOCK_pool);
|
||||
|
||||
#ifdef NOT_USED
|
||||
lockman_init(&maria_lockman, (loid_to_lo_func *)&short_trid_to_TRN, 10000);
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -190,7 +168,7 @@ void trnman_destroy()
|
|||
|
||||
if (short_trid_to_active_trn == NULL) /* trnman already destroyed */
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_ASSERT(trid_to_committed_trn.count == 0);
|
||||
DBUG_ASSERT(trid_to_trn.count == 0);
|
||||
DBUG_ASSERT(trnman_active_transactions == 0);
|
||||
DBUG_ASSERT(trnman_committed_transactions == 0);
|
||||
DBUG_ASSERT(active_list_max.prev == &active_list_min);
|
||||
|
@ -201,20 +179,15 @@ void trnman_destroy()
|
|||
{
|
||||
TRN *trn= pool;
|
||||
pool= pool->next;
|
||||
DBUG_ASSERT(trn->locks.mutex == 0);
|
||||
DBUG_ASSERT(trn->locks.cond == 0);
|
||||
my_free((void *)trn, MYF(0));
|
||||
}
|
||||
lf_hash_destroy(&trid_to_committed_trn);
|
||||
lf_hash_destroy(&trid_to_trn);
|
||||
DBUG_PRINT("info", ("pthread_mutex_destroy LOCK_trn_list"));
|
||||
pthread_mutex_destroy(&LOCK_trn_list);
|
||||
my_atomic_rwlock_destroy(&LOCK_short_trid_to_trn);
|
||||
my_atomic_rwlock_destroy(&LOCK_pool);
|
||||
my_free((void *)(short_trid_to_active_trn+1), MYF(0));
|
||||
short_trid_to_active_trn= NULL;
|
||||
#ifdef NOT_USED
|
||||
lockman_destroy(&maria_lockman);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -262,6 +235,7 @@ static void set_short_trid(TRN *trn)
|
|||
|
||||
TRN *trnman_new_trn(pthread_mutex_t *mutex, pthread_cond_t *cond)
|
||||
{
|
||||
int res;
|
||||
TRN *trn;
|
||||
DBUG_ENTER("trnman_new_trn");
|
||||
|
||||
|
@ -307,7 +281,7 @@ TRN *trnman_new_trn(pthread_mutex_t *mutex, pthread_cond_t *cond)
|
|||
}
|
||||
trnman_allocated_transactions++;
|
||||
}
|
||||
trn->pins= lf_hash_get_pins(&trid_to_committed_trn);
|
||||
trn->pins= lf_hash_get_pins(&trid_to_trn);
|
||||
if (!trn->pins)
|
||||
{
|
||||
trnman_free_trn(trn);
|
||||
|
@ -336,18 +310,10 @@ TRN *trnman_new_trn(pthread_mutex_t *mutex, pthread_cond_t *cond)
|
|||
trn->min_read_from= trn->trid + 1;
|
||||
}
|
||||
|
||||
trn->commit_trid= 0;
|
||||
trn->commit_trid= ~(TrID)0;
|
||||
trn->rec_lsn= trn->undo_lsn= trn->first_undo_lsn= 0;
|
||||
trn->used_tables= 0;
|
||||
|
||||
trn->locks.mutex= mutex;
|
||||
trn->locks.cond= cond;
|
||||
trn->locks.waiting_for= 0;
|
||||
trn->locks.all_locks= 0;
|
||||
#ifdef NOT_USED
|
||||
trn->locks.pins= lf_alloc_get_pins(&maria_lockman.alloc);
|
||||
#endif
|
||||
|
||||
trn->locked_tables= 0;
|
||||
|
||||
/*
|
||||
|
@ -356,6 +322,14 @@ TRN *trnman_new_trn(pthread_mutex_t *mutex, pthread_cond_t *cond)
|
|||
*/
|
||||
set_short_trid(trn);
|
||||
|
||||
res= lf_hash_insert(&trid_to_trn, trn->pins, &trn);
|
||||
DBUG_ASSERT(res <= 0);
|
||||
if (res)
|
||||
{
|
||||
trnman_end_trn(trn, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DBUG_PRINT("exit", ("trn: x%lx trid: 0x%lu",
|
||||
(ulong) trn, (ulong) trn->trid));
|
||||
|
||||
|
@ -424,7 +398,7 @@ my_bool trnman_end_trn(TRN *trn, my_bool commit)
|
|||
|
||||
/*
|
||||
if transaction is committed and it was not the only active transaction -
|
||||
add it to the committed list (which is used for read-from relation)
|
||||
add it to the committed list
|
||||
*/
|
||||
if (commit && active_list_min.next != &active_list_max)
|
||||
{
|
||||
|
@ -432,35 +406,12 @@ my_bool trnman_end_trn(TRN *trn, my_bool commit)
|
|||
trn->next= &committed_list_max;
|
||||
trn->prev= committed_list_max.prev;
|
||||
trnman_committed_transactions++;
|
||||
|
||||
res= lf_hash_insert(&trid_to_committed_trn, pins, &trn);
|
||||
/*
|
||||
By going on with life is res<0, we let other threads block on
|
||||
our rows (because they will never see us committed in
|
||||
trid_to_committed_trn) until they timeout. Though correct, this is not a
|
||||
good situation:
|
||||
- if connection reconnects and wants to check if its rows have been
|
||||
committed, it will not be able to do that (it will just lock on them) so
|
||||
connection stays permanently in doubt
|
||||
- internal structures trid_to_committed_trn and committed_list are
|
||||
desynchronized.
|
||||
So we should take Maria down immediately, the two problems being
|
||||
automatically solved at restart.
|
||||
*/
|
||||
DBUG_ASSERT(res <= 0);
|
||||
}
|
||||
if (res)
|
||||
{
|
||||
/*
|
||||
res == 1 means the condition in the if() above was false.
|
||||
res == -1 means lf_hash_insert failed
|
||||
*/
|
||||
trn->next= free_me;
|
||||
free_me= trn;
|
||||
committed_list_max.prev= trn->prev->next= trn;
|
||||
}
|
||||
else
|
||||
{
|
||||
committed_list_max.prev= trn->prev->next= trn;
|
||||
trn->next= free_me;
|
||||
free_me= trn;
|
||||
}
|
||||
if ((*trnman_end_trans_hook)(trn, commit,
|
||||
active_list_min.next != &active_list_max))
|
||||
|
@ -469,11 +420,6 @@ my_bool trnman_end_trn(TRN *trn, my_bool commit)
|
|||
pthread_mutex_unlock(&LOCK_trn_list);
|
||||
|
||||
/* the rest is done outside of a critical section */
|
||||
#ifdef NOT_USED
|
||||
lockman_release_locks(&maria_lockman, &trn->locks);
|
||||
#endif
|
||||
trn->locks.mutex= 0;
|
||||
trn->locks.cond= 0;
|
||||
my_atomic_rwlock_rdlock(&LOCK_short_trid_to_trn);
|
||||
my_atomic_storeptr((void **)&short_trid_to_active_trn[trn->short_id], 0);
|
||||
my_atomic_rwlock_rdunlock(&LOCK_short_trid_to_trn);
|
||||
|
@ -493,15 +439,12 @@ my_bool trnman_end_trn(TRN *trn, my_bool commit)
|
|||
/*
|
||||
ignore OOM here. it's harmless, and there's nothing we could do, anyway
|
||||
*/
|
||||
(void)lf_hash_delete(&trid_to_committed_trn, pins, &t->trid, sizeof(TrID));
|
||||
(void)lf_hash_delete(&trid_to_trn, pins, &t->trid, sizeof(TrID));
|
||||
|
||||
trnman_free_trn(t);
|
||||
}
|
||||
|
||||
lf_hash_put_pins(pins);
|
||||
#ifdef NOT_USED
|
||||
lf_pinbox_put_pins(trn->locks.pins);
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(res < 0);
|
||||
}
|
||||
|
@ -579,9 +522,9 @@ int trnman_can_read_from(TRN *trn, TrID trid)
|
|||
return trid == trn->trid;
|
||||
}
|
||||
|
||||
found= lf_hash_search(&trid_to_committed_trn, trn->pins, &trid, sizeof(trid));
|
||||
found= lf_hash_search(&trid_to_trn, trn->pins, &trid, sizeof(trid));
|
||||
if (found == NULL)
|
||||
return 0; /* not in the hash of committed transactions = cannot read */
|
||||
return 0; /* not in the hash of transactions = cannot read */
|
||||
if (found == MY_ERRPTR)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
C_MODE_START
|
||||
|
||||
#include <lf.h>
|
||||
#include "lockman.h"
|
||||
#include "trnman_public.h"
|
||||
#include "ma_loghandler_lsn.h"
|
||||
|
||||
|
@ -32,16 +31,8 @@ C_MODE_START
|
|||
transaction, is reassigned when transaction ends.
|
||||
*/
|
||||
|
||||
/*
|
||||
short transaction id is at the same time its identifier
|
||||
for a lock manager - its lock owner identifier (loid)
|
||||
*/
|
||||
|
||||
#define short_id locks.loid
|
||||
|
||||
struct st_transaction
|
||||
{
|
||||
LOCK_OWNER locks; /* must be the first! see short_trid_to_TRN() */
|
||||
LF_PINS *pins;
|
||||
void *used_tables; /* Tables used by transaction */
|
||||
TRN *next, *prev;
|
||||
|
@ -49,7 +40,8 @@ struct st_transaction
|
|||
LSN rec_lsn, undo_lsn;
|
||||
LSN_WITH_FLAGS first_undo_lsn;
|
||||
uint locked_tables;
|
||||
/* Note! if locks.loid is 0, trn is NOT initialized */
|
||||
uint16 short_id;
|
||||
/* Note! if short_id is 0, trn is NOT initialized */
|
||||
};
|
||||
|
||||
#define TRANSACTION_LOGGED_LONG_ID ULL(0x8000000000000000)
|
||||
|
|
|
@ -227,7 +227,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
long_tr_id[5]= 0xff;
|
||||
|
||||
int4store(long_tr_id, 0);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
|
||||
trn->short_id= 0;
|
||||
trn->first_undo_lsn= TRANSACTION_LOGGED_LONG_ID;
|
||||
|
@ -250,7 +250,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
if (i % 2)
|
||||
{
|
||||
lsn_store(lsn_buff, lsn_base);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE;
|
||||
/* check auto-count feature */
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= NULL;
|
||||
|
@ -268,9 +268,9 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
lsn_store(lsn_buff, lsn_base);
|
||||
if ((rec_len= rand_buffer_size()) < 12)
|
||||
rec_len= 12;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
|
||||
/* check record length auto-counting */
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -290,7 +290,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
{
|
||||
lsn_store(lsn_buff, lsn_base);
|
||||
lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 23;
|
||||
if (translog_write_record(&lsn,
|
||||
LOGREC_FIXED_RECORD_2LSN_EXAMPLE,
|
||||
|
@ -308,9 +308,9 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn);
|
||||
if ((rec_len= rand_buffer_size()) < 19)
|
||||
rec_len= 19;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 14;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
|
||||
if (translog_write_record(&lsn,
|
||||
LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE,
|
||||
|
@ -327,7 +327,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
ok(1, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
|
||||
}
|
||||
int4store(long_tr_id, i);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
|
||||
if (translog_write_record(&lsn,
|
||||
LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
|
||||
|
@ -346,7 +346,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
|
||||
if ((rec_len= rand_buffer_size()) < 9)
|
||||
rec_len= 9;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= rec_len;
|
||||
if (translog_write_record(&lsn,
|
||||
LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE,
|
||||
|
|
|
@ -293,7 +293,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
long_tr_id[5]= 0xff;
|
||||
|
||||
int4store(long_tr_id, 0);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
|
||||
trn->short_id= 0;
|
||||
trn->first_undo_lsn= TRANSACTION_LOGGED_LONG_ID;
|
||||
|
@ -301,7 +301,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
trn, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1, parts,
|
||||
NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "Can't write record #%lu\n", (ulong) 0);
|
||||
fprintf(stderr, "Can't write record #%u\n", 0);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
@ -314,7 +314,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
if (i % 2)
|
||||
{
|
||||
lsn_store(lsn_buff, lsn_base);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE;
|
||||
trn->short_id= i % 0xFFFF;
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -322,8 +322,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
LSN_STORE_SIZE, TRANSLOG_INTERNAL_PARTS + 1,
|
||||
parts, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "1 Can't write reference before record #%lu\n",
|
||||
(ulong) i);
|
||||
fprintf(stderr, "1 Can't write reference before record #%u\n", i);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_FIXED_RECORD_1LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
@ -331,9 +330,9 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
ok(1, "write LOGREC_FIXED_RECORD_1LSN_EXAMPLE");
|
||||
lsn_store(lsn_buff, lsn_base);
|
||||
rec_len= get_len();
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
|
||||
trn->short_id= i % 0xFFFF;
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -342,8 +341,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
TRANSLOG_INTERNAL_PARTS + 2,
|
||||
parts, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "1 Can't write var reference before record #%lu\n",
|
||||
(ulong) i);
|
||||
fprintf(stderr, "1 Can't write var reference before record #%u\n", i);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
@ -354,7 +352,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
{
|
||||
lsn_store(lsn_buff, lsn_base);
|
||||
lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].length= 23;
|
||||
trn->short_id= i % 0xFFFF;
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -362,8 +360,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
trn, NULL, 23, TRANSLOG_INTERNAL_PARTS + 1,
|
||||
parts, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "0 Can't write reference before record #%lu\n",
|
||||
(ulong) i);
|
||||
fprintf(stderr, "0 Can't write reference before record #%u\n", i);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_FIXED_RECORD_2LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
@ -372,9 +369,9 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
lsn_store(lsn_buff, lsn_base);
|
||||
lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn);
|
||||
rec_len= get_len();
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= lsn_buff;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE * 2;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
|
||||
trn->short_id= i % 0xFFFF;
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -383,8 +380,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
TRANSLOG_INTERNAL_PARTS + 2,
|
||||
parts, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "0 Can't write var reference before record #%lu\n",
|
||||
(ulong) i);
|
||||
fprintf(stderr, "0 Can't write var reference before record #%u\n", i);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
@ -392,7 +388,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
ok(1, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
|
||||
}
|
||||
int4store(long_tr_id, i);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
|
||||
trn->short_id= i % 0xFFFF;
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -400,7 +396,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
trn, NULL, 6,
|
||||
TRANSLOG_INTERNAL_PARTS + 1, parts, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "Can't write record #%lu\n", (ulong) i);
|
||||
fprintf(stderr, "Can't write record #%u\n", i);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
@ -410,7 +406,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
lsn_base= lsn;
|
||||
|
||||
rec_len= get_len();
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= rec_len;
|
||||
trn->short_id= i % 0xFFFF;
|
||||
if (translog_write_record(&lsn,
|
||||
|
@ -418,7 +414,7 @@ int main(int argc __attribute__((unused)), char *argv[])
|
|||
trn, NULL, rec_len,
|
||||
TRANSLOG_INTERNAL_PARTS + 1, parts, NULL, NULL))
|
||||
{
|
||||
fprintf(stderr, "Can't write variable record #%lu\n", (ulong) i);
|
||||
fprintf(stderr, "Can't write variable record #%u\n", i);
|
||||
translog_destroy();
|
||||
ok(0, "write LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE");
|
||||
exit(1);
|
||||
|
|
|
@ -167,7 +167,7 @@ void writer(int num)
|
|||
|
||||
int2store(long_tr_id, num);
|
||||
int4store(long_tr_id + 2, i);
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
|
||||
if (translog_write_record(&lsn,
|
||||
LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
|
||||
|
@ -183,7 +183,7 @@ void writer(int num)
|
|||
return;
|
||||
}
|
||||
lsns1[num][i]= lsn;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_buffer;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= len;
|
||||
if (translog_write_record(&lsn,
|
||||
LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE,
|
||||
|
@ -368,7 +368,7 @@ int main(int argc __attribute__((unused)),
|
|||
0x11, 0x22, 0x33, 0x44, 0x55, 0x66
|
||||
};
|
||||
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].str= long_tr_id;
|
||||
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
|
||||
dummy_transaction_object.first_undo_lsn= TRANSACTION_LOGGED_LONG_ID;
|
||||
if (translog_write_record(&first_lsn,
|
||||
|
|
Loading…
Reference in a new issue