Commit a8a3521b authored by marko's avatar marko

branches/zip: Merge 1556:1571 from trunk.

parent ae0ae671
...@@ -4558,17 +4558,17 @@ ha_innobase::position( ...@@ -4558,17 +4558,17 @@ ha_innobase::position(
/********************************************************************* /*********************************************************************
If it's a DB_TOO_BIG_RECORD error then set a suitable message to If it's a DB_TOO_BIG_RECORD error then set a suitable message to
return to the client.*/ return to the client.*/
static inline
void void
innodb_check_for_record_too_big_error( innodb_check_for_record_too_big_error(
/*==================================*/ /*==================================*/
dict_table_t* table, /* in: table to check */ ulint comp, /* in: ROW_FORMAT: nonzero=COMPACT, 0=REDUNDANT */
int error) /* in: error code to check */ int error) /* in: error code to check */
{ {
if (error == (int)DB_TOO_BIG_RECORD) { if (error == (int)DB_TOO_BIG_RECORD) {
ulint max_row_size; 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); my_error(ER_TOO_BIG_ROWSIZE, MYF(0), max_row_size);
} }
...@@ -4682,9 +4682,8 @@ create_table_def( ...@@ -4682,9 +4682,8 @@ create_table_def(
error = row_create_table_for_mysql(table, trx); error = row_create_table_for_mysql(table, trx);
/* We need access to the table and so we do the error checking innodb_check_for_record_too_big_error(dict_table_is_comp(table),
and set the error message here, before the error translation.*/ error);
innodb_check_for_record_too_big_error(table, error);
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
...@@ -4808,9 +4807,8 @@ create_index( ...@@ -4808,9 +4807,8 @@ create_index(
sure we don't create too long indexes. */ sure we don't create too long indexes. */
error = row_create_index_for_mysql(index, trx, field_lengths); error = row_create_index_for_mysql(index, trx, field_lengths);
/* We need access to the table and so we do the error checking innodb_check_for_record_too_big_error(form->s->row_type
and set the error message here, before the error translation.*/ != ROW_TYPE_REDUNDANT, error);
innodb_check_for_record_too_big_error(index->table, error);
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
...@@ -4827,6 +4825,8 @@ int ...@@ -4827,6 +4825,8 @@ int
create_clustered_index_when_no_primary( create_clustered_index_when_no_primary(
/*===================================*/ /*===================================*/
trx_t* trx, /* in: InnoDB transaction handle */ trx_t* trx, /* in: InnoDB transaction handle */
ulint comp, /* in: ROW_FORMAT:
nonzero=COMPACT, 0=REDUNDANT */
const char* table_name) /* in: table name */ const char* table_name) /* in: table name */
{ {
dict_index_t* index; dict_index_t* index;
...@@ -4835,14 +4835,12 @@ create_clustered_index_when_no_primary( ...@@ -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 /* We pass 0 as the space id, and determine at a lower level the space
id where to store the table */ id where to store the table */
index = dict_mem_index_create((char*) table_name, index = dict_mem_index_create(table_name, "GEN_CLUST_INDEX",
(char*) "GEN_CLUST_INDEX", 0, DICT_CLUSTERED, 0); 0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx, NULL); error = row_create_index_for_mysql(index, trx, NULL);
/* We need access to the table and so we do the error checking innodb_check_for_record_too_big_error(comp, error);
and set the error message here, before the error translation.*/
innodb_check_for_record_too_big_error(index->table, error);
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
...@@ -4979,8 +4977,9 @@ ha_innobase::create( ...@@ -4979,8 +4977,9 @@ ha_innobase::create(
order the rows by their row id which is internally generated order the rows by their row id which is internally generated
by InnoDB */ by InnoDB */
error = create_clustered_index_when_no_primary(trx, error = create_clustered_index_when_no_primary(
norm_name); trx, form->s->row_type != ROW_TYPE_REDUNDANT,
norm_name);
if (error) { if (error) {
goto cleanup; goto cleanup;
} }
......
...@@ -604,6 +604,15 @@ page_get_free_space_of_empty( ...@@ -604,6 +604,15 @@ page_get_free_space_of_empty(
/* out: free space */ /* out: free space */
ulint comp) /* in: nonzero=compact page format */ ulint comp) /* in: nonzero=compact page format */
__attribute__((const)); __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 Returns the base extra size of a physical record. This is the
size of the fixed header, independent of the record size. */ size of the fixed header, independent of the record size. */
......
...@@ -889,7 +889,8 @@ UNIV_INLINE ...@@ -889,7 +889,8 @@ UNIV_INLINE
void void
rec_offs_set_n_alloc( 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 */ ulint n_alloc) /* in: number of elements */
{ {
ut_ad(offsets); ut_ad(offsets);
...@@ -1374,7 +1375,8 @@ UNIV_INLINE ...@@ -1374,7 +1375,8 @@ UNIV_INLINE
void void
rec_offs_set_n_fields( 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 */ ulint n_fields) /* in: number of fields */
{ {
ut_ad(offsets); ut_ad(offsets);
......
...@@ -554,19 +554,6 @@ row_undo_report_drop_table_dict_operation( ...@@ -554,19 +554,6 @@ row_undo_report_drop_table_dict_operation(
/* out: DB_SUCCESS or error code */ /* out: DB_SUCCESS or error code */
trx_t* trx, /* in: query thread */ trx_t* trx, /* in: query thread */
const char* table_name); /* in: table name dropped */ 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 /* A struct describing a place for an individual column in the MySQL
row format which is presented to the table handler in ha_innobase. row format which is presented to the table handler in ha_innobase.
......
...@@ -216,6 +216,18 @@ page_set_max_trx_id( ...@@ -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. */ Allocates a block of memory from the heap of an index page. */
......
...@@ -478,7 +478,7 @@ rec_get_offsets_func( ...@@ -478,7 +478,7 @@ rec_get_offsets_func(
/* out: the new offsets */ /* out: the new offsets */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ 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 allocated elements, or an array from
rec_get_offsets(), or NULL */ rec_get_offsets(), or NULL */
ulint n_fields,/* in: maximum number of initialized fields ulint n_fields,/* in: maximum number of initialized fields
......
...@@ -4460,24 +4460,3 @@ row_create_index_graph_for_mysql( ...@@ -4460,24 +4460,3 @@ row_create_index_graph_for_mysql(
return(err); return(err);
} }
#endif /* !UNIV_HOTBACKUP */ #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);
}
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