mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
Merge mysql-5.1-innodb from bk-internal into my local repo
This commit is contained in:
@@ -6290,6 +6290,33 @@ create_clustered_index_when_no_primary(
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Return a display name for the row format
|
||||
@return row format name */
|
||||
|
||||
const char *get_row_format_name(
|
||||
/*============================*/
|
||||
enum row_type row_format) /*!< in: Row Format */
|
||||
{
|
||||
switch (row_format) {
|
||||
case ROW_TYPE_COMPACT:
|
||||
return("COMPACT");
|
||||
case ROW_TYPE_COMPRESSED:
|
||||
return("COMPRESSED");
|
||||
case ROW_TYPE_DYNAMIC:
|
||||
return("DYNAMIC");
|
||||
case ROW_TYPE_REDUNDANT:
|
||||
return("REDUNDANT");
|
||||
case ROW_TYPE_DEFAULT:
|
||||
return("DEFAULT");
|
||||
case ROW_TYPE_FIXED:
|
||||
return("FIXED");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return("NOT USED");
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Validates the create options. We may build on this function
|
||||
in future. For now, it checks two specifiers:
|
||||
@@ -6305,9 +6332,9 @@ create_options_are_valid(
|
||||
columns and indexes */
|
||||
HA_CREATE_INFO* create_info) /*!< in: create info. */
|
||||
{
|
||||
ibool kbs_specified = FALSE;
|
||||
ibool kbs_specified = FALSE;
|
||||
ibool ret = TRUE;
|
||||
|
||||
enum row_type row_type = form->s->row_type;
|
||||
|
||||
ut_ad(thd != NULL);
|
||||
|
||||
@@ -6316,13 +6343,28 @@ create_options_are_valid(
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* Check for a valid Innodb ROW_FORMAT specifier. For example,
|
||||
ROW_TYPE_FIXED can be sent to Innodb */
|
||||
switch (row_type) {
|
||||
case ROW_TYPE_COMPACT:
|
||||
case ROW_TYPE_COMPRESSED:
|
||||
case ROW_TYPE_DYNAMIC:
|
||||
case ROW_TYPE_REDUNDANT:
|
||||
case ROW_TYPE_DEFAULT:
|
||||
break;
|
||||
default:
|
||||
push_warning(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: invalid ROW_FORMAT specifier.");
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
ut_ad(form != NULL);
|
||||
ut_ad(create_info != NULL);
|
||||
|
||||
/* First check if KEY_BLOCK_SIZE was specified. */
|
||||
if (create_info->key_block_size
|
||||
|| (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
|
||||
|
||||
/* First check if a non-zero KEY_BLOCK_SIZE was specified. */
|
||||
if (create_info->key_block_size) {
|
||||
kbs_specified = TRUE;
|
||||
switch (create_info->key_block_size) {
|
||||
case 1:
|
||||
@@ -6333,13 +6375,12 @@ create_options_are_valid(
|
||||
/* Valid value. */
|
||||
break;
|
||||
default:
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: invalid"
|
||||
" KEY_BLOCK_SIZE = %lu."
|
||||
" Valid values are"
|
||||
" [1, 2, 4, 8, 16]",
|
||||
create_info->key_block_size);
|
||||
push_warning_printf(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: invalid KEY_BLOCK_SIZE = %lu."
|
||||
" Valid values are [1, 2, 4, 8, 16]",
|
||||
create_info->key_block_size);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -6347,109 +6388,67 @@ create_options_are_valid(
|
||||
/* If KEY_BLOCK_SIZE was specified, check for its
|
||||
dependencies. */
|
||||
if (kbs_specified && !srv_file_per_table) {
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE"
|
||||
" requires innodb_file_per_table.");
|
||||
push_warning(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE"
|
||||
" requires innodb_file_per_table.");
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) {
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE"
|
||||
" requires innodb_file_format >"
|
||||
" Antelope.");
|
||||
push_warning(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE requires"
|
||||
" innodb_file_format > Antelope.");
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
/* Now check for ROW_FORMAT specifier. */
|
||||
if (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) {
|
||||
switch (form->s->row_type) {
|
||||
const char* row_format_name;
|
||||
case ROW_TYPE_COMPRESSED:
|
||||
case ROW_TYPE_DYNAMIC:
|
||||
row_format_name
|
||||
= form->s->row_type == ROW_TYPE_COMPRESSED
|
||||
? "COMPRESSED"
|
||||
: "DYNAMIC";
|
||||
|
||||
/* These two ROW_FORMATs require srv_file_per_table
|
||||
and srv_file_format > Antelope */
|
||||
if (!srv_file_per_table) {
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ROW_FORMAT=%s"
|
||||
" requires innodb_file_per_table.",
|
||||
row_format_name);
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
if (srv_file_format < DICT_TF_FORMAT_ZIP) {
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ROW_FORMAT=%s"
|
||||
" requires innodb_file_format >"
|
||||
" Antelope.",
|
||||
row_format_name);
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
/* Cannot specify KEY_BLOCK_SIZE with
|
||||
ROW_FORMAT = DYNAMIC.
|
||||
However, we do allow COMPRESSED to be
|
||||
specified with KEY_BLOCK_SIZE. */
|
||||
if (kbs_specified
|
||||
&& form->s->row_type == ROW_TYPE_DYNAMIC) {
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: cannot specify"
|
||||
" ROW_FORMAT = DYNAMIC with"
|
||||
" KEY_BLOCK_SIZE.");
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ROW_TYPE_REDUNDANT:
|
||||
case ROW_TYPE_COMPACT:
|
||||
case ROW_TYPE_DEFAULT:
|
||||
/* Default is COMPACT. */
|
||||
row_format_name
|
||||
= form->s->row_type == ROW_TYPE_REDUNDANT
|
||||
? "REDUNDANT"
|
||||
: "COMPACT";
|
||||
|
||||
/* Cannot specify KEY_BLOCK_SIZE with these
|
||||
format specifiers. */
|
||||
if (kbs_specified) {
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: cannot specify"
|
||||
" ROW_FORMAT = %s with"
|
||||
" KEY_BLOCK_SIZE.",
|
||||
row_format_name);
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
push_warning(thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: invalid ROW_FORMAT specifier.");
|
||||
ret = FALSE;
|
||||
|
||||
switch (row_type) {
|
||||
case ROW_TYPE_COMPRESSED:
|
||||
case ROW_TYPE_DYNAMIC:
|
||||
/* These two ROW_FORMATs require srv_file_per_table
|
||||
and srv_file_format > Antelope */
|
||||
if (!srv_file_per_table) {
|
||||
push_warning_printf(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ROW_FORMAT=%s"
|
||||
" requires innodb_file_per_table.",
|
||||
get_row_format_name(row_type));
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
if (srv_file_format < DICT_TF_FORMAT_ZIP) {
|
||||
push_warning_printf(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ROW_FORMAT=%s requires"
|
||||
" innodb_file_format > Antelope.",
|
||||
get_row_format_name(row_type));
|
||||
ret = FALSE;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (row_type) {
|
||||
case ROW_TYPE_REDUNDANT:
|
||||
case ROW_TYPE_COMPACT:
|
||||
case ROW_TYPE_DYNAMIC:
|
||||
/* KEY_BLOCK_SIZE is only allowed with Compressed or Default */
|
||||
if (kbs_specified) {
|
||||
push_warning_printf(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: cannot specify ROW_FORMAT = %s"
|
||||
" with KEY_BLOCK_SIZE.",
|
||||
get_row_format_name(row_type));
|
||||
ret = FALSE;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
@@ -6575,8 +6574,7 @@ ha_innobase::create(
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (create_info->key_block_size
|
||||
|| (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
|
||||
if (create_info->key_block_size) {
|
||||
/* Determine the page_zip.ssize corresponding to the
|
||||
requested page size (key_block_size) in kilobytes. */
|
||||
|
||||
@@ -6597,38 +6595,39 @@ ha_innobase::create(
|
||||
}
|
||||
|
||||
if (!srv_file_per_table) {
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE"
|
||||
" requires innodb_file_per_table.");
|
||||
push_warning(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE"
|
||||
" requires innodb_file_per_table.");
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
if (file_format < DICT_TF_FORMAT_ZIP) {
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE"
|
||||
" requires innodb_file_format >"
|
||||
" Antelope.");
|
||||
push_warning(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE requires"
|
||||
" innodb_file_format > Antelope.");
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
if (!flags) {
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ignoring"
|
||||
" KEY_BLOCK_SIZE=%lu.",
|
||||
create_info->key_block_size);
|
||||
push_warning_printf(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ignoring"
|
||||
" KEY_BLOCK_SIZE=%lu.",
|
||||
create_info->key_block_size);
|
||||
}
|
||||
}
|
||||
|
||||
row_type = form->s->row_type;
|
||||
|
||||
if (flags) {
|
||||
/* if KEY_BLOCK_SIZE was specified on this statement and
|
||||
ROW_FORMAT was not, automatically change ROW_FORMAT to COMPRESSED.*/
|
||||
if ( (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)
|
||||
&& !(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) {
|
||||
/* if ROW_FORMAT is set to default,
|
||||
automatically change it to COMPRESSED.*/
|
||||
if (row_type == ROW_TYPE_DEFAULT) {
|
||||
row_type = ROW_TYPE_COMPRESSED;
|
||||
} else if (row_type != ROW_TYPE_COMPRESSED) {
|
||||
/* ROW_FORMAT other than COMPRESSED
|
||||
@@ -6638,8 +6637,7 @@ ha_innobase::create(
|
||||
such combinations can be obtained
|
||||
with ALTER TABLE anyway. */
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
|
||||
" unless ROW_FORMAT=COMPRESSED.",
|
||||
@@ -6664,33 +6662,24 @@ ha_innobase::create(
|
||||
}
|
||||
|
||||
switch (row_type) {
|
||||
const char* row_format_name;
|
||||
case ROW_TYPE_REDUNDANT:
|
||||
break;
|
||||
case ROW_TYPE_COMPRESSED:
|
||||
case ROW_TYPE_DYNAMIC:
|
||||
row_format_name
|
||||
= row_type == ROW_TYPE_COMPRESSED
|
||||
? "COMPRESSED"
|
||||
: "DYNAMIC";
|
||||
|
||||
if (!srv_file_per_table) {
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ROW_FORMAT=%s"
|
||||
" requires innodb_file_per_table.",
|
||||
row_format_name);
|
||||
"InnoDB: ROW_FORMAT=%s requires"
|
||||
" innodb_file_per_table.",
|
||||
get_row_format_name(row_type));
|
||||
} else if (file_format < DICT_TF_FORMAT_ZIP) {
|
||||
push_warning_printf(
|
||||
thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: ROW_FORMAT=%s"
|
||||
" requires innodb_file_format >"
|
||||
" Antelope.",
|
||||
row_format_name);
|
||||
"InnoDB: ROW_FORMAT=%s requires"
|
||||
" innodb_file_format > Antelope.",
|
||||
get_row_format_name(row_type));
|
||||
} else {
|
||||
flags |= DICT_TF_COMPACT
|
||||
| (DICT_TF_FORMAT_ZIP
|
||||
@@ -6702,10 +6691,10 @@ ha_innobase::create(
|
||||
case ROW_TYPE_NOT_USED:
|
||||
case ROW_TYPE_FIXED:
|
||||
default:
|
||||
push_warning(thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: assuming ROW_FORMAT=COMPACT.");
|
||||
push_warning(
|
||||
thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: assuming ROW_FORMAT=COMPACT.");
|
||||
case ROW_TYPE_DEFAULT:
|
||||
case ROW_TYPE_COMPACT:
|
||||
flags = DICT_TF_COMPACT;
|
||||
@@ -7658,19 +7647,12 @@ ha_innobase::info_low(
|
||||
innodb_crash_recovery is set to a high value. */
|
||||
stats.delete_length = 0;
|
||||
} else {
|
||||
/* lock the data dictionary to avoid races with
|
||||
ibd_file_missing and tablespace_discarded */
|
||||
row_mysql_lock_data_dictionary(prebuilt->trx);
|
||||
ullint avail_space;
|
||||
|
||||
/* ib_table->space must be an existent tablespace */
|
||||
if (!ib_table->ibd_file_missing
|
||||
&& !ib_table->tablespace_discarded) {
|
||||
|
||||
stats.delete_length =
|
||||
fsp_get_available_space_in_free_extents(
|
||||
ib_table->space) * 1024;
|
||||
} else {
|
||||
avail_space = fsp_get_available_space_in_free_extents(
|
||||
ib_table->space);
|
||||
|
||||
if (avail_space == ULLINT_UNDEFINED) {
|
||||
THD* thd;
|
||||
|
||||
thd = ha_thd();
|
||||
@@ -7687,9 +7669,9 @@ ha_innobase::info_low(
|
||||
ib_table->name);
|
||||
|
||||
stats.delete_length = 0;
|
||||
} else {
|
||||
stats.delete_length = avail_space * 1024;
|
||||
}
|
||||
|
||||
row_mysql_unlock_data_dictionary(prebuilt->trx);
|
||||
}
|
||||
|
||||
stats.check_time = 0;
|
||||
|
Reference in New Issue
Block a user