From a8a3521b0961ba619b5dc64275f25c1c5bb1c485 Mon Sep 17 00:00:00 2001 From: marko <Unknown> Date: Tue, 12 Jun 2007 10:59:01 +0000 Subject: [PATCH] branches/zip: Merge 1556:1571 from trunk. --- handler/ha_innodb.cc | 33 ++++++++++++++++----------------- include/page0page.h | 9 +++++++++ include/rem0rec.ic | 6 ++++-- include/row0mysql.h | 13 ------------- page/page0page.c | 12 ++++++++++++ rem/rem0rec.c | 2 +- row/row0mysql.c | 21 --------------------- 7 files changed, 42 insertions(+), 54 deletions(-) diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 90adced4de0..4fee83062de 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -4558,17 +4558,17 @@ ha_innobase::position( /********************************************************************* If it's a DB_TOO_BIG_RECORD error then set a suitable message to return to the client.*/ -static +inline void innodb_check_for_record_too_big_error( /*==================================*/ - dict_table_t* table, /* in: table to check */ - int error) /* in: error code to check */ + ulint comp, /* in: ROW_FORMAT: nonzero=COMPACT, 0=REDUNDANT */ + int error) /* in: error code to check */ { if (error == (int)DB_TOO_BIG_RECORD) { ulint max_row_size; - max_row_size = page_get_free_space_of_empty_noninline(table); + max_row_size = page_get_free_space_of_empty_noninline(comp); my_error(ER_TOO_BIG_ROWSIZE, MYF(0), max_row_size); } @@ -4682,9 +4682,8 @@ create_table_def( error = row_create_table_for_mysql(table, trx); - /* We need access to the table and so we do the error checking - and set the error message here, before the error translation.*/ - innodb_check_for_record_too_big_error(table, error); + innodb_check_for_record_too_big_error(dict_table_is_comp(table), + error); error = convert_error_code_to_mysql(error, NULL); @@ -4808,9 +4807,8 @@ create_index( sure we don't create too long indexes. */ error = row_create_index_for_mysql(index, trx, field_lengths); - /* We need access to the table and so we do the error checking - and set the error message here, before the error translation.*/ - innodb_check_for_record_too_big_error(index->table, error); + innodb_check_for_record_too_big_error(form->s->row_type + != ROW_TYPE_REDUNDANT, error); error = convert_error_code_to_mysql(error, NULL); @@ -4827,6 +4825,8 @@ int create_clustered_index_when_no_primary( /*===================================*/ trx_t* trx, /* in: InnoDB transaction handle */ + ulint comp, /* in: ROW_FORMAT: + nonzero=COMPACT, 0=REDUNDANT */ const char* table_name) /* in: table name */ { dict_index_t* index; @@ -4835,14 +4835,12 @@ create_clustered_index_when_no_primary( /* We pass 0 as the space id, and determine at a lower level the space id where to store the table */ - index = dict_mem_index_create((char*) table_name, - (char*) "GEN_CLUST_INDEX", 0, DICT_CLUSTERED, 0); + index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX", + 0, DICT_CLUSTERED, 0); error = row_create_index_for_mysql(index, trx, NULL); - /* We need access to the table and so we do the error checking - and set the error message here, before the error translation.*/ - innodb_check_for_record_too_big_error(index->table, error); + innodb_check_for_record_too_big_error(comp, error); error = convert_error_code_to_mysql(error, NULL); @@ -4979,8 +4977,9 @@ ha_innobase::create( order the rows by their row id which is internally generated by InnoDB */ - error = create_clustered_index_when_no_primary(trx, - norm_name); + error = create_clustered_index_when_no_primary( + trx, form->s->row_type != ROW_TYPE_REDUNDANT, + norm_name); if (error) { goto cleanup; } diff --git a/include/page0page.h b/include/page0page.h index ca3b842ae7b..368c2fcf0dc 100644 --- a/include/page0page.h +++ b/include/page0page.h @@ -604,6 +604,15 @@ page_get_free_space_of_empty( /* out: free space */ ulint comp) /* in: nonzero=compact page format */ __attribute__((const)); +/***************************************************************** +Calculates free space if a page is emptied. */ + +ulint +page_get_free_space_of_empty_noninline( +/*===================================*/ + /* out: free space */ + ulint comp) /* in: nonzero=compact page format */ + __attribute__((const)); /************************************************************** Returns the base extra size of a physical record. This is the size of the fixed header, independent of the record size. */ diff --git a/include/rem0rec.ic b/include/rem0rec.ic index e901f54b375..fc5d0999f6c 100644 --- a/include/rem0rec.ic +++ b/include/rem0rec.ic @@ -889,7 +889,8 @@ UNIV_INLINE void rec_offs_set_n_alloc( /*=================*/ - ulint* offsets, /* in: array for rec_get_offsets() */ + ulint* offsets, /* out: array for rec_get_offsets(), + must be allocated */ ulint n_alloc) /* in: number of elements */ { ut_ad(offsets); @@ -1374,7 +1375,8 @@ UNIV_INLINE void rec_offs_set_n_fields( /*==================*/ - ulint* offsets, /* in: array returned by rec_get_offsets() */ + ulint* offsets, /* in/out: array returned by + rec_get_offsets() */ ulint n_fields) /* in: number of fields */ { ut_ad(offsets); diff --git a/include/row0mysql.h b/include/row0mysql.h index f53887de4e9..e1dbf9283be 100644 --- a/include/row0mysql.h +++ b/include/row0mysql.h @@ -554,19 +554,6 @@ row_undo_report_drop_table_dict_operation( /* out: DB_SUCCESS or error code */ trx_t* trx, /* in: query thread */ const char* table_name); /* in: table name dropped */ -/************************************************************************* -Get the min of the maximum possible row sizes. */ - -ulint -page_get_free_space_of_empty_noninline( -/*===================================*/ - /* out: The (approx) maximum size - of a row, this is a conservative - estimate, since the size can be - slightly larger depending upon - the ROW_FORMAT setting.*/ - dict_table_t* table); /* in: table for which max record - size required.*/ /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. diff --git a/page/page0page.c b/page/page0page.c index 32780163002..a52eac78d29 100644 --- a/page/page0page.c +++ b/page/page0page.c @@ -216,6 +216,18 @@ page_set_max_trx_id( } } +/***************************************************************** +Calculates free space if a page is emptied. */ + +ulint +page_get_free_space_of_empty_noninline( +/*===================================*/ + /* out: free space */ + ulint comp) /* in: nonzero=compact page format */ +{ + return(page_get_free_space_of_empty(comp)); +} + /**************************************************************** Allocates a block of memory from the heap of an index page. */ diff --git a/rem/rem0rec.c b/rem/rem0rec.c index 12955f7744d..67d71cf7b41 100644 --- a/rem/rem0rec.c +++ b/rem/rem0rec.c @@ -478,7 +478,7 @@ rec_get_offsets_func( /* out: the new offsets */ const rec_t* rec, /* in: physical record */ dict_index_t* index, /* in: record descriptor */ - ulint* offsets,/* in: array consisting of offsets[0] + ulint* offsets,/* in/out: array consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL */ ulint n_fields,/* in: maximum number of initialized fields diff --git a/row/row0mysql.c b/row/row0mysql.c index 7f4d220be58..360bbc0de9b 100644 --- a/row/row0mysql.c +++ b/row/row0mysql.c @@ -4460,24 +4460,3 @@ row_create_index_graph_for_mysql( return(err); } #endif /* !UNIV_HOTBACKUP */ - -/************************************************************************* -Get the maximum row size. */ - -ulint -page_get_free_space_of_empty_noninline( -/*===================================*/ - /* out: The (approx) maximum size - of a row, this is a conservative - estimate, since the size can be - slightly larger depending upon - the ROW_FORMAT setting.*/ - dict_table_t* table) /* in: table for which max record - size is required.*/ -{ - ibool compact; - - compact = dict_table_is_comp(table); - - return(page_get_free_space_of_empty(compact) / 2); -}