Commit graph

19 commits

Author SHA1 Message Date
Sergei Golubchik
e27c338634 5.5.38 merge 2014-06-06 00:07:27 +02:00
Michael Widenius
a55c159424 MDEV-6245 Certain compressed tables with myisampack are corrupted by "CHECK TABLE"
- Fixed bug that we where using wrong checksum algorithm when using VARCHAR with fixed lenth rows
- Ensure in myisampack that HA_OPTION_NULL_FIELDS is set for tables with null fields.

mysql-test/r/myisampack.result:
  Updated results
mysql-test/t/myisampack.test:
  Added more tests
storage/myisam/mi_open.c:
  Use correct checksum algorithm when we have VARCHAR fields with fixed length records
storage/myisam/myisampack.c:
  Ensure HA_OPTION_NULL_FIELDS is set for tables with null fields.
  (This was not set by default for not compressed tables without checksums to keep MyISAM tables compatible with MySQL)
2014-05-17 10:42:59 +03:00
Sergei Golubchik
1b468ca675 MDEV-5815 MySQL BUG#11751736: DROP DATABASE STATEMENT SHOULD REMOVE .OLD SUFFIX FROM DATABASE DIRECTORY
Delete .OLD and .TMD files when a MyISAM table is dropped.
Same for Aria.

sql/sql_db.cc:
  dead code - *.TMD cannot be deleted from here.
2014-03-26 09:32:54 +01:00
Michael Widenius
9ebda8764d Fixes after Serg's review of %M extenstions
- Changed output to be error "error-text" instead of error - error-text


extra/perror.c:
  Move my_handler_errors.h into include
include/my_handler_errors.h:
  Move my_handler_errors.h into include
mysql-test/r/errors.result:
  Updated result
mysql-test/r/innodb_mysql_sync.result:
  Updated result
mysql-test/r/myisam-system.result:
  Updated result
mysql-test/r/myisampack.result:
  Updated result
mysql-test/r/partition_innodb_plugin.result:
  Updated result
mysql-test/r/ps_1general.result:
  Updated result
mysql-test/r/trigger.result:
  Updated result
mysql-test/r/type_bit.result:
  Updated result
mysql-test/r/type_bit_innodb.result:
  Updated result
mysql-test/r/type_blob.result:
  Updated result
mysql-test/suite/archive/archive.result:
  Updated result
mysql-test/suite/binlog/r/binlog_index.result:
  Updated result
mysql-test/suite/binlog/r/binlog_ioerr.result:
  Updated result
mysql-test/suite/csv/csv.result:
  Updated result
mysql-test/suite/engines/iuds/r/type_bit_iuds.result:
  Updated result
mysql-test/suite/federated/federated_bug_35333.result:
  Updated result
mysql-test/suite/innodb/r/innodb-create-options.result:
  Updated result
mysql-test/suite/innodb/r/innodb-index.result:
  Updated result
mysql-test/suite/innodb/r/innodb-zip.result:
  Updated result
mysql-test/suite/innodb/r/innodb.result:
  Updated result
mysql-test/suite/innodb/r/innodb_bug13635833.result:
  Updated result
mysql-test/suite/innodb/r/innodb_bug21704.result:
  Updated result
mysql-test/suite/innodb/r/innodb_bug46000.result:
  Updated result
mysql-test/suite/parts/r/partition_bit_innodb.result:
  Updated result
mysql-test/suite/parts/r/partition_bit_myisam.result:
  Updated result
mysql-test/suite/percona/percona_innodb_fake_changes.result:
  Updated result
mysql-test/suite/perfschema/r/misc.result:
  Updated result
mysql-test/suite/perfschema/r/privilege.result:
  Updated result
mysql-test/suite/rpl/r/rpl_EE_err.result:
  Updated result
mysql-test/suite/rpl/r/rpl_binlog_errors.result:
  Updated result
mysql-test/suite/rpl/r/rpl_drop_db.result:
  Updated result
sql/share/errmsg-utf8.txt:
  Removed 'column' from error text that was used in different context
strings/my_vsnprintf.c:
  Move my_handler_errors.h into include
  Minor cleanups
  Changed output of %M to be error "error-text" instead of error - error-text
unittest/mysys/my_vsnprintf-t.c:
  Updated error text
2012-06-17 15:34:39 +03:00
Michael Widenius
aa81e025a8 Added text for errno in error messages by:
- Adding %M my_sprintf() modifier that prints error number - system-error-text
- Modified mysys, mysql_client and SQL error messages to use %M instead of %d
- Added my_strerror()
Updated handler errors to 5.6 error numbers
Updated text for a few error messages (to match 5.6)
Increased length of command name in error output

