Commit graph

71 commits

Author SHA1 Message Date
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
f177f125d4 Merge branch '5.5' into 10.1 2019-05-11 19:15:57 +03:00
Michal Schorm
17b4f99928 Update FSF address
This commit is based on the work of Michal Schorm, rebased on the
earliest MariaDB version.

Th command line used to generate this diff was:

find ./ -type f \
  -exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
  -exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
  -exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \
  -exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \
  -exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \
  -exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
2019-05-10 20:52:00 +03:00
Marko Mäkelä
84129fb1b5 After-merge fix for commit 98eb9518db
The merge only covered 10.1 up to
commit 4d248974e0.

Actually merge the changes up to
commit 0a534348c7.

Also, remove the unused InnoDB field trx_t::abort_type.
2018-03-16 15:49:53 +02:00
Sergey Vojtovich
0a534348c7 MDEV-14265 - RPMLint warning: shared-lib-calls-exit
Eliminated last exit() call from libmysqld.
2018-03-16 13:26:52 +04:00
Vladislav Vaintroub
7354dc6773 MDEV-13384 - misc Windows warnings fixed 2017-09-28 17:20:46 +00:00
Vladislav Vaintroub
eba44874ca MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.
- Fix win64 pointer truncation warnings
(usually coming from misusing 0x%lx and long cast in DBUG)

- Also fix printf-format warnings

Make the above mentioned warnings fatal.

- fix pthread_join on Windows to set return value.
2017-09-28 17:20:46 +00:00
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Sergei Golubchik
8d34a29663 aria_read_log: silence expected safemalloc warnings 2015-12-19 13:59:29 +01:00
Michael Widenius
f0f2072d1f Fixed problem with very slow shutdown when using 100,000 MyISAM tables with delay_key_write
Reason for the problem was that the hash of changed files in the key cache was too small (was 128). Fixed by making the hash size larger and changeable.

- Introduced key-cache-file-hash-size (default 512) for MyISAM and aria_pagecache_file_hash_size (default 512) for Aria.
- Added new status variable "Feature_delay_key_write" which counts number of tables opened that are using delay_key_write


mysql-test/r/features.result:
  Added test of Feature_delay_key_write
mysql-test/r/key_cache.result:
  Updated tests as the number of blocks has changed
mysql-test/r/mysqld--help.result:
  Updated result
mysql-test/suite/maria/maria3.result:
  Updated result
mysql-test/suite/sys_vars/r/key_cache_file_hash_size_basic.result:
  Test new variable
mysql-test/suite/sys_vars/t/aria_pagecache_file_hash_size_basic.test:
  Test new variable
mysql-test/suite/sys_vars/t/key_cache_file_hash_size_basic.test:
  Test new variable
mysql-test/t/features.test:
  Added test of Feature_delay_key_write
mysql-test/t/key_cache.test:
  Updated tests as the number of blocks has changed
mysys/mf_keycache.c:
  Made CHANGED_BLOCKS_HASH dynamic
sql/handler.cc:
  Updated call to init_key_cache()
sql/mysqld.cc:
  Added "Feature_delay_key_write"
  Added support for key-cache-file-hash-size
sql/mysqld.h:
  Added support for key-cache-file-hash-size
sql/sql_class.h:
  Added feature_files_opened_with_delayed_keys
sql/sys_vars.cc:
  Added key_cache_file_hash_size
storage/maria/ha_maria.cc:
  Added pagecache_file_hash_size
  Added counting of files with delay_key_write
storage/maria/ma_checkpoint.c:
  Fixed compiler warning
storage/maria/ma_pagecache.c:
  Made PAGECACHE_CHANGED_BLOCKS_HASH into a variable
storage/maria/ma_pagecache.h:
  Made PAGECACHE_CHANGED_BLOCKS_HASH into a variable
storage/maria/ma_rt_test.c:
  Updated parameters for init_pagecache()
storage/maria/ma_test1.c:
  Updated parameters for init_pagecache()
storage/maria/ma_test2.c:
  Updated parameters for init_pagecache()
storage/maria/ma_test3.c:
  Updated parameters for init_pagecache()
storage/maria/maria_chk.c:
  Updated parameters for init_pagecache()
storage/maria/maria_ftdump.c:
  Updated parameters for init_pagecache()
storage/maria/maria_pack.c:
  Updated parameters for init_pagecache()
storage/maria/maria_read_log.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_pagecache_consist.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_pagecache_rwconsist.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_pagecache_rwconsist2.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_pagecache_single.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Updated parameters for init_pagecache()
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Updated parameters for init_pagecache()
storage/myisam/ha_myisam.cc:
  Added counting of files with delay_key_write
storage/myisam/mi_check.c:
  Updated call to init_key_cache()
storage/myisam/mi_test1.c:
  Updated call to init_key_cache()
storage/myisam/mi_test2.c:
  Updated call to init_key_cache()
storage/myisam/mi_test3.c:
  Updated call to init_key_cache()
storage/myisam/mi_test_all.sh:
  Fixed broken test
storage/myisam/myisam_ftdump.c:
  Updated call to init_key_cache()
storage/myisam/myisamchk.c:
  Updated call to init_key_cache()
storage/myisam/myisamlog.c:
  Updated call to init_key_cache()
2014-07-19 17:46:08 +03:00
Sergey Vojtovich
b95c8ce530 MDEV-5675 - Performance: my_hash_sort_bin is called too often
Reduced number of my_hash_sort_bin() calls from 4 to 1 per query.
Reduced number of memory accesses done by my_hash_sort_bin().

Details:
- let MDL subsystem use pre-calculated hash value for hash
  inserts and deletes
- let table cache use pre-calculated MDL hash value
- MDL namespace is excluded from hash value calculation, so that
  hash value can be used by table cache as is
- hash value for MDL is calculated as resulting hash value + MDL
  namespace
- extended hash implementation to accept user defined hash function
2014-03-06 16:19:12 +04:00
Michael Widenius
53d44ad18b Added some fixes that should make MyISAM & Aria REPAIR work with more than 4G records
- If one specifies --force twice to myisamchk and aria_chk, then we will try to finnish the repair even if sort_buffer would be too small.
  This was done by dynamically allocate buffer handler objects as long as memory lasts.
- New option for myisamchk and aria_chk: create-missing-keys
- Changed default size of myisam_sort_buffer_size from 8M to 128M.
- Changed default size of sort_buffer_size in aria_chk from 128M to 256M.
- Increased information in error message about 'sort_buffer_size' beeing to small.
- Print also to 'show warnings' if repair was retried.
- Increased size of internal sort-buffer-readers from 16K to 128K
- Changed printing of 'number of records' to use %ll instead of casting to long
- Changed buffer sizes for myisam and aria to use MY_ALIGN_DOWN() to get same number of bytes allocated on different machines.





include/my_global.h:
  Added MY_ALIGN_DOWN() to get previous alignment (for big memory areas)
include/myisam.h:
  Increased size of types to be able to handle more records
include/myisamchk.h:
  Increased size of types to be able to handle more records
  Added T_FORCE_SORT_MEMORY to force repair to work even if sort_buffer would not be big enough
mysql-test/r/myisam.result:
  Updated result
mysql-test/r/mysqld--help.result:
  Updated result
mysql-test/r/repair.result:
  Updated result
mysql-test/suite/maria/maria.result:
  Added test cases for some fixed bugs in MyISAM to verify that Aria doesn't have them too.
mysql-test/suite/maria/maria.test:
  Added test cases for some fixed bugs in MyISAM to verify that Aria doesn't have them too.
mysql-test/suite/maria/maria3.result:
  Updated result after sort buffer size increase
mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result:
  Updated result after sort buffer size increase
mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic.result:
  Updated result after sort buffer size increase
mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic.test:
  Updated result after sort buffer size increase
mysql-test/t/myisam.test:
  Fixed error messages to not print system specific data
mysql-test/t/repair.test:
  Fixed error messages to not print system specific data
storage/maria/ha_maria.cc:
  Print also to 'show warnings' if repair was retried
  Changed default size of sort_buffer_size from 128M to 256M (same as in mysqld)
storage/maria/ma_check.c:
  Renamed USE_BUFFER_INIT -> PAGE_BUFFER_INIT
storage/maria/ma_sort.c:
  Increased size of internal sort-buffer-readers from 16K to 128K
  Increased size of types to be able to handle more records
  Added support for T_FORCE_SORT_MEMORY
  Don't allocate too many extra BUFFPEK at a time (they are probably not needed)
  Improved error message for "sort_buffer_size is too small"
  Changed printing of 'number of records' to use %ll instead of casting to long
  Fixed bug where maria_update_key_parts() was called too early.
  Fixed bug in detecting result from read_to_buffer().
  Added 'out of memory' checking when calling 'alloc_dynamic()'.
storage/maria/maria_chk.c:
  Added --create-missing-keys
  If one specifies --force twice then we will try to finnish the repair even if sort_buffer would be too small.
  check_param.sort_buffer_length varialble was used with wrong type.
