Commit a10648a6 authored by unknown's avatar unknown

Enabled ps_maria.test

Fixed bug in field-is-zero detection
Fixed bug in truncate file (datafile was not properly initialized)


mysql-test/t/disabled.def:
  Enable ps_maria
storage/maria/ma_bitmap.c:
  Added reset of bitmap (for truncate)
storage/maria/ma_blockrec.c:
  Fixed bug in zero detection
storage/maria/ma_blockrec.h:
  New prototype
storage/maria/ma_create.c:
  Moved initialzation of datafile to separate function
storage/maria/ma_delete_all.c:
  Added initializtion of data file
storage/maria/maria_def.h:
  New prototype
parent 0fd06131
...@@ -39,4 +39,3 @@ mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results ...@@ -39,4 +39,3 @@ mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results
plugin : Bug#25659 memory leak via "plugins" test plugin : Bug#25659 memory leak via "plugins" test
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
ndb_alter_table : Bug##25774 ndb_alter_table.test fails in DBUG_ASSERT() on Linux x64 ndb_alter_table : Bug##25774 ndb_alter_table.test fails in DBUG_ASSERT() on Linux x64
ps_maria : Until maria is fully functional
...@@ -191,6 +191,7 @@ my_bool _ma_bitmap_end(MARIA_SHARE *share) ...@@ -191,6 +191,7 @@ my_bool _ma_bitmap_end(MARIA_SHARE *share)
_ma_flush_bitmap(share); _ma_flush_bitmap(share);
pthread_mutex_destroy(&share->bitmap.bitmap_lock); pthread_mutex_destroy(&share->bitmap.bitmap_lock);
my_free((byte*) share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR)); my_free((byte*) share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR));
share->bitmap.map= 0;
return res; return res;
} }
...@@ -216,6 +217,19 @@ my_bool _ma_flush_bitmap(MARIA_SHARE *share) ...@@ -216,6 +217,19 @@ my_bool _ma_flush_bitmap(MARIA_SHARE *share)
} }
void _ma_bitmap_delete_all(MARIA_SHARE *share)
{
MARIA_FILE_BITMAP *bitmap= &share->bitmap;
if (bitmap->map) /* Not in create */
{
bzero(bitmap->map, share->block_size);
bitmap->changed= 0;
bitmap->page= 0;
bitmap->used_size= bitmap->total_size;
}
}
/* /*
Return bitmap pattern for the smallest head block that can hold 'size' Return bitmap pattern for the smallest head block that can hold 'size'
......
...@@ -585,7 +585,7 @@ static void calc_record_size(MARIA_HA *info, const byte *record, ...@@ -585,7 +585,7 @@ static void calc_record_size(MARIA_HA *info, const byte *record,
*null_field_lengths= rec->length; *null_field_lengths= rec->length;
break; break;
case FIELD_SKIP_ZERO: /* Fixed length field */ case FIELD_SKIP_ZERO: /* Fixed length field */
if (memcmp(record+ rec->null_pos, maria_zero_string, if (memcmp(record+ rec->offset, maria_zero_string,
rec->length) == 0) rec->length) == 0)
{ {
row->empty_bits[rec->empty_pos] |= rec->empty_bit; row->empty_bits[rec->empty_pos] |= rec->empty_bit;
......
...@@ -158,3 +158,4 @@ my_bool _ma_check_if_right_bitmap_type(MARIA_HA *info, ...@@ -158,3 +158,4 @@ my_bool _ma_check_if_right_bitmap_type(MARIA_HA *info,
enum en_page_type page_type, enum en_page_type page_type,
ulonglong page, ulonglong page,
uint *bitmap_pattern); uint *bitmap_pattern);
void _ma_bitmap_delete_all(MARIA_SHARE *share);
...@@ -773,17 +773,8 @@ int maria_create(const char *name, enum data_file_type record_type, ...@@ -773,17 +773,8 @@ int maria_create(const char *name, enum data_file_type record_type,
goto err; goto err;
errpos=3; errpos=3;
if (record_type == BLOCK_RECORD) if (_ma_initialize_data_file(dfile, &share))
{ goto err;
/* Write one bitmap page */
char buff[IO_SIZE];
uint i;
bzero(buff, sizeof(buff));
for (i= 0 ; i < maria_block_size ; i+= IO_SIZE)
if (my_write(dfile, (byte*) buff, sizeof(buff), MYF(MY_NABP)))
goto err;
share.state.state.data_file_length= maria_block_size;
}
} }
DBUG_PRINT("info", ("write state info and base info")); DBUG_PRINT("info", ("write state info and base info"));
if (_ma_state_info_write(file, &share.state, 2) || if (_ma_state_info_write(file, &share.state, 2) ||
...@@ -1030,7 +1021,7 @@ static inline int sign(longlong a) ...@@ -1030,7 +1021,7 @@ static inline int sign(longlong a)
} }
int compare_columns(MARIA_COLUMNDEF **a_ptr, MARIA_COLUMNDEF **b_ptr) static int compare_columns(MARIA_COLUMNDEF **a_ptr, MARIA_COLUMNDEF **b_ptr)
{ {
MARIA_COLUMNDEF *a= *a_ptr, *b= *b_ptr; MARIA_COLUMNDEF *a= *a_ptr, *b= *b_ptr;
enum en_fieldtype a_type, b_type; enum en_fieldtype a_type, b_type;
...@@ -1062,5 +1053,23 @@ int compare_columns(MARIA_COLUMNDEF **a_ptr, MARIA_COLUMNDEF **b_ptr) ...@@ -1062,5 +1053,23 @@ int compare_columns(MARIA_COLUMNDEF **a_ptr, MARIA_COLUMNDEF **b_ptr)
} }
/* Initialize data file */
int _ma_initialize_data_file(File dfile, MARIA_SHARE *share)
{
if (share->data_file_type == BLOCK_RECORD)
{
/* Write one bitmap page */
byte buff[IO_SIZE];
uint i;
bzero((char*) buff, sizeof(buff));
if (my_seek(dfile, 0, SEEK_SET, 0))
return 1;
for (i= 0 ; i < maria_block_size ; i+= IO_SIZE)
if (my_write(dfile, buff, sizeof(buff), MYF(MY_NABP)))
return 1;
share->state.state.data_file_length= maria_block_size;
_ma_bitmap_delete_all(share);
}
return 0;
}
...@@ -65,6 +65,10 @@ int maria_delete_all_rows(MARIA_HA *info) ...@@ -65,6 +65,10 @@ int maria_delete_all_rows(MARIA_HA *info)
if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) || if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) ) my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) )
goto err; goto err;
if (_ma_initialize_data_file(info->dfile, info->s))
goto err;
/* /*
RECOVERY TODO Consider updating ZeroDirtyPagesLSN here. It is RECOVERY TODO Consider updating ZeroDirtyPagesLSN here. It is
not a necessity (it is one only in RENAME commands) but an optional not a necessity (it is one only in RENAME commands) but an optional
......
...@@ -852,3 +852,4 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param); ...@@ -852,3 +852,4 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param);
int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages, int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
ulong); ulong);
int _ma_sync_table_files(const MARIA_HA *info); int _ma_sync_table_files(const MARIA_HA *info);
int _ma_initialize_data_file(File dfile, MARIA_SHARE *share);
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