extra/comp_err.c:
  Added support for %M
include/my_base.h:
  Updated handler errors to 5.6 error numbers
include/my_sys.h:
  Added my_strerror()
libmysql/errmsg.c:
  Updated error messages to use %M
mysql-test/r/errors.result:
  Updated result as error message have changed
mysql-test/r/innodb_mysql_sync.result:
  Updated result with text for errno
mysql-test/r/myisam-system.result:
  Updated result with text for errno
mysql-test/r/myisam.result:
  Updated result as error message have changed
mysql-test/r/myisampack.result:
  Updated result with text for errno
mysql-test/r/mysql.result:
  Updated result with text for errno
mysql-test/r/mysql_upgrade.result:
  Updated result with text for errno
mysql-test/r/partition_datatype.result:
  Updated result as error message have changed
mysql-test/r/partition_innodb_plugin.result:
  Updated result with text for errno
mysql-test/r/ps_1general.result:
  Updated result with text for errno
mysql-test/r/trigger.result:
  Updated result with text for errno
mysql-test/r/type_bit.result:
  Updated result as error message have changed
mysql-test/r/type_bit_innodb.result:
  Updated result as error message have changed
mysql-test/r/type_blob.result:
  Updated result as error message have changed
mysql-test/suite/archive/archive.result:
  Updated result with text for errno
mysql-test/suite/binlog/r/binlog_index.result:
  Updated result with text for errno
mysql-test/suite/binlog/r/binlog_ioerr.result:
  Updated result with text for errno
mysql-test/suite/csv/csv.result:
  Updated result with text for errno
mysql-test/suite/federated/federated_bug_35333.result:
  Updated result with text for errno
mysql-test/suite/innodb/r/innodb-create-options.result:
  Updated result with text for errno
mysql-test/suite/innodb/r/innodb-index.result:
  Updated result with text for errno
mysql-test/suite/innodb/r/innodb-zip.result:
  Updated result as error message have changed
mysql-test/suite/innodb/r/innodb.result:
  Updated result with text for errno
mysql-test/suite/innodb/r/innodb_bug21704.result:
  Updated result with text for errno
mysql-test/suite/innodb/r/innodb_bug46000.result:
  Updated result with text for errno
mysql-test/suite/innodb/r/innodb_bug53591.result:
  Updated result as error message have changed
mysql-test/suite/innodb/r/innodb_corrupt_bit.result:
  New error numbers
mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result:
  Updated result as error message have changed
mysql-test/suite/innodb/t/innodb-create-options.test:
  Added regexp to avoid system error text
mysql-test/suite/innodb/t/innodb-zip.test:
  Added regexp to avoid system error text
mysql-test/suite/maria/maria-recovery2.result:
  Updated supression rule
mysql-test/suite/maria/maria-recovery2.test:
  Updated supression rule
mysql-test/suite/maria/maria.result:
  Updated result as error message have changed
mysql-test/suite/parts/r/partition_bit_innodb.result:
  
  Updated result as error message have changed
mysql-test/suite/parts/r/partition_bit_myisam.result:
  
  Updated result as error message have changed
mysql-test/suite/percona/percona_innodb_fake_changes.result:
  Updated result with text for errno
mysql-test/suite/perfschema/r/dml_cond_instances.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_events_waits_current.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_events_waits_history.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_events_waits_history_long.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_ews_by_instance.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_file_instances.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_mutex_instances.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_performance_timers.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_rwlock_instances.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/dml_threads.result:
  Updated result as error message have changed
mysql-test/suite/perfschema/r/misc.result:
  Updated result with text for errno
mysql-test/suite/perfschema/r/privilege.result:
  Updated result with text for errno
mysql-test/suite/rpl/r/rpl_EE_err.result:
  Updated result with text for errno
mysql-test/suite/rpl/r/rpl_binlog_errors.result:
  Updated result with text for errno
mysql-test/suite/rpl/r/rpl_drop_db.result:
  Updated result with text for errno
mysys/errors.c:
  Updated error messages to use %M
  Changed all errors to use Errcode: consistenly
mysys/my_handler_errors.h:
  Updated handler errors to 5.6 error numbers
sql/share/errmsg-utf8.txt:
  Updated error messages to use %M
sql/sys_vars.cc:
  Added error number to ER_EVENT_SET_VAR_ERROR
strings/my_vsnprintf.c:
  Added %M my_sprintf() modifier that prints error number - system-error-text
  Simplify code
  Movied common code to function
  Removed some casts that was not necessary when reading integer/unsigned int stored in longlong
  Added my_strerror()
unittest/mysys/my_vsnprintf-t.c:
  Added testing of %M