storage/maria/maria_def.h:
  Increased size of types to be able to handle more records
  Use MY_ALIGN_DOWN() to get same number of bytes allocated on different machines
  Renamed USE_BUFFER_INIT -> PAGE_BUFFER_INIT
storage/maria/maria_ftdump.c:
  Renamed USE_BUFFER_INIT -> PAGE_BUFFER_INIT
storage/maria/maria_read_log.c:
  Use PAGE_BUFFER_INIT for page cache
storage/myisam/ha_myisam.cc:
  Changed default size of myisam_sort_buffer_size from 8M to 128M
storage/myisam/mi_check.c:
  Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
storage/myisam/myisam_ftdump.c:
  Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
storage/myisam/myisamchk.c:
  Added --create-missing-keys
  If one specifies --force twice then we will try to finnish the repair even if sort_buffer would be too small.
  check_param.sort_buffer_length varialble was used with wrong type.
  Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
storage/myisam/myisamdef.h:
  Increased SORT_BUFFER_INIT to 64M
  (speeds up repair a lot and most machines have nowadays a lot of memory)
  Use MY_ALIGN_DOWN() to get same number of bytes allocated on different machines
  Renamed USE_BUFFER_INIT -> KEY_BUFFER_INIT
storage/myisam/sort.c:
  Increased size of internal sort-buffer-readers from 16K to 128K
  Increased size of types to be able to handle more records
  Added support for T_FORCE_SORT_MEMORY
  Don't allocate too many extra BUFFPEK at a time (they are probably not needed)
  Improved error message for "sort_buffer_size is too small"
  Changed printing of 'number of records' to use %ll instead of casting to long
  Fixed bug in detecting result from read_to_buffer().
  Added 'out of memory' checking when calling 'alloc_dynamic()'.
2013-05-10 12:32:34 +03:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Michael Widenius
5e876bd300 Aria bug fixes and improvements:
- Fixed performance bug in alter table with Aria; Aria didn't use disable keys + enable keys
- Fixed wrong warning about 'Wrong CRC on datapage' from REPAIR TABLE with aria block tables.
- Fixed bug in aria_chk that disabled performance counters.
- Added --translog_buffer_size to maria_read_log.

storage/maria/ha_maria.cc:
  Fixed performance bug in alter table with Aria; Aria didn't use disable keys + enable keys
storage/maria/ma_bitmap.c:
  Added some DBUG_ASSERT()'s and made code more uniform
storage/maria/ma_check.c:
  Fixed wrong warning about 'Wrong CRC on datapage' from REPAIR TABLE with aria block tables.
storage/maria/ma_pagecache.c:
  Copy read pages to buffer even if there was an error (to be able to detect zero filled pages)
storage/maria/maria_chk.c:
  Fixed bug in aria_chk that disabled performance counters.
storage/maria/maria_read_log.c:
  Added option to set translog_buffer_size
2011-06-30 00:37:12 +03:00
Michael Widenius
bf0e1f44c6 Fixed portability problem with partiton_error.test
Added option to aria_read_log to crash recovery at certain points in the recovery process.
Fixed bug that caused future recovery attempts to fail if we got a crash/got killed during closing of tables at end of recovery process.


mysql-test/mysql-test-run.pl:
  Don't abort if 'var' points to stale place; Just remove it.
mysql-test/suite/maria/r/maria.result:
  Fixed wrong indentation
mysql-test/t/partition_error.test:
  Fixed portability problem with partiton_error.test
storage/maria/ma_close.c:
  More DBUG_PRINT info
storage/maria/ma_pagecache.c:
  Copy flush_log_callback when writing to page cache. This fixes problem in recovery when switching from mode of file
storage/maria/ma_recovery.c:
  Added option to aria_read_log to crash recovery at certain points in the recovery process.
storage/maria/ma_recovery.h:
  Added option to aria_read_log to crash recovery at certain points in the recovery process.
storage/maria/maria_chk.c:
  Align aria_chk -d output
  Don't write warning Aria table '...' is usable but should be fixed if the table was before marked as crashed but now is ok
storage/maria/maria_read_log.c:
  Added option to aria_read_log to crash recovery at certain points in the recovery process.
2011-06-13 12:46:11 +03:00
Sergei Golubchik
0accbd0364 lots of post-merge changes 2011-04-25 17:22:25 +02:00
Michael Widenius
3358cdd504 Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
Michael Widenius
07b5d554ee - maria/ma_test_all.sh can now be run with --tmpdir=/dev/shm for faster testing
- Fixed mysql-test-run failures on window
- Fixed compiler warnings from my last push (sorry about that)
- Fixed that maria_chk --repair --extended works again
- Fixed compiler warnings about using not unitialized data

mysql-test/mysql-test-run.pl:
  Better output
mysql-test/suite/parts/inc/partition_check_drop.inc:
  Use remove_files_wildcard instead of rm
mysys/safemalloc.c:
  Fixed argument to printf
storage/maria/ma_cache.c:
  Don't give errors when running maria_chk
storage/maria/ma_dynrec.c:
  Don't give errors when running maria_chk
storage/maria/ma_rt_test.c:
  Added option --datadir for where to put logs and test data
storage/maria/ma_test1.c:
  Added option --datadir for where to put logs and test data
storage/maria/ma_test2.c:
  Added option --datadir for where to put logs and test data
storage/maria/maria_chk.c:
  If --datadir is used but --logdir is not, set --logdir from --datadir
  (this reflects how --help said how things should work)
storage/maria/maria_read_log.c:
  Changed short option for 'maria-log-dir-path' from -l to -h to be same as mysqld, maria_chk, ma_test1 etc..
storage/maria/unittest/ma_test_all-t:
  Allow one to specify --tmpdir for where to store logs and data
storage/xtradb/buf/buf0buf.c:
  Fixed compiler warnings about using not unitialized data
storage/xtradb/row/row0upd.c:
  Fixed compiler warnings about using not unitialized data
storage/xtradb/srv/srv0srv.c:
  Fixed compiler warnings about using not unitialized data
2011-02-25 14:55:40 +02:00
Michael Widenius
4c576fd492 Merge with 5.1 2011-01-12 17:38:13 +02:00
Michael Widenius
713999a4fe Allow one to decrease page-buffer-size down to 1M (from 128M) for maria_read_log
Don't allow too low value of pagecache_buffer_size for mysqld

storage/maria/ha_maria.cc:
  Don't allow too low value of pagecache_buffer_size (as it will stop mysqld from starting)
storage/maria/maria_read_log.c:
  Allow one to decrease page-buffer-size down to 1M (from 128M)
2011-01-12 01:48:34 +02:00
Michael Widenius
a008186f1d Allow smaller size for page-buffer-size
storage/maria/maria_read_log.c:
  Allow smaller size for page-buffer-size (down to 1M)
  Sorted options for --help
2011-01-11 14:42:33 +02:00
Michael Widenius
fdaaf48c93 Merge with 5.1 2011-01-07 12:05:46 +02:00
Michael Widenius
5b0afd8a0d Bug fixing in Aria:
- Fixed some bugs in recovery of blobs
- Don't ASSERT() on checksum errors when running check table
- Added to maria_read_log option --tables-to-redo=list-of-tables to only recover some tables (good for debugging)


storage/maria/ma_blockrec.c:
  Don't ASSERT() on checksum errors when running check table
  Fixed bug in recovery of blog page that was not in dirty pages list
storage/maria/ma_check.c:
  Don't ASSERT() on checksum errors when running check table
storage/maria/ma_recovery.c:
  Handling of --tables-to-redo
storage/maria/ma_recovery.h:
  Handling of --tables-to-redo
storage/maria/ma_recovery_util.c:
  Give better warning if table was not in dirty pages list
storage/maria/maria_def.h:
  Added in_check_table
storage/maria/maria_read_log.c:
  Added --tables-to-redo=list-of-tables to only recover some tables (good for debugging)
  Cleaned up message when wrong arguments
2011-01-06 22:49:17 +02:00
Sergei Golubchik
e246077bcf rename maria to aria 2010-09-12 18:40:01 +02:00
Michael Widenius
909e4eb08d Added verbose mode to recovery
More DBUG
Added convert-debug-for-diff
Added missing (from last push) federated test case

.bzrignore:
  Ignore generated files
mysql-test/README:
  Updated documentation for --extern
mysql-test/suite/federated/federated_bug_32426.result:
  Added test for federatedx
mysql-test/suite/federated/federated_bug_32426.test:
  Added test for federatedx
scripts/Makefile.am:
  Added convert-debug-for-diff
scripts/convert-debug-for-diff.sh:
  Added script for converting
sql/log.cc:
  Added DBUG
sql/mysqld.cc:
  Added DBUG
storage/maria/ma_recovery.c:
  If verbose, write dirty pages (for debugging)
storage/maria/ma_static.c:
  Added verbose mode to recovery
storage/maria/maria_def.h:
  Added verbose mode to recovery
storage/maria/maria_read_log.c:
  Added verbose mode to recovery
2010-08-18 10:52:57 +03:00
Michael Widenius
6bbb0b5739 Added option --start-from-checkpoint to maria_read_log
Print out checked file names in maria_check -s (unless you use a second -s)
Some trivial optimizations

storage/maria/ma_bitmap.c:
  Trivial optimizations:
  - Combine common code (to be able to remove duplicate mutex_lock call)
  - Move setting of thread specific variables outside of mutex
storage/maria/ma_check.c:
  Fixed wrong argument to printf
storage/maria/maria_chk.c:
  Print out checked table names unless -s -s
storage/maria/maria_read_log.c:
  Added option --start-from-checkpoint (to help find bugs in checkpoints)
2010-08-12 19:46:36 +03:00
Michael Widenius
e6cf286b5d Fixed LP#605798 RQG: Table corruption after Maria engine recovery - "Wrong data in bitmap"
maria_chk & maria_read_log now reads block size from control file.



mysql-test/suite/maria/r/maria.result:
  Updated results after trivial change of maria_chk's output
storage/maria/ma_bitmap.c:
  More DBUG_PRINT
storage/maria/ma_blockrec.c:
  Fixed bug that we didn't mark page full in bitmap if directory is full
storage/maria/ma_check.c:
  Write out if directory is full for errors in bitmap
storage/maria/ma_control_file.c:
  Don't give error for wrong block size if block size is 0
storage/maria/maria_chk.c:
  Read block size from control file
  In case of -dvv, write also out bitmap information (good for debugging)
storage/maria/maria_read_log.c:
  Read block size from control file
  Fixed that maria_read_log works with different page size than TRANSLOG_PAGE_SIZE
2010-08-11 00:58:08 +03:00
Michael Widenius
f0f2103695 Automatic merge 2010-08-05 18:59:44 +03:00
Michael Widenius
f66d2500c4 Remove not used files
Added option: --warning-for-wrong-transaction-id to maria_check


mysql-test/r/innodb-use-sys-malloc.result:
  Remove not used files
mysql-test/t/innodb-use-sys-malloc-master.opt:
  Remove not used files
storage/maria/ma_recovery.c:
  Added support for --lsn-end
storage/maria/ma_recovery.h:
  New prototype
storage/maria/ma_write.c:
  Added logging of KEY_OP_CHECK for all possible keyblock splits.
  (Helps us find error in log file handling)
storage/maria/maria_chk.c:
  Added option: --warning-for-wrong-transaction-id
  --update-status now resets open count if check succeds
storage/maria/maria_read_log.c:
  Added option --end-lsn for only appling part of log (good for debugging)
  Changed options to use '-' instead of '_'
2010-08-05 18:56:31 +03:00
Michael Widenius
1f5b93e772 Fixed compiler warnings
Fixed some wrong test cases
Fixed bug in null handling in XtraDB


extra/comp_err.c:
  Fixed compiler warnings
extra/my_print_defaults.c:
  Fixed compiler warnings
mysql-test/suite/binlog/t/binlog_killed.test:
  Added support for timeouts
mysql-test/suite/funcs_1/r/is_columns_is.result:
  Updated results (INNODB_SYS_TABLES had got new column)
scripts/mysql_install_db.sh:
  Fixed typo
sql/mysql_priv.h:
  Removed not needed argument for compare_record()
sql/sql_insert.cc:
  Removed not needed argument for compare_record()
sql/sql_update.cc:
  Removed not needed argument for compare_record()
  The argument is not needed becasue we copy the full record[0] to record[1] and the comparison should work even if all columns are not read
sql/table.cc:
  The comparison of rows is independent of HA_PARTIAL_COLUMN_READ
storage/maria/maria_chk.c:
  Fixed compiler warnings
storage/maria/maria_read_log.c:
  Fixed compiler warnings
storage/myisam/myisamchk.c:
  Fixed compiler warnings
storage/myisam/myisampack.c:
  Fixed compiler warnings
storage/xtradb/dict/dict0load.c:
  Fixed compiler warnings
storage/xtradb/row/row0sel.c:
  Fixed null handling in XtraDB. (See comment)
storage/xtradb/trx/trx0sys.c:
  Fixed compiler warnings
support-files/compiler_warnings.supp:
  Fixed compiler warnings
2010-08-04 21:36:11 +03:00
Michael Widenius
e0a6b02c5d Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
2010-08-02 12:01:24 +03:00
Michael Widenius
d2f8b7d045 Fix for LP#602604: RQG: ma_blockrec.c:6187: _ma_apply_redo_insert_row_head_or_tail: Assertion `0' failed on Maria engine recovery
More DBUG_PRINT (to simplify future debugging)
Aria: Added STATE_IN_REPAIR, which is set on start of repair. This allows us to see if 'crashed' flag was set intentionally.
Aria: Some trivial speedup optimization
Aria: Better warning if table was marked crashed by unfinnished repair


mysql-test/lib/v1/mysql-test-run.pl:
  Fix so one can run RQG
mysql-test/suite/maria/r/maria-recovery2.result:
  Update for new error message.
mysys/stacktrace.c:
  Fixed compiler warning
storage/maria/ha_maria.cc:
  More DBUG_PRINT
  Added STATE_IN_REPAIR flag, which is set on start of repair. This allows us to see if 'crashed' flag was set intentionally.
  Don't log query for dropping temporary table.
storage/maria/ha_maria.h:
  Added prototype for drop_table()
storage/maria/ma_blockrec.c:
  More DBUG_PRINT
  Make read_long_data() inline for most cases. (Trivial speedup optimization)
storage/maria/ma_check.c:
  Better warning if table was marked crashed by unfinnished repair
storage/maria/ma_open.c:
  More DBUG_PRINT
storage/maria/ma_recovery.c:
  Give warning if found crashed table.
  Changed warning for tables that can't be opened.
storage/maria/ma_recovery_util.c:
  Write warnings to DBUG file
storage/maria/maria_chk.c:
  Added STATE_IN_REPAIR flag, which is set on start of repair. This allows us to see if 'crashed' flag was set intentionally.
storage/maria/maria_def.h:
  Added maria_mark_in_repair(x)
storage/maria/maria_read_log.c:
  Added option: --character-sets-dir
storage/maria/trnman.c:
  By default set min_read_from to max value.
  This allows us to remove TRN:s from rows during recovery to get more space.
  This fixes bug LP#602604: RQG: ma_blockrec.c:6187: _ma_apply_redo_insert_row_head_or_tail: Assertion `0' failed on Maria engine recovery
2010-07-30 10:45:27 +03:00
Michael Widenius
910284e6e6 Fixed bugs found by pushbuild
Added code to detect and give error when doing an insert into a view where we accessed fields in a not yet read table
Disabled test in subselect.test as the CHECK_OPTION for views doesn't work for insert.
This needs to be fixed properly later.

The problem with views are described in Bug #41760 Inserting into multiple-table views is not working

mysql-test/r/insert.result:
  Fixed wrong usage of insert into view.
mysql-test/r/subselect.result:
  Disabled wrong test (temporary)
mysql-test/suite/maria/r/maria.result:
  Added test of size of table
mysql-test/suite/maria/t/maria.test:
  Added test of size of table
mysql-test/t/insert.test:
  Fixed wrong usage of insert into view
  The bug is that during insert/update we currently don't read any of the referenced tables of the view.
  This means that we can't get a value from another table to use as part of the update.
mysql-test/t/subselect.test:
  Disabled not working test until someone has time to fix insert into view properly
  Here we where refering to last used value in t2, which is wrong.
sql/sql_insert.cc:
  Detect if we are trying to update one table in a view based on value in another, not yet read, table.
  This fixes the problem discovered in insert.test
storage/maria/ma_blockrec.c:
  Don't ignore not critical changes to the last page in the table.
  We need to write the last page as otherwise we can during aborting of a row with a duplicate key get
  state.data_file_length and the real length of file out of sync
storage/maria/ma_check.c:
  Flush the page cache even if we got an error during zerofill.
  (This fixes a call to assert() in case of a too short data file)
storage/maria/ma_pagecache.c:
  Mark page as read when we do a write of a full page.
  This fixes a bug when we got an error during read and then used direct write to page to update it
storage/maria/ma_state.c:
  Restore info->lock.type after call to maria_versioning.
  Fixed crash in maria_recover.test
storage/maria/maria_read_log.c:
  Don't write thread id in debug log. (Not needed as maria_read_log is a single treaded program)
2008-12-27 04:05:16 +02:00
unknown
f83bd712ae Merge bk-internal.mysql.com:/home/bk/mysql-maria
into  mysql.com:/home/my/mysql-maria


mysql-test/r/maria.result:
  Auto merged
mysql-test/suite/ndb/r/ndb_auto_increment.result:
  Auto merged
mysql-test/t/maria.test:
  Auto merged
mysys/hash.c:
  Auto merged
mysys/thr_lock.c:
  Auto merged
sql/field.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/ha_partition.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event_old.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
storage/csv/ha_tina.cc:
  Auto merged
storage/federated/ha_federated.cc:
  Auto merged
storage/maria/Makefile.am:
  Auto merged
storage/maria/ma_check.c:
  Auto merged
storage/maria/ma_control_file.c:
  Auto merged
storage/maria/ma_delete_all.c:
  Auto merged
storage/maria/ma_dynrec.c:
  Auto merged
storage/maria/ma_init.c:
  Auto merged
storage/maria/ma_key_recover.c:
  Auto merged
storage/maria/ma_open.c:
  Auto merged
storage/maria/ma_page.c:
  Auto merged
storage/maria/ma_range.c:
  Auto merged
storage/maria/ma_recovery.c:
  Auto merged
storage/maria/ma_test1.c:
  Auto merged
storage/maria/maria_read_log.c:
  Auto merged
storage/maria/unittest/ma_test_all-t:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Auto merged
storage/maria/unittest/ma_test_recovery.pl:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/myisamdef.h:
  Auto merged
include/my_base.h:
  Manual merge where error code are kept same as in 5.1
mysys/my_handler.c:
  No changes
sql/item.cc:
  Manual merge
sql/sql_class.cc:
  Manual merge
sql/sql_insert.cc:
  Manual merge
storage/maria/ha_maria.cc:
  Manual merge
storage/maria/ma_blockrec.c:
  Manual merge
storage/maria/ma_delete.c:
  Manual merge
storage/maria/ma_write.c:
  Manual merge
2008-05-29 21:39:25 +03:00
unknown
c9a825810d WL#3072 - Maria Recovery
Recovery of R-tree and fulltext indices.
Fix for BUG#35551 "Maria: crash in REPAIR TABLE/ENABLE KEYS if using
repair-with-keycache method".
Fix for bug (see ma_rt_index.c) where we could have a wrong
page_link pointer causing wrong memory access during some R-tree
index insert/delete.
Making ma_rt_test work again (it had been neglected over time) and
adding options (record type etc) to prepare it for integration into
ma_test_all-t (but there is BUG#36321 about "ma_rt_test -M" crash)


mysql-test/r/maria.result:
  correct result
mysql-test/t/maria.test:
  now we get no error
storage/maria/ma_blockrec.c:
  delete_dir_entry() and delete_head_or_tail() don't use info->keyread_buff.
  ma_get_length() does not change **packet, marking it with 'const' to
  remove some casts in callers of this function. The
  (const uchar**)&header casts will be removed when Monty changes 'header'
  to const uchar*.
  _ma_apply_redo_purge_row_head_or_tail() sets 'buff' from pagecache_read()
  so its initialization was superfluous.
storage/maria/ma_check.c:
  Fix for BUG#35551 "Maria: crash in REPAIR TABLE/ENABLE KEYS if using repair-with-keycache method"
  (see comment in code)
storage/maria/ma_create.c:
  FULLTEXT and SPATIAL indices have logging now, they are recoverable.
storage/maria/ma_delete.c:
  Logging done by _ma_ck_delete() is moved to a function
  (_ma_write_undo_key_delete()), for reusal by R-tree logging.
  _ma_log_delete() is made non-static for same
  reason, and some of its parameters are made pointers to const.
  Removed wrong comment ("Note that for delete key" etc, contradicted by
  code and comment "Log also position to row" a few lines above)
storage/maria/ma_ft_update.c:
  unneeded cast, comment for future
storage/maria/ma_key_recover.c:
  Comment about possible deadlock.
  Write bad page to DBUG trace if KEY_OP_CHECK founds bad CRC.
  Support operation KEY_OP_MULTI_COPY.
  When we execute, in UNDO phase, UNDO_KEY_DELETE|INSERT, we must call
  the proper key insertion|deletion depending on if this is R-tree
  or B-tree.
  Explanation of of _ma_[un]lock_key_del() work, maybe useful for
  mortals like me.
storage/maria/ma_key_recover.h:
  change of prototypes
storage/maria/ma_loghandler.h:
  New operation which can be stored in REDO_INDEX log records: KEY_OP_MULTI_COPY
storage/maria/ma_page.c:
  Comments
storage/maria/ma_pagecache.c:
  typo
storage/maria/ma_rt_index.c:
  Fix for bug: the page_link pointer in maria_rtree_insert_req()
  could be wrong when we set its 'changed' member; for the solution
  see ma_key_recover.h. It is needed only in cases when we manipulate
  several pages.
  Logging of changes done to pages by key insert/delete.
  maria_rtree_delete()'s main work is moved to a new function
  maria_rtree_real_delete(), which is used by maria_rtree_delete()
  and by applying of UNDO_KEY_INSERT.
storage/maria/ma_rt_index.h:
  new prototypes and macros for ma_rt_index.c
storage/maria/ma_rt_key.c:
  Logging of maria_rtree_add_key() and maria_rtree_delete_key().
  When inserting, split is necessary if there is not enough room for key:
  take checksum's occupied space in this calculation.
storage/maria/ma_rt_key.h:
  new prototypes (those functions need to know the page's id
  because they do logging)
storage/maria/ma_rt_mbr.c:
  Comments about what the functions change.
storage/maria/ma_rt_split.c:
  maria_rtree_split_page() needs to know the page's id, because
  it does logging.
  Logging of what a split operation does to the split page (see
  comment of _ma_log_rt_split(): moves of keys inside the page,
  sometimes insertion of the new key, and shrinking of the page)
  and to the new page (receives some keys from split page, and
  sometimes the new key).
storage/maria/ma_rt_test.c:
  ma_rt_test had been forgotten when maria_rkey() was changed some months ago
  (0->HA_WHOLE_KEY change), and when calls to maria_rnd(,,HA_OFFSET_ERROR)
  were rewritten to maria_scan() calls (which implies maria_scan_init()).
  The 'max_i' change is to adapt to the fact that maria_scan() does
  not return deleted records for BLOCK_RECORD but does so for other formats;
  the initial code assumed a certain number of deleted records would be
  returned, we change it to rather count only non-deleted ones.
  We also add more features to this test, like ma_test1 (the plan
  is to run ma_rt_test in ma_test_all-t):
  options to choose records' format, table checksum, transactions,
  checkpoints, end at specific stages, abort without committing,
  and debug trace.
storage/maria/ma_test1.c:
  MY_INIT() does my_init().
storage/maria/ma_write.c:
  Logging done by _ma_ck_write_btree_with_log() is moved to a function
  (_ma_write_undo_key_insert()), for reusal by R-tree logging.
  _ma_log_new() and _ma_log_change() are made non-static for same
  reason. Some parameters of logging functions are made pointers to const.
  If EXTRA_DEBUG_KEY_CHANGES, we now log CRC in _ma_log_change() too
  (better checks, bigger record).
storage/maria/maria_read_log.c:
  Program takes no arguments, bail out if any, instead of silently discarding them
storage/myisam/rt_test.c:
  rt_test had been forgotten when mi_rkey() was changed some months ago
  (0->HA_WHOLE_KEY change).
  The 'max_i' change is to make it symmetric with ma_rt_test.c
mysql-test/r/maria-gis-rtree-dynamic.result:
  correct result
mysql-test/r/maria-gis-rtree-trans.result:
  correct result
mysql-test/r/maria-recovery-rtree-ft.result:
  almost correct result (hitting BUG# in the end)
mysql-test/t/maria-gis-rtree-dynamic.test:
  test R-tree & dynamic row format
mysql-test/t/maria-gis-rtree-trans.test:
  Test R-tree and page row format and transactional
mysql-test/t/maria-recovery-rtree-ft-master.opt:
  usual options for recovery testing
mysql-test/t/maria-recovery-rtree-ft.test:
  test of recovery of R-tree and fulltext indices.
2008-04-24 17:22:51 +02:00
unknown
126c1228f5 Added versioning of row data
Will in future changeset (soon) av versioning of status variables (number of rows) and index
Changed some LEX_STRING to LEX_CUSTRING to avoid casts and warnings
Removed some not needed variables (as noticed by Guilhem)


include/maria.h:
  Added prototypes for maria_chk_init_for_check(), maria_versioning() and maria_ignore_trids()
include/my_base.h:
  Add new error HA_ERR_ROW_NOT_VISIBLE
include/myisamchk.h:
  Added variables for checking visibility of rows during maria_chk
include/thr_lock.h:
  Changed argument type from int to my_bool for get_status
  Added variable allow_multiple_concurrent_insert, to signal if table supports multiple concurrent inserts
mysql-test/r/maria-page-checksum.result:
  Added missing drop table
mysql-test/t/maria-page-checksum.test:
  Added missing drop table
mysys/my_handler.c:
  Added new error messages
mysys/thr_lock.c:
  Added support for multiple concurrent inserts, if table handler supports it
sql/sql_yacc.yy:
  Added LOCK TABLE table_name WRITE CONCURRENT
  This was added (temporarly?) to be able to check versioning with Maria
storage/csv/ha_tina.cc:
  Updated parameter for get_status
storage/maria/ha_maria.cc:
  Added calls to maria_chk_init_status()
  Fixed call to ma_control_file_open()
storage/maria/ma_blockrec.c:
  Changed some LEX_STRING to LEX_CUSTRING to avoid casts and warnings
  Changed back some 'header' parameters to const char*
  Removed some casts
  
  Added support for versioning:
  - If info->row_flag & ROW_FLAG_TRANSID is set, store transaction id together with the row
  - When reading rows, check if rows are visible. Give error if not
  - When scanning table, ignore not visible rows
  - Added function parameters to some functions, to be able to call _ma_compact_block_page() with different parameters depending of if the page is a HEAD or TAIL page
  - _ma_compact_block_page() deletes transaction id's that are visible by all running transactions
  - Added functions for thr_lock() to enable multiple concurrent inserts
  - Added helper function 'mysql_versioning()' to enable/disable versioning
  - Added helper function maria_ignore_trids(), used by maria_chk and maria_pack to see all rows.
storage/maria/ma_blockrec.h:
  Updated parameters for some functions.
  Added new functions to read/store state with thr_lock
storage/maria/ma_check.c:
  Enable handling of transaction id's in rows
  Give a readable error if a table contains a transation id that makes rows not visible
storage/maria/ma_control_file.c:
  Added option to not give warning if control file doesn't exists.
storage/maria/ma_control_file.h:
  Updated parameter lists for ma_control_file_open()
storage/maria/ma_delete.c:
  Removed not used variable (suggestion by Guilhem)
storage/maria/ma_locking.c:
  Changed type of argument from int -> my_bool
storage/maria/ma_open.c:
  Removed not used variables 'key_write_undo_lsn' and 'key_delete_undo_lsn'
  Added new thr_lock interface functions for BLOCK_RECORD to enable multiple concurrent insert
storage/maria/ma_test1.c:
  Added option --versioning (-C) to check versioning
storage/maria/ma_test2.c:
  Added option -C to check versioning
storage/maria/ma_test_recovery:
  Forward argumetns to ma_test_recovery.pl
storage/maria/ma_write.c:
  Removed not used variable key_write_undo_lsn
storage/maria/maria_chk.c:
  Always read control file (if exist) at start
  Initialize checking of tables by calling maria_chk_init_for_check()
  In verbose mode and in case of error, print max found transaction id
storage/maria/maria_def.h:
  Added Trid to MARIA_ROW to be able to check transaction id for found row
  Moved 'base_length' from MARIA_ROW to MARIA_HA to be able to handle different base length (with and without TRANSID) without if's
  Added default row_flag to MARIA_HA for the same reason
  Changed LEX_STRING -> LEX_CUSTRING to avoid casts in ma_blockrec.c
  Removed not needed variables key_write_undo_lsn and key_delete_undo_lsn
  Added prototypes for new functions and fixed those that had changed
storage/maria/maria_pack.c:
  Ensure we can read all rows from the file, independent of the used transaction id
storage/maria/maria_read_log.c:
  Updated arguments to ma_control_file_open()
storage/maria/trnman.c:
  If we have only one transaction, fixed that min_read_from contains current transaction
  Fixed that trnman_can_read_from() returns that row is readable if it was written by current transaction
storage/maria/unittest/ma_control_file-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_all-t:
  Added test of versioning
  Removed printing of one extra space
storage/maria/unittest/ma_test_loghandler-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Updated arguments to ma_control_file_open()
storage/maria/unittest/ma_test_recovery.expected:
  Updated file with result from new tests
storage/maria/unittest/ma_test_recovery.pl:
  Added options --abort-on-error and --verbose
  In case of --verbose, print all excuted shell commands
  Added test of versioning
storage/myisam/mi_locking.c:
  Updated type of parameter
storage/myisam/myisamdef.h:
  Updated type of parameter
mysql-test/r/maria-mvcc.result:
  New BitKeeper file ``mysql-test/r/maria-mvcc.result''
mysql-test/t/maria-mvcc.test:
  New BitKeeper file ``mysql-test/t/maria-mvcc.test''
2008-04-10 05:26:36 +03:00
unknown
722a8ebe5b Store maximum transaction id into control file at clean shutdown.
This can serve to maria_chk to check that trids found in rows and keys
are not too big. Also used by Recovery when logs are lost.
Options --require-control-file, --datadir, --log-dir (yes, the dashes are
inconsistent but I imitated mysqld --datadir and --maria-log-dir) for
maria_chk.
Lock control file _before_ reading its content.


storage/maria/ha_maria.cc:
  new prototype
storage/maria/ma_check.c:
  A function to find the max trid in the system (consults transaction
  manager and control file), to check tables.
storage/maria/ma_checkpoint.c:
  new prototype
storage/maria/ma_control_file.c:
  Store max trid into control file, in a backward-compatible way
  (can still read old control files).
  Parameter to ma_control_file_open(), to not create the log if it's
  missing (maria_chk needs that).
  Lock control file _before_ reading its content.
  Fix for a segfault when reading an old control file (bzero() with a
  negative second argument)
storage/maria/ma_control_file.h:
  changes to the control file module's API
storage/maria/ma_init.c:
  When Maria shuts down cleanly, store max trid into control file.
storage/maria/ma_loghandler.c:
  new prototype
storage/maria/ma_recovery.c:
  During recovery, consult max trid stored in control file, in case it is
  bigger than what we found in log (case of logs manually removed by user).
storage/maria/ma_test1.c:
  new prototype
storage/maria/ma_test2.c:
  new prototype
storage/maria/maria_chk.c:
  New option --require-control-file (abort if control file not found),
  --datadir (path for control file (and for logs if --log-dir not specified)),
  --log-dir (path for logs).
  Try to open control file when maria_chk starts.
storage/maria/maria_read_log.c:
  new prototype
storage/maria/trnman.c:
  A new function to know max trid in transaction manager
storage/maria/trnman_public.h:
  New function
storage/maria/unittest/ma_control_file-t.c:
  new prototypes. Testing storing and retrieving the max trid to/from
  control file
storage/maria/unittest/ma_test_loghandler-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  new prototype
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  new prototype
2008-04-04 19:10:53 +02:00
unknown
a1255fc299 Support of moving logs in other directory then data root.
Fixed typo in maria_read_log "help" output.
Compilation warning on Mac OS fixed.


mysql-test/include/maria_empty_logs.inc:
  Added support of moving maria log relatively
    to master data directory.
mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc:
  Added support of moving maria log relatively
    to master data directory.
mysql-test/include/maria_verify_recovery.inc:
  Added support of moving maria log relatively
    to master data directory.
mysql-test/t/maria-recovery-master.opt:
  Check of recovery with logs in other place.
mysql-test/t/maria-recovery.test:
  Check of recovery with logs in other place.
storage/maria/ha_maria.cc:
  Support of moving logs in other directory then data root.
storage/maria/ma_loghandler.c:
  Compilation warning on Mac OS fixed.
storage/maria/ma_static.c:
  Support of moving logs in other directory then data root.
storage/maria/ma_test1.c:
  Support of moving logs in other directory then data root.
storage/maria/maria_def.h:
  Support of moving logs in other directory then data root.
storage/maria/maria_read_log.c:
  Support of moving logs in other directory then data root.
  Fixed typo in maria_read_log "help" output.
2008-01-26 23:03:23 +02:00
unknown
c719e1fd33 Added wrapper for chmod(): my_chmod()
Automaticly disable ma_test_recovery if not compiled with debugging. This fixes that make test works in Maria.
Fixed wrong merge of ma_init.c from 5.1
Portability fixes:
- Use my_chmod() instead of my_chmod()
- Use my_access() instead of my_stat() to test if file exists
- Don't test result value of pthread_mutex_lock() and pthread_mutex_unlock() as this is not portable
- No reason to test if file exists before we delete it



include/my_sys.h:
  Added my_chmod
include/mysys_err.h:
  Added error for my_chmod
mysys/Makefile.am:
  Added my_chmod
mysys/errors.c:
  Added error for my_chmod
mysys/my_init.c:
  Syncronize with 5.1 to fix setting of QueryPerformanceFrequency()
storage/maria/ma_test1.c:
  Changed short option of --skip-delete and --skip-update to be more logical
storage/maria/ma_test_recovery.expected:
  Updated results after adding more tests
storage/maria/ma_test_recovery:
  Abort test nicely if we are runnning without debugging
  Added more tests
  Changed temporary file names so that one can run maria_chk on them
  Removed some old comments
storage/maria/maria_read_log.c:
  Added note if maria_read_log will not be able to create byte-to-byte identical tables compared to normal execution
storage/maria/unittest/ma_pagecache_consist.c:
  Removed wrong setting of buff that caused memory overwrite
  Use my_chmod() instead of chmod()
  Don't test result value of pthread_mutex_lock() and pthread_mutex_unlock() as this is not portable
storage/maria/unittest/ma_pagecache_single.c:
  Use my_chmod() instead of chmod()
  Don't test result value of pthread_mutex_lock() and pthread_mutex_unlock() as this is not portable
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  No reason to test if file exists before we delete it
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Don't test result value of pthread_mutex_lock() and pthread_mutex_unlock() as this is not portable
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  No reason to test if file exists before we delete it
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
  Use my_access() instead of my_stat() to test if file exists
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  No reason to test if file exists before we delete it
  chmod -> my_chmod
mysys/my_chmod.c:
  Added wrapper for chmod()
2008-01-03 09:45:46 +02:00
unknown
fabdf6df6d Postmerge fix.
storage/maria/ma_loghandler.c:
  Postmerge fix.
  New state of the log added to proicess correctly shutdown.
storage/maria/ma_loghandler.h:
  New state of the log added to proicess correctly shutdown.
2007-12-15 19:16:41 +02:00
unknown
98a2c5e3cf Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria
into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-readonly


storage/maria/ha_maria.cc:
  Auto merged
storage/maria/ma_create.c:
  Auto merged
storage/maria/ma_open.c:
  Auto merged
storage/maria/ma_test1.c:
  Auto merged
storage/maria/ma_test2.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Auto merged
storage/maria/ma_check.c:
  Merge.
storage/maria/ma_loghandler.c:
  Merge.
storage/maria/ma_loghandler.h:
  Merge.
storage/maria/maria_read_log.c:
  Merge.
storage/maria/unittest/Makefile.am:
  Merge.
2007-12-15 16:07:16 +02:00
unknown
d225521c76 Transaction log behaviour in case of write
error fixed (switching to the read only mode).
Added read only mode of transactions log handler.


storage/maria/ha_maria.cc:
  Transaction log initialization parameters change.
storage/maria/ma_check.c:
  New status variable of transactional log.
storage/maria/ma_create.c:
  New status variable of transactional log.
storage/maria/ma_loghandler.c:
  - New status variable added.
  - Checking the status variable in the loghandler
  interface functions added
  - All fails of loghandler functions revised.
  - UNRECOVERABLE_ERROR() removed.
  - Switching to read only mode added where it nead.
  - Checking of log state added before writes log content
    and changing status variables like sent_to_file, n_buffers_only, flushed.
  - Readonly loghandler initialization added.
  - Fixed problem with example table transactional log initialization.
storage/maria/ma_loghandler.h:
  Readonly loghandler initialization added.
  Fixed problem with example table transactional log initialization.
  New status variable added.
storage/maria/ma_open.c:
  New status variable of transactional log.
storage/maria/ma_test1.c:
  Transaction log initialization parameters change.
storage/maria/ma_test2.c:
  Transaction log initialization parameters change.
storage/maria/maria_read_log.c:
  Transaction loghandler initialization in read only mode in
  case of only dysplay parameter.
storage/maria/unittest/Makefile.am:
  Test of readonly mode added.
storage/maria/unittest/ma_test_loghandler-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
  Fixed incorrect fprintf call parameters.
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Useing this test also as read only loghandler test.
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Transaction log initialization parameters change.
  Fixed problem with example table transactional log initialization.
2007-12-15 15:44:29 +02:00
unknown
f7df9addba WL#3072 - Maria Recovery: recovery of state.auto_increment.
When we log UNDO_KEY_INSERT for an auto_inc key, we update
state.auto_increment (not anymore at the end of maria_write() except
if this is a non-transactional table). When Recovery sees UNDO_KEY_INSERT
in the REDO phase, it reads the auto_inc value from it and updates
state.auto_increment.


mysql-test/r/maria-recovery.result:
  Without the code fix, there would be in CHECK TABLE:
  "Auto-increment value: 0 is smaller than max used value: 3"
  and no AUTO_INCREMENT= clause in SHOW CREATE TABLE.
mysql-test/t/maria-recovery.test:
  Test of recovery of state.auto_increment: from an old table,
  does the replaying of the log set state.auto_increment to
  what it should be.
storage/maria/ma_check.c:
  new way of calling ma_retrieve_auto_increment(): pass key
storage/maria/ma_key.c:
  ma_retrieve_auto_increment() now operates directly with a pointer
  to the key and not on the record.
storage/maria/ma_key_recover.c:
  dedicated write_hook_for_undo_key_insert(): sets state.auto_increment
  under log's mutex.
storage/maria/ma_key_recover.h:
  Dedicated hook for UNDO_KEY_INSERT, to set state.auto_increment.
  Such hook needs a new member st_msg_write_hook_for_undo_key::auto_increment,
  which contains the auto_increment value inserted.
storage/maria/ma_loghandler.c:
  UNDO_KEY_INSERT gets a dedicated write_hook, to set auto_increment.
storage/maria/ma_recovery.c:
  When in the REDO phase we see UNDO_KEY_INSERT: if the state is older
  than this record, and the key is the auto_increment one, read
  the key's value from the log record and update state.auto_increment.
storage/maria/ma_test_all.sh:
  use $maria_path to be able to run from /dev/shm (faster)
storage/maria/ma_update.c:
  bool is more of C++, using my_bool.
  If table is transactional, state.auto_increment is already updated
  in write_hook_for_undo_key_insert().
storage/maria/ma_write.c:
  If table is transactional, state.auto_increment is not updated at
  the end of maria_write() but rather in write_hook_for_undo_key_insert()
  (under log's mutex, so that a concurrent checkpoint does not read
  state.auto_increment while it is changing - corrupted).
  _ma_ck_write_btree_with_log() extracts the auto_increment value
  from the key, puts it into msg.auto_increment, and this is passed
  to write_hook_for_undo_key_insert().
storage/maria/maria_def.h:
  change of prototype of ma_retrieve_auto_increment()
storage/maria/maria_read_log.c:
  use default log file size. Use separate page caches for table
  and logs (needed if maria_block_size!=TRANSLOG_PAGE_SIZE).
2007-12-12 22:33:36 +01:00
unknown
ebf7ab7bce Added error HA_ERR_FILE_TOO_SHORT to be used when files are shorter than expected (by my_read/my_pread)
Added debugger hook _my_dbug_put_break_here() that is called if we get a CRC that matches --debug-crc-break (my_crc_dbug_break)
Fixed REDO_REPAIR to use all repair modes (repair, repair_by_sort, repair_paralell
REDO_REPAIR now also logs used key map
Fixed some bugs in REDO logging of key pages
Better error messages from maria_read_log
Added my_readwrite_flags to init_pagecache() to be able to get better error messages and simplify code.
Don't allow pagecaches with less than 8 blocks (Causes strange crashes)
Added EXTRA_DEBUG_KEY_CHANGES. When this is defined some REDO_INDEX entries contains page checksums (these are calculated and checked in DBUG mode, ignored otherwise)
Fixed bug in ma_pagecache unit tests that caused program to sometimes fail
Added some missing calls to MY_INIT() that caused some unit tests to fail
Fixed that TRUNCATE works properly on temporary MyISAM files
Updates some result files to new table checksums results (checksum when NULL fields are ignored)
perl test-insert can be replayed with maria_read_log!


sql/share/Makefile.am:
  Change mode to -rw-rw-r--
BitKeeper/etc/ignore:
  added storage/maria/unittest/page_cache_test_file_1 storage/maria/unittest/pagecache_debug.log
include/maria.h:
  Added maria_tmpdir
include/my_base.h:
  Added error HA_ERR_FILE_TOO_SHORT
include/my_sys.h:
  Added variable my_crc_dbug_check
  Added function my_dbug_put_break_here()
include/myisamchk.h:
  Added org_key_map (Needed for writing REDO record for REPAIR)
mysql-test/r/innodb.result:
  Updated to new checksum algorithm (NULL ignored)
mysql-test/r/mix2_myisam.result:
  Updated to new checksum algorithm (NULL ignored)
mysql-test/r/myisam.result:
  Updated to new checksum algorithm (NULL ignored)
mysql-test/t/myisam.test:
  Added used table
mysys/checksum.c:
  Added DBUG for checksum results
  Added debugger hook so that _my_dbug_put_break_here() is called if we get matching CRC
mysys/lf_alloc-pin.c:
  Fixed compiler warning
mysys/my_handler.c:
  Added new error message
mysys/my_init.c:
  If my_progname is not given, use 'unknown' form my_progname_short
  Added debugger function my_debug_put_break_here()
mysys/my_pread.c:
  In case of too short file when MY_NABP or MY_FNABP is specified, give error HA_ERR_FILE_TO_SHORT
mysys/my_read.c:
  In case of too short file when MY_NABP or MY_FNABP is specified, give error HA_ERR_FILE_TO_SHORT
sql/mysqld.cc:
  Added debug option --debug-crc-break
sql/sql_parse.cc:
  Trivial optimization
storage/maria/ha_maria.cc:
  Renamed variable to be more logical
  Ensure that param.testflag is correct when calling repair
  Added extra argument to init_pagecache
  Set default value for maria_tempdir
storage/maria/ma_blockrec.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_cache.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_check.c:
  Set param->testflag to match how repair is run (needed for REDO logging)
  Simple optimization
  Moved flag if page is node from pagelength to keypage-flag byte
  Log used key map in REDO log.
storage/maria/ma_delete.c:
  Remember previous UNDO entry when writing undo (for future CLR records)
  Moved flag if page is node from pagelength to keypage-flag byte
  Fixed some bugs in redo logging
  Added CRC for some translog REDO_INDEX entries
storage/maria/ma_dynrec.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_ft_update.c:
  Fixed call to _ma_store_page_used()
storage/maria/ma_key_recover.c:
  Added CRC for some translog REDO_INDEX entries
  Removed not needed pagecache_write() in _ma_apply_redo_index()
storage/maria/ma_locking.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_loghandler.c:
  Added used key map to REDO_REPAIR_TABLE
storage/maria/ma_loghandler.h:
  Added operation for checksum of key pages
storage/maria/ma_open.c:
  Allocate storage for undo lsn pointers
storage/maria/ma_pagecache.c:
  Remove not needed include file
  Change logging to use fd: for file descritors as other code
  Added my_readwrite_flags to init_pagecache() to be able to get better error messages for maria_chk/maria_read_log
  Don't allow pagecaches with less than 8 blocks
  Remove wrong DBUG_ASSERT()
storage/maria/ma_pagecache.h:
  Added readwrite_flags
storage/maria/ma_recovery.c:
  Better error messages for maria_read_log:
  - Added eprint() for printing error messages
  - Print extra \n before error message if we are printing %0 %10 ...
  
  Added used key_map to REDO_REPAIR log entry
  More DBUG
  Call same repair method that was used by mysqld
storage/maria/ma_rt_index.c:
  Moved flag if page is node from pagelength to keypage-flag byte
storage/maria/ma_rt_key.c:
  Fixed call to _ma_store_page_used()
storage/maria/ma_rt_split.c:
  Moved flag if page is node from pagelength to keypage-flag byte
storage/maria/ma_static.c:
  Added maria_tmpdir
storage/maria/ma_test1.c:
  Updated call to init_pagecache()
storage/maria/ma_test2.c:
  Updated call to init_pagecache()
storage/maria/ma_test3.c:
  Updated call to init_pagecache()
storage/maria/ma_write.c:
  Removed #ifdef NOT_YET
  Moved flag if page is node from pagelength to keypage-flag byte
  Fixed bug in  _ma_log_del_prefix()
storage/maria/maria_chk.c:
  Fixed wrong min limit for page_buffer_size
  Updated call to init_pagecache()
storage/maria/maria_def.h:
  Added EXTRA_DEBUG_KEY_CHANGES. When this is defined some REDO_INDEX entries contains page checksums
  Moved flag if page is node from pagelength to keypage-flag byte
storage/maria/maria_ftdump.c:
  Updated call to init_pagecache()
storage/maria/maria_pack.c:
  Updated call to init_pagecache()
  Reset share->state.create_rename_lsn & share->state.is_of_horizon
storage/maria/maria_read_log.c:
  Better error messages
  Added --tmpdir option (needed to set temporary directory for REDO_REPAIR)
  Added --start-from-lsn
  Changed option for --display-only to 'd' (wanted to use -o for 'offset')
storage/maria/unittest/lockman2-t.c:
  Added missing call to MY_INIT()
storage/maria/unittest/ma_pagecache_consist.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_pagecache_single.c:
  Fixed bug that caused program to sometimes fail
  Added some DBUG_ASSERTS()
  Changed some calls to malloc()/free() to my_malloc()/my_free()
  Create extra file to expose original hard-to-find bug
storage/maria/unittest/ma_test_loghandler-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Updated call to init_pagecache()
storage/maria/unittest/test_file.c:
  Changed malloc()/free() to my_malloc()/my_free()
  Fixed memory leak
  Changd logic a bit while trying to find bug in reset_file()
storage/maria/unittest/trnman-t.c:
  Added missing call to MY_INIT()
storage/myisam/mi_cache.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/myisam/mi_create.c:
  Removed O_EXCL to get TRUNCATE to work for temporary files
storage/myisam/mi_dynrec.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/myisam/mi_locking.c:
  Test for HA_ERR_FILE_TOO_SHORT instead for -1
mysql-test/r/old-mode.result:
  New BitKeeper file ``mysql-test/r/old-mode.result''
mysql-test/t/old-mode-master.opt:
  New BitKeeper file ``mysql-test/t/old-mode-master.opt''
mysql-test/t/old-mode.test:
  New BitKeeper file ``mysql-test/t/old-mode.test''
2007-12-04 23:23:42 +02:00
unknown
4e0964cb04 Fixed repair_by_sort to work with BLOCK_RECORD
Fixed bugs in undo logging
Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read)
Reserved place for reference-transid on key pages (for packing of transids)
ALTER TABLE and INSERT ... SELECT now uses fast creation of index
    
Known bugs:
ma_test_recovery fails because of a bug in redo handling when log is cut directly after a redo (Guilhem knows how to fix)
ma_test_recovery.excepted is not totally correct, because of the above bug
mysqld sometimes fails to restart; Fails with error "end_of_redo_phase: Assertion `long_trid != 0' failed"; Guilhem to investigate


include/maria.h:
  Prototype changes
  Added current_filepos to st_maria_sort_info
mysql-test/r/maria.result:
  Updated results that changes as alter table and insert ... select now uses fast creation of index
mysys/mf_iocache.c:
  Reset variable to gurard against double invocation
storage/maria/ma_bitmap.c:
  Added _ma_bitmap_reset_cache() (needed for repair)
storage/maria/ma_blockrec.c:
  Simplify code
  More initial allocations
  Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read)
storage/maria/ma_blockrec.h:
  Moved TRANSID_SIZE to maria_def.h
  Added prototype for new functions
storage/maria/ma_check.c:
  Simplicy code
  Fixed repair_by_sort to work with BLOCK_RECORD
  - When using BLOCK_RECORD or UNPACK create new Maria handle
  - Use common initializer function
  - Align code with maria_repair()
  
  Made some changes to maria_repair_parallel() to use common initializer function
  Removed ASK_MONTY section by fixing noted problem
storage/maria/ma_close.c:
  Moved check for readonly to _ma_state_info_write()
storage/maria/ma_key_recover.c:
  Use different log entries if key root changes or not.
  This fixed some bugs when tree grows
storage/maria/ma_key_recover.h:
  Added keynr to st_msg_to_write_hook_for_undo_key
storage/maria/ma_loghandler.c:
  Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT
storage/maria/ma_loghandler.h:
  Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT
storage/maria/ma_open.c:
  Added TRANSID to all key pages (for future compressing of trans id's)
  For compressed records, alloc a bit bigger buffer to avoid valgrind warnings
  If table is opened readonly, don't update state
storage/maria/ma_packrec.c:
  Allocate bigger array for bit unpacking to avoid valgrind errors
storage/maria/ma_recovery.c:
  Added UNDO_KEY_INSERT_WITH_ROOT & UNDO_KEY_DELETE_WITH_ROOT
storage/maria/ma_sort.c:
  More logging
storage/maria/ma_test_all.sh:
  More tests
storage/maria/ma_test_recovery.expected:
  Update results
  Note that this is not complete becasue of a bug in recovery
storage/maria/ma_test_recovery:
  Removed recreation of index (not needed when we have redo for index pages)
storage/maria/maria_chk.c:
  When using flag --read-only, don't update status for files
  When using --unpack, don't use REPAIR_BY_SORT if other repair option is given
  Enable repair_by_sort for BLOCK records
  Removed not needed newline at start of --describe
storage/maria/maria_def.h:
  Support for TRANSID_SIZE to key pages
storage/maria/maria_read_log.c:
  renamed --only-display to --display-only
2007-11-28 21:38:30 +02:00
unknown
fc0a25ec49 WL#3071 Maria checkpoint, WL#3072 Maria recovery
instead of fprintf(stderr) when a task (with no user connected) gets
an error, use my_printf_error(). Flags ME_JUST_WARNING and ME_JUST_INFO
added to my_error()/my_printf_error(), which pass it to
my_message_sql() which is modified to call the appropriate
sql_print_*(). This way recovery can signal its start and end with
[Note] and not [ERROR] (but failure with [ERROR]).
Recovery's detailed progress (percents etc) still uses stderr as they
have to stay on one single line.
sql_print_error() changed to use my_progname_short (nicer display).
mysql-test-run.pl --gdb/--ddd does not run mysqld, because
a breakpoint in mysql_parse is too late to debug startup problems;
instead, dev should set the breakpoints it wants and then "run" ("r").


include/my_sys.h:
  new flags to tell error_handler_hook that this is not an error
  but an information or warning
mysql-test/mysql-test-run.pl:
  when running with --gdb/--ddd to debug mysqld, breaking at mysql_parse
  is too late to debug startup problems; now, it does not run mysqld,
  does not set breakpoints, developer can set as early breakpoints
  as it wants and is responsible for typing "run" (or "r")
mysys/my_init.c:
  set my_progname_short
mysys/my_static.c:
  my_progname_short added
sql/mysqld.cc:
  * my_message_sql() can now receive info or warning, not only error;
  this allows mysys to tell the user (or the error log if no user)
  about an info or warning. Used from Maria.
  * plugins (or engines like Maria) may want to call my_error(), so
  set up the error handler hook (my_message_sql) before initializing
  plugins; otherwise they get my_message_no_curses which is less
  integrated into mysqld (is just fputs())
  * using my_progname_short instead of my_progname, in my_message_sql()
  (less space on screen)
storage/maria/ma_checkpoint.c:
  fprintf(stderr) -> ma_message_no_user()
storage/maria/ma_checkpoint.h:
  function for any Maria task, not connected to a user (example:
  checkpoint, recovery; soon could be deleted records purger)
  to report a message (calls my_printf_error() which, when inside ha_maria,
  leads to sql_print_*(), and when outside, leads to
  my_message_no_curses i.e. stderr).
storage/maria/ma_recovery.c:
  To tell that recovery starts and ends we use ma_message_no_user()
  (sql_print_*() in practice). Detailed progress info still uses
  stderr as sql_print() cannot put several messages on one line.
  071116 18:42:16 [Note] mysqld: Maria engine: starting recovery
  recovered pages: 0% 67% 100% (0.0 seconds); transactions to roll back: 1 0 (0.0
  seconds); tables to flush: 1 0 (0.0 seconds);
  071116 18:42:16 [Note] mysqld: Maria engine: recovery done
storage/maria/maria_chk.c:
  my_progname_short moved to mysys
storage/maria/maria_read_log.c:
  my_progname_short moved to mysys
storage/myisam/myisamchk.c:
  my_progname_short moved to mysys
2007-11-16 17:09:51 +01:00
unknown
1bc5e3b971 WL#3072 - Maria recovery
maria_read_log used to always print a warning message at startup
to say it is unsafe if ALTER TABLE was used. Now it prints it only
if the log does show the problem (=ALTER TABLE or CREATE SELECT, which
both disable logging of REDO_INSERT*).
For that, when ha_maria::external_lock() disables transactionality
it writes a LOGREC_INCOMPLETE_LOG to the log, which "maria_read_log -a"
picks up to write a warning.
REPAIR TABLE also disables those REDO_INSERT* but as maria_read_log
executes LOGREC_REDO_REPAIR no warning is needed.


storage/maria/ha_maria.cc:
  as we now log a record when disabling transactionility, we need the
  TRN to be set up first
storage/maria/ma_blockrec.c:
  comment
storage/maria/ma_loghandler.c:
  new type of log record
storage/maria/ma_loghandler.h:
  new type of log record
storage/maria/ma_recovery.c:
  * maria_apply_log() now returns a count of warnings. What currently
  produces warnings is:
  - skipping applying UNDOs though there are some (=> inconsistent table)
  - replaying log (in maria_read_log) though the log contains some
  ALTER TABLE or CREATE SELECT (log misses REDO_INSERT* for those
  and is so incomplete).
  Count of warnings affects the final message of maria_read_log and
  recovery (though in recovery none of the two conditions above should
  happen).
  * maria_read_log used to always print a warning message at startup
  to say it is unsafe if ALTER TABLE was used. Now it prints it only
  if the log does show the problem, i.e. ALTER TABLE or CREATE SELECT
  was used (both disable logging of REDO_INSERT* as those records are
  not needed for recovery; those missing records in turn make
  recreation-from-scratch, via maria_read_log, impossible). For that,
  when ha_maria::external_lock() disables transactionality,
  _ma_tmp_disable_logging_for_table() writes a LOGREC_INCOMPLETE_LOG to
  the log, which maria_apply_log() picks up to write a warning.
storage/maria/ma_recovery.h:
  maria_apply_log() returns a count of warnings
storage/maria/maria_def.h:
  _ma_tmp_disable_logging_for_table() grows so becomes a function
storage/maria/maria_read_log.c:
  maria_apply_log can now return a count of warnings, to temper the
  "SUCCESS" message printed in the end by maria_read_log.
  Advise users to make a backup first.
2007-11-14 12:51:16 +01:00
unknown
08b7152893 WL#3072 Maria recovery
- fixes (in recovery, checkpoint, log handler) of bugs found
during testing.
- new option --check for maria_read_log: with --only-display (which only
reads the header) it reads the full record, for debugging.


storage/maria/ma_loghandler.c:
  importing patch from Sanja for bug of translog_next_LSN() found
  during recovery
storage/maria/ma_loghandler_lsn.h:
  better types (0L is 4 bytes on some platforms, it causes problems
  when used into lsn_store(): right shift >= width of type.
storage/maria/ma_pagecache.c:
  work around infamous "PAGECACHE_PLAIN_PAGE used for transactional
  tables in specialm case"; REDO phase disables logging and this causes
  pages to be PAGECACHE_PLAIN_PAGE, thus ignored wrongly by the
  checkpoint taken at the end of the REDO phase.
storage/maria/ma_recovery.c:
  - a #ifdef which broke maria_read_log in non-debug builds (no output!)
  - support for maria_read_log --check
  - detect record corruption before opening the table
  - updating is_of_horizon requires writing the state
  - fix for wrong parsing of checkpoint record by recovery
storage/maria/ma_recovery.h:
  support for maria_read_log --check
storage/maria/maria_read_log.c:
  Option --check: --only-display only looks at the header;
  adding --check tries a translog_read_record() to see if record can
  be fully read (this is to find bugs).
2007-10-16 14:56:38 +02:00
unknown
63ff9877a5 WL#3072 Maria recovery
Misc changes:
- fix for benign Valgrind error, compiler warnings
- fix for a segfault in execution of maria_delete_all_rows() and one
when taking multiple checkpoints
- fix for too paranoid assertion
- adding ability to take checkpoints at the end of the REDO phase
and at the end of recovery.
- other minor changes


storage/maria/ha_maria.cc:
  The checkpoint done after Recovery is finished, is moved to
  maria_recover().
storage/maria/ma_bitmap.c:
  fix for Valgrind error: the "shadow debug copy" of the bitmap page
  started unitialized and so ma_print_bitmap() would use it uninitialized
storage/maria/ma_checkpoint.c:
  * reset pointers to NULL after freeing them, or we segfault at
  next checkpoint in my_realloc().
  * fix for compiler warnings.
storage/maria/ma_delete_all.c:
  info->trn is NULL for non-transactional tables
storage/maria/ma_locking.c:
  correct assertion (it fired wrongly in execution of REDO_DROP_TABLE
  due to the maria_extra(HA_PREPARE_FOR_DROP)->_ma_decrement_open_count()
  ->maria_lock_database(F_UNLCK); another solution would have been to
  not call _ma_decrement_open_count() (it's ok to have a wrong open
  count in a table which we are dropping), but the same problem
  would still exist for REDO_RENAME_TABLE.
storage/maria/ma_loghandler.c:
  fail early if UNRECOVERABLE_ERROR
storage/maria/ma_recovery.c:
  * new argument to maria_apply_log(): should it take checkpoints
  (at end of REDO phase and at the very end) or no.
  * moving the call to translog_next_LSN() into
  parse_checkpoint_record() ("hide the details").
  * Refining an error detection for something which could happen
  if there is a checkpoint record in the log.
  * Using close_one_table() instead of maria_extra(HA_EXTRA_PREPARE_FOR_DROP|RENAME),
  as it looks safer, and also changing how close_one_table() works:
  it now limits itself to scanning all_tables[], thus having one loopp
  instead of two, which should be faster (as a result, it does not
  close tables not registered in this array, which is ok as there
  should not be any).
storage/maria/ma_recovery.h:
  new parameter
storage/maria/maria_read_log.c:
  update to new prototype
2007-10-08 19:08:25 +02:00
unknown
24db7ed7e1 WL#3072 Maria recovery.
* Thanks to Serg's tip, we fix here the compilation issue of
REDO_REPAIR_TABLE's execution, by defining versions of
_ma_killed_ptr() and _ma_check_print_info|warning|error()
in maria_read_log.c (we move those of maria_chk.c into an include
file and include it in maria_chk.c and maria_read_log.c).
Execution of such record looks like working from my tests (it only
happens in maria_read_log; recovery-from-mysqld skips DDLs and
REPAIR is considered DDL here as it bypasses logging): tested
ALTER TABLE ENABLE KEYS and then remove table, apply log: that
did a repair.
* Recent changes broke maria_read_log a bit: -a became default
and -o caused error; fixing this.


storage/maria/Makefile.am:
  addind new file
storage/maria/ma_recovery.c:
  enable execution of REDO_REPAIR_TABLE by maria_read_log now that
  it compiles. Now reason to keep only T_QUICK from testflag.
storage/maria/maria_chk.c:
  moving these functions to ma_check_standalone.h for reusability
storage/maria/maria_def.h:
  comment
storage/maria/maria_read_log.c:
  ma_check_standalone.h needs my_progname_short.
  Fixing bug where "maria_read_log" would default to -a and
  "maria_read_log -o" would throw an error. Implemented behaviour is:
  - no options: usage()
  - -a : applys, applys UNDOs by default unless --disable-undo
  - -o : only prints
storage/maria/ma_check_standalone.h:
  All standalone programs which need to use functions from ma_check.c
  (like maria_repair()) must define their version of _ma_killed_ptr()
  and _ma_check_print_info|warning|error(). Indeed, linking with ma_check.o
  brings in the dependencies of ma_check.o which are definitions of the above
  functions; if the program does not define them then the ones of
  ha_maria.o are used i.e. ha_maria.o is linked into the program, and this
  brings dependencies of ha_maria.o on mysqld.o into the program's linking
  which thus fails, as the program is not linked with mysqld.o.
  We put in this file the functions which maria_chk.c uses, so that
  they can be reused by maria_read_log (when it replays REDO_REPAIR_TABLE)
  as they are good enough (they just print to stdout/stderr like
  maria_read_log already does).
2007-10-03 18:10:32 +02:00