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

into  mysql.com:/home/my/mysql-maria


dbug/dbug.c:
  Auto merged
mysys/lf_alloc-pin.c:
  Auto merged
storage/maria/lockman.c:
  Auto merged
storage/maria/ma_open.c:
  Auto merged
storage/maria/ma_recovery.c:
  Auto merged
storage/maria/unittest/ma_test_recovery.pl:
  Manual merge
This commit is contained in:
unknown 2008-02-21 02:51:51 +02:00
commit 33c24d59f4
16 changed files with 96 additions and 26 deletions

View file

@ -3077,3 +3077,4 @@ maria_log.00000*
ma_test_recovery.output
test?.MA?
dbug/tests
storage/maria/unittest/tmp/*

View file

@ -124,7 +124,7 @@
#define SANITY_CHECK_ON (1 << 10) /* Check safemalloc on DBUG_ENTER */
#define FLUSH_ON_WRITE (1 << 11) /* Flush on every write */
#define OPEN_APPEND (1 << 12) /* Open for append */
#define TRACE_ON (1 << 31) /* Trace enabled. MUST be the highest bit!*/
#define TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/
#define TRACING (cs->stack->flags & TRACE_ON)
#define DEBUGGING (cs->stack->flags & DEBUG_ON)

View file

@ -169,7 +169,7 @@ LF_PINS *_lf_pinbox_get_pins(LF_PINBOX *pinbox, void *stack_end)
if (!(pins= top_ver % LF_PINBOX_MAX_PINS))
{
/* the stack of free elements is empty */
pins= my_atomic_add32(&pinbox->pins_in_array, 1)+1;
pins= my_atomic_add32((int32 volatile*) &pinbox->pins_in_array, 1)+1;
if (unlikely(pins >= LF_PINBOX_MAX_PINS))
return 0;
/*
@ -183,7 +183,8 @@ LF_PINS *_lf_pinbox_get_pins(LF_PINBOX *pinbox, void *stack_end)
}
el= (LF_PINS *)_lf_dynarray_value(&pinbox->pinarray, pins);
next= el->link;
} while (!my_atomic_cas32(&pinbox->pinstack_top_ver, &top_ver,
} while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver,
(int32*) &top_ver,
top_ver-pins+next+LF_PINBOX_MAX_PINS));
/*
set el->link to the index of el in the dynarray (el->link has two usages:
@ -237,7 +238,8 @@ void _lf_pinbox_put_pins(LF_PINS *pins)
do
{
pins->link= top_ver % LF_PINBOX_MAX_PINS;
} while (!my_atomic_cas32(&pinbox->pinstack_top_ver, &top_ver,
} while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver,
(int32*) &top_ver,
top_ver-pins->link+nr+LF_PINBOX_MAX_PINS));
return;
}

View file

@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map)
if (*byte_ptr & (1 << k))
return (i*32) + (j*8) + k;
}
DBUG_ASSERT(0);
}
}
DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *map)
if (!(*byte_ptr & (1 << k)))
return (i*32) + (j*8) + k;
}
DBUG_ASSERT(0);
}
}
DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;

View file

@ -183,7 +183,7 @@ int packfrm(uchar *data, size_t len,
DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", (ulong) org_len,
(ulong) comp_len));
DBUG_DUMP("compressed", (char*)data, org_len);
DBUG_DUMP("compressed", data, org_len);
error= 2;
blob_len= BLOB_HEADER + org_len;

3
sql-bench/myisam.cnf Normal file
View file

@ -0,0 +1,3 @@
[mysqld]
data=/data
key_buffer_size=256M

View file

@ -631,7 +631,7 @@ enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo,
/* a new value was added to the hash */
csize= lm->size;
if ((my_atomic_add32(&lm->count, 1)+1.0) / csize > MAX_LOAD)
my_atomic_cas32(&lm->size, &csize, csize*2);
my_atomic_cas32(&lm->size, (int*) &csize, csize*2);
node->lonext= lo->all_locks;
lo->all_locks= node;
for ( ; res & NEED_TO_WAIT; res= lockpeek(el, node, pins, &blocker))

View file

@ -460,6 +460,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
if (share->options & HA_OPTION_COMPRESS_RECORD)
share->base.max_key_length+=2; /* For safety */
/* Add space for node pointer */
share->base.max_key_length+= share->base.key_reflength;
if (!my_multi_malloc(MY_WME,
&share,sizeof(*share),

View file

@ -3265,7 +3265,7 @@ static void print_redo_phase_progress(TRANSLOG_ADDRESS addr)
{
static uint end_logno= FILENO_IMPOSSIBLE, percentage_printed= 0;
static ulong end_offset;
static ulonglong initial_remainder= -1;
static ulonglong initial_remainder= ~(ulonglong) 0;
uint cur_logno;
ulong cur_offset;

View file

@ -34,11 +34,13 @@ int maria_rsame(MARIA_HA *info, uchar *record, int inx)
if (inx != -1 && ! maria_is_key_active(info->s->state.key_map, inx))
{
DBUG_PRINT("error", ("wrong index usage"));
DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
}
if (info->cur_row.lastpos == HA_OFFSET_ERROR ||
info->update & HA_STATE_DELETED)
{
DBUG_PRINT("error", ("no current record"));
DBUG_RETURN(my_errno=HA_ERR_KEY_NOT_FOUND); /* No current record */
}
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
@ -65,5 +67,6 @@ int maria_rsame(MARIA_HA *info, uchar *record, int inx)
DBUG_RETURN(0);
if (my_errno == HA_ERR_RECORD_DELETED)
my_errno=HA_ERR_KEY_NOT_FOUND;
DBUG_PRINT("error", ("my_errno: %d", my_errno));
DBUG_RETURN(my_errno);
} /* maria_rsame */

View file

@ -40,9 +40,10 @@ int maria_scan_init(register MARIA_HA *info)
record Read data here
RETURN
0 ok
HA_ERR_END_OF_FILE End of file
# Error code
0 ok
HA_ERR_END_OF_FILE End of file
HA_ERR_RECORD_DELETED Record was deleted (can only happen for static rec)
# Error code
*/
int maria_scan(MARIA_HA *info, uchar *record)

View file

@ -173,13 +173,14 @@ int _ma_read_static_record(register MARIA_HA *info, register uchar *record,
MARIA_RECORD_POS pos)
{
int error;
DBUG_ENTER("_ma_read_static_record");
if (pos != HA_OFFSET_ERROR)
{
if (info->opt_flag & WRITE_CACHE_USED &&
info->rec_cache.pos_in_file <= pos &&
flush_io_cache(&info->rec_cache))
return(my_errno);
DBUG_RETURN(my_errno);
info->rec_cache.seek_not_done=1; /* We have done a seek */
error= (int) info->s->file_read(info, record,info->s->base.reclength,
@ -190,17 +191,27 @@ int _ma_read_static_record(register MARIA_HA *info, register uchar *record,
if (!*record)
{
/* Record is deleted */
return ((my_errno=HA_ERR_RECORD_DELETED));
DBUG_PRINT("warning", ("Record is deleted"));
DBUG_RETURN((my_errno=HA_ERR_RECORD_DELETED));
}
info->update|= HA_STATE_AKTIV; /* Record is read */
return(0);
DBUG_RETURN(0);
}
}
fast_ma_writeinfo(info); /* No such record */
return(my_errno);
DBUG_RETURN(my_errno);
}
/**
@brief Read record from given position or next record
@note
When scanning, this function will return HA_ERR_RECORD_DELETED
for deleted rows even if skip_deleted_blocks is set.
The reason for this is to allow the caller to calculate the record
position without having to do call maria_position() for each record.
*/
int _ma_read_rnd_static_record(MARIA_HA *info, uchar *buf,
MARIA_RECORD_POS filepos,
@ -219,7 +230,8 @@ int _ma_read_rnd_static_record(MARIA_HA *info, uchar *buf,
(skip_deleted_blocks || !filepos))
{
cache_read=1; /* Read record using cache */
cache_length=(uint) (info->rec_cache.read_end - info->rec_cache.read_pos);
cache_length= (uint) (info->rec_cache.read_end -
info->rec_cache.read_pos);
}
else
info->rec_cache.seek_not_done=1; /* Filepos is changed */

View file

@ -660,6 +660,12 @@ int main(int argc, char *argv[])
printf("Got error %d when scanning table\n", tmp);
break;
}
if (!tmp)
{
/* Remember position to last found row */
info.recpos= maria_position(file);
bmove(read_record2,read_record,reclength);
}
}
maria_scan_end(file);
if (i != write_count && i != write_count - opt_delete)
@ -668,7 +674,14 @@ int main(int argc, char *argv[])
goto err;
}
bmove(read_record2,read_record,reclength);
if (maria_rsame_with_pos(file,read_record,0,info.recpos))
goto err;
if (bcmp(read_record,read_record2,reclength) != 0)
{
printf("maria_rsame_with_pos didn't find same record\n");
goto err;
}
for (i=min(2,keys) ; i-- > 0 ;)
{
if (maria_rsame(file,read_record2,(int) i)) goto err;
@ -860,7 +873,7 @@ int main(int argc, char *argv[])
ulong blob_length,pos;
uchar *ptr;
memcpy_fixed(&ptr, read_record+blob_pos+4, sizeof(ptr));
longget(blob_length,read_record+blob_pos);
blob_length= uint4korr(read_record+blob_pos);
for (pos=0 ; pos < blob_length ; pos++)
{
if (ptr[pos] != (uchar) (blob_length+pos))

View file

@ -16,6 +16,8 @@ my $maria_exe_path; # path to executables (ma_test1, maria_chk etc)
my $tmp= "./tmp";
my $my_progname= $0;
my $suffix;
my $md5sum;
$my_progname=~ s/.*[\/]//;
$maria_path= dirname($0) . "/..";
@ -60,7 +62,24 @@ sub main
}
}
# test data is always put in the current directory or a tmp subdirectory of it
# Test if we should use md5sum or digest -a md5
if (defined(my_which("md5sum")))
{
$md5sum="md5sum";
}
elsif (defined(my_which("digest")))
{
$md5sum="digest -a md5";
}
else
{
die "Can't find either md5sum or digest. Please install one of them"
}
# test data is always put in the current directory or a tmp subdirectory
# of it
if (! -d "$tmp")
{
mkdir $tmp;
@ -335,11 +354,11 @@ sub apply_log
print MY_LOG "bad argument '$shouldchangelog'\n";
return 1;
}
$log_md5= `md5sum maria_log.*`;
$log_md5= `$md5sum maria_log.*`;
print MY_LOG "applying log\n";
`$maria_exe_path/maria_read_log$suffix -a > $tmp/maria_read_log_$table.txt`;
$log_md5_2= `md5sum maria_log.*`;
$log_md5_2= `$md5sum maria_log.*`;
if ("$log_md5" ne "$log_md5_2" )
{
if ("$shouldchangelog" eq "shouldnotchangelog")
@ -356,6 +375,22 @@ sub apply_log
}
sub my_which
{
my ($command) = @_;
my (@paths, $path);
return $command if (-f $command && -x $command);
@paths = split(':', $ENV{'PATH'});
foreach $path (@paths)
{
$path .= "/$command";
return $path if (-f $path && -x $path);
}
return undef();
}
####
#### usage
####

View file

@ -775,7 +775,7 @@ int main(int argc, char *argv[])
ulong blob_length,pos;
uchar *ptr;
memcpy_fixed(&ptr, read_record+blob_pos+4, sizeof(ptr));
longget(blob_length,read_record+blob_pos);
blob_length= uint4korr(read_record+blob_pos);
for (pos=0 ; pos < blob_length ; pos++)
{
if (ptr[pos] != (uchar) (blob_length+pos))

View file

@ -328,7 +328,9 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length)
{
my_wc_t wc;
int chlen;
for (; (chlen= cs->cset->mb_wc(cs, &wc, str, strend)) > 0; str+= chlen)
for (;
(chlen= cs->cset->mb_wc(cs, &wc, (uchar*) str, (uchar*) strend)) > 0;
str+= chlen)
{
if (wc > 0x7F)
return MY_REPERTOIRE_UNICODE30;