2012-05-30 00:37:55 +03:00
Sergey Vojtovich
cb9e23bb30 Merge. 2011-09-16 16:21:05 +04:00
Sergey Vojtovich
3f9cbd7731 BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH
FULLTEXT INDEXES

myisamchk may create incorrect fulltext index for compressed
tables. Incorrect data pointer size was used while creating
fulltext index.

mysql-test/r/myisampack.result:
  A test case for BUG#11761180.
mysql-test/t/myisampack.test:
  A test case for BUG#11761180.
storage/myisam/ft_boolean_search.c:
  rec_reflength on share may have adjustments required for
  compressed tables and must be used instead of rec_reflength
  on base info.
storage/myisam/ft_nlq_search.c:
  rec_reflength on share may have adjustments required for
  compressed tables and must be used instead of rec_reflength
  on base info.
storage/myisam/mi_check.c:
  rec_reflength on share may have adjustments required for
  compressed tables and must be used instead of rec_reflength
  on base info.
storage/myisam/mi_write.c:
  rec_reflength on share may have adjustments required for
  compressed tables and must be used instead of rec_reflength
  on base info.
2011-09-16 15:30:31 +04:00
Jon Olav Hauglid
e14934d26d Bug #56494 Segfault in upgrade_shared_lock_to_exclusive() for
REPAIR of merge table
Bug #56422 CHECK TABLE run when the table is locked reports
           corruption along with timeout

The crash happened if a table maintenance statement (ANALYZE TABLE,
REPAIR TABLE, etc.) was executed on a MERGE table and opening and 
locking a child table failed. This could for example happen if a child
table did not exist or if a lock timeout happened while waiting for
a conflicting metadata lock to disappear.

Since opening and locking the MERGE table and its children failed,
the tables would be closed and the metadata locks released.
However, TABLE_LIST::table for the MERGE table would still be set,
with its value invalid since the tables had been closed.
This caused the table maintenance statement to try to continue
and upgrade the metadata lock on the MERGE table. But since the lock
already had been released, this caused a segfault.

This patch fixes the problem by setting TABLE_LIST::table to NULL 
if open_and_lock_tables() fails. This prevents maintenance
statements from continuing and trying to upgrade the metadata lock.

The patch includes a 5.5 version of the fix for
Bug #46339 crash on REPAIR TABLE merge table USE_FRM.
This bug caused REPAIR TABLE ... USE_FRM to give an assert 
when used on merge tables.

The patch also enables the CHECK TABLE statement for log tables.
Before, CHECK TABLE for log tables gave ER_CANT_LOCK_LOG_TABLE,
yet still counted the statement as successfully executed.
With the changes to table maintenance statement error handling
in this patch, CHECK TABLE would no longer be considered as
successful in this case. This would have caused upgrade scripts
to mistakenly think that the general and slow logs are corrupted
and have to be repaired. Enabling CHECK TABLES for log tables
prevents this from happening.

Finally, the patch changes the error message from "Corrupt" to
"Operation failed" for a number of issues not related to table
corruption. For example "Lock wait timeout exceeded" and 
"Deadlock found trying to get lock".

Test cases added to merge.test and check.test.
2010-09-22 10:15:41 +02:00
Magne Mahre
57edb25c41 Fix for a bug when backporting/merging Bug#36573 2009-11-26 13:47:55 +01:00
Magne Mahre
0b8696591a Addition to BUG#36573 - myisampack --join does not create destination table
.frm file
      
Added FLUSH TABLES before myisampack --join operation to fix the test 
warnings or errors
Removed unused variable in create_dest_frm() method
2009-11-25 20:22:45 +01:00
Magne Mahre
952f8bda78 Fix for Bug#36573 myisampack --join does not create destination
table .frm file
            
Problem:
========
Myisampack --join did not create the destination table .frm file. 
The user had to copy one of the source table .frm file as destination .frm 
file for mysql server to recognize. This is just 'user-friendliness' issue.
            
How it was solved
=================
After successful join and compression we copy the frm file from the first 
source table.
            
