diff --git a/client/mysqldump.c b/client/mysqldump.c index e72b8f247156..87f6f78c130d 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -233,15 +233,25 @@ LIST *skipped_keys_list; #define FBOBJ_FBTYPE_FIELD 1 #define ASSOC_TYPE_FIELD 4 +#define HASHOUT_APP_ID_FIELD 1 +#define FBID_FBTYPE_FIELD 1 +#define FBID_IS_DELETED_FIELD 4 HASH fbobj_assoc_stats; +typedef enum { + FBOBJ= 0, + ASSOC= 1, + HASHOUT= 2, + FBID= 3, +} field_type_t; + typedef struct type_stat { uchar* type; int type_len; ulong count; ulong space; - int field_type; + field_type_t field_type; } TYPE_STAT; static uchar *type_stat_get_key(TYPE_STAT *fbts, size_t *length, @@ -363,9 +373,10 @@ static struct my_option my_long_options[] = &opt_slave_data, &opt_slave_data, 0, GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0}, {"dump-fbobj-assoc-stats", OPT_DUMP_FBOBJ_STATS, - "Calculate and output total size per type for fbobjects and assocs to the " - "given filename. The format in the file is tab separated values in the " - "form: fbobject/assoc, type, row count, size in bytes", + "Calculate and output total size per type for fbobjects, assocs, fbids " + "and hashouts to the given filename. The format in the file is tab " + "separated values in the form: fbobject/assoc/fbid/hashout, " + "type(+is_deleted for fbid), row count, size in bytes", &opt_dump_fbobj_assoc_stats, &opt_dump_fbobj_assoc_stats, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"events", 'E', "Dump events.", @@ -3924,6 +3935,7 @@ static void dump_table(char *table, char *db) my_bool gather_stats= 0; uint num_fields; uint stat_field_offset= 0; + field_type_t stat_field_type= FBOBJ; MYSQL_RES *res = NULL; MYSQL_FIELD *field; MYSQL_ROW row; @@ -3981,19 +3993,35 @@ static void dump_table(char *table, char *db) } /* - Dump stats for fbobj_* and assoc_* tables, but excluding assoc_count and - assoc_info_queue. + Dump stats for fbobj_*, fbid, the top hashout and assoc_* tables, but + excluding assoc_count and assoc_info_queue. */ if (opt_dump_fbobj_assoc_stats) { if (strncmp(table, "fbobj_", 6) == 0) { gather_stats= 1; stat_field_offset= FBOBJ_FBTYPE_FIELD; + stat_field_type= FBOBJ; } else if (strncmp(table, "assoc_", 6) == 0 && (strcmp(table, "assoc_count") != 0) && (strcmp(table, "assoc_info_queue") != 0)) { gather_stats= 1; stat_field_offset= ASSOC_TYPE_FIELD; + stat_field_type= ASSOC; + } + else if (strcmp(table, "fbid") == 0) { + gather_stats= 1; + stat_field_offset= FBID_FBTYPE_FIELD; + stat_field_type= FBID; + } + else if (strcmp(table, "hashout_short_url") == 0 + || (strcmp(table, "hashout") == 0) + || (strcmp(table, "hashout_xid_crow") == 0) + || (strcmp(table, "hashout_xid") == 0) + || (strcmp(table, "hashout_udid") == 0)) { + gather_stats= 1; + stat_field_offset= HASHOUT_APP_ID_FIELD; + stat_field_type= HASHOUT; } /* Protect against new tables that may not have the right schema. */ if (num_fields < stat_field_offset) { @@ -4182,25 +4210,62 @@ static void dump_table(char *table, char *db) ha_checksum row_crc= 0; uint i; ulong *lengths= mysql_fetch_lengths(res); + uint num_columns= mysql_num_fields(res); rownr++; if (gather_stats) { row_length= 0; for (i= 0; i < mysql_num_fields(res); i++) row_length += lengths[i]; - bucket= (TYPE_STAT*)my_hash_search(&fbobj_assoc_stats, - (uchar*)row[stat_field_offset], - lengths[stat_field_offset]); - if (!bucket) { - bucket= (TYPE_STAT*) malloc(sizeof(TYPE_STAT)); - bucket->type= (uchar*)my_strdup(row[stat_field_offset],MYF(MY_FAE)); - bucket->type_len= lengths[stat_field_offset]; - bucket->count= 0; - bucket->space= 0; - bucket->field_type= stat_field_offset; - my_hash_insert(&fbobj_assoc_stats,(uchar*) bucket); + /* For fbid table, concatenate is_deleted to type*/ + if (stat_field_type == FBID) { + if (num_columns <= FBID_IS_DELETED_FIELD) { + fprintf(fbobj_assoc_stats_file, + "-- FBID table has less than 5 columns.\n"); + } else { + char type[(strlen(row[stat_field_offset]) + + strlen(row[FBID_IS_DELETED_FIELD]))]; + strcpy(type, row[stat_field_offset]); + strcat(type, row[FBID_IS_DELETED_FIELD]); + uint length= (lengths[stat_field_offset] + + lengths[FBID_IS_DELETED_FIELD]); + bucket= (TYPE_STAT*)my_hash_search(&fbobj_assoc_stats, + (uchar*)type, + length); + if (!bucket) { + bucket= (TYPE_STAT*) malloc(sizeof(TYPE_STAT)); + bucket->type= (uchar*)my_strdup(type,MYF(MY_FAE)); + bucket->type_len= length; + bucket->count= 0; + bucket->space= 0; + bucket->field_type= stat_field_type; + my_hash_insert(&fbobj_assoc_stats,(uchar*) bucket); + } + bucket->count++; + bucket->space += row_length; + } + } else { + if (num_columns <= stat_field_offset) { + fprintf(fbobj_assoc_stats_file, + "-- %s table has less than %d columns.\n", + table, stat_field_offset+1); + } else { + bucket= (TYPE_STAT*)my_hash_search(&fbobj_assoc_stats, + (uchar*)row[stat_field_offset], + lengths[stat_field_offset]); + if (!bucket) { + bucket= (TYPE_STAT*) malloc(sizeof(TYPE_STAT)); + bucket->type= (uchar*)my_strdup(row[stat_field_offset], + MYF(MY_FAE)); + bucket->type_len= lengths[stat_field_offset]; + bucket->count= 0; + bucket->space= 0; + bucket->field_type= stat_field_type; + my_hash_insert(&fbobj_assoc_stats,(uchar*) bucket); + } + bucket->count++; + bucket->space += row_length; + } } - bucket->count++; - bucket->space += row_length; } if (!extended_insert && !opt_xml) { @@ -4434,13 +4499,12 @@ static void dump_table(char *table, char *db) if (gather_stats) { TYPE_STAT* stat; - fprintf(fbobj_assoc_stats_file, "-- Dumping FBObj/Assoc stats for: %s\n", - table); + fprintf(fbobj_assoc_stats_file, "-- Dumping FBObj/Assoc/Fbid/Hashout " + "stats for: %s\n", table); for (uint i= 0; i < fbobj_assoc_stats.records; i++) { stat= (TYPE_STAT*) my_hash_element(&fbobj_assoc_stats, i); - fprintf(fbobj_assoc_stats_file,"%s\t%s\t%lu\t%lu\n", - stat->field_type == FBOBJ_FBTYPE_FIELD ? "fbobj" : "assoc", - stat->type, stat->count, stat->space); + fprintf(fbobj_assoc_stats_file,"%d\t%s\t%lu\t%lu\n", + stat->field_type, stat->type, stat->count, stat->space); } my_hash_reset(&fbobj_assoc_stats); } diff --git a/mysql-test/r/mysqldump_fbid_hashout.result b/mysql-test/r/mysqldump_fbid_hashout.result new file mode 100644 index 000000000000..264e886971a3 --- /dev/null +++ b/mysql-test/r/mysqldump_fbid_hashout.result @@ -0,0 +1,288 @@ +DROP TABLE IF EXISTS fbid; +DROP TABLE IF EXISTS fbid_test; +DROP TABLE IF EXISTS hashout_test; +DROP TABLE IF EXISTS hashout_short_url; +DROP TABLE IF EXISTS hashout; +DROP TABLE IF EXISTS hashout_xid; +DROP TABLE IF EXISTS hashout_xid_crow; +DROP TABLE IF EXISTS hashout_udid; +DROP DATABASE IF EXISTS fbid_hashout_test; +CREATE DATABASE fbid_hashout_test; +USE fbid_hashout_test; +CREATE TABLE fbid ( +col0 bigint(20) NOT NULL DEFAULT '0', +col1 int(11) NOT NULL DEFAULT '0', +col2 int(11) NOT NULL DEFAULT '0', +col3 varchar(255) NOT NULL DEFAULT '', +col4 tinyint(4) DEFAULT '0', +PRIMARY KEY (col0), +KEY `type_id` (`col1`,`col0`) +) ENGINE = InnoDB; +CREATE TABLE fbid_test ( +col0 bigint(20) NOT NULL DEFAULT '0', +col1 int(11) NOT NULL DEFAULT '0', +col2 int(11) NOT NULL DEFAULT '0', +col3 varchar(255) NOT NULL DEFAULT '', +col4 tinyint(4) DEFAULT '0', +PRIMARY KEY (col0), +KEY `type_id` (`col1`,`col0`) +) ENGINE = InnoDB; +CREATE TABLE hashout_test ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +col1 bigint(20) NOT NULL DEFAULT '0', +col2 text, +col3 blob, +col4 int(10) unsigned DEFAULT NULL, +PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; +CREATE TABLE hashout_short_url ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +col1 bigint(20) NOT NULL DEFAULT '0', +col2 text, +col3 blob, +col4 int(10) unsigned DEFAULT NULL, +PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; +CREATE TABLE hashout ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +col1 bigint(20) NOT NULL DEFAULT '0', +col2 text, +col3 blob, +col4 int(10) unsigned DEFAULT NULL, +PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; +CREATE TABLE hashout_xid ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +col1 bigint(20) NOT NULL DEFAULT '0', +col2 text, +col3 blob, +col4 int(10) unsigned DEFAULT NULL, +PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; +CREATE TABLE hashout_xid_crow ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +col1 bigint(20) NOT NULL DEFAULT '0', +col2 text, +col3 blob, +col4 int(10) unsigned DEFAULT NULL, +PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; +CREATE TABLE hashout_udid ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +col1 bigint(20) NOT NULL DEFAULT '0', +col2 text, +col3 blob, +col4 int(10) unsigned DEFAULT NULL, +PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; +INSERT INTO fbid VALUES (1, 2, 3, REPEAT('X', 1), 0); +INSERT INTO fbid VALUES (2, 3, 3, REPEAT('X', 2), 1); +INSERT INTO fbid VALUES (3, 4, 3, REPEAT('X', 3), 2); +INSERT INTO fbid VALUES (4, 2, 3, REPEAT('X', 5), 0); +INSERT INTO fbid_test VALUES (1, 5, 3, REPEAT('X', 4), 0); +INSERT INTO fbid_test VALUES (2, 6, 3, REPEAT('X', 5), 1); +INSERT INTO hashout_test VALUES ('a', 7, REPEAT('X', 6), 1,1); +INSERT INTO hashout_short_url VALUES ('a', 8, REPEAT('X', 7), 1,1); +INSERT INTO hashout_short_url VALUES ('b', 9, REPEAT('X', 8), 1,1); +INSERT INTO hashout_short_url VALUES ('c', 8, REPEAT('X', 9), 1,1); +INSERT INTO hashout VALUES ('d', 10, REPEAT('X', 1), 1,1); +INSERT INTO hashout VALUES ('e', 11, REPEAT('X', 11), 1,1); +INSERT INTO hashout VALUES ('f', 11, REPEAT('X', 12), 1,1); +INSERT INTO hashout_xid VALUES ('a', 12, REPEAT('X', 13), 1,1); +INSERT INTO hashout_xid VALUES ('b', 13, REPEAT('X', 14), 1,1); +INSERT INTO hashout_xid VALUES ('c', 13, REPEAT('X', 15), 1,1); +INSERT INTO hashout_xid_crow VALUES ('d', 14, REPEAT('X', 1), 1,1); +INSERT INTO hashout_xid_crow VALUES ('e', 15, REPEAT('X', 2), 1,1); +INSERT INTO hashout_xid_crow VALUES ('f', 14, REPEAT('X', 3), 1,1); +INSERT INTO hashout_udid VALUES ('g', 16, REPEAT('X', 4), 1,1); +INSERT INTO hashout_udid VALUES ('h', 17, REPEAT('X', 5), 1,1); +INSERT INTO hashout_udid VALUES ('i', 18, REPEAT('X', 6), 1,1); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `fbid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fbid` ( + `col0` bigint(20) NOT NULL DEFAULT '0', + `col1` int(11) NOT NULL DEFAULT '0', + `col2` int(11) NOT NULL DEFAULT '0', + `col3` varchar(255) NOT NULL DEFAULT '', + `col4` tinyint(4) DEFAULT '0', + PRIMARY KEY (`col0`), + KEY `type_id` (`col1`,`col0`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `fbid` WRITE; +/*!40000 ALTER TABLE `fbid` DISABLE KEYS */; +INSERT INTO `fbid` VALUES (1,2,3,'X',0),(2,3,3,'XX',1),(3,4,3,'XXX',2),(4,2,3,'XXXXX',0); +/*!40000 ALTER TABLE `fbid` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `fbid_test`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fbid_test` ( + `col0` bigint(20) NOT NULL DEFAULT '0', + `col1` int(11) NOT NULL DEFAULT '0', + `col2` int(11) NOT NULL DEFAULT '0', + `col3` varchar(255) NOT NULL DEFAULT '', + `col4` tinyint(4) DEFAULT '0', + PRIMARY KEY (`col0`), + KEY `type_id` (`col1`,`col0`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `fbid_test` WRITE; +/*!40000 ALTER TABLE `fbid_test` DISABLE KEYS */; +INSERT INTO `fbid_test` VALUES (1,5,3,'XXXX',0),(2,6,3,'XXXXX',1); +/*!40000 ALTER TABLE `fbid_test` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout_test`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout_test` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + `col1` bigint(20) NOT NULL DEFAULT '0', + `col2` text, + `col3` blob, + `col4` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`col0`,`col1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout_test` WRITE; +/*!40000 ALTER TABLE `hashout_test` DISABLE KEYS */; +INSERT INTO `hashout_test` VALUES ('a\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',7,'XXXXXX','1',1); +/*!40000 ALTER TABLE `hashout_test` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout_short_url`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout_short_url` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + `col1` bigint(20) NOT NULL DEFAULT '0', + `col2` text, + `col3` blob, + `col4` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`col0`,`col1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout_short_url` WRITE; +/*!40000 ALTER TABLE `hashout_short_url` DISABLE KEYS */; +INSERT INTO `hashout_short_url` VALUES ('a\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',8,'XXXXXXX','1',1),('b\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',9,'XXXXXXXX','1',1),('c\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',8,'XXXXXXXXX','1',1); +/*!40000 ALTER TABLE `hashout_short_url` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + `col1` bigint(20) NOT NULL DEFAULT '0', + `col2` text, + `col3` blob, + `col4` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`col0`,`col1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout` WRITE; +/*!40000 ALTER TABLE `hashout` DISABLE KEYS */; +INSERT INTO `hashout` VALUES ('d\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',10,'X','1',1),('e\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',11,'XXXXXXXXXXX','1',1),('f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',11,'XXXXXXXXXXXX','1',1); +/*!40000 ALTER TABLE `hashout` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout_xid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout_xid` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + `col1` bigint(20) NOT NULL DEFAULT '0', + `col2` text, + `col3` blob, + `col4` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`col0`,`col1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout_xid` WRITE; +/*!40000 ALTER TABLE `hashout_xid` DISABLE KEYS */; +INSERT INTO `hashout_xid` VALUES ('a\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',12,'XXXXXXXXXXXXX','1',1),('b\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',13,'XXXXXXXXXXXXXX','1',1),('c\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',13,'XXXXXXXXXXXXXXX','1',1); +/*!40000 ALTER TABLE `hashout_xid` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout_xid_crow`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout_xid_crow` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + `col1` bigint(20) NOT NULL DEFAULT '0', + `col2` text, + `col3` blob, + `col4` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`col0`,`col1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout_xid_crow` WRITE; +/*!40000 ALTER TABLE `hashout_xid_crow` DISABLE KEYS */; +INSERT INTO `hashout_xid_crow` VALUES ('d\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',14,'X','1',1),('e\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',15,'XX','1',1),('f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',14,'XXX','1',1); +/*!40000 ALTER TABLE `hashout_xid_crow` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout_udid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout_udid` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + `col1` bigint(20) NOT NULL DEFAULT '0', + `col2` text, + `col3` blob, + `col4` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`col0`,`col1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout_udid` WRITE; +/*!40000 ALTER TABLE `hashout_udid` DISABLE KEYS */; +INSERT INTO `hashout_udid` VALUES ('g\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',16,'XXXX','1',1),('h\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',17,'XXXXX','1',1),('i\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',18,'XXXXXX','1',1); +/*!40000 ALTER TABLE `hashout_udid` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: fbid +3 20 2 14 +3 42 1 7 +3 31 1 6 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout_short_url +2 9 1 27 +2 8 2 54 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout +2 10 1 21 +2 11 2 63 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout_xid +2 12 1 33 +2 13 2 69 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout_xid_crow +2 14 2 44 +2 15 1 22 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout_udid +2 18 1 26 +2 17 1 25 +2 16 1 24 +-- FBObj/Assoc stats dump completed. +DROP DATABASE fbid_hashout_test; diff --git a/mysql-test/r/mysqldump_fbid_hashout_schemachange.result b/mysql-test/r/mysqldump_fbid_hashout_schemachange.result new file mode 100644 index 000000000000..460e951c772c --- /dev/null +++ b/mysql-test/r/mysqldump_fbid_hashout_schemachange.result @@ -0,0 +1,100 @@ +DROP TABLE IF EXISTS fbid; +DROP TABLE IF EXISTS hashout; +DROP TABLE IF EXISTS hashout_udid; +DROP DATABASE IF EXISTS fbid_hashout_schema_change_test; +CREATE DATABASE fbid_hashout_schema_change_test; +USE fbid_hashout_schema_change_test; +CREATE TABLE fbid ( +col0 bigint(20) NOT NULL DEFAULT '0', +col1 int(11) NOT NULL DEFAULT '0', +col2 int(11) NOT NULL DEFAULT '0', +col3 varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (col0), +KEY `type_id` (`col1`,`col0`) +) ENGINE = InnoDB; +CREATE TABLE hashout ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +PRIMARY KEY (col0) +) ENGINE = InnoDB; +CREATE TABLE hashout_udid ( +col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +PRIMARY KEY (col0) +) ENGINE = InnoDB; +INSERT INTO fbid VALUES (1, 2, 3, REPEAT('X', 1)); +INSERT INTO hashout VALUES ('d'); +INSERT INTO hashout_udid VALUES ('i'); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `fbid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fbid` ( + `col0` bigint(20) NOT NULL DEFAULT '0', + `col1` int(11) NOT NULL DEFAULT '0', + `col2` int(11) NOT NULL DEFAULT '0', + `col3` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`col0`), + KEY `type_id` (`col1`,`col0`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `fbid` WRITE; +/*!40000 ALTER TABLE `fbid` DISABLE KEYS */; +INSERT INTO `fbid` VALUES (1,2,3,'X'); +/*!40000 ALTER TABLE `fbid` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + PRIMARY KEY (`col0`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout` WRITE; +/*!40000 ALTER TABLE `hashout` DISABLE KEYS */; +INSERT INTO `hashout` VALUES ('d\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'); +/*!40000 ALTER TABLE `hashout` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `hashout_udid`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `hashout_udid` ( + `col0` binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + PRIMARY KEY (`col0`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `hashout_udid` WRITE; +/*!40000 ALTER TABLE `hashout_udid` DISABLE KEYS */; +INSERT INTO `hashout_udid` VALUES ('i\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'); +/*!40000 ALTER TABLE `hashout_udid` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- FBID table has less than 5 columns. +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: fbid +-- hashout table has less than 2 columns. +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout +-- hashout_udid table has less than 2 columns. +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: hashout_udid +-- FBObj/Assoc stats dump completed. +DROP DATABASE fbid_hashout_schema_change_test; diff --git a/mysql-test/r/mysqldump_fbobj.result b/mysql-test/r/mysqldump_fbobj.result index ca202fa7b0bd..93cf13f1b89d 100644 --- a/mysql-test/r/mysqldump_fbobj.result +++ b/mysql-test/r/mysqldump_fbobj.result @@ -112,11 +112,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dumping FBObj/Assoc stats for: fbobj_test -fbobj 3 1 73 -fbobj 2 2 116 --- Dumping FBObj/Assoc stats for: assoc_test -assoc 5 2 230 -assoc 1 1 145 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: fbobj_test +0 3 1 73 +0 2 2 116 +-- Dumping FBObj/Assoc/Fbid/Hashout stats for: assoc_test +1 5 2 230 +1 1 1 145 -- FBObj/Assoc stats dump completed. DROP DATABASE fbobj_test; diff --git a/mysql-test/t/mysqldump_fbid_hashout.test b/mysql-test/t/mysqldump_fbid_hashout.test new file mode 100644 index 000000000000..d82d0cd77273 --- /dev/null +++ b/mysql-test/t/mysqldump_fbid_hashout.test @@ -0,0 +1,125 @@ +--disable_warnings +DROP TABLE IF EXISTS fbid; +DROP TABLE IF EXISTS fbid_test; +DROP TABLE IF EXISTS hashout_test; +DROP TABLE IF EXISTS hashout_short_url; +DROP TABLE IF EXISTS hashout; +DROP TABLE IF EXISTS hashout_xid; +DROP TABLE IF EXISTS hashout_xid_crow; +DROP TABLE IF EXISTS hashout_udid; +DROP DATABASE IF EXISTS fbid_hashout_test; +--enable_warnings + +CREATE DATABASE fbid_hashout_test; +USE fbid_hashout_test; +CREATE TABLE fbid ( + col0 bigint(20) NOT NULL DEFAULT '0', + col1 int(11) NOT NULL DEFAULT '0', + col2 int(11) NOT NULL DEFAULT '0', + col3 varchar(255) NOT NULL DEFAULT '', + col4 tinyint(4) DEFAULT '0', + PRIMARY KEY (col0), + KEY `type_id` (`col1`,`col0`) +) ENGINE = InnoDB; + +CREATE TABLE fbid_test ( + col0 bigint(20) NOT NULL DEFAULT '0', + col1 int(11) NOT NULL DEFAULT '0', + col2 int(11) NOT NULL DEFAULT '0', + col3 varchar(255) NOT NULL DEFAULT '', + col4 tinyint(4) DEFAULT '0', + PRIMARY KEY (col0), + KEY `type_id` (`col1`,`col0`) +) ENGINE = InnoDB; + +CREATE TABLE hashout_test ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + col1 bigint(20) NOT NULL DEFAULT '0', + col2 text, + col3 blob, + col4 int(10) unsigned DEFAULT NULL, + PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; + +CREATE TABLE hashout_short_url ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + col1 bigint(20) NOT NULL DEFAULT '0', + col2 text, + col3 blob, + col4 int(10) unsigned DEFAULT NULL, + PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; + + +CREATE TABLE hashout ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + col1 bigint(20) NOT NULL DEFAULT '0', + col2 text, + col3 blob, + col4 int(10) unsigned DEFAULT NULL, + PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; + + +CREATE TABLE hashout_xid ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + col1 bigint(20) NOT NULL DEFAULT '0', + col2 text, + col3 blob, + col4 int(10) unsigned DEFAULT NULL, + PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; + + +CREATE TABLE hashout_xid_crow ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + col1 bigint(20) NOT NULL DEFAULT '0', + col2 text, + col3 blob, + col4 int(10) unsigned DEFAULT NULL, + PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; + +CREATE TABLE hashout_udid ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + col1 bigint(20) NOT NULL DEFAULT '0', + col2 text, + col3 blob, + col4 int(10) unsigned DEFAULT NULL, + PRIMARY KEY (col0, col1) +) ENGINE = InnoDB; + +INSERT INTO fbid VALUES (1, 2, 3, REPEAT('X', 1), 0); +INSERT INTO fbid VALUES (2, 3, 3, REPEAT('X', 2), 1); +INSERT INTO fbid VALUES (3, 4, 3, REPEAT('X', 3), 2); +INSERT INTO fbid VALUES (4, 2, 3, REPEAT('X', 5), 0); + +INSERT INTO fbid_test VALUES (1, 5, 3, REPEAT('X', 4), 0); +INSERT INTO fbid_test VALUES (2, 6, 3, REPEAT('X', 5), 1); + +INSERT INTO hashout_test VALUES ('a', 7, REPEAT('X', 6), 1,1); + +INSERT INTO hashout_short_url VALUES ('a', 8, REPEAT('X', 7), 1,1); +INSERT INTO hashout_short_url VALUES ('b', 9, REPEAT('X', 8), 1,1); +INSERT INTO hashout_short_url VALUES ('c', 8, REPEAT('X', 9), 1,1); + +INSERT INTO hashout VALUES ('d', 10, REPEAT('X', 1), 1,1); +INSERT INTO hashout VALUES ('e', 11, REPEAT('X', 11), 1,1); +INSERT INTO hashout VALUES ('f', 11, REPEAT('X', 12), 1,1); + +INSERT INTO hashout_xid VALUES ('a', 12, REPEAT('X', 13), 1,1); +INSERT INTO hashout_xid VALUES ('b', 13, REPEAT('X', 14), 1,1); +INSERT INTO hashout_xid VALUES ('c', 13, REPEAT('X', 15), 1,1); + +INSERT INTO hashout_xid_crow VALUES ('d', 14, REPEAT('X', 1), 1,1); +INSERT INTO hashout_xid_crow VALUES ('e', 15, REPEAT('X', 2), 1,1); +INSERT INTO hashout_xid_crow VALUES ('f', 14, REPEAT('X', 3), 1,1); + +INSERT INTO hashout_udid VALUES ('g', 16, REPEAT('X', 4), 1,1); +INSERT INTO hashout_udid VALUES ('h', 17, REPEAT('X', 5), 1,1); +INSERT INTO hashout_udid VALUES ('i', 18, REPEAT('X', 6), 1,1); + +--exec $MYSQL_DUMP --skip-comments --skip-dump-date --dump-fbobj-assoc-stats=$MYSQLTEST_VARDIR/fbid_hashout_dump fbid_hashout_test fbid fbid_test hashout_test hashout_short_url hashout hashout_xid hashout_xid_crow hashout_udid +--cat_file $MYSQLTEST_VARDIR/fbid_hashout_dump + +DROP DATABASE fbid_hashout_test; diff --git a/mysql-test/t/mysqldump_fbid_hashout_schemachange.test b/mysql-test/t/mysqldump_fbid_hashout_schemachange.test new file mode 100644 index 000000000000..0673813dfd29 --- /dev/null +++ b/mysql-test/t/mysqldump_fbid_hashout_schemachange.test @@ -0,0 +1,38 @@ +--disable_warnings +DROP TABLE IF EXISTS fbid; +DROP TABLE IF EXISTS hashout; +DROP TABLE IF EXISTS hashout_udid; +DROP DATABASE IF EXISTS fbid_hashout_schema_change_test; +--enable_warnings + +CREATE DATABASE fbid_hashout_schema_change_test; +USE fbid_hashout_schema_change_test; +CREATE TABLE fbid ( + col0 bigint(20) NOT NULL DEFAULT '0', + col1 int(11) NOT NULL DEFAULT '0', + col2 int(11) NOT NULL DEFAULT '0', + col3 varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (col0), + KEY `type_id` (`col1`,`col0`) +) ENGINE = InnoDB; + +CREATE TABLE hashout ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + PRIMARY KEY (col0) +) ENGINE = InnoDB; + +CREATE TABLE hashout_udid ( + col0 binary(16) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + PRIMARY KEY (col0) +) ENGINE = InnoDB; + +INSERT INTO fbid VALUES (1, 2, 3, REPEAT('X', 1)); + +INSERT INTO hashout VALUES ('d'); + +INSERT INTO hashout_udid VALUES ('i'); + +--exec $MYSQL_DUMP --skip-comments --skip-dump-date --dump-fbobj-assoc-stats=$MYSQLTEST_VARDIR/fbid_hashout_dump_schema_change fbid_hashout_schema_change_test fbid hashout hashout_udid +--cat_file $MYSQLTEST_VARDIR/fbid_hashout_dump_schema_change + +DROP DATABASE fbid_hashout_schema_change_test;