freezes (win) the server
The check for equality was assuming the field object is always
created. If it's not it was de-referencing a NULL pointer.
Fixed to use the data in the create object instead.
We set up DATE and TIMESTAMP differently in field-creation than we
did in field-MD creation (for CREATE). Admirably, ALTER TABLE
detected this and didn't damage any data, but it did initiate a
full copy/conversion, which we don't really need to do.
Now we describe Field and Create_field the same for those types.
As a result, ALTER TABLE that only changes meta-data (like a
field's name) no longer forces a data-copy when there needn't
be one.
mysql-test/r/alter_table.result:
0 rows should be affected when a meta-data change is enough ALTER TABLE.
mysql-test/t/alter_table.test:
add test-case: show that we don't do a full data-copy on ALTER TABLE
when we don't need to.
sql/field.cc:
Remove Field_str::compare_str_field_flags() (now in Field/Create_field as
field_flags_are_binary().
Correct some field-lengths!
sql/field.h:
Clean-up: use defined constants rather than numeric literals for certain
field-lengths.
Add enquiry-functions binaryp() to classes Field and Create_field.
This replaces field.cc's Field_str::compare_str_field_flags().
The problem was that appending values to the end of an existing
ENUM or SET column was being treated as table data modification,
preventing a immediately (fast) table alteration that occurs when
only table metadata is being modified.
The cause was twofold: adding a enumeration or set members to the
end of the list of valid member values was not being considered
a "compatible" table alteration, and for SET columns, the check
was being done upon the max display length and not the underlying
(pack) length of the field.
The solution is to augment the function that checks wether two ENUM
or SET fields are compatible -- by comparing the pack lengths and
performing a limited comparison of the member values.
mysql-test/r/alter_table.result:
Add test case result for Bug#45567
mysql-test/t/alter_table.test:
Add test case for Bug#45567
sql/field.cc:
Check whether two fields can be considered 'equal' for table
alteration purposes. Fields are equal if they retain the same
pack length and if new members are added to the end of the list.
sql/field.h:
Add comment and remove method.
added ability for TINY[MEDIUM] text fields
to be converted to greater subtype during
alter if necessary(altered charset)
mysql-test/r/alter_table.result:
test result
mysql-test/t/alter_table.test:
test case
sql/sql_table.cc:
added ability for TINY[MEDIUM] text fields
to be converted to greater subtype during
alter if necessary(altered charset)
Problem: mysqld doesn't detect that enum data must be reinserted performing
'ALTER TABLE' in some cases.
Fix: reinsert data altering an enum field if enum values are changed.
mysql-test/r/alter_table.result:
Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
- test result.
mysql-test/t/alter_table.test:
Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
- test case.
sql/field.cc:
Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
- Field_enum::is_equal() introduced, which is called to detect that a field
is changing by 'ALTER TABLE'.
sql/field.h:
Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
- Field_enum::is_equal() introduced, which is called to detect that a field
is changing by 'ALTER TABLE'.
The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
table reconstruction.
The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.
mysql-test/r/alter_table.result:
test result
mysql-test/t/alter_table.test:
test case
sql/sql_table.cc:
The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
table reconstruction.
The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.
The problem was that when comparing tables for a possible
fast alter table, the comparison was being performed using
the parsed information and not the final definition.
The solution is to use the possible final table layout to
compare if a fast alter is possible or not.
mysql-test/include/mix1.inc:
Disable test case for Bug 21704 as it hasn't been fixed.
mysql-test/r/alter_table.result:
Add test case result for Bug#33873
mysql-test/r/innodb_mysql.result:
Update test case result
mysql-test/t/alter_table.test:
Add test case for Bug#33873
sql/sql_table.cc:
Use updated (final) information to compare fields.
INSERT/DELETE/UPDATE followed by ALTER TABLE within LOCK TABLES
may cause table corruption on Windows.
That happens because ALTER TABLE writes outdated shared state
info into index file.
Fixed by removing obsolete workaround.
Affects MyISAM tables on Windows only.
myisam/mi_extra.c:
On windows when mi_extra(HA_EXTRA_PREPARE_FOR_DELETE) is called,
we release external lock and close index file. If we're in LOCK
TABLES, MyISAM state info doesn't get updated until UNLOCK TABLES.
That means when we release external lock and we're in LOCK TABLES,
we may write outdated state info.
As SQL layer closes all table instances, we do not need this
workaround anymore.
mysql-test/r/alter_table.result:
A test case for BUG#29957.
mysql-test/t/alter_table.test:
A test case for BUG#29957.
into olga.mysql.com:/home/igor/mysql-5.1-opt-merge
mysql-test/r/alter_table.result:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/r/user_var.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/strict.test:
Auto merged
mysql-test/t/subselect3.test:
Auto merged
sql/field.h:
Auto merged
sql/handler.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/ps_2myisam.result:
Manual merge.
mysql-test/r/ps_3innodb.result:
Manual merge.
mysql-test/r/ps_4heap.result:
Manual merge.
mysql-test/r/ps_5merge.result:
Manual merge.
mysql-test/r/ps_7ndb.result:
Manual merge.
sql/sql_table.cc:
Manual merge.
sql/sql_view.cc:
Manual merge.
To avoid unnecessary work the mysql_alter_table function takes the
list of table fields and applies all changes to it (drops/moves/renames/etc).
Then this function compares the new list and the old one. If the changes
require only .frm to be modified then the actual data isn't copied. To detect
changes all columns attributes but names are compared. When a column has been
moved and has replaced another column with the same attributes except name
the mysql_alter_table function wrongly decides that two fields has been just
renamed. As a result the data from the moved column and from all columns
after it is not copied.
Now the mysql_alter_table function forces table data copying by setting
the need_copy_table flag when it finds a moved column. The flag is set at
the stage when the modified fields are created.
sql/sql_table.cc:
Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
Now the mysql_alter_table function forces table data copying by setting
the need_copy_table flag when it finds a moved column. The flag is set at
the stage when the modified fields are created.
mysql-test/r/alter_table.result:
Added a test case for the bug#28427: Columns were renamed instead of moving by ALTER TABLE.
mysql-test/t/alter_table.test:
Added a test case for the bug#28427: Columns were renamed instead of moving by ALTER TABLE.
into moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
mysql-test/r/func_gconcat.result:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
sql/item_sum.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/table.h:
Auto merged
mysql-test/r/alter_table.result:
Manual merge
mysql-test/t/alter_table.test:
Manual merge
sql/sql_table.cc:
Manual merge
mode.
When a new DATE/DATETIME field without default value is being added by the
ALTER TABLE the '0000-00-00' value is used as the default one. But it wasn't
checked whether such value was allowed by the set sql mode. Due to this
'0000-00-00' values was allowed for DATE/DATETIME fields even in the
NO_ZERO_DATE mode.
Now the mysql_alter_table() function checks whether the '0000-00-00' value
is allowed for DATE/DATETIME fields by the set sql mode.
The new error_if_not_empty flag is used in the mysql_alter_table() function
to indicate that it should abort if the table being altered isn't empty.
The new new_datetime_field field is used in the mysql_alter_table() function
for error throwing purposes.
The new error_if_not_empty parameter is added to the copy_data_between_tables()
function to indicate the it should return error if the source table isn't empty.
mysql-test/t/alter_table.test:
Added a test case for the bug#27507: Wrong DATETIME value was allowed by
ALTER TABLE in the NO_ZERO_DATE mode.
mysql-test/r/alter_table.result:
Added a test case for the bug#27507: Wrong DATETIME value was allowed by
ALTER TABLE in the NO_ZERO_DATE mode.
sql/sql_table.cc:
Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the NO_ZERO_DATE
mode.
Now the mysql_alter_table() function checks whether the '0000-00-00' value
is allowed for DATE/DATETIME fields by the set sql mode.
The new error_if_not_empty flag is used in the mysql_alter_table() function
to indicate that it should abort if the table being altered isn't empty.
The new new_datetime_field field is used in the mysql_alter_table() function
for error throwing purposes.
The new error_if_not_empty parameter is added to the copy_data_between_tables()
function to indicate the it should return error if the source table isn't empty.
and invalidation in the most general case (non-temporary table and
not simple RENAME or ENABLE/DISABLE KEYS or partitioning command).
See comment for sql/sql_table.cc for more information.
These changes are prerequisite for 5.1 version of fix for bug #23667
"CREATE TABLE LIKE is not isolated from alteration by other connections"
mysql-test/include/mix1.inc:
Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
which should be consistent across all platforms and for all engines.
mysql-test/r/alter_table-big.result:
Changed test for bug #25044 to use @@debug and injected sleeps
infrastructure. Extended test coverage for ALTER TABLE's behavior
under concurrency.
mysql-test/r/alter_table.result:
Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
which should be consistent across all platforms and for all engines.
mysql-test/r/innodb_mysql.result:
Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
which should be consistent across all platforms and for all engines.
mysql-test/t/alter_table-big.test:
Changed test for bug #25044 to use @@debug and injected sleeps
infrastructure. Extended test coverage for ALTER TABLE's behavior
under concurrency.
mysql-test/t/alter_table.test:
Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
which should be consistent across all platforms and for all engines.
sql/mysql_priv.h:
Made functions reopen_table() and close_handle_and_leave_table_as_lock()
available outside of sql_base.cc file.
Changed close_data_tables() in such way that after closing handler
for the table it leaves TABLE object for it in table cache not as
placeholder for ordinary name-lock but as placeholder for an exclusive
name-lock. Renamed this routine to close_data_files_and_morph_locks().
sql/sql_base.cc:
Made functions reopen_table() and close_handle_and_leave_table_as_lock()
available outside of sql_base.cc file.
Changed close_data_tables() in such way that after closing handler
for the table it leaves TABLE object for it in table cache not as
placeholder for ordinary name-lock but as placeholder for an exclusive
name-lock. Renamed this routine to close_data_files_and_morph_locks().
Also adjusted it so it can work properly not only in LOCK TABLES mode.
sql/sql_table.cc:
Changed the way in which ALTER TABLE implementation handles table
locking and invalidation in the most general case (non-temporary table
and not simple RENAME or ENABLE/DISABLE KEYS or partitioning command)
Now after preparing new version of the table we:
1) Wait until all other threads close old version of table.
2) Close instances of table open by this thread and replace them
with exclusive name-locks.
3) Rename the old table to a temp name, rename the new one to the
old name.
4) If we are under LOCK TABLES and don't do ALTER TABLE ... RENAME
we reopen new version of table.
5) Write statement to the binary log.
6) If we are under LOCK TABLES and do ALTER TABLE ... RENAME we
remove name-locks from list of open tables and table cache.
7) If we are not not under LOCK TABLES we rely on close_thread_tables()
call to remove name-locks from table cache and list of open table.
Such approach:
a) Eliminates possibility for concurrent statement to sneak in and get
access to the new version of the table before ALTER TABLE gets logged
into binary log.
b) Ensures that ALTER TABLE behaves under LOCK TABLES in the same way
on all platforms and for all engines (in 5.0 this was not true)
c) Preserves nice invariant that if table is open in some connection
there is a guarantee that .FRM file for this table exists and is
properly named.
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
mysql-test/r/alter_table.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
sql/sql_table.cc:
Auto merged
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
mysql-test/r/alter_table.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
sql/sql_table.cc:
Auto merged
into pilot.blaudden:/home/msvensson/mysql/bug25262/my51-bug25262
mysql-test/r/alter_table.result:
Manual merge
mysql-test/t/alter_table.test:
Manual merge
sql/sql_table.cc:
Manual merge, auto_increment_value variable has moved into "stats"
It was syntactically correct to define
spatial keys over parts of columns (e.g.
ALTER TABLE t1 ADD x GEOMETRY NOT NULL,
ADD SPATIAL KEY (x(32))).
This may lead to undefined results and/or
interpretation.
Fixed by not allowing partial column
specification in a SPATIAL index definition.
mysql-test/r/alter_table.result:
Bug #26794: 5.1 part
test case
mysql-test/r/gis-rtree.result:
Bug #26794: 5.1 part
updated the tests to the new syntax
mysql-test/t/alter_table.test:
Bug #26794: 5.1 part
test case
mysql-test/t/gis-rtree.test:
Bug #26794: 5.1 part
updated the tests to the new syntax
sql/sql_table.cc:
Bug #26794: 5.1 part
Disable defining SPATIAL KEYS with sub-key parts
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE.
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
mysql-test/r/alter_table.result:
Bug #26794: test case
mysql-test/r/gis-rtree.result:
Bug #26794: fixed SHOW CREATE TABLE output.
mysql-test/t/alter_table.test:
Bug #26794: test case
sql/field.cc:
Bug #26794: Allow sub-keys for GEOMETRY
sql/sql_show.cc:
Bug #26794: Don't show sub-key notion
in SHOW CREATE TABLE for SPATIAL indexes.
sql/sql_table.cc:
Bug #26794: Allow sub-keys for GEOMETRY
into magare.gmz:/home/kgeorge/mysql/work/B26794-5.1-opt
mysql-test/r/gis-rtree.result:
Auto merged
sql/field.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/alter_table.result:
tests merge
mysql-test/t/alter_table.test:
tests merge
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE.
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
mysql-test/r/alter_table.result:
Bug #26794: test case
mysql-test/r/gis-rtree.result:
Bug #26794: fixed SHOW CREATE TABLE output.
mysql-test/t/alter_table.test:
Bug #26794: test case
sql/field.cc:
Bug #26794: Allow sub-keys for GEOMETRY
sql/sql_show.cc:
Bug #26794: Don't show sub-key notion
in SHOW CREATE TABLE for SPATIAL indexes.
sql/sql_table.cc:
Bug #26794: Allow sub-keys for GEOMETRY
- Try to copy the autoincrement value when altering the table
mysql-test/r/alter_table.result:
Update test result
mysql-test/t/alter_table.test:
Add test case as described in bug report
sql/sql_table.cc:
Try to copy the autoincrement value when altering the table
into weblab.(none):/home/marcsql/TREE/mysql-5.1-24562-merge
mysql-test/r/alter_table.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
sql/sql_yacc.yy:
Auto merged
WL#3681 (ALTER TABLE ORDER BY)
Before this fix, the ALTER TABLE statement implemented an ORDER BY option
with the following characteristics :
1) The order by clause accepts a list of criteria, with optional ASC or
DESC keywords
2) Each criteria can be a general expression, involving operators,
native functions, stored functions, user defined functions, subselects ...
With this fix :
1) has been left unchanged, since it's a de-facto existing feature,
that was already present in the code base and partially covered in the test
suite. Code coverage for ASC and DESC was missing and has been improved.
2) has been changed to limit the kind of criteria that are permissible:
now only a column name is valid.
mysql-test/r/alter_table.result:
Prevent ALTER TABLE ORDER BY clauses to use general expressions.
mysql-test/t/alter_table.test:
Prevent ALTER TABLE ORDER BY clauses to use general expressions.
sql/sql_yacc.yy:
Prevent ALTER TABLE ORDER BY clauses to use general expressions.
into mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-5.1-engines
mysql-test/r/alter_table.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
sql/sql_parse.cc:
Auto merged
into mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-5.0-engines
mysql-test/r/alter_table.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
sql/sql_parse.cc:
SCCS merged
table
ROW_FORMAT option is lost during CREATE/DROP INDEX.
This fix forces CREATE/DROP INDEX to retain ROW_FORMAT by instructing
mysql_alter_table() that ROW_FORMAT is not used during creating/dropping
indexes.
mysql-test/r/alter_table.result:
A test case for bug#23404.
mysql-test/t/alter_table.test:
A test case for bug#23404.
sql/sql_parse.cc:
CREATE/DROP INDEX must not change ROW_FORMAT. Setting create_info.row_type
to ROW_TYPE_NOT_USED informs mysql_alter_table that ROW_FORMAT was not
used during alteration, and thus must be retained.
into example.com:/work/bug22369-v2/my51
mysql-test/r/alter_table.result:
Auto merged
mysql-test/r/grant.result:
Auto merged
mysql-test/t/grant.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/t/alter_table.test:
manual merge
with other alterations causes lost tables
Using RENAME clause combined with other clauses of ALTER TABLE led to
data loss (the data was there but not accessible). This could happen if the
changes do not change the table much. Adding and droppping of fields and
indices was safe. Renaming a column with MODIFY or CHANGE was unsafe operation,
if the actual column didn't change (changing from int to int, which is a noop)
Depending on the storage engine (SE) the behavior is different:
1)MyISAM/MEMORY - the ALTER TABLE statement completes
without any error but next SELECT against the new table fails.
2)InnoDB (and every other transactional table) - The ALTER TABLE statement
fails. There are the the following files in the db dir -
`new_table_name.frm` and a temporary table's frm. If the SE is file
based, then the data and index files will be present but with the old
names. What happens is that for InnoDB the table is not renamed in the
internal DDIC.
Fixed by adding additional call to mysql_rename_table() method, which should
not include FRM file rename, because it has been already done during file
names juggling.
mysql-test/r/alter_table.result:
update result
mysql-test/r/grant.result:
update result
mysql-test/t/alter_table.test:
2006/11/29 11:46:23+01:00 andrey@example.com +44 -9
Error to bug number
Added test case for #22369: Alter table rename combined
with other alterations causes lost tables
mysql-test/t/grant.test:
add test for bug#22369 - alter table was missing check
for DROP_ACL when ALTER_RENAME clause is specified. Synchronise
with RENAME TABLE DDL.
sql/mysql_priv.h:
Add a new flag for mysql_rename_table()
sql/sql_parse.cc:
To be consistent with SQLCOM_RENAME_TABLE, SQLCOM_ALTER_TABLE has
to check for DROP_ACL if there is ALTER_RENAME flag set.
sql/sql_table.cc:
ALTER_RENAME, the data and index files weren't renamed in the engine
but only the FRM was new, when the tables old and new tables are compatible.
In the chain of FRM renames we add a call to mysql_rename_table() which should
instruct the engine to rename the table but not rename the FRM.
This bug was there only in 5.1 branch. 4.1 and 5.0 always do copy data on RENAME
if there are more clauses than just rename.
into example.com:/work/bug24395-v2/my51
mysql-test/r/alter_table.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
storage/myisam/mi_open.c:
Auto merged
sql/sql_table.cc:
manual merge
into example.com:/work/bug24395-v2/my50
fix for bug#24395 merged into 5.0
mysql-test/t/alter_table.test:
Auto merged
myisam/mi_open.c:
merge into 5.0 by using macroses available in 5.0
mysql-test/r/alter_table.result:
manual merge
sql/sql_table.cc:
manual merge
Added else clause of
if (new_table && !new_table->file->is_view)
This else clauses does keys management on the live table, thus we have
to force other threads to reopen the table.
into shellback.(none):/home/msvensson/mysql/mysql-5.1-maint
BitKeeper/etc/ignore:
auto-union
Makefile.am:
Auto merged
client/mysql.cc:
Auto merged
client/mysql_upgrade.c:
Auto merged
client/mysqltest.c:
Auto merged
extra/yassl/src/ssl.cpp:
Auto merged
mysql-test/lib/mtr_report.pl:
Auto merged
mysql-test/mysql-test-run-shell.sh:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/r/udf.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/disabled.def:
Auto merged
mysql-test/t/limit.test:
Auto merged
mysql-test/t/mysql.test:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
mysql-test/t/system_mysql_db_fix30020.test:
Auto merged
mysql-test/t/udf.test:
Auto merged
mysql-test/t/view_grant.test:
Auto merged
mysys/Makefile.am:
Auto merged
scripts/mysql_fix_privilege_tables.sql:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql-common/my_time.c:
Auto merged
sql/sql_table.cc:
Auto merged
extra/yassl/taocrypt/include/algebra.hpp:
Remove fix as it conflicts with "import from yassl" and it's been
fixed there
sql/ha_ndbcluster.cc:
Merge fix of warnings
sql/sql_base.cc:
Merge
ALTER TABLE DISABLE KEYS doesn't work when modifying the table
ENABLE|DISABLE KEYS combined with another ALTER TABLE option, different
than RENAME TO did nothing. Also, if the table had disabled keys
and was ALTER-ed then the end table was with enabled keys.
Fixed by checking whether the table had disabled keys and enabling them
in the copied table.
myisam/mi_open.c:
Extend mi_indexes_are_disabled to implement return value
2 - Non-unique indexes are disabled
mysql-test/r/alter_table.result:
update result
mysql-test/t/alter_table.test:
update test
sql/sql_table.cc:
When ENABLE|DISABLE index is combined with another option
different than RENAME TO, we should ENABLE|DISABLE the keys of
the modified table. Also when modifying we should preserve the
previous state of the indices.
(This problem exists in 5.0 and 5.1 but since the codebase has
diverged, this fix won't automerge, but the fix will be quite
similar).
into example.com:/work/bug24219/my51
mysql-test/t/alter_table.test:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/alter_table.result:
manual merge
There was an improper order of doing chained operations.
To the documentor: ENABLE|DISABLE KEYS combined with RENAME TO, and no other
ALTER TABLE clause, leads to server crash independent of the presence of
indices and data in the table.
mysql-test/r/alter_table.result:
update result
mysql-test/t/alter_table.test:
add test for bug#24129
sql/sql_table.cc:
If there is operation on the KEYS, first do it
and then do a rename if there is such. Or, we will crash because
the underlying table has changed.
BUILD/SETUP.sh:
Added check for CCACHE_DISABLE. If set, do not
use ccache at all.
BUILD/compile-pentium-gcov:
Moved CCACHE_DISABLE up before going into SETUP.sh.
Added debug_extra_flags to extra_flags.
mysql-test/r/create.result:
Added tests for incorrect database names.
mysql-test/r/ctype_create.result:
Added tests for incorrect alter database names.
mysql-test/r/events.result:
Added tests for incorrect database names.
mysql-test/r/grant.result:
Output changed to capital letters.
mysql-test/t/alter_table.test:
Removed extra empty line
mysql-test/t/create.test:
Added tests for incorrect database names.
mysql-test/t/ctype_create.test:
Added tests for incorrect name handling
mysql-test/t/events.test:
Added tests for incorrect database names.
sql/item_timefunc.cc:
Added dummy case to avoid compiler warning.
sql/mysql_priv.h:
Changed argument from char pointer to LEX_STRING pointer.
sql/mysqld.cc:
Added a missing component from struct.
sql/sql_class.h:
Added function LEX_STRING_make that sets the string and length.
sql/sql_db.cc:
Changed several char pointers to lex_strings.
sql/sql_lex.cc:
name is now LEX_STRING
sql/sql_lex.h:
Changed name to LEX_STRING.
sql/sql_parse.cc:
Changed several char pointers to lex_strings.
db_length needed a trick, because in old client protocol there
was an extra char zero added to the string.
check_db_name() now takes LEX_STRING pointer as an argument.
Changed remove_escape() to take LEX_STRING pointer as an argument.
Removed COM_CREATE_DB and COM_DROP_DB. These are obsolete.
sql/sql_table.cc:
char* -> LEX_STRING*
sql/sql_yacc.yy:
Changed char* -> LEX_STRING*
sql/table.cc:
check_db_name() now takes LEX_STRING* as argument instead of char*.
Optimized code a bit.
tests/mysql_client_test.c:
Added test for (short) status.
After defining out (ifdef) COM_DROP_DB and COM_CREATE_DB
in mysqld.cc mysql_client_test needed to be informed that
failing in recognizing these commands is not fatal error
anymore.
New test cases. Names with umlauts don't compare well on Windows.
mysql-test/r/alter_table.result:
Bug#18775 - Temporary table from alter table visible to other threads
New test results
mysql-test/r/backup.result:
Bug#18775 - Temporary table from alter table visible to other threads
New test results
mysql-test/t/alter_table.test:
Bug#18775 - Temporary table from alter table visible to other threads
New test case. Names with umlauts don't compare well on Windows.
mysql-test/t/backup.test:
Bug#18775 - Temporary table from alter table visible to other threads
New test case. Names with umlauts don't compare well on Windows.
Continued implementation of WL#1324 (table name to filename encoding)
The intermediate (not temporary) files of the new table
during ALTER TABLE was visible for SHOW TABLES. These
intermediate files are copies of the original table with
the changes done by ALTER TABLE. After all the data is
copied over from the original table, these files are renamed
to the original tables file names. So they are not temporary
files. They persist after ALTER TABLE, but just with another
name.
In 5.0 the intermediate files are invisible for SHOW TABLES
because all file names beginning with "#sql" were suppressed.
This failed since 5.1.6 because even temporary table names were
converted when making file names from them. The prefix became
converted to "@0023sql". Converting the prefix during SHOW TABLES
would suppress the listing of user tables that start with "#sql".
The solution of the problem is to continue the implementation of
the table name to file name conversion feature. One requirement
is to suppress the conversion for temporary table names.
This change is straightforward for real temporary tables as there
is a function that creates temporary file names.
But the generated path names are located in TMPDIR and have no
relation to the internal table name. This cannot be used for
ALTER TABLE. Its intermediate files need to be in the same
directory as the old table files. And it is necessary to be
able to deduce the same path from the same table name repeatedly.
Consequently the intermediate table files must be handled like normal
tables. Their internal names shall start with tmp_file_prefix
(#sql) and they shall not be converted like normal table names.
I added a flags parameter to all relevant functions that are
called from ALTER TABLE. It is used to suppress the conversion
for the intermediate table files.
The outcome is that the suppression of #sql in SHOW TABLES
works again. It does not suppress user tables as these are
converted to @0023sql on file level.
This patch does also fix ALTER TABLE ... RENAME, which could not
rename a table with non-ASCII characters in its name.
It does also fix the problem that a user could create a table like
`#sql-xxxx-yyyy`, where xxxx is mysqld's pid and yyyy is the thread
ID of some other thread, which prevented this thread from running
ALTER TABLE.
Some of the above problems are mentioned in Bug 1405, which can
be closed with this patch.
This patch does also contain some minor fixes for other forgotten
conversions. Still known problems are reported as bugs 21370,
21373, and 21387.
mysql-test/r/alter_table.result:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test results.
mysql-test/r/backup.result:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test results.
mysql-test/r/repair.result:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test results.
mysql-test/t/alter_table.test:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test cases.
mysql-test/t/backup.test:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test cases.
mysql-test/t/repair.test:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added a test case.
sql/ha_myisam.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added missing table name mapping calls to backup() and restore().
sql/ha_myisammrg.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/ha_ndbcluster.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/ha_ndbcluster_binlog.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/ha_ndbcluster_binlog.h:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Removed unnecessary check for wrong temp file prefix.
sql/mysql_priv.h:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Extended quick_rm_table(), mysql_rename_table(), and
build_table_filename() by an flags argument, which can indicate
temporary table names that should not be converted.
Added symbolic flag values.
sql/sql_acl.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_base.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Fixed a comment.
Added DBUG calls.
sql/sql_db.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_delete.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_insert.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_partition.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_rename.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_show.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Reverted the former fix for this bug. tmp_file_prefix is now used
verbatim in the comparison of file names.
sql/sql_table.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added a check for a tmp_file_prefix file name to
filename_to_tablename(). These names are now accepted without
conversion.
Extended quick_rm_table(), mysql_rename_table(), and
build_table_filename() by an flags argument, which can indicate
temporary table names that should not be converted.
Removed the table to file name conversion from
build_tmptable_filename().
Disabled REPAIR TABLE ... USE_FRM for temporary tables.
Added the forgotten conversion to mysql_alter_table() for the case
of ALTER TABLE ... RENAME.
Added comments and DBUG calls.
sql/sql_trigger.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_view.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/table.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Replaced a literal ".frm" by reg_ext.
Added DBUG calls.
storage/innobase/row/row0mysql.c:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Changed back the encoded temp file prefix to #sql.
The problem is that in a MyISAM table the following column
after a varchar field gets corrupted, if varchar field is
extended.
This should be made to work without a copy in the future, but
I'm not sure if this code is ready yet. This fix will force copy
in this case. It will not do any harm to have it here, only makes
alter table a bit slower in this case. If this should work for
MyISAM, then the bug is somewhere else in that code.
Until it works, I propose this as a temporary fix or a workaround.
Test case for the bug has been added.
mysql-test/r/alter_table.result:
Added test case for Bug#19386: Multiple alter causes crashed table.
mysql-test/t/alter_table.test:
Added test case for Bug#19386: Multiple alter causes crashed table.
sql/ha_myisam.cc:
For MyISAM type, if varchar column is extended, it should return not
compatible for now. In other words, it forces a copy of the table during
alter table.