Functionality added
===================
myisampack --join=/path/t3 /path/t1 /path/t2 creates 
/path/t3.frm (which is bascially copied from first table's frm /path/t1)
      
Tests
=====
Modified myisampack.test to test two scenario's
1. Positive myisampack --join test
   In this case after the join operation is done,we test if the destination 
   table is accessible from the server
2. Positive myisampack --join test with an existing .frm file.
   We test the above case with an existing .frm file for the destination 
   table. It should return success even in this case.
3. Positive myisampack --join test with no .frm file for source tables
   We test the join operation with no .frm files for source tables. It should
   complete the join operation without any warnings and error messages
4. Negative myisampack --join test
   We test myisampack --join with existing .MYI,.MDI,.frm files for the 
   destination table. It should fail with exit status 2 in this case.
2009-11-25 20:19:59 +01:00
Satya B
543abcd48e merge 5.0-bugteam to 5.1-bugteam 2009-04-07 17:06:15 +05:30
Satya B
10350e2097 Fix for Bug #43973 - backup_myisam.test fails on 6.0-bugteam
The test started failing following the push for BUG#41541.
Some of the algorithms access bytes beyond the input data
and this can affect up to one byte less than "word size"
which is BITS_SAVED / 8. 
      
Fixed by adding (BITS_SAVED / 8) -1 bytes to buffer size
(i.e. Memory Segment #2) to avoid accessing un-allocated data.

myisam/mi_packrec.c:
  Fixed _mi_read_pack_info() method to allocate (BITS_SAVED/8) - 1 
  bytes to the Memory Segment #2
mysql-test/r/myisampack.result:
  Result file for BUG#43973
mysql-test/t/myisampack.test:
  Testcase for BUG#43973
2009-04-07 16:54:32 +05:30
Satya B
c084645ca0 merge 5.0-bugteam to 5.1-bugteam 2009-03-25 15:43:49 +05:30
Satya B
ca873cd7c7 Fix for BUG#41541 - Valgrind warnings on packed MyISAM table
After the table is compressed by the myisampack utility,
opening the table by the server produces valgrind warnings.
      
This happens because when we try to read a record into the buffer
we alway assume that the remaining buffer to read is always equal 
to word size(4 or 8 or 2 bytes) we read. Sometimes we have 
remaining buffer size less than word size and trying to read the 
entire word size will end up in valgrind errors.
            
Fixed by reading byte by byte when we detect the remaining buffer 
size is less than the word size.

myisam/mi_packrec.c:
  Fixed fill_buffer() to read byte by byte when the remaining 
  buffer size is less than word size.
mysql-test/r/myisampack.result:
  Result file for BUG#41541
mysql-test/t/myisampack.test:
  Testcase for BUG#41541
2009-03-25 14:45:53 +05:30
Satya B
4a3e9851cf TestCase for BUG#41574 - REPAIR TABLE: crashes for compressed tables
Extending the existing testcase written for BUG#40949 to verify
repair table operation for compressed tables



mysql-test/r/myisampack.result:
  Modified result file for myisampack.test
mysql-test/t/myisampack.test:
  Modified Testcase to test repair operation for compressed tables
2009-01-22 11:25:26 +05:30
Sergey Glukhov
952d284ba4 Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines(for 5.1)
mysql-test/r/myisampack.result:
  result fix
mysql-test/t/myisampack.test:
  test case fix
2008-12-17 17:23:21 +04:00
Sergey Glukhov
0d2db9c020 Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
reset diagnostics area state after error message is sent


mysql-test/r/myisampack.result:
  test result
mysql-test/t/myisampack.test:
  test case
sql/sql_table.cc:
  reset diagnostics area state after error message is sent
2008-12-09 13:04:28 +04:00
unknown
c5df4b3092 BUG#31277 - myisamchk --unpack corrupts a table
With certain data sets (when compressed record length gets bigger than
uncompressed) myisamchk --unpack may corrupt data file.

Fixed that record length was wrongly restored from compressed table.


myisam/mi_check.c:
  With compressed tables compressed record length may be bigger than
  pack_reclength, thus we may allocate insufficient memory for record
  buffer.
  
  Let single function allocate record buffer, performing needed record
  length calculations.
  
  Still, it is not doable with parallel repair, as it allocates needed
  record buffers at once. For parellel repair added better record length
  calculation.
myisam/mi_open.c:
  When calculating record buffer size, take into account that compressed
  record length may be bigger than uncompressed.
myisam/mi_packrec.c:
  With certain data set share->max_pack_length (compressed record length)
  may be bigger than share->base.pack_reclength (packed record length).
  
  set_if_bigger(pack_reclength, max_pack_length) in this case causes
  myisamchk --unpack to write extra garbage, whereas pack_reclength
  remains the same in new index file. As a result we get unreadable
  table.
myisam/myisamchk.c:
  With compressed tables compressed record length may be bigger than
  pack_reclength, thus we may allocate insufficient memory for record
  buffer.
  
  Let single function allocate record buffer, performing needed record
  length calculations.
mysql-test/mysql-test-run.pl:
  Environment variables to execute myisamchk and myisampack.
mysql-test/r/myisampack.result:
  New BitKeeper file ``mysql-test/r/myisampack.result''
mysql-test/t/myisampack.test:
  New BitKeeper file ``mysql-test/t/myisampack.test''
2007-11-07 12:55:28 +04:00