diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index e0812f54b4f82b0bf2311ac2f35ef21904bcf5c7..f351b4079fa716e3d20d238785c5544b6cd3ccef 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -39,4 +39,3 @@ mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results plugin : Bug#25659 memory leak via "plugins" test 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 -ps_maria : Until maria is fully functional diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index b32a2a11bfcc4a3ff3d0d39b3b76d1b1c358e5c0..202f695e30c06be07ba8933caf6cfd299c47f19b 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -191,6 +191,7 @@ my_bool _ma_bitmap_end(MARIA_SHARE *share) _ma_flush_bitmap(share); pthread_mutex_destroy(&share->bitmap.bitmap_lock); my_free((byte*) share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR)); + share->bitmap.map= 0; return res; } @@ -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' diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 29c06cba7e50cd6a9ca24ef4b3498e8922bda5da..c56522a9072c1ea3f2422ef622f538e15ddbc469 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -585,7 +585,7 @@ static void calc_record_size(MARIA_HA *info, const byte *record, *null_field_lengths= rec->length; break; 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) { row->empty_bits[rec->empty_pos] |= rec->empty_bit; diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h index e54ce45114f8cb31b94adebfc9c71655f4337796..54145319b83259f8972e993d5667abfcc4a17c67 100644 --- a/storage/maria/ma_blockrec.h +++ b/storage/maria/ma_blockrec.h @@ -158,3 +158,4 @@ my_bool _ma_check_if_right_bitmap_type(MARIA_HA *info, enum en_page_type page_type, ulonglong page, uint *bitmap_pattern); +void _ma_bitmap_delete_all(MARIA_SHARE *share); diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 69c18f54910fcfcd1eeeba164d3b2cbe49c2087b..00bf949a43c9916ab1819f0ad0f5d0d346c98012 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -773,17 +773,8 @@ int maria_create(const char *name, enum data_file_type record_type, goto err; errpos=3; - if (record_type == BLOCK_RECORD) - { - /* 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; - } + if (_ma_initialize_data_file(dfile, &share)) + goto err; } DBUG_PRINT("info", ("write state info and base info")); if (_ma_state_info_write(file, &share.state, 2) || @@ -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; enum en_fieldtype a_type, b_type; @@ -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; +} diff --git a/storage/maria/ma_delete_all.c b/storage/maria/ma_delete_all.c index 80022b1ae26f1e314d40ff500e54dd07393b9ad9..7880a692fc9942a7db504289557c9909ed0e1e2e 100644 --- a/storage/maria/ma_delete_all.c +++ b/storage/maria/ma_delete_all.c @@ -65,6 +65,10 @@ int maria_delete_all_rows(MARIA_HA *info) if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) || my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) ) goto err; + + if (_ma_initialize_data_file(info->dfile, info->s)) + goto err; + /* RECOVERY TODO Consider updating ZeroDirtyPagesLSN here. It is not a necessity (it is one only in RENAME commands) but an optional diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 8d4cf75f09d76d38acb5c9246fc930c43d29e097..553e8efb787421c414a5d2939b85c16ac8252c56 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -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, ulong); int _ma_sync_table_files(const MARIA_HA *info); +int _ma_initialize_data_file(File dfile, MARIA_SHARE *share);