From 376fb08072e00c6be932b5c38ff6e23288e81e50 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Dec 2003 13:14:21 +0200 Subject: Some small portability fixes. Added support for lower_case_table_names=2, which is to be used on case insensitive file systems. This tells MySQL to preserve the used case of filenames and database names to make it esier to move files between cases sensitive can case insensitive file systems (like Windows and Linux) client/mysqltest.c: Indentation cleanup include/myisam.h: Made some pointers 'const' mysql-test/mysql-test-run.sh: Portability fix for OSX sql/filesort.cc: Safety fix (not needed for current code but needed for 5.0) sql/ha_berkeley.cc: More debugging Changed 'create' to return error number sql/ha_berkeley.h: Added HA_FILE_BASED sql/ha_innodb.cc: Added missing DBUG_RETURN sql/ha_isam.cc: Changed create to return error number sql/ha_isam.h: Added HA_FILE_BASED sql/ha_isammrg.h: Added HA_FILE_BASED sql/ha_myisam.cc: Changed create to return error number sql/ha_myisam.h: Added HA_FILE_BASED sql/ha_myisammrg.cc: Changed create to return error number sql/ha_myisammrg.h: Added HA_FILE_BASED sql/handler.cc: Ensure that table engines gets table names in lower case even if we are using lower_case_table_names Removed test for DB_TYPE_INNODB by ensuring that create method returns error number. sql/handler.h: Added HA_FILE_BASED Made some struct entries 'const' Added 'alias' for create to be able to create tables in mixed case on case insensitive file systems sql/mysql_priv.h: Support for lower_case_table_names=2 sql/mysqld.cc: Support for lower_case_table_names=2 Moved test of case insenstive file system after all mutex are created sql/set_var.cc: Support for lower_case_table_names=2 sql/sql_class.h: Indentation change sql/sql_db.cc: Support for lower_case_table_names=2 sql/sql_insert.cc: Indentation change sql/sql_parse.cc: Support for lower_case_table_names=2 sql/sql_rename.cc: Support for lower_case_table_names=2 Added missing 'unpack_filename' to RENAME which may fix a bug in RENAME TABLE on windows sql/sql_show.cc: If lower_case_table_name=2 is given, show original case in SHOW CREATE TABLE sql/sql_table.cc: Support for lower_case_table_names=2 for DROP TABLE, RENAME TABLE, ALTER TABLE and CREATE TABLE --- sql/handler.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sql/handler.h') diff --git a/sql/handler.h b/sql/handler.h index 03568e2e070..8e72267c337 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -67,12 +67,14 @@ #define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2) #define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2) #define HA_NO_AUTO_INCREMENT (HA_CAN_SQL_HANDLER*2) +/* Table data are stored in separate files */ +#define HA_FILE_BASED (HA_NO_AUTO_INCREMENT*2) /* Next record gives next record according last record read (even if database is updated after read). Not used at this point. */ -#define HA_LASTKEY_ORDER (HA_NO_AUTO_INCREMENT*2) +#define HA_LASTKEY_ORDER (HA_FILE_BASED*2) /* bits in index_flags(index_number) for what you can do with index */ @@ -149,8 +151,9 @@ enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED, typedef struct st_ha_create_information { - char *comment,*password; - char *data_file_name, *index_file_name; + const char *comment,*password; + const char *data_file_name, *index_file_name; + const char *alias; ulonglong max_rows,min_rows; ulonglong auto_increment_value; ulong table_options; -- cgit v1.2.1 From bbd2adf4ba6ec2086a5e8eeaa89f56f1abee02f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Jan 2004 00:05:34 +0100 Subject: Fix for BUG#2477 "Slave stop with error after master reboot if use HEAP tables": when we open the HEAP table for the first time since server restart, in hp_open(), we set a flag to propagate this info to the handler level which then writes a DELETE FROM this_heap_table to the binlog. It is not a perfect solution for the bug, because between the server start and the first open of the table, the slave still had old data in his table so a SELECT on the slave may show wrong content. But if there is a --init-file to populate the HEAP table on master as startup, then this is a safe fix (I'll put a note about init-file in the HEAP section of the manual). heap/hp_info.c: new info variable implicit_emptied heap/hp_open.c: If this is the first open of the HEAP table, it means it is empty, so we mark it. include/heap.h: new variables implicit_emptied (we need one in HEAPINFO for the hp_info() call). sql/ha_heap.cc: report info to upper level sql/handler.h: new info 'implicit_emptied' in the handler level; only HEAP uses it. sql/sql_base.cc: When a HEAP table is opened for the first time, write a DELETE FROM to the binlog, for replication and mysqlbinlog|mysql. Monty: I added the entry->file->implicit_emptied= 0; --- sql/handler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/handler.h') diff --git a/sql/handler.h b/sql/handler.h index 8e72267c337..60edf539e2c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -213,6 +213,7 @@ public: uint raid_type,raid_chunks; FT_INFO *ft_handler; bool auto_increment_column_changed; + bool implicit_emptied; /* Can be !=0 only if HEAP */ handler(TABLE *table_arg) :table(table_arg), ref(0), data_file_length(0), max_data_file_length(0), index_file_length(0), @@ -221,7 +222,7 @@ public: create_time(0), check_time(0), update_time(0), key_used_on_scan(MAX_KEY), active_index(MAX_REF_PARTS), ref_length(sizeof(my_off_t)), block_size(0), - raid_type(0), ft_handler(0) + raid_type(0), ft_handler(0), implicit_emptied(0) {} virtual ~handler(void) {} int ha_open(const char *name, int mode, int test_if_locked); -- cgit v1.2.1 From e2646f092e0e077dc5ad5440159767eeee2136d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Feb 2004 23:57:29 +0200 Subject: row0mysql.c: Allow always DROPping of a table which is only referenced by FOREIGN KEY constraints from the same table Many files: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way sql/ha_innodb.cc: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way sql/sql_insert.cc: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way sql/ha_innodb.h: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way sql/handler.h: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way innobase/dict/dict0dict.c: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way innobase/include/dict0dict.h: Do not let REPLACE to perform internally an UPDATE if the table is referenced by a FOREIGN KEY: the manual says that REPLACE must resolve a duplicate key error semantically with DELETE(s) + INSERT, and not by an UPDATE; the internal update caused foreign key checks and cascaded operations to behave in a semantically wrong way innobase/row/row0mysql.c: Allow always DROPping of a table which is only referenced by FOREIGN KEY constraints from the same table --- sql/handler.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/handler.h') diff --git a/sql/handler.h b/sql/handler.h index 60edf539e2c..750db45759e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -319,6 +319,8 @@ public: virtual void append_create_info(String *packet) {} virtual char* get_foreign_key_create_info() { return(NULL);} /* gets foreign key create string from InnoDB */ + virtual uint referenced_by_foreign_key() { return 0;} /* used in REPLACE; + is > 0 if table is referred by a FOREIGN KEY */ virtual void init_table_handle_for_HANDLER() { return; } /* prepare InnoDB for HANDLER */ virtual void free_foreign_key_create_info(char* str) {} -- cgit v1.2.1 From 30d52f53d1ca4614726b79f3c582de8c7e6ce67b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Feb 2004 12:03:08 +0100 Subject: Code cleanups client/mysqlbinlog.cc: Ensure that errors are returned to upper levels instead of just doing 'exit/die' in sub function. sql/handler.h: Indentation cleanup sql/sql_insert.cc: Indentation cleanup --- sql/handler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sql/handler.h') diff --git a/sql/handler.h b/sql/handler.h index 750db45759e..ead0ed106c7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -319,8 +319,9 @@ public: virtual void append_create_info(String *packet) {} virtual char* get_foreign_key_create_info() { return(NULL);} /* gets foreign key create string from InnoDB */ - virtual uint referenced_by_foreign_key() { return 0;} /* used in REPLACE; - is > 0 if table is referred by a FOREIGN KEY */ + + /* used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */ + virtual uint referenced_by_foreign_key() { return 0;} virtual void init_table_handle_for_HANDLER() { return; } /* prepare InnoDB for HANDLER */ virtual void free_foreign_key_create_info(char* str) {} -- cgit v1.2.1