summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorunknown <stewart@willster.(none)>2006-10-10 00:03:46 +1000
committerunknown <stewart@willster.(none)>2006-10-10 00:03:46 +1000
commite5c306cb93d95a98b51c2366f7bd02bf12169de1 (patch)
treea911c05bd5cb802cc6f30cf6c0ee60badca3a66a /sql/sql_show.cc
parent171affd73ee6c83cabc2e1d3dd9a27bae9840446 (diff)
downloadmariadb-git-e5c306cb93d95a98b51c2366f7bd02bf12169de1.tar.gz
BUG#20839 Illegal error code: 155 returned downgrading from 5.1.12-> 5.1.11
Update mysqldump to dump the needed tablespaces to create the tables for either the dbs or tables we're dumping. With --all-tablespaces, we still dump everything. client/mysqldump.c: Add --no-tablespaces to force not dumping any tablespace information Change behaviour so that: If dumping all databases, all tablespaces are dumped If dumping with --all-tablespaces, all tablespaces are dumped If dumping a set of databases, dump only tablespaces used by tables in that database If dumping a set of tables, dump only tablespaces used by those tables If --no-tablespaces is specified, no tablespaces are dumped. Default behaviour is to dump a restorable dump - i.e. with the tablespaces. When connecting to old mysqld, --no-tablespaces should be specified. sql/sql_show.cc: Use the TABLESPACE_NAME field of the INFORMATION_SCHEMA.PARTITIONS table. NOTE: *CHANGE* in behaviour: if no tablespace, TABLESPACE_NAME will be NULL. This is to support a tablespace called 'default' (which you can happily create). It is likely that the other fields with 'default' should change too. This should also happily continue to work in the future (from a user point of view) when we introduce tablespace per partition.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 5fce82d781a..8f3c8236424 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3889,6 +3889,7 @@ static void collect_partition_expr(List<char> &field_list, String *str)
static void store_schema_partitions_record(THD *thd, TABLE *table,
+ TABLE *show_table,
partition_element *part_elem,
handler *file, uint part_id)
{
@@ -3942,11 +3943,21 @@ static void store_schema_partitions_record(THD *thd, TABLE *table,
table->field[23]->store((longlong) part_elem->nodegroup_id, TRUE);
else
table->field[23]->store(STRING_WITH_LEN("default"), cs);
+
+ table->field[24]->set_notnull();
if (part_elem->tablespace_name)
table->field[24]->store(part_elem->tablespace_name,
strlen(part_elem->tablespace_name), cs);
else
- table->field[24]->store(STRING_WITH_LEN("default"), cs);
+ {
+ DBUG_PRINT("info",("FOO"));
+ char *ts= show_table->file->get_tablespace_name(thd);
+ if(ts)
+ table->field[24]->store(ts, strlen(ts), cs);
+ else
+ table->field[24]->set_null();
+ my_free(ts, MYF(0));
+ }
}
return;
}
@@ -4129,7 +4140,7 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
table->field[6]->store((longlong) ++subpart_pos, TRUE);
table->field[6]->set_notnull();
- store_schema_partitions_record(thd, table, subpart_elem,
+ store_schema_partitions_record(thd, table, show_table, subpart_elem,
file, part_id);
part_id++;
if(schema_table_store_record(thd, table))
@@ -4138,7 +4149,7 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
}
else
{
- store_schema_partitions_record(thd, table, part_elem,
+ store_schema_partitions_record(thd, table, show_table, part_elem,
file, part_id);
part_id++;
if(schema_table_store_record(thd, table))
@@ -4150,7 +4161,7 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
else
#endif
{
- store_schema_partitions_record(thd, table, 0, file, 0);
+ store_schema_partitions_record(thd, table, show_table, 0, file, 0);
if(schema_table_store_record(thd, table))
DBUG_RETURN(1);
}
@@ -5334,7 +5345,7 @@ ST_FIELD_INFO partitions_fields_info[]=
{"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
{"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0},
{"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};