Commit e8b0bb47 authored by unknown's avatar unknown

Fixed bug in allocation of dynamic record buffer in Maria

Unified printing of mutex addresses to make them easier to compare


mysys/thr_mutex.c:
  Unified printing of mutex addresses to make them easier to compare
storage/maria/ma_dynrec.c:
  Fixed indentation
storage/maria/ma_open.c:
  Fixed bug in allocation of dynamic record buffer
parent abe1031e
...@@ -96,7 +96,7 @@ int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line) ...@@ -96,7 +96,7 @@ int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
int error; int error;
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (my_thread_var_get_dbug((my_bool*) 0)) if (my_thread_var_get_dbug((my_bool*) 0))
DBUG_PRINT("mutex", ("Locking mutex: 0x%lx", (ulong) mp)); DBUG_PRINT("mutex", ("0x%lx locking", (ulong) mp));
#endif #endif
if (!mp->file) if (!mp->file)
{ {
...@@ -137,7 +137,7 @@ line %d more than 1 time\n", file,line); ...@@ -137,7 +137,7 @@ line %d more than 1 time\n", file,line);
pthread_mutex_unlock(&mp->global); pthread_mutex_unlock(&mp->global);
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (my_thread_var_get_dbug((my_bool*) 0)) if (my_thread_var_get_dbug((my_bool*) 0))
DBUG_PRINT("mutex", ("mutex: 0x%lx locked", (ulong) mp)); DBUG_PRINT("mutex", ("0x%lx locked", (ulong) mp));
#endif #endif
return error; return error;
} }
...@@ -148,7 +148,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line) ...@@ -148,7 +148,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
int error; int error;
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (my_thread_var_get_dbug((my_bool*) 0)) if (my_thread_var_get_dbug((my_bool*) 0))
DBUG_PRINT("mutex", ("Unlocking mutex 0x%lx", (ulong) mp)); DBUG_PRINT("mutex", ("0x%lx unlocking", (ulong) mp));
#endif #endif
pthread_mutex_lock(&mp->global); pthread_mutex_lock(&mp->global);
if (mp->count == 0) if (mp->count == 0)
......
...@@ -932,7 +932,8 @@ uint _ma_rec_pack(MARIA_HA *info, register uchar *to, ...@@ -932,7 +932,8 @@ uint _ma_rec_pack(MARIA_HA *info, register uchar *to,
flag|=bit; flag|=bit;
else else
{ {
memcpy((uchar*) to,from,(size_t) length); to+=length; memcpy((uchar*) to,from,(size_t) length);
to+=length;
} }
} }
else if (type == FIELD_SKIP_ENDSPACE || else if (type == FIELD_SKIP_ENDSPACE ||
......
...@@ -668,15 +668,18 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -668,15 +668,18 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->page_type= PAGECACHE_PLAIN_PAGE; share->page_type= PAGECACHE_PLAIN_PAGE;
share->now_transactional= share->base.born_transactional; share->now_transactional= share->base.born_transactional;
share->base.default_rec_buff_size= max(share->base.pack_reclength,
share->base.max_key_length);
if (share->data_file_type == DYNAMIC_RECORD) if (share->data_file_type == DYNAMIC_RECORD)
{ {
/* add bits used to pack data to pack_reclength for faster allocation */
share->base.pack_reclength+= share->base.pack_bytes;
share->base.extra_rec_buff_size= share->base.extra_rec_buff_size=
(ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER) + MARIA_SPLIT_LENGTH + (ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER) + MARIA_SPLIT_LENGTH +
MARIA_REC_BUFF_OFFSET); MARIA_REC_BUFF_OFFSET);
share->base.default_rec_buff_size+= share->base.extra_rec_buff_size;
} }
share->base.default_rec_buff_size= (max(share->base.pack_reclength,
share->base.max_key_length) +
share->base.extra_rec_buff_size);
if (share->data_file_type == COMPRESSED_RECORD) if (share->data_file_type == COMPRESSED_RECORD)
{ {
/* Need some extra bytes for decode_bytes */ /* Need some extra bytes for decode_bytes */
...@@ -897,8 +900,6 @@ void _ma_setup_functions(register MARIA_SHARE *share) ...@@ -897,8 +900,6 @@ void _ma_setup_functions(register MARIA_SHARE *share)
share->compare_record= _ma_cmp_dynamic_record; share->compare_record= _ma_cmp_dynamic_record;
share->compare_unique= _ma_cmp_dynamic_unique; share->compare_unique= _ma_cmp_dynamic_unique;
share->calc_checksum= share->calc_write_checksum= _ma_checksum; share->calc_checksum= share->calc_write_checksum= _ma_checksum;
/* add bits used to pack data to pack_reclength for faster allocation */
share->base.pack_reclength+= share->base.pack_bytes;
if (share->base.blobs) if (share->base.blobs)
{ {
share->update_record= _ma_update_blob_record; share->update_record= _ma_update_blob_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