Commit 5d46eeef authored by Eugene Kosov's avatar Eugene Kosov Committed by Sergey Vojtovich

Simplified away READ_RECORD::cache_records

parent 3950a98a
...@@ -584,7 +584,7 @@ static int rr_unpack_from_buffer(READ_RECORD *info) ...@@ -584,7 +584,7 @@ static int rr_unpack_from_buffer(READ_RECORD *info)
static int init_rr_cache(THD *thd, READ_RECORD *info) static int init_rr_cache(THD *thd, READ_RECORD *info)
{ {
uint rec_cache_size; uint rec_cache_size, cache_records;
DBUG_ENTER("init_rr_cache"); DBUG_ENTER("init_rr_cache");
info->struct_length= 3+MAX_REFLENGTH; info->struct_length= 3+MAX_REFLENGTH;
...@@ -593,22 +593,22 @@ static int init_rr_cache(THD *thd, READ_RECORD *info) ...@@ -593,22 +593,22 @@ static int init_rr_cache(THD *thd, READ_RECORD *info)
info->reclength= ALIGN_SIZE(info->struct_length); info->reclength= ALIGN_SIZE(info->struct_length);
info->error_offset= info->table->s->reclength; info->error_offset= info->table->s->reclength;
info->cache_records= (thd->variables.read_rnd_buff_size / cache_records= thd->variables.read_rnd_buff_size /
(info->reclength+info->struct_length)); (info->reclength + info->struct_length);
rec_cache_size= info->cache_records*info->reclength; rec_cache_size= cache_records * info->reclength;
info->rec_cache_size= info->cache_records*info->ref_length; info->rec_cache_size= cache_records * info->ref_length;
// We have to allocate one more byte to use uint3korr (see comments for it) // We have to allocate one more byte to use uint3korr (see comments for it)
if (info->cache_records <= 2 || if (cache_records <= 2 ||
!(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records* !(info->cache= (uchar*) my_malloc_lock(rec_cache_size + cache_records *
info->struct_length+1, info->struct_length + 1,
MYF(MY_THREAD_SPECIFIC)))) MYF(MY_THREAD_SPECIFIC))))
DBUG_RETURN(1); DBUG_RETURN(1);
#ifdef HAVE_valgrind #ifdef HAVE_valgrind
// Avoid warnings in qsort // Avoid warnings in qsort
bzero(info->cache,rec_cache_size+info->cache_records* info->struct_length+1); bzero(info->cache, rec_cache_size + cache_records * info->struct_length + 1);
#endif #endif
DBUG_PRINT("info",("Allocated buffert for %d records",info->cache_records)); DBUG_PRINT("info", ("Allocated buffer for %d records", cache_records));
info->read_positions=info->cache+rec_cache_size; info->read_positions=info->cache+rec_cache_size;
info->cache_pos=info->cache_end=info->cache; info->cache_pos=info->cache_end=info->cache;
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -56,7 +56,6 @@ struct READ_RECORD ...@@ -56,7 +56,6 @@ struct READ_RECORD
Read_func read_record_func; Read_func read_record_func;
THD *thd; THD *thd;
SQL_SELECT *select; SQL_SELECT *select;
uint cache_records;
uint ref_length,struct_length,reclength,rec_cache_size,error_offset; uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
uchar *ref_pos; /* pointer to form->refpos */ uchar *ref_pos; /* pointer to form->refpos */
uchar *record; uchar *record;
......
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