Commit graph

783 commits

Author SHA1 Message Date
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
Michael Widenius
86fcfb1508 Fix for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test:
Fixed bug when removing a newly inserted record (in case of duplicate key).
The bug caused a crash for rows with several blobs and the first blob was small enough to fit into the head page.
Don't change state_history if nothing changed (speed optimization that also simplifies logic).
Reset state_history if we added/deleted or updated rows without versioning.
Fixed wrong test in trnman_exists_active_transactions() if state is visible or not.

Other bugs fixed:
Fixed wrong argument to (lock->get_status) when we had to wait for TL_WRITE_CONCURRENT_INSERT.
Item_equal::update_used_tables() didn't calculate const_item_cache properly.
Added assert's to detect if join_read_const_table() was called under wrong assumptions..
Fixed that _ma_setup_live_state() is called from thr_lock() instead of handler::external_lock().
This was needed to get versioning information to be setup correctly.
Fixed error in debug binaries during a call to _ma_check_table_is_closed() when another thread was opening/closing a table.
Fixed wrong test when finding right history_state to use.

mysql-test/suite/maria/r/maria.result:
  Added test for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test
mysql-test/suite/maria/t/maria.test:
  Added test for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test
mysys/thr_lock.c:
  Fixed wrong argument to (lock->get_status) when we had to wait for TL_WRITE_CONCURRENT_INSERT
sql/item_cmpfunc.cc:
  Item_equal::update_used_tables() didn't calculate const_item_cache properly, which later caused a wrong result for item->const_item()
sql/sql_base.cc:
  In debug mode, Initilize record buffer with unexpected data to catch usage of uninitialized memory
sql/sql_select.cc:
  Fixed indentation
  Added assert's to detect if join_read_const_table() was called under wrong assumptions.
  One assert() is disabled for now as Item_equal() doesn't behave as expected.
storage/maria/ha_maria.cc:
  Move calling to _ma_setup_live_state() to ma_state.c::_ma_block_get_status()
  This was needed as _ma_setup_live_state() needed to know if the table will be used concurrently or not
storage/maria/ma_blockrec.c:
  Fixed bug when removing a newly inserted record (in case of duplicate key).
  The bug caused a crash for rows with several blobs and the first blob was small enough to fit into the head page.
storage/maria/ma_dbug.c:
  Added mutex to protect the open table list during _ma_check_table_is_closed().
  Without the protection we could get a error in debug binaries during a call to _ma_check_table_is_closed()
storage/maria/ma_delete_table.c:
  Removed not used code
storage/maria/ma_rename.c:
  Removed not used code
storage/maria/ma_state.c:
  Fixed wrong test when finding right history_state to use
  Mark in tables->state_current.no_transid if we are using transid's or not.
  Don't change state_history if nothing changed (speed optimization that also simplifies logic)
  Reset state_history if we added/deleted or updated rows without versioning.
  More DBUG_ASSERT's and more DBUG
  Updated maria_versioning() to initialize environment before calling _ma_blok_get_status(). This was needed because of the new logic in _ma_block_get_status()
storage/maria/ma_state.h:
  Added flags to detect if table changed and/or if we changed table without versioning
storage/maria/ma_write.c:
  Simple cleanups (No logic changes)
storage/maria/trnman.c:
  Fixed wrong test in trnman_exists_active_transactions() if state is visible or not.
2008-12-22 02:17:37 +02:00
Michael Widenius
7f91cf0861 Merge with main Maria tree 2008-12-09 14:36:51 +02:00
Michael Widenius
9948682b43 Merge with base Maria tree
Remove warnings from test logs about depricated options

mysql-test/t/events_logs_tests-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/log_tables-big-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/log_tables-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/multi_statement-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/ps-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/show_check-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/slow_query_log_file_basic-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/slow_query_log_file_func-master.opt:
  Remove warnings from test logs about depricated options
mysql-test/t/union-master.opt:
  Remove warnings from test logs about depricated options
sql/mysqld.cc:
  Don't give warnings for empty log file names
2008-12-09 12:29:33 +02:00
Guilhem Bichot
c9a29373e1 Fix for BUG#41159 "Maria: deadlock between checkpoint and maria_write() when extending data file".
No testcase (concurrency, tested by pushbuild2).

storage/maria/ha_maria.cc:
  a comment about what Sanja had discovered a while ago
storage/maria/ma_bitmap.c:
  guard against concurrent flush of bitmap by checkpoint: we must have close_lock here
storage/maria/ma_blockrec.c:
  comment fixed for new behaviour
storage/maria/ma_checkpoint.c:
  Release intern_lock before flushing bitmap, or it deadlocks with allocate_and_write_block_record()
  when that function needs to increase the data file's length (that function makes bitmap non flushable,
  then wants intern_lock to increase data_file_length).
  The checkpoint section which looks at the share's content (bitmap, state) needs to be protected from the possible
  my_free-ing done by a concurrent maria_close(); intern_lock is not enough as
  both maria_close() and checkpoint now have to release it in the middle.
  So the protection is done with close_lock. in_checkpoint is now protected by close_lock
  in places where it was protected by intern_lock.
storage/maria/ma_close.c:
  hold close_lock in maria_close() from start to end, to guard against checkpoint trying to flush
  bitmap while we have my_free'd its structures, for example. intern_lock was not enough as
  both maria_close() and checkpoint have to release it in the middle, to avoid deadlocks.
storage/maria/ma_open.c:
  initialize new mutex
storage/maria/ma_recovery.c:
  a comment about what Sanja had discovered a while ago
storage/maria/maria_def.h:
  comment.
  new mutex protecting the close of a MARIA_SHARE, from _start_ to _end_ of it.
2008-12-09 10:56:02 +01:00
unknown
131a6a57a4 merge 2008-12-08 22:12:23 +02:00
unknown
c9b0c5a15c Fixed mutexes lock order in maria_close(): LOCK_trn_list -> MARIA_SHARE::intern_lock (then will be WL to revert the order).
(BUG#40981 Maria: deadlock between checkpoint and maria_close() when freeing state info)

storage/maria/ma_checkpoint.c:
  The argument added to the function to use it in maria_close().
storage/maria/ma_close.c:
  Locking/unlocking MARIA_SHARE::intern_lock added to use correct order of the mutexes taking.
storage/maria/ma_state.c:
  Removed assert becase now we have externally locked mutex in maria_close().
  The argument added to the _ma_remove_not_visible_states_with_lock() to use it in maria_close().
  _ma_remove_not_visible_states_with_lock() fixed tio be usable from maria_chk where transaction manager is not initialized.
storage/maria/ma_state.h:
  The argument added to the function to use it in maria_close().
storage/maria/maria_def.h:
  Fixed comment to the variable.
storage/maria/trnman.c:
  The debugging assert added.
  New function to detect transaction manager initialization added (maria_chk do not initialize it).
storage/maria/trnman_public.h:
  New function to detect transaction manager initialization added (maria_chk do not initialize it).
2008-12-08 22:09:59 +02:00
Michael Widenius
d0fb8270df Fixed problem with crash in Maria _ma_setup_live_state() where history link didn't include needed state
mysql-test/mysql-test-run.pl:
  Remove warnings in log about depricated mysqld options
storage/maria/ma_state.c:
  More DBUG_PRINT
storage/maria/trnman.c:
  Fixed wrong test if commit_trid is visible
2008-12-08 20:31:16 +02:00
unknown
7f3631c2bf merge 2008-12-08 12:06:08 +02:00
unknown
e1ee25e4fb False alarm about incorrect mutex taking removed.
storage/maria/ma_loghandler.c:
  Number of the buffer now passed to buffer initialization function to assign buffer number and break false alarm "chain" by switching off deadlock detection for one buffer.
2008-12-08 11:22:49 +02:00
Guilhem Bichot
ccfb9c32f8 merge with latest 5.1-maria 2008-12-05 22:25:38 +01:00
Guilhem Bichot
91bc9cc9e6 Fix for BUG#41037 "Maria: recovery failure (pushbuild2)" (checkpoint bug).
mysql-test/suite/maria/r/maria-recovery3.result:
  result.
mysql-test/suite/maria/t/maria-recovery3-master.opt:
  usual recovery test options
mysql-test/suite/maria/t/maria-recovery3.test:
  Test for BUG#41037. Without the bugfix, the test would hang because Recovery would fail with "undo_key_insert got error 126": Recovery would believe INSERT of 2 is uncommitted, try to execute its UNDO_KEY_INSERT, fail to find the key to delete because DELETE deleted it. That failure of _ma_ck_real_delete() would mark table as corrupted (see
  in d_search()) which is error 126 (HA_ERR_CRASHED).
storage/maria/ma_blockrec.c:
  set trn->rec_lsn to LSN of commit record, when writing it.
storage/maria/ma_blockrec.h:
  new function
storage/maria/ma_commit.c:
  when committing or rolling back, rec_lsn should be LSN_IMPOSSIBLE: assertion is moved here
  from trnman_end_trn(), because now ma_commit() can set rec_lsn and so when we reach trnman_end_trn()
  it's not LSN_IMPOSSIBLE anymore.
  Adding debug possibility to pause between COMMIT record write and trnman_commit_trn(), to be
  able to fire checkpoint in between.
storage/maria/ma_loghandler.c:
  in-write hook for COMMIT records
storage/maria/ma_recovery.c:
  More debugging info in maria_recovery.trace, to see how the starting point of REDO phase is determined
storage/maria/trnman.c:
  assertion cannot be here anymore see ma_commit.c
2008-12-05 22:11:46 +01:00
Sergei Golubchik
633eabc643 compilation warnings 2008-12-05 19:13:08 +01:00
Sergei Golubchik
d00d63dda2 merged 2008-12-05 14:42:14 +01:00
Sergei Golubchik
c151d0cc05 bug#41024 maria: Server crashes in sysbench OLTP_RW test at lf_hash.c:94
bug#41023 maria: Server asserts in sysbench OLTP_RO test 
bug#40888 maria: Server crashes in sysbench OLTP_RW test at lf_alloc-pin.c:513
bug#40892 maria: Livelock in sysbench OLTP_RW test 
bug#40895 maria: Server crashes in sysbench OLTP_RO test at lf_alloc-pin.c:367
bug#40890 maria: Server crashes in sysbench OLTP_RW test at ctype-bin.c:8

Yet another strict aliasing issue
2008-12-05 11:51:51 +01:00
Sergei Golubchik
f82866f588 bug#40416 - Maria: Memory allocated at trnman.c:129 was underrun.
we cannot access a trn after we put it in the pool
2008-12-05 11:20:11 +01:00
Michael Widenius
fb68158856 Merge with base MySQL-5.1-maria 2008-12-03 06:07:50 +02:00
Michael Widenius
32f81bab7d WL#3262 add mutex lock order checking to safemutex (also called safe_mutex_deadlock_detector)
This writes a warning on stderr if one uses mutex in different order,
like if one in one case would lock mutex in the order A,B and in another case
would lock mutex in the order B,A
This is inspired by and loosely based on the LOCKDEP patch by Jonas
Wrong mutex order is either fixed or mutex are marked with MYF_NO_DEADLOCK_DETECTION
if used inconsistently (need to be fixed by server team)

KNOWN_BUGS.txt:
  Added information that one need to dump and restore Maria tables
include/hash.h:
  Added prototype function for walking over all elements in a hash
include/my_pthread.h:
  Added my_pthread_mutex_init() and my_pthread_mutex_lock(); These should be used if one wants to disable mutex order checking.
  Changed names of the nonposix mutex_init functions to not conflict with my_phread_mutex_init()
  Added and extended structures for mutex deadlock detection.
  New arguments to sage_mutex_init() and safe_mutex_lock() to allow one to disable mutex order checking.
  Added variable 'safe_mutex_deadlock_detector' to enable/disable deadlock detection for all pthread_mutex_init()
mysys/Makefile.am:
  Added cleaning of test files
  Added test_thr_mutex
mysys/hash.c:
  Added hash_iterate() to iterate over all elements in a hash
  More comments
mysys/my_init.c:
  Added calls to destory all mutex uses by mysys()
  Added waiting for threads to end before calling TERMINATE() to list not freed memory
mysys/my_pthread.c:
  Changed names to free my_pthread_mutex_init() for mutex-lock-order-checking
mysys/my_sleep.c:
  Fixed too long wait if using 1000000L as argument
mysys/my_thr_init.c:
  Mark THR_LOCK_threads and THR_LOCK_malloc to not have mutex deadlock detection.
  (We can't have it enabled for this as these are internal mutex used by the detector  
  Call my_thread_init() early as we need thread specific variables enabled for the following pthread_mutex_init()
  Move code to wait for threads to end to my_wait_for_other_threads_to_die()
  Don't destroy mutex and conditions unless all threads have died
  Added my_thread_destroy_mutex() to destroy all mutex used by the mysys thread system
  Name the thread specific mutex as "mysys_var->mutex"
  Added my_thread_var_mutex_in_use() to return pointer to mutex in use or 0 if thread variables are not initialized
mysys/mysys_priv.h:
  Added prototypes for functions used internally with mutex-wrong-usage detection
mysys/thr_mutex.c:
  Added runtime detection of mutex used in conflicting order
  See WL#3262 or test_thr_mutex.c for examples
  The base idea is for each mutex have two hashes:
  - mutex->locked_mutex points to all mutex used after this one
  - mutex->used_mutex points to all mutex which has this mutex in it's mutex->locked_mutex
  There is a wrong mutex order if any mutex currently locked before this mutex is in the mutex->locked_mutex hash
sql/event_queue.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/event_scheduler.cc:
  Declare the right order to take the mutex
sql/events.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/ha_ndbcluster_binlog.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/log.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/mysqld.cc:
  Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
  This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
  Added call to free sp cache.
  Add destruction of LOCK_server_started and COND_server_started.
  Added register_mutex_order() function to register in which order mutex should be taken
  (to initiailize mutex_deadlock_detector).
  Added option to turn off safe_mutex_deadlock_detector
sql/protocol.cc:
  Fixed wrong argument to DBUG_PRINT (found by valgrind)
sql/rpl_mi.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/set_var.cc:
  Remove wrong locking of LOCK_global_system_variables when reading and setting log variables
  (would cause inconsistent mutex order).
  Update global variables outside of logger.unlock() as LOCK_global_system_variables has to be taken before logger locks
  Reviewed by gluh
sql/sp_cache.cc:
  Added function to destroy mutex used by sp cache
sql/sp_cache.h:
  Added function to destroy mutex used by sp cache
sql/sql_class.cc:
  Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
  This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
  Register order in which LOCK_delete and mysys_var->mutex is taken
sql/sql_insert.cc:
  Give a name for Delayed_insert::mutex
  Mark mutex used inconsistently (need to be fixed by server team)
  Move closing of tables outside of di->mutex (to avoid wrong mutex order)
sql/sql_show.cc:
  Don't keep LOCK_global_system_variables locked over value->show_type() as this leads to wrong mutex order
storage/innobase/handler/ha_innodb.cc:
  Disable safe_muted_deadlock_detector for innobase intern mutex (to speed up page cache initialization)
storage/maria/ha_maria.cc:
  Added flag to ha_maria::info() to signal if we need to lock table share or not.
  This is needed to avoid locking mutex in wrong order
storage/maria/ha_maria.h:
  Added flag to ha_maria::info() to signal if we need to lock table share or not.
storage/maria/ma_close.c:
  Destroy key_del_lock
  Simplify freeing ftparser_param
storage/maria/ma_key.c:
  Better comment
storage/maria/ma_loghandler.c:
  Mark mutex used inconsistently (need to be fixed by sanja)
storage/maria/ma_state.c:
  More comments
storage/maria/ma_test1.c:
  Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
storage/maria/ma_test2.c:
  Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
2008-12-03 00:02:52 +02:00
Sergei Golubchik
7881dc1f9f dbug fix: only do safemalloc checks if a function is selected
mysqlslap: fix a crash when mysql_store_result() fails

client/mysqlslap.c:
  fix a crash
dbug/dbug.c:
  only do safemalloc checks if a function is selected
mysql-test/mysql-test-run.pl:
  it's easier to add new gdb parameters this way
storage/maria/ma_open.c:
  typo in a comment
2008-12-02 16:29:59 +01:00
unknown
2b51150231 Do not use MY_WME in the stat call which errors we process on high level.
(BUG#41127: Maria: assertion when SHOW ENGINE MARIA LOGS and missing logs)

mysql-test/suite/maria/r/maria_showlog_error.result:
  test suite for the BUG#41127
mysql-test/suite/maria/t/maria_showlog_error.test:
  test suite for the BUG#41127
storage/maria/ha_maria.cc:
  Do not use MY_WME in the stat call which errors we process on high level.
2008-12-01 15:21:37 +02:00
Guilhem Bichot
f2d05437d5 In pushbuild2 when testing Maria's recovery, it can happen that a page was not entirely written
(i.e. file's size % 8192 != 0). Don't assert on this, Recovery is supposed to fix it.
2008-11-24 15:23:48 +01:00
unknown
ef5d498348 merge 2008-11-24 09:54:07 +02:00
unknown
094d92e242 Prevent reenabling logging by thread which tries to lock table used by bulk insert.
Scenario of the BUG#40731 ("Maria: hang (probably in page cache) under concurrency"):
      T1: Disable logging for the table
      T1: Start inserting into the table
      T2: Tries to lock the table so waits.
      T2: Tries unlock and relock during the process see that the table has disabled logging and reenables it
      T1: Got DBUG_ASSERT because suddenly start use table with transaction switched on which is not expected during bulk insert

storage/maria/ma_pagecache.c:
  Page type print added for debugging purposes.
storage/maria/ma_recovery.c:
  Check that it was this thred which switched off logging (transactional mode).
storage/maria/maria_def.h:
  Flag for controling which thread switched off transactiona mode for the table added.
2008-11-24 09:48:21 +02:00
Guilhem Bichot
8d96bcda72 During Maria's checkpoint, use the proper mutex to read transaction's short_id
storage/maria/trnman.c:
  During Maria's checkpoint, we walk the list of active transactions; in this list we may find a transaction with a short_id of 0 which means "uninitialized" (is being created right now) and want to ignore this transaction. Such short_id is set under trn->state_lock, so use this mutex to reliably read short_id during checkpoint.
2008-11-20 15:11:00 +01:00
unknown
f36a9625e3 Added correct reaction on find operation status during writing the page. (BUG#40308)
storage/maria/ma_pagecache.c:
  Added correct reaction on find operation status during writing the page.
2008-11-13 00:06:18 +02:00
unknown
bbb68f4cf3 Added correct reaction on find operation status during writing the page. (BUG#40308)
storage/maria/ma_pagecache.c:
  Added correct reaction on find operation status during writing the page.
2008-11-12 23:59:06 +02:00
Michael Widenius
4150dfda93 Fix for bug: Bug #40391 Maria deadlock in trnman_get_min_trid , trnman_end_trn
storage/maria/trnman.c:
  Store min used trid in a global variable and change trnman_get_min_trid() to return this variable without using a mutex.
  This is safe as trnman_get_min_trid() is used for trid optimization and all algoritms will work even if it returns a slightly older trid.
  
  Also ensure that LOCK_trn_list is unlocked in trnman_new_trn() in the very unlikely case that lf_hash_get_pins() fails
2008-11-05 23:17:09 +02:00
Michael Widenius
e4febda89e Fixed that packed transid can be compared byte per byte and we get them in increasing order
The old way to store the length prefix was (256 - length); This is now changed to (length -249)
Fixed also that some defines to have a MARIA_ prefix

storage/maria/ma_control_file.c:
  Added comment
storage/maria/ma_key.c:
  Added MARIA_ prefix to some defines
  Changed how packed transid length was stored
storage/maria/ma_open.c:
  Added MARIA_ prefix to some defines
storage/maria/maria_def.h:
  Added MARIA_ prefix to some defines
  Changed how packed transid length was stored
2008-11-04 12:54:04 +02:00
Michael Widenius
cc684c3475 Automatic merge 2008-11-03 15:58:14 +02:00
Michael Widenius
d5456c5d1b Fixed bug introduced in last push.
storage/maria/ha_maria.cc:
  Use file->s->lock_key_trees instead of file->s->lock.get_status to detect if we are using versioning
storage/maria/ma_state.c:
  Fixed function prototype
storage/maria/ma_state.h:
  Fixed function prototype
2008-11-03 15:53:22 +02:00
unknown
ba9bc33bdc merge 2008-11-03 00:05:16 +02:00
Michael Widenius
2b521320fb Added ha_maria::is_changed() (needed for Query cache)
storage/maria/ha_maria.cc:
  Added ha_maria::is_changed()
storage/maria/ha_maria.h:
  Added ha_maria::is_changed()
storage/maria/ma_delete.c:
  Mark that table changed
storage/maria/ma_open.c:
  Ensure that info->state->changed is always reset from thr_lock()
storage/maria/ma_state.c:
  Reset handler->state->changed at first usage of transactional table
  Reset handler->state->changed when taking lock for not transactional table
storage/maria/ma_state.h:
  Added variable and function to track changes of table
storage/maria/ma_update.c:
  Mark that table changed
storage/maria/ma_write.c:
  Mark that table changed
2008-11-01 01:14:58 +02:00
unknown
24d1df1a56 merge 2008-10-31 15:06:56 +02:00
Sergei Golubchik
ca4d512aa4 Bug#40416 Maria: Memory allocated at trnman.c:129 was underrun
fix a bug that was introduced in one of the infamous "cleanups"

storage/maria/trnman.c:
  restore the correct precedence
2008-10-30 12:21:05 +01:00
Guilhem Bichot
d40f3fc3b8 calling make_lock_and_pin() without cache's mutex is wrong (patch from Sanja).
storage/maria/ma_pagecache.c:
  calling make_lock_and_pin() without cache's mutex is wrong (patch from Sanja)
2008-10-17 15:38:25 +02:00
Guilhem Bichot
8b87da7fa7 Fix for BUG#39363 "Concurent inserts in the same table lead to hang in maria engine"
(need a mutex when modifying bitmap->non_flushable), which I hit when running maria_bulk_insert.yy.
After fixing this, I hit an assertion in check_and_set_lsn() saying that the page was PAGECACHE_PLAIN_PAGE.
This could be caused by pages left by an operation which had transactions disabled (like a bulk insert with repair):
in this patch we remove those pages out of the cache when we re-enable transactions.
After fixing this, I get page cache deadlocks, pushbuild2 also has some, to be looked at.
No testcase, requires concurrency and running for 15 minutes, but automatically tested by pushbuild2.


storage/maria/ma_bitmap.c:
  Doing bitmap->non_flushable++ without mutex was wrong. If this ++ happened while another ++ or -- was happening
  in another thread, one ++ or -- could be missed and the bitmap code would behave wrongly. For example, if a ++
  was missed, the DBUG_ASSERT(((int) (bitmap->non_flushable)) >= 0) in _ma_bitmap_release_unused() could fire.
  I saw this assertion happen in practice in maria_bulk_insert.yy. Adding this mutex lock eliminated
  the assertion problem.
  The >=0 was wrong, should be >0 (or the variable could go negative).
storage/maria/ma_recovery.c:
  When we re-enable transactionality, as we may have created pages of type PAGECACHE_PLAIN_PAGE before,
  we need to remove them from the cache (FLUSH_RELEASE). Or they would stay this way, and later when we
  maria_write() to them, we would try to tag them with a LSN (ma_unpin_all_pages()), which is incorrect
  for a plain page (and causes assertion in the page cache at start of check_and_set_lsn()).
  I saw the assertion fire with maria_bulk_insert.yy, and this seems to cure it.
  page cache
2008-10-17 15:37:07 +02:00
unknown
edf842967a Merge 2008-10-16 23:52:33 +03:00
Guilhem Bichot
421973ec13 Fix for BUG#39710 "Maria assertion in maria_disable_non_unique_index".
No testcase, this requires concurrency and is automatically tested by
maria_bulk_insert.yy in pushbuild2.

storage/maria/ha_maria.cc:
  The case of BUG#39710 is:
  two threads want to INSERT SELECT into the same table.
  Thread1 (T1) starts, does external_lock, thr_lock (store_lock sees 0 records so
  upgrades to TL_WRITE), goes into bulk insert, starts writes
  T2 starts, external_lock, thr_lock (store_lock sees 0 records so
  upgrades to TL_WRITE), blocks on existing thr_lock of T1.
  T1 ends writes, ends bulk insert, commits (ha_maria::implicit_commit()
  at end of dispatch_command()), external_lock and thr_unlock
  (close_thread_tables() at end of dispatch_command()).
  T2 wakes up, gets thr_lock, goes into start_bulk_insert() where
  file->state is out-of-date and still says that file->state->records==0,
  so maria_disable_non_unique_index() is called, which asserts because
  the actual number of records (share->state.state.records) is >0.
  The solution, maybe temporary, is to also check share->state.state.records==0
  when deciding to do bulk insert, with the idea that such operation cannot
  rely on the view of the start of the transaction, as it uses repair,
  and can safely read share->state as it has acquired the exclusive
  TL_WRITE.
  Question for reviewer: if we enter the if() branch, do we also need to do:
  *(file->state)= share->state.state;
  or even call some existing function which does that?
2008-10-16 21:48:32 +02:00
unknown
b70f7317fa Fixed ability to read without read lock acquiring. (BUG#39665 related)
storage/maria/ma_pagecache.c:
  Fixed ability to read without read lock acquiring.
storage/maria/unittest/CMakeLists.txt:
  New unit test which tests simple read and prolonged writes consistency added.
storage/maria/unittest/Makefile.am:
  New unit test which tests simple read and prolonged writes consistency added.
storage/maria/unittest/ma_pagecache_rwconsist2.c:
  New unit test which tests simple read and prolonged writes consistency added.
2008-10-16 22:44:12 +03:00
Guilhem Bichot
d44e00e791 Fix for Windows build failure: __attribute__ does not exist under Windows
storage/maria/ma_static.c:
  __attribute__ does not exist under Windows, so it can be used only afer my_global.h which defines it to nothing.
2008-10-16 10:54:53 +02:00
Guilhem Bichot
a184d6b0a9 Merge of my revision 2008-10-15 22:00:35 +02:00
Guilhem Bichot
5aa1e3b364 Small fixes for pushbuild: compiler warnings, checking that partitioning is enabled when testing it.
Don't fsync() index file when closing Maria table if not transactional.

mysql-test/suite/maria/r/maria.result:
  piece moved
mysql-test/suite/maria/r/maria_partition.result:
  result
mysql-test/suite/maria/t/maria.test:
  - reset default storage engine at end of test, not in the middle
  - move piece which requires partitioning, to maria_partition.test, otherwise test fails
  on builds without partitioning compiled in
mysql-test/suite/maria/t/maria_partition.test:
  new test for those Maria bugs which are specific of partitioning
mysys/my_uuid.c:
  compiler warning fix (fix imported from latest 5.1-main)
storage/maria/ma_close.c:
  don't fsync() index file when closing table if not transactional
  (same test as in _ma_once_end_block_record() when fsync-ing data file)
storage/maria/ma_create.c:
  compiler warning fix (char* assigned to uchar*)
storage/maria/ma_loghandler.c:
  compiler warning fix (char* assigned to uchar*)
2008-10-15 14:44:31 +02:00
Michael Widenius
2faf503e55 Automatic merge with main tree
Fixed that mysql-test-run --skip-from starts from the given test

mysql-test/lib/mtr_cases.pl:
  Moved testing of $opt_start_from to mysql-test-run.pl because tests are now run per suite and the old way would rerun not wanted tests
mysql-test/mysql-test-run.pl:
  Fixed that mysql-test-run --skip-from starts from the given test
2008-10-15 13:46:40 +03:00
Michael Widenius
3271841881 Merging of changes from myisam -> maria missing in last 5.1 - 5.1->maria merge
MARIA_MAX_MSG_BUF -> HA_MAX_MSG_BUF

include/maria.h:
  Remove MARIA_MAX_MSG_BUF; We are now using HA_MAX_MSG_BUF
  Added maria_test_invalid_symlink
storage/maria/ha_maria.cc:
  MARIA_MAX_MSG_BUF -> HA_MAX_MSG_BUF
storage/maria/ma_check.c:
  Removed tab in string constant
  Add extra argument to ma_open_datafile()
storage/maria/ma_create.c:
  Set error number if table is in use
storage/maria/ma_open.c:
  Added name argument to open functions for security check if filename is linked to another file in database directory
storage/maria/ma_static.c:
  Default functions for checking if wrong symlink
storage/maria/maria_chk.c:
  Add extra argument to _ma_open_datafile()
storage/maria/maria_def.h:
  Add extra argument to _ma_open_datafile()
2008-10-15 00:23:33 +03:00
Guilhem Bichot
8ecda6cd26 _ma_bitmap_unpin_all() needs to unpin not-locked pages which were pinned by other threads
in write_changed_bitmap(), and page cache forbids that. Here we make the page
cache more relaxed. Original patch by Sanja, simplified by me as limited to
not-locked. See comment of ma_bitmap.c.
With that, maria_stress.yy runs until hitting BUG 39665.

storage/maria/ma_bitmap.c:
  A thread which unpins bitmap pages in _ma_bitmap_unpin_all() sometimes
  hit an assertion in the page cache (info!=0 in remove_pin()) which states
  that you can unpin/unlock only what *you* have pinned/locked.
  Fixed by setting the new last parameter of pagecache_unlock_by_link()
  to TRUE in _ma_bitmap_unpin_all().
storage/maria/ma_blockrec.c:
  new prototype and splitting assertion in three (3rd one fires: BUG 39665)
storage/maria/ma_check.c:
  new prototype
storage/maria/ma_key_recover.c:
  new prototype
storage/maria/ma_loghandler.c:
  new prototype
storage/maria/ma_pagecache.c:
  Allow a thread to unpin, with pagecache_unlock_by_link(), a non-locked page pinned by others.
  This is a hack for _ma_bitmap_unpin_all() which needs to unpin pages which were
  pinned by other threads in write_changed_bitmap().
storage/maria/ma_pagecache.h:
  new prototype
storage/maria/ma_preload.c:
  new prototype
storage/maria/unittest/ma_pagecache_rwconsist.c:
  new prototype
storage/maria/unittest/ma_pagecache_single.c:
  new prototype
2008-10-14 17:18:14 +02:00
Guilhem Bichot
8dc87e3e9b WL#4595 "Maria - no write-lock when pinning bitmap pages": turns out that page cache
already supports pin-without-lock so implementation of this WL is instant and
done here. This could improve concurrency. No testcase, this requires
multiple threads and is automatically tested at push time by maria_stress.yy (pushbuild2).

storage/maria/ma_bitmap.c:
  As the page cache supports pinning without write-locking, we don't take write lock
  in write_changed_bitmap(), only a pin; this could improve concurrency (WL#4595).
2008-10-14 14:16:10 +02:00
Guilhem Bichot
ed567bd2a9 Fix for BUG#39210 "Maria deadlock in _ma_bitmap_wait_or_flush". It was a thread
which nobody woke up (see comment of ma_bitmap.c). No testcase, this requires
multiple threads and is automatically tested at push time by maria_stress.yy (pushbuild2).

storage/maria/ma_bitmap.c:
  * _ma_bitmap_wait_or_flush() didn't publish that it was waiting for bitmap to not
  be over-allocated (i.e. didn't modify bitmap->flush_all_requested) so nobody
  (_ma_bitmap_flushable(), _ma_bitmap_release_unused()) knew it had to wake it up
  => it stalled (BUG#39210). In fact the wait in _ma_bitmap_wait_or_flush()
  is not needed, it's ok if this function sends the over-allocated bitmap to page
  cache and keeps pin on it (_ma_bitmap_unpin_all() will unpin it later, and
  the one who added _ma_bitmap_wait_or_flush() didn't know it). Function
  is thus deleted, as _ma_bitmap_flush() can do its job.
  * After fixing that, test runs longer and BUG 39665 happens, which looks like
  a separate page cache bug.
  * Smaller changes: _ma_bitmap_flush_all() called write_changed_bitmap() even
  though it might not be changed; added some DBUG calls in functions; split
  assertions.
  * In _ma_bitmap_release_unused(), it's more logical to test non_flushable_state
  than now_transactional to know if we have to decrement non_flushable
  (it's exactly per the definition of non_flushable_state).
storage/maria/ma_blockrec.c:
  _ma_bitmap_wait_or_flush() is not needed.
  ******
  new prototype and splitting assertion in three (3rd one fires: BUG 39665)
storage/maria/ma_blockrec.h:
  _ma_bitmap_wait_or_flush() is not needed.
2008-10-14 11:38:07 +02:00
Michael Widenius
058916ae02 Fix for bug#39226 Maria: crash with FLUSH TABLES WITH READ LOCK after LOCK TABLES
- The problem was that we didn't inform the handler that we are going to close tables that are locked and may have (at least in Maria) be part of an active transaction.
Fix for Bug#39227 Maria: crash with ALTER TABLE PARTITION
Fix for Bug #39987 main.partition_not_windows fails under debug build
Fixed some compiler errors & warnings found by pushbuild

include/my_base.h:
  Added HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for signaling the handler that the file will be forced closed
include/my_global.h:
  Removed 'register' from 'swap_variables' as this gives a warnings when the variables are structs. Compilers should also now be smart enough to figure out this themselves
mysql-test/r/subselect_debug.result:
  Reset value of the debug variable;  Without setting this the subselect_innodb test will fail when run after this one
mysql-test/suite/maria/r/maria.result:
  Merged test with myisam.test
  Added tests for new fixed bugs
mysql-test/suite/maria/t/maria.test:
  Merged test with myisam.test
  Added tests for new fixed bugs
mysql-test/t/subselect_debug.test:
  Reset value of the debug variable;  Without setting this the subselect_innodb test will fail when run after this one
mysys/my_uuid.c:
  Fixed compiler error on windows
sql/ha_partition.cc:
  Added support for the new extra flag: HA_EXTRA_PREPARE_FOR_FORCED_CLOSE (Bug #39226)
  Ensure that we call extra() for HA_EXTRA_PREPARE_FOR_DROP (Bug#39227)
sql/mysqld.cc:
  Fix for Bug #39987 main.partition_not_windows fails under debug build
  The problem was that when compiling for purify/valgrind realpath() is not used, which causes test_if_data_home_dir to fail when it shouldn't
sql/sql_base.cc:
  Call HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for tables that are locked but we are going to force close without doing a commit
sql/sql_parse.cc:
  More DBUG_PRINT. Fixed comments
storage/maria/ma_extra.c:
  If HA_EXTRA_PREPARE_FOR_FORCED_CLOSE is called and the table is part of a transaction, remove the table from beeing part of a transaction.
  This is safe as this is only used as part of flush tables or when the table is not part of a transaction
storage/myisam/mi_open.c:
  Indentation fix
unittest/mysys/waiting_threads-t.c:
  Remove not needed 'volatile' to get rid of compiler warnings on windows
2008-10-12 13:09:52 +03:00
Guilhem Bichot
ade71b2522 Fix for BUG#39697 "Maria: hang when failing to insert due to UNIQUE (seen in pushbuild2 too)"
It was a forgotten rw_unlock(), due to the deadlock detector feature (so bug was only in 5.1-maria, not
6.0-maria).

mysql-test/suite/maria/r/maria3.result:
  result, all fine
mysql-test/suite/maria/t/maria3.test:
  Test of BUG#39697: two scenarios (transactional tables, and non-transactional table but dynamic row format so still taking the rwlock) where the hang happened.
  t2 added by this test was masked by a temporary table created earlier in the test, which we forgot to drop.
storage/maria/ha_maria.cc:
  use new macro
storage/maria/ma_blockrec.c:
  use new macro
storage/maria/ma_commit.c:
  use new macro
storage/maria/ma_init.c:
  putting address of dummy_transaction_object in --debug trace can be useful
storage/maria/ma_open.c:
  use new macro
storage/maria/ma_write.c:
  if local_lock_tree is true, we have acquired keyinfo->root_lock so need to release it before "goto err".
  A pair of assertions so that our usage of TrIDs is kept sensible.
storage/maria/maria_def.h:
  A macro so that changes of MARIA_HA::trn can be tracked with --debug. It helped to understand in what cases,
  in maria_write(), we could have !(info->dup_key_trid == info->trn->trid) && !share->now_transactional
  (answer: ALTER TABLE adding UNIQUE index on transactional table).
2008-10-09 22:03:54 +02:00
unknown
51a92bbb03 Comparison of tables during altering fixed. (BUG#39399)
mysql-test/r/maria.result:
  Test suite of BUG#39399.
mysql-test/t/maria.test:
  Test suite of BUG#39399.
storage/maria/ha_maria.cc:
  Comparison of tables during altering fixed. (BUG#39399)
  Unused function parameter removed.
2008-09-28 21:32:59 +03:00
Michael Widenius
be0b404266 Fix for Bug #39243 SELECT WHERE does not find row
Symptom was that records_in_range() found 0 matching keys which confused the optimizer to belive that there was no matching rows for the query

mysql-test/r/maria.result:
  New testcase
mysql-test/t/maria.test:
  New testcase
storage/maria/ma_search.c:
  Fix bug in skip_key for keys that starts with a CHAR/VARCHAR NULL key.
2008-09-26 11:16:35 +03:00
Michael Widenius
7f960da42b Automatic merge 2008-09-06 00:06:10 +03:00
Michael Widenius
d286751a68 Fixed bug in underflow handling of page during delete found by running sql_bench
storage/maria/ma_delete.c:
  Remove wrong optimization (first_key is not related to keypos value at this point)
storage/maria/maria_chk.c:
  Added printing of forgotten option
2008-09-05 16:52:21 +03:00
Sergei Golubchik
27dadbd895 wt: don't support a key as a union { ulonglong, void* }. Although convenient,
it forces the user to bzero a key before setting it as a pointer, otherwise
it'll have random content on architectures where
sizeof(void*) < sizeof(ulonglong).

Declaring a key as ulonglong only (not a union) makes this user mistake
impossible.

include/waiting_threads.h:
  WT_RESOURCE_ID::value is an ulonglong, not a union
mysys/waiting_threads.c:
  WT_RESOURCE_ID::value is an ulonglong, not a union
storage/maria/ma_write.c:
  WT_RESOURCE_ID::value is an ulonglong, not a union
storage/maria/trnman.c:
  WT_RESOURCE_ID::value is an ulonglong, not a union
unittest/mysys/waiting_threads-t.c:
  WT_RESOURCE_ID::value is an ulonglong, not a union
2008-09-01 21:43:11 +02:00
Michael Widenius
d6bdf03375 Added MARIA_PAGE structure to keep all information about a maria key page.
This allowed me to remove a lot of parameters to functions, local variables,
duplicate code and identical constructs.  It should also make the code easier
to read.
Changed all marking of page as changed to use offset instead of pointers; This removed
one theoretical problem where dynamic_array may have been moved between two calls.
In addition I changed some functions from return my_bool


include/maria.h:
  Changes to use MARIA_PAGE
storage/maria/ma_check.c:
  Changes to use MARIA_PAGE
  Folded lines longer > 79 characters
storage/maria/ma_delete.c:
  Changes to use MARIA_PAGE
  Changed _ma_ck_delete(), ma_log_delete(), ma_write_undo_key_delete() and _ma_ck_real_delete() to return type my_bool
  Removed some calls to maria_print_error() as the caller (maria_delete() and maria_write()) also prints the error
storage/maria/ma_ft_update.c:
  Fix needed as _ma_ck_delete() now returns my_bool
  New parameter for ma_write_keypage.
storage/maria/ma_key_recover.c:
  Changes to use MARIA_PAGE
storage/maria/ma_key_recover.h:
  Updated function prototypes
storage/maria/ma_page.c:
  Changes to use MARIA_PAGE
  Added _ma_page_setup() for old functions that doesn't (yet) use MARIA_PAGE natively
storage/maria/ma_range.c:
  Changes to use MARIA_PAGE
storage/maria/ma_rt_index.c:
  Changes to use MARIA_PAGE
  Changed maria_rtree_delete() and maria_rtree_real_delete() to return type my_bool
  Removed one 'if (node_flag) as this was always true
  Changed lable 'err1' to 'err' as there was no other error lables
  Moved allocation of page_buff outside of loop for fewer alloc/free calls
  Changed n_pages and m_pages to uint as 65000 pages is more than enough
storage/maria/ma_rt_index.h:
  Updated function prototypes
storage/maria/ma_rt_key.c:
  Changes to use MARIA_PAGE
storage/maria/ma_rt_key.h:
  Updated function prototypes
storage/maria/ma_rt_mbr.c:
  Changes to use MARIA_PAGE
storage/maria/ma_rt_mbr.h:
  Updated function prototypes
storage/maria/ma_rt_split.c:
  Changes to use MARIA_PAGE
storage/maria/ma_search.c:
  Changes to use MARIA_PAGE
storage/maria/ma_write.c:
  Changes to use MARIA_PAGE
  Changed _ma_ck_write_btree_with_log(), _ma_ck_real_write_btree(), ma_enlarge_root() to use return type my_bool
  Don't set *root to HA_OFFSET_ERROR in case of error
  Removed maria_print_error() calls as caller will do this
  Simplified logic in balance_page by introducing pointers to left and right pages
storage/maria/maria_chk.c:
  Changes to use MARIA_PAGE
storage/maria/maria_def.h:
  Changes to use MARIA_PAGE
  Removed some not used macros
  Added macros for MARIA_PAGE handling
2008-09-01 20:31:40 +03:00
Sergei Golubchik
8ccb262d05 remove useless #include's 2008-08-30 23:32:27 +02:00
Sergei Golubchik
8ba0216128 compiler warnings/errors 2008-08-30 21:34:41 +02:00
Sergei Golubchik
4be86917fe merge 2008-08-28 20:52:23 +02:00
Sergei Golubchik
942651ea6c wt: comments, OOM checks, test case for deadlock detection
include/waiting_threads.h:
  make wt_thd_dontwait private
mysql-test/r/maria.result:
  deadlock example
mysql-test/t/maria.test:
  deadlock example
mysys/waiting_threads.c:
  comments, OOM checks
sql/mysqld.cc:
  fix variables
sql/sql_class.cc:
  move wt_lazy_init to THD constructor
sql/sql_class.h:
  move wt_lazy_init to THD constructor
storage/maria/ha_maria.cc:
  backport from 6.0
storage/maria/ma_write.c:
  poset-review fixes, set thd->proc_info
storage/maria/trnman.c:
  bugfixing
storage/myisam/mi_check.c:
  warnings
storage/myisam/mi_page.c:
  warnings
storage/myisam/mi_search.c:
  warnings
storage/myisammrg/myrg_create.c:
  warnings
unittest/mysys/waiting_threads-t.c:
  fixes
2008-08-28 14:43:44 +02:00
Michael Widenius
dd406c1e7e Fix for Bug#36499 Maria: potential deadlock
This was done by introducing another mutex for handling the key_del link
I also renamed all key_del variables to start with key_del prefix


storage/maria/ma_close.c:
  Rename of key_del variables
storage/maria/ma_key_recover.c:
  Changed key_del to be protexted by it's own mutex: key_del_lock
  Rename of key_del variables
  Removed comment for old bug
storage/maria/ma_key_recover.h:
  Rename of key_del variables
storage/maria/ma_open.c:
  Initialization for new key_del_lock mutex
  Renamed intern_cond to key_del_cond as it was only used for protection of key_del
storage/maria/ma_page.c:
  Rename of key_del variables
storage/maria/ma_write.c:
  Rename of key_del variables
storage/maria/maria_def.h:
  Rename of key_del variables
  Added key_del_lock
2008-08-26 15:34:57 +03:00
Michael Widenius
6629c7641a Fixed some wrong usage of my_bool
Fixed compiler warning
Ensure that pagecache returns correct error number


storage/maria/ma_pagecache.c:
  Ensure that block->error contain error code from my_errno (not return value from pread/pwrite)
  Went through usage of my_pread/my_pwrite and ensured that result was threated correctly
  Fixed some wrong usage of my_bool
2008-08-25 21:26:50 +03:00
Michael Widenius
43528b9d1a Automatic merge 2008-08-25 15:13:31 +03:00
Michael Widenius
1a5de5bc82 Changed all file names in maria to LEX_STRING and removed some calls to strlen()
Ensure that pagecache gives correct error number even if error for block happend


mysys/my_pread.c:
  Indentation fix
storage/maria/ha_maria.cc:
  filenames changed to be of type LEX_STRING
storage/maria/ma_check.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_checkpoint.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_create.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_dbug.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_delete.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_info.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_keycache.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_locking.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_loghandler.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_open.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_pagecache.c:
  Store error number for last failed operation in the page block
  This should fix some asserts() when errno was not properly set after failure to read block in another thread
storage/maria/ma_recovery.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_update.c:
  filenames changed to be of type LEX_STRING
storage/maria/ma_write.c:
  filenames changed to be of type LEX_STRING
storage/maria/maria_def.h:
  filenames changed to be of type LEX_STRING
storage/maria/maria_ftdump.c:
  filenames changed to be of type LEX_STRING
storage/maria/maria_pack.c:
  filenames changed to be of type LEX_STRING
2008-08-25 14:49:47 +03:00
Sergei Golubchik
4bdb308b9a BUG#38606: delete in lock write concurrent
(sanja's patch)
2008-08-25 10:35:25 +02:00
Michael Widenius
d145362edf Fix for bug#38484 DELETE causes crash or index corruption
There is no test cases as it's not trivial to do a test case for this.
The new code for Maria is however executed by the test case in the bug report.

mysql-test/mysql-test-run.pl:
  Avoid warnings when running with --extern
storage/maria/ha_maria.cc:
  Disable not complete assert until Sanja can push a proper fix
storage/maria/ma_delete.c:
  Fix that pageflag for page is calculated based on original values
storage/maria/ma_search.c:
  Ensure that prev_length structure variable is properly reset when not used
storage/myisam/mi_search.c:
  Ensure that prev_length structure variable is properly reset when not used
2008-08-24 16:29:34 +03:00
Michael Widenius
57e0bdb306 Automatic merge 2008-08-19 01:22:31 +03:00
Michael Widenius
ea31b1e6ec Fixes for Bug #38016 Maria: trying to access freed memory when committing a transaction
Don't write out states if they haven't changed

sql/sql_base.cc:
  Call extra(HA_EXTRA_PREPARE_FOR_DROP) before doing a drop of a table
  More DBUG
sql/sql_table.cc:
  Call extra(HA_EXTRA_PREPARE_FOR_RENAME) before renaming a table
storage/maria/ha_maria.cc:
  Ensure that file->trn is set when we call extra(HA_EXTRA_PREPARE_FOR_DROP/RENAME)
storage/maria/ma_close.c:
  When doing close, assert if we have pointers in trn->table_list that points to the MARIA_SHARE
storage/maria/ma_extra.c:
  Reset info->state_start in case of drop/rename. This fixes the problem of accessing freed memory in repair
  Don't write state changed if they haven't changed
storage/maria/ma_open.c:
  Reset share->changed after we have written out a state (speed optimization to not write states when they haven't changed)
storage/maria/ma_state.c:
  Decrement share->in_trans properly in DBUG_BINARY to ensure that the DBUG_ASSERT() in maria_close() works
  More DBUG
2008-08-19 01:21:22 +03:00
Sergei Golubchik
edb33da737 Bug#38466 maria: range query returns no data
storage/maria/ma_search.c:
  when we found a matching key on the node page and want to search in the left leaf
  we must use only SEARCH_FIND flag, and never SEARCH_BIGGER, SEARCH_SMALLER, or SEARCH_LAST
2008-08-16 11:49:28 +02:00
Sergei Golubchik
47a82ad552 Bug#38135 Assertion failed: save_errno, file .\ma_update.c, line 200
typo fixed.

mysql-test/r/maria.result:
  new test case
mysql-test/t/maria.test:
  new test case
sql/sql_select.cc:
  ctags friendly
storage/maria/ma_blockrec.c:
  typo fixed
2008-08-11 16:40:32 +02:00
Sergei Golubchik
f8c1059cbf move wt* maintainance from maria to the server
include/waiting_threads.h:
  C_MODE_START/END
mysys/waiting_threads.c:
  relax the checks - auto init thd in will_wait_for,
  allow to destroy uninited thd (=noop),
  allow a "release" an unexistent resource (=noop),
sql/sql_class.cc:
  move wt* maintainance from maria to the server.
  do THD::cleanup after ha_close_connection() and plugin_thdvar_cleanup().
storage/maria/unittest/trnman-t.c:
  update to new prototype
2008-08-07 22:57:25 +02:00
Sergei Golubchik
5a4cdba544 fixes for failing test suite
storage/maria/ma_write.c:
  select ... group by ... - take temporary tables into account, they have TRN->pins == 0
storage/maria/trnman.c:
  one cannot modify TRN->trid, it's a key in the trid_to_trn
  hash, if trid is modified, TRN won't be found (and deleted in
  trnman_free_trn) from the hash.
2008-08-06 23:52:55 +02:00
Sergei Golubchik
3971e262e9 maria: deadlock detection when waiting on unique key (useless until we can rollback)
include/my_pthread.h:
  cleanup
include/waiting_threads.h:
  header guard
mysys/waiting_threads.c:
  bug - kill strategy were not applied to deadlocks of length 1.
  cast timeout to ulonglong.
storage/maria/ma_static.c:
  declare WT_RESOURCE_TYPE ma_rc_dup_unique
storage/maria/ma_write.c:
  deadlock detection when waiting on unique key (useless until we can rollback)
storage/maria/maria_def.h:
  deadlock detection when waiting on unique key (useless until we can rollback)
storage/maria/trnman.c:
  use deadlock detector.
  protect state transitions of a TRN with a mutex.
  trnman_trid_to_trn() function.
storage/maria/trnman.h:
  trnman_trid_to_trn() function
  protect state transitions of a TRN with a mutex
  use deadlock detector.
storage/maria/trnman_public.h:
  trnman_trid_to_trn()
2008-08-06 21:30:05 +02:00
Sergei Golubchik
7ca3fc4ff0 compiler warnings 2008-08-06 16:03:27 +02:00
Sergei Golubchik
8347290482 compiler warnings
trnman: remove old lockman code
trnman: replace trid_to_committed_trn hash with trid_to_trn

storage/maria/ma_blockrec.c:
  compiler warnings
storage/maria/ma_loghandler.c:
  compiler warnings
storage/maria/ma_write.c:
  compiler warnings
storage/maria/trnman.c:
  remove old lockman code
  replace trid_to_committed_trn hash with trid_to_trn
storage/maria/trnman.h:
  remove old lockman code
  replace trid_to_committed_trn hash with trid_to_trn
storage/maria/unittest/ma_test_loghandler-t.c:
  compiler warnings
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  compiler warnings
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  compiler warnings
2008-08-04 18:57:41 +02:00
Sergei Golubchik
01ecf1f36b merged 2008-08-02 08:09:28 +02:00
Sergei Golubchik
6ba12f070c WL#3064 - waiting threads - wait-for graph and deadlock detection
client/mysqltest.c:
  compiler warnings
configure.in:
  remove old tests for unused programs
  disable the use of gcc built-ins if smp assembler atomics were selected explictily.
  add waiting_threads.o to THREAD_LOBJECTS
include/lf.h:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
  constructor/destructor in lf-alloc
include/my_pthread.h:
  shuffle set_timespec/set_timespec_nsec macros a bit to be able to fill
  several timeout structures with only one my_getsystime() call
include/waiting_threads.h:
  waiting threads - wait-for graph and deadlock detection
mysys/Makefile.am:
  add waiting_threads.c
mysys/lf_alloc-pin.c:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
  constructor/destructor in lf-alloc
mysys/lf_hash.c:
  constructor/destructor in lf-alloc
mysys/my_thr_init.c:
  remember end-of-stack pointer in the mysys_var
mysys/waiting_threads.c:
  waiting threads - wait-for graph and deadlock detection
storage/maria/ha_maria.cc:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
storage/maria/ma_commit.c:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
storage/maria/trnman.c:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
storage/maria/trnman_public.h:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
storage/maria/unittest/trnman-t.c:
  replace the end-of-stack pointer with the pointer to the end-of-stack pointer.
  the latter could be stored in THD (mysys_vars) and updated in pool-of-threads
  scheduler.
unittest/mysys/Makefile.am:
  add waiting_threads-t
unittest/mysys/lf-t.c:
  factor out the common code for multi-threaded stress unit tests
  move lf tests to a separate file
unittest/mysys/my_atomic-t.c:
  factor out the common code for multi-threaded stress unit tests
  move lf tests to a separate file
unittest/mysys/thr_template.c:
  factor out the common code for multi-threaded stress unit tests
unittest/mysys/waiting_threads-t.c:
  wt tests
2008-07-29 16:10:24 +02:00
unknown
8783b60a5e Fix for BUG#37737.
Fixed prev_last_lsn assignment.

storage/maria/ma_loghandler.c:
  Fix for BUG#37737:
   - buffer flush finish now can be done only in order
   - overlay processing fixed (no back direction bufferslocking now)
  Fixed prev_last_lsn assignment (now only for new buffer and only under buffer lock protection).
2008-07-23 02:43:20 +03:00
Michael Widenius
9e7626532b Auto merge
mysql-test/r/maria2.result:
  Manual merge
2008-07-12 17:59:54 +03:00
Michael Widenius
50fa1eb8b5 Fixing bug when using alter table on locked maria table
Reset history when we reenable logging for transactional tables (safety fix)

mysql-test/r/maria2.result:
  New results
mysql-test/t/maria2.test:
  Added test case for alter table on locked maria table
mysql-test/valgrind.supp:
  Added suppression rules for warnings in libc / libld
storage/maria/ma_extra.c:
  Remove table from trnman list if we are going to drop or rename it; We don't want not existing shares in the list when we do commit!
storage/maria/ma_recovery.c:
  Ensure that info->state don't point to history event when we disable logging for a table;  This is needed as alter table will first do commit and then unlock, which would cause us to access a non existing object when we reenable logging.
  Reset history when we reenable logging (safety fix)
storage/maria/ma_state.c:
  Do less work when share->now_transactional is not set. (Safety fix)
  Added function to remove shares to be deleted from trnman->used_tables
  Added function to reset history to current context
storage/maria/ma_state.h:
  Prototypes for new function
2008-07-12 17:14:28 +03:00
Guilhem Bichot
6f8b889ae5 Fix for BUG#38018 INSERT SELECT ON DUPLICATE KEY UPDATE and LOAD DATA CONCURRENT REPLACE
used TL_WRITE_CONCURRENT_INSERT though they may update/delete a row. This could cause concurrent SELECTs
to see a changing table while the SELECT happens, or if the query was made of a group of SELECTs,
some SELECTs would see different versions of the table. And anyway versioning in Maria was so far coded
to support only insertions. REPLACE SELECT, INSERT VALUES ON DUPLICATE KEY UPDATE, LOAD DATA REPLACE
were ok.

mysql-test/r/maria2.result:
  result. Without the code fix, the assertion added to ha_maria::update_row() would fire twice.
mysql-test/t/maria2.test:
  test when INSERT ON DUPLICATE KEY UPDATE and LOAD DATA CONCURRENT REPLACE do update rows
storage/maria/ha_maria.cc:
  Assert that update_row and delete_row never see TL_WRITE_CONCURRENT_INSERT.
  INSERT SELECT ON DUPLICATE KEY UPDATE and LOAD DATA CONCURRENT REPLACE
  must upgrade TL_WRITE_CONCURRENT_INSERT to TL_WRITE because they may update/delete a row.
2008-07-11 16:33:47 +02:00
Guilhem Bichot
dddc6fd2ef Porting bugfix made by Serg (for bug37276_reduced_corruption.sql of BUG#37276 "Maria: various index corruption,
block format assertion failure") from 6.0-maria to 5.1-maria.
2008-07-10 16:51:59 +02:00
Guilhem Bichot
eb548dc32f missing DBUG_RETURN, was causing crashes when run with --default-storage-engine=maria in tests
main.func_misc main.grant_cache_no_prot main.lowercase_table_grant main.mysql_client_test main.query_cache
main.query_cache_notembedded main.query_cache_ps_no_prot

storage/maria/ha_maria.cc:
  missing DBUG_RETURN
2008-07-10 16:38:14 +02:00
Guilhem Bichot
8de480a278 Merge of latest mysql-maria 2008-07-09 23:02:18 +02:00
Guilhem Bichot
71f72bad3f Fix for BUG#37873 "Client gets ok from INSERT VALUES before commit record is on disk":
this was true also for INSERT SELECT, UPDATE, DELETE. This fix will be removed when Maria supports COMMIT/ROLLBACK
("Maria 2.0"), because then Maria will trans_register_ha() and so participate in ha_commit_trans().
Without the fix, the assertion added to ha_maria::external_lock() fires many times in *maria*.test.

sql/sql_parse.cc:
  Before sending OK to client, commit transaction in Maria.
storage/maria/ha_maria.cc:
  Assertion added to external_lock() when committing: OK should not have been sent yet (ACI*D*).
  In ha_maria::implicit_commit(), possibility to not create a new transaction, this is used
  before net_end_statement(), when the next step is close_thread_tables();
  in this use case, ha_maria::implicit_commit() should not commit if under LOCK TABLES.
storage/maria/ha_maria.h:
  new prototype
2008-07-09 22:47:46 +02:00
Michael Widenius
7f02282404 Fixes for bug#37276:
- Fixes key corruption where pages wasn't marked that they contained transid.
- Fixed bug in block record that could create too small rows when transid was removed. This fixed some asserts() when testing block length

Added --abort-source-on-error to the mysql client. (Very helpfull when debugging wrong .sql files)

client/client_priv.h:
  Added enum for new option to mysql
client/mysql.cc:
  Added new option --abort-source-on-error to allow one to get 'source' to stop on error. This is 0 by default, to keep old behaviour.
  Print file name and line number when getting an error when doing source filename
sql/field.cc:
  Removed old dead code
sql/sql_class.cc:
  Removed old dead code
storage/maria/ma_blockrec.c:
  Added checking of min block length to check_directory()
  When creating new directory entry, set length to 0; This ensures that the assert checks() on block lengths works properly.
  Added more DBUG_ASSERT() and more calls to check_directory()
  In get_head_or_tail_page(), send in correct min_block_length. This is now safe as the length of new blocks are now 0
storage/maria/ma_delete.c:
  When moving key to parent page, mark page if key has transid
storage/maria/ma_write.c:
  Fixed bug where _ma_find_last_pos() didn't set int_key->flag.
  Simpilifed code by unrolling loop.
2008-07-09 16:09:30 +03:00
Guilhem Bichot
81d3d3ac42 - lifting a limit: INSERT|REPLACE SELECT and LOAD DATA always prevented versioning, now what do so is if
the table is empty.
- lifting another limit: versioning was disabled if table had more than one unique index
- correcting test of statement-based binlogging, when converting read locks to TL_READ_NO_INSERT

KNOWN_BUGS.txt:
  removing mostly fixed limitation (see ha_maria.cc)
mysql-test/r/maria-mvcc.result:
  result update
mysql-test/t/maria-mvcc.test:
  now when table is empty it does not do versioning, so test hung; inserting one row at start of the test,
  to enable versioning.
sql/sql_parse.cc:
  Maria team wrongly removed this "break", thanks Davi for noticing
storage/maria/ha_maria.cc:
  - We used to prevent versioning in INSERT/REPLACE SELECT and LOAD DATA, because the index rebuild done by
  bulk insert sometimes, is unsafe when versioning is on. Here we change that: in store_lock(), if the table is empty
  (which is required for index rebuild to be used), we disable versioning; in start_bulk_insert(), we don't do
  index rebuild if versioning is enabled.
  - Test for statement-based binlogging was incomplete: statement-based binlogging is on for this statement
  if binlog is open and statement has binlogging enabled and statement is not doing row-based binlogging
storage/maria/ma_open.c:
  Monty and I agreed that it's ok to have versioning on a table with more than one unique index: if an INSERT
  hits a duplicate key when inserting the second index' key, no other thread should be able to touch the 
  first index' just-inserted key, because that key has an uncommitted transaction id, so the first thread
  should have time to remove the first index' key.
2008-07-09 14:07:38 +02:00
Guilhem Bichot
60b88ce475 Fix for BUG#37876 "Importing Maria table from other server via binary copy does not work":
- after auto-zerofill (ha_maria::check_and_repair()) kepts its state's LSNs unchanged, which could
be the same as the create_rename_lsn of another pre-existing table, which would break versioning as this LSN
serves as unique identifier in the versioning code (in maria_open()). Even the state pieces which
maria_zerofill() did change were lost (because they didn't go to disk).
- after this fix, if two tables were auto-zerofilled at the same time (by _ma_mark_changed())
they could receive the same create_rename_lsn, which would break versioning again. Fix is to write a log
record each time a table is imported.
- Print state's LSNs (create_rename_lsn, is_of_horizon, skip_redo_lsn) and UUID in maria_chk -dvv.

mysql-test/r/maria-autozerofill.result:
  result
mysql-test/t/maria-autozerofill.test:
  Test for auto-zerofilling
storage/maria/ha_maria.cc:
  The state changes done by auto-zerofilling never reached disk.
storage/maria/ma_check.c:
  When zerofilling a table, including its pages' LSNs, new state LSNs are needed next time the table
  is imported into a Maria instance.
storage/maria/ma_create.c:
  Write LOGREC_IMPORTED_TABLE when importing a table. This is informative and ensures
  that the table gets a unique create_rename_lsn even though multiple tables
  are imported by concurrent threads (it advances the log's end LSN).
storage/maria/ma_key_recover.c:
  comment
storage/maria/ma_locking.c:
  instead of using translog_get_horizon() for state's LSNs of imported table,
  use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
storage/maria/ma_loghandler.c:
  New type of log record
storage/maria/ma_loghandler.h:
  New type of log record
storage/maria/ma_loghandler_lsn.h:
  New name for constant as can be used not only by maria_chk but auto-zerofill now too.
storage/maria/ma_open.c:
  instead of using translog_get_horizon() for state's LSNs of imported table,
  use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
storage/maria/ma_recovery.c:
  print content of LOGREC_IMPORTED_TABLE in maria_read_log.
storage/maria/maria_chk.c:
  print info about LSNs of the table's state, and UUID, when maria_chk -dvv
storage/maria/maria_pack.c:
  new name for constant
storage/maria/unittest/ma_test_recovery.pl:
  Now that maria_chk -dvv shows state LSNs and UUID those need to be filtered out,
  as maria_read_log -a does not use the same as at original run.
2008-07-09 11:02:27 +02:00
Michael Widenius
f9ef13d562 Automatic merge 2008-07-05 14:55:01 +03:00
Michael Widenius
82d7938905 Bug#37276 maria crash on insert around the time check table is run
Fixed several (but not all) issues found by the test program:
- ASSERT on row_length in ma_blockrec.c::_ma_compact_block_page()
- Fixed bug when splitting node pages
- Fixed hang in 'closeing tables' (conflicting mutex order) by ensuring we first take trnman lock and then share->intern_lock

storage/maria/ma_blockrec.c:
  When compacting a row page when allocating space for a new row, the min length of a the new block may be temporarly smaller than 'min_block_length'.
storage/maria/ma_check.c:
  More DBUG output
storage/maria/ma_checkpoint.c:
  Call new function _ma_remove_not_visible_states_with_lock() to ensure we first take lock on trnman and then on share->intern_lock
  +
storage/maria/ma_close.c:
  Added comment
storage/maria/ma_open.c:
  Added comment
storage/maria/ma_search.c:
  Copy also node data; Caused bug when splitting node pages
storage/maria/ma_state.c:
  Added _ma_remove_not_visible_states_with_lock() to ensure we take locks in right order
storage/maria/ma_state.h:
  Added new prototype
storage/maria/trnman.c:
  Added trnman_lock() and trnman_unlock().
  Needed by _ma_remove_not_visible_states_with_lock() to get mutex in right order
storage/maria/trnman_public.h:
  Added new prototypes
2008-07-05 14:03:21 +03:00
Guilhem Bichot
4d48802fde Fix for BUG#35107 "maria-preload.test is disabled because unrepeatable page cache statistics"
What varies accross machine is maria_pagecache_read_requests, but maria_pagecache_reads doesn't and
is the most interesting (helps verify that disk wasn't touched after preloading), that's all we keep.

mysql-test/r/maria-preload.result:
  unrepeatable variable removed
mysql-test/t/maria-preload.test:
  unrepeatable variable removed
storage/maria/ma_test_force_start.pl:
  portability fix for running under Windows
2008-07-03 23:02:13 +02:00
Guilhem Bichot
3e37fb35b1 Back-port of changes made to 6.0-maria (to remove compiler warnings or fix simple test failures)
in the last days: substitution in tests has to work for absolute datadir (/dev/shm/...);
internal temp tables (like information_schema) can be Maria; Maria may not be compiled in; splitting
too long maria.test in two; mtr --embedded runs in mysql-test not mysql-test/var/master-data
so we need some absolute paths in tests; can't restart mysqld in --embedded; missing DBUG_VOID_RETURN in
mysqltest.c (fix from Serg); is_collation_character_set_applicability.test was too long name
which broke tar's 99-char limit.
2008-07-01 22:47:09 +02:00
Guilhem Bichot
2425763869 Fix for BUG#37288 "Maria - zerofill corrupts table". Testcase is running ma_test_recovery.pl on Windows.
storage/maria/ma_blockrec.c:
  comment
storage/maria/ma_check.c:
  When zerofilling the data file, _ma_compact_block_page() may increase free space in a
  page so bitmap page needs to be corrected.
2008-06-30 11:25:14 +02:00
Guilhem Bichot
fdebe2788f Fix for BUG#35107 "maria-preload.test is disabled because causes assertion".
maria-preload will be re-enabled later because other pieces of it have possibly random output.

storage/maria/ma_check.c:
  Fix for BUG#35107 "maria-preload.test is disabled because causes assertion".
2008-06-30 11:23:10 +02:00
Guilhem Bichot
0432bc1e95 Fix for unit test failures.
storage/maria/ma_test1.c:
  rec_length was too short by one byte: at line 299 memcpy(record,read_record,rec_length) thus didn't copy the
  last byte, so 'record' was not ok for use by update_record(), contained an incomplete blob address, sometimes
  crashed on Itanium.
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Tests failed once, never before for hundreds of times, we don't know if test is correct, disabling.
2008-06-30 11:13:08 +02:00
Michael Widenius
f27efe69f5 Disable versioning (concurrent writes) if more than one unique key
The reason for this is that if we change one unique key and then get a failure on the second, we may not be able to rename the first one back before someone else writes the same key value.  In Maria 2.0, when we keep deleted key values in the tree, this will not be a problem anymore
Fixed typedisable concurrent insert/select for SQLCOM_LOAD as there are problems with concurrent threads during index recreation

KNOWN_BUGS.txt:
  More comments
storage/maria/ha_maria.cc:
  Fixed typo (REPLACE -> INSERT)
  Also disable concurrent insert/select for SQLCOM_LOAD as there are problems with concurrent threads during index recreation
storage/maria/ma_open.c:
  Disable versioning (concurrent writes) if more than one unique key
2008-06-28 18:09:03 +03:00
Michael Widenius
c580583756 Automatic merge
Added some minor changes that was done in my tree while waiting for test to run:
- Remove in Maria T_QUICK when retrying repair for enabling indexes, as the record file may be in use by other threads
- Disable code that is only relevant for EXTERNAL_LOCKING

include/m_string.h:
  Automatic merge
storage/maria/ha_maria.cc:
  Remove T_QUICK when retrying repair for enabling indexes, as the record file may be in use by other threads
storage/maria/ma_check.c:
  Automatic merge
storage/maria/ma_key.c:
  Automatic merge
storage/maria/ma_loghandler.c:
  Automatic merge
storage/maria/ma_open.c:
  Disable code that is only relevant for EXTERNAL_LOCKING
storage/maria/ma_sp_key.c:
  Automatic merge
storage/maria/ma_write.c:
  Automatic merge
storage/maria/trnman.c:
  Automatic merge
2008-06-28 16:57:00 +03:00
Michael Widenius
d29e7f7472 Fix for Bug #37007 Maria: different checksum for MyISAM table depending on CHECKSUM=0|1
This also adds a check that MyISAM tables with incompatible checksums are detected by CHECK TABLE ... [FOR UPGRADE] and thus also by mysql_upgrade.
The tables that are incomatible are MyISAM tables with ROW_FORMAT=fixed and has VARCHAR fields and have CHECKSUM enabled.
Before these tables gave different checksum if you used CHECK TABLE with or without EXTENDED

mysql-test/r/old-mode.result:
  Now we get same results with and without EXTENDED
mysql-test/r/row-checksum-old.result:
  Initial results
mysql-test/r/row-checksum.result:
  Initial results
mysql-test/t/old-mode.test:
  Added test with QUICK to show that the live checksum is not used when running with --old
mysql-test/t/row-checksum-old-master.opt:
  Start mysqld with --old mode to enable old checksum code
mysql-test/t/row-checksum-old.test:
  Run row-checksum test under mysqld --old
mysql-test/t/row-checksum.test:
  Verify that checksum are calculated the same way with and without EXTENDED
  We run this with several storage engines to ensure results are the same over storage engines
sql/ha_partition.cc:
  Use new HA_HAS_xxx_CHECKSUM flags
sql/handler.cc:
  Use new HA_HAS_xxx_CHECKSUM flags
sql/handler.h:
  Split HA_HAS_CHECKSUM into HA_HAS_NEW_CHECKSUM and HA_HAS_OLD_CHECKSUM flags.
  This is a safe API change as only MyISAM and Maria should use these handler flags.
sql/sql_show.cc:
  Use new HA_HAS_xxx_CHECKSUM flags
sql/sql_table.cc:
  Use file->checksum() for live checksums if the life checksum method corresponds to the mysqld --old flag
storage/maria/ha_maria.cc:
  Use new HA_HAS_xxx_CHECKSUM flags
storage/myisam/ha_myisam.cc:
  Set HA_HAS_OLD_CHECKSUM and/or HA_HAS_NEW_CHECKSUM flags depending on if this is a new myisam or old myisam file
  Add method check_for_upgrade() to detect if the table is of old version with a checksum that is incompatible with CHECK TABLE ... EXTENDED
storage/myisam/ha_myisam.h:
  Added check_for_upgrade()
storage/myisam/mi_open.c:
  Removed not neede cast
  Initialize share->has_null_fields and share->has_varchar_fields variables
storage/myisam/myisamdef.h:
  Added share->has_null_fields and share->has_varchar_fields
2008-06-28 15:45:15 +03:00
Sergei Golubchik
97a0501e92 fix for a strict aliasing issue with gcc 3.4.3 on sol10-amd64-a 2008-06-28 12:06:59 +02:00
Michael Widenius
9f589947b8 Fix for Bug #36578 Maria: maria-recover may fail to autorepair a table
Fixed also some similar issues in MyISAM. This was not noticed before as MyISAM did a second retry without key cache (which just made the second repair attempty slower)

storage/maria/ha_maria.cc:
  Print information if we retry without quick in case of CHECK TABLE table_name QUICK
  Remove T_QUICK flag when retrying repair, but set T_SAFE_REPAIR to ensure we don't loose any rows
  Remember T_RETRY_WITH_QUICK flag when restoring repair flags
  Don't print 'checking table' if we are not checking table in auto-repair
  Don't use T_QUICK in auto repair (safer)
  Changed parameter of type HA_PARAM &param to HA_PARAM *param
storage/maria/ha_maria.h:
  Changed parameter of type HA_PARAM &param to HA_PARAM *param
storage/maria/ma_check.c:
  Added retry without T_QUICK if there is a problem reading a row in BLOCK_RECORD
storage/myisam/ha_myisam.cc:
  Remove T_QUICK flag when retrying repair, but set T_SAFE_REPAIR to ensure we don't loose any rows
  Remember T_RETRY_WITH_QUICK flag when restoring repair flags
2008-06-28 11:27:14 +03:00
unknown
38d024b577 merge 2008-06-26 22:27:08 +03:00
unknown
7b8d4af166 Fixed maria-big test failure.
storage/maria/ma_loghandler.c:
  Processed case when current buffer filled but there is no new LSN in the buffer generated (so it is no need to fluesh this buffer) and buffer->last_lsn is LSN_IMPOSSIBLE.
2008-06-26 22:01:19 +03:00
Guilhem Bichot
f0c53638d7 Fixes for build errors under Windows and compiler warning under Linux
include/m_string.h:
  new macro like LINT_INIT but for struct. In m_string.h because bzero() becomes available only there
storage/maria/ma_check.c:
  compiler error under Windows (declaration after statements...)
storage/maria/ma_key.c:
  trnman.h is not in include/ but in storage/maria
storage/maria/ma_sp_key.c:
  trnman.h is not in include/ but in storage/maria
storage/maria/ma_write.c:
  avoid compiler warning (org_key.flag may be used uninitialized)
2008-06-26 17:10:11 +02:00
Michael Widenius
1d72603832 Merge; No notable changes
.bzr-mysql/default.conf:
  Automatic merge
config/ac-macros/plugins.m4:
  Automatic merge
configure.in:
  Automatic merge
include/my_global.h:
  Automatic merge
mysql-test/include/maria_empty_logs.inc:
  Use Guilmhems version, but don't echo use database
mysql-test/r/maria-no-logging.result:
  Automatic merge
mysql-test/r/maria-page-checksum.result:
  Automatic merge
mysql-test/r/maria-recover.result:
  Automatic merge
mysql-test/r/maria2.result:
  Automatic merge
mysql-test/t/maria-no-logging.test:
  Automatic merge
mysql-test/t/maria-page-checksum.test:
  Automatic merge
mysql-test/t/maria-purge.test:
  Automatic merge
mysql-test/t/maria-recover.test:
  Automatic merge
mysql-test/t/maria2.test:
  Automatic merge
sql/sql_table.cc:
  Automatic merge
storage/maria/CMakeLists.txt:
  Automatic merge
storage/maria/ma_ft_parser.c:
  Automatic merge
storage/maria/ma_loghandler.c:
  Automatic merge
storage/maria/ma_recovery.c:
  Automatic merge
storage/maria/ma_rt_test.c:
  Manual merge
storage/maria/ma_state.c:
  Automatic merge
storage/maria/ma_test_force_start.pl:
  Automatic merge
storage/maria/plug.in:
  Automatic merge
storage/maria/unittest/CMakeLists.txt:
  Automatic merge
storage/maria/unittest/Makefile.am:
  Automatic merge
storage/maria/unittest/ma_test_all-t:
  Automatic merge
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Automatic merge
storage/maria/unittest/ma_test_recovery.pl:
  Automatic merge
storage/myisam/rt_test.c:
  Automatic merge
2008-06-26 12:32:22 +03:00
Michael Widenius
52cb0c24a6 Added versioning of Maria index
Store max_trid in index file as state.create_trid. This is used to pack all transids in the index pages relative to max possible transid for file.
Enable versioning for transactional tables with index. Tables with an auto-increment key, rtree or fulltext keys are not versioned.
Changed info->lastkey to type MARIA_KEY. Removed info->lastkey_length as this is now part of info->lastkey
Renamed old info->lastkey to info->lastkey_buff
Use exact key lenghts for keys, not USE_WHOLE_KEY
For partial key searches, use SEARCH_PART_KEY
When searching to insert new key on page, use SEARCH_INSERT to mark that key has rowid

Changes done in a lot of files:
- Modified functions to use MARIA_KEY instead of key pointer and key length
- Use keyinfo->root_lock instead of share->key_root_lock[keynr]
- Simplify code by using local variable keyinfo instead if share->keyinfo[i]
- Added #fdef EXTERNAL_LOCKING around removed state elements
- HA_MAX_KEY_BUFF -> MARIA_MAX_KEY_BUFF (to reserve space for transid)
- Changed type of 'nextflag' to uint32 to ensure all SEARCH_xxx flags fits into it

.bzrignore:
  Added missing temporary directory
extra/Makefile.am:
  comp_err is now deleted on make distclean
include/maria.h:
  Added structure MARIA_KEY, which is used for intern key objects in Maria.
  Changed functions to take MARIA_KEY as an argument instead of pointer to packed key.
  Changed some functions that always return true or false to my_bool.
  Added virtual function make_key() to avoid if in _ma_make_key()
  Moved rw_lock_t for locking trees from share->key_root_lock to MARIA_KEYDEF. This makes usage of the locks simpler and faster
include/my_base.h:
  Added HA_RTREE_INDEX flag to mark rtree index. Used for easier checks in ma_check()
  Added SEARCH_INSERT to be used when inserting new keys
  Added SEARCH_PART_KEY for partial searches
  Added SEARCH_USER_KEY_HAS_TRANSID to be used when key we use for searching in btree has a TRANSID
  Added SEARCH_PAGE_KEY_HAS_TRANSID to be used when key we found in btree has a transid
include/my_handler.h:
  Make next_flag 32 bit to make sure we can handle all SEARCH_ bits
mysql-test/include/maria_empty_logs.inc:
  Read and restore current database; Don't assume we are using mysqltest.
  Don't log use databasename to log. Using this include should not cause any result changes.
mysql-test/r/maria-gis-rtree-dynamic.result:
  Updated results after adding some check table commands to help pinpoint errors
mysql-test/r/maria-mvcc.result:
  New tests
mysql-test/r/maria-purge.result:
  New result after adding removal of logs
mysql-test/r/maria-recovery-big.result:
  maria_empty_logs doesn't log 'use mysqltest' anymore
mysql-test/r/maria-recovery-bitmap.result:
  maria_empty_logs doesn't log 'use mysqltest' anymore
mysql-test/r/maria-recovery-rtree-ft.result:
  maria_empty_logs doesn't log 'use mysqltest' anymore
mysql-test/r/maria-recovery.result:
  maria_empty_logs doesn't log 'use mysqltest' anymore
mysql-test/r/maria.result:
  New tests
mysql-test/r/variables-big.result:
  Don't log id as it's not predictable
mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result:
  Updated results to new binlog results. (Test has not been run in a long time as it requires --big)
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt:
  Moved file to ndb replication test directory
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test:
  Fixed wrong path to included tests
mysql-test/t/maria-gis-rtree-dynamic.test:
  Added some check table commands to help pinpoint errors
mysql-test/t/maria-mvcc.test:
  New tests
mysql-test/t/maria-purge.test:
  Remove logs to make test results predictable
mysql-test/t/maria.test:
  New tests for some possible problems
mysql-test/t/variables-big.test:
  Don't log id as it's not predictable
mysys/my_handler.c:
  Updated function comment to reflect old code
  Changed nextflag to be uint32 to ensure we can have flags > 16 bit
  Changed checking if we are in insert with NULL keys as next_flag can now include additional bits that have to be ignored.
  Added SEARCH_INSERT flag to be used when inserting new keys in btree. This flag tells us the that the keys includes row position and it's thus safe to remove SEARCH_FIND
  Added comparision of transid. This is only done if the keys actually have a transid, which is indicated by nextflag
mysys/my_lock.c:
  Fixed wrong test (Found by Guilhem)
scripts/Makefile.am:
  Ensure that test programs are deleted by make clean
sql/rpl_rli.cc:
  Moved assignment order to fix compiler warning
storage/heap/hp_write.c:
  Add SEARCH_INSERT to signal ha_key_cmp that we we should also compare rowid for keys
storage/maria/Makefile.am:
  Remove also maria log files when doing make distclean
storage/maria/ha_maria.cc:
  Use 'file->start_state' as default state for transactional tables without versioning
  At table unlock, set file->state to point to live state. (Needed for information schema to pick up right number of rows)
  In ha_maria::implicit_commit() move all locked (ie open) tables to new transaction. This is needed to ensure ha_maria->info doesn't point to a deleted history event.
  Disable concurrent inserts for insert ... select and table changes with subqueries if statement based replication as this would cause wrong results on slave
storage/maria/ma_blockrec.c:
  Updated comment
storage/maria/ma_check.c:
  Compact key pages (removes transid) when doing --zerofill
  Check that 'page_flag' on key pages contains KEYPAGE_FLAG_HAS_TRANSID if there is a single key on the page with a transid
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Use new interface to _ma_rec_pos(), _ma_dpointer(), _ma_ft_del(), ma_update_state_lsn()
  Removed not needed argument from get_record_for_key()
  Fixed that we check doesn't give errors for RTREE; We now treath these like SPATIAL
  Remove some SPATIAL specific code where the virtual functions can handle this in a general manner
  Use info->lastkey_buff instead of info->lastkey
  _ma_dpos() -> _ma_row_pos_from_key()
  _ma_make_key() -> keyinfo->make_key()
  _ma_print_key() -> _ma_print_keydata()
  _ma_move_key() -> ma_copy_copy()
  Add SEARCH_INSERT to signal ha_key_cmp that we we should also compare rowid for keys
  Ensure that data on page doesn't overwrite page checksum position
  Use DBUG_DUMP_KEY instead of DBUG_DUMP
  Use exact key lengths instead of USE_WHOLE_KEY to ha_key_cmp()
  Fixed check if rowid points outside of BLOCK_RECORD data file
  Use info->lastkey_buff instead of key on stack in some safe places
  Added #fdef EXTERNAL_LOCKING around removed state elements
storage/maria/ma_close.c:
  Use keyinfo->root_lock instead of share->key_root_lock[keynr]
storage/maria/ma_create.c:
  Removed assert that is already checked in maria_init()
  Force transactinal tables to be of type BLOCK_RECORD
  Fixed wrong usage of HA_PACK_RECORD (should be HA_OPTION_PACK_RECORD)
  Mark keys that uses HA_KEY_ALG_RTREE with HA_RTREE_INDEX for easier handling of these in ma_check
  Store max_trid in index file as state.create_trid. This is used to pack all transids in the index pages relative to max possible transid for file.
storage/maria/ma_dbug.c:
  Changed _ma_print_key() to use MARIA_KEY
storage/maria/ma_delete.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  info->lastkey2-> info->lastkey_buff2
  Added SEARCH_INSERT to signal ha_key_cmp that we we should also compare rowid for keys
  Use new interface for get_key(), _ma_get_last_key() and others
  _ma_dpos() -> ma_row_pos_from_key()
  Simplify setting of prev_key in del()
  Ensure that KEYPAGE_FLAG_HAS_TRANSID is set in page_flag if key page has transid
  Treath key pages that may have a transid as if keys would be of variable length
storage/maria/ma_delete_all.c:
  Reset history state if maria_delete_all_rows() are called
  Update parameters to _ma_update_state_lsns() call
storage/maria/ma_extra.c:
  Store and restore info->lastkey
storage/maria/ma_ft_boolean_search.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_ft_nlq_search.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Use lastkey_buff2 instead of info->lastkey+info->s->base.max_key_length (same thing)
storage/maria/ma_ft_update.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_ftdefs.h:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_fulltext.h:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_init.c:
  Check if blocksize is legal
  (Moved test here from ma_open())
storage/maria/ma_key.c:
  Added functions for storing/reading of transid 
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Moved _ma_sp_make_key() out of _ma_make_key() as we now use keyinfo->make_key to create keys
  Add transid to keys if table is versioned
  Added _ma_copy_key()
storage/maria/ma_key_recover.c:
  Add logging of page_flag (holds information if there are keys with transid on page)
  Changed DBUG_PRINT("info" -> DBUG_PRINT("redo" as the redo logging can be quite extensive
  Added lots of DBUG_PRINT()
  Added support for index page operations: KEY_OP_SET_PAGEFLAG and KEY_OP_COMPACT_PAGE
storage/maria/ma_key_recover.h:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_locking.c:
  Added new arguments to _ma_update_state_lsns_sub()
storage/maria/ma_loghandler.c:
  Fixed all logging of LSN to look similar in DBUG log
  Changed if (left != 0) to if (left) as the later is used also later in the code
storage/maria/ma_loghandler.h:
  Added new index page operations
storage/maria/ma_open.c:
  Removed allocated "state_dummy" and instead use share->state.common for transactional tables that are not versioned
  This is needed to not get double increments of state.records (one in ma_write.c and on when log is written)
  Changed info->lastkey to MARIA_KEY type
  Removed resetting of MARIA_HA variables that have 0 as default value (as info is zerofilled)
  Enable versioning for transactional tables with index. Tables with an auto-increment key, rtree or fulltext keys are not versioned.
  Check on open that state.create_trid is correct
  Extend share->base.max_key_length in case of transactional table so that it can hold transid
  Removed 4.0 compatible fulltext key mode as this is not relevant for Maria
  Removed old and wrong #ifdef ENABLE_WHEN_WE_HAVE_TRANS_ROW_ID code block
  Initialize all new virtual function pointers
  Removed storing of state->unique, state->process and store state->create_trid instead
storage/maria/ma_page.c:
  Added comment to describe key page structure
  Added functions to compact key page and log the compact operation
storage/maria/ma_range.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Use SEARCH_PART_KEY indicator instead of USE_WHOLE_KEY to detect if we are doing a part key search
  Added handling of pages with transid
storage/maria/ma_recovery.c:
  Don't assert if table we opened are not transactional. This may be a table which has been changed from transactional to not transactinal
  Added new arguments to _ma_update_state_lsns()
storage/maria/ma_rename.c:
  Added new arguments to _ma_update_state_lsns()
storage/maria/ma_rkey.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Don't use USE_WHOLE_KEY, use real length of key
  Use share->row_is_visible() to test if row is visible
  Moved search_flag == HA_READ_KEY_EXACT out of 'read-next-row' loop as this only need to be tested once
  Removed test if last_used_keyseg != 0 as this is always true
storage/maria/ma_rnext.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Simplify code by using local variable keyinfo instead if share->keyinfo[i]
  Use share->row_is_visible() to test if row is visible
storage/maria/ma_rnext_same.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  lastkey2 -> lastkey_buff2
storage/maria/ma_rprev.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Simplify code by using local variable keyinfo instead if share->keyinfo[i]
  Use share->row_is_visible() to test if row is visible
storage/maria/ma_rsame.c:
  Updated comment
  Simplify code by using local variable keyinfo instead if share->keyinfo[i]
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_rsamepos.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_rt_index.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Use better variable names
  Removed not needed casts
  _ma_dpos() -> _ma_row_pos_from_key()
  Use info->last_rtree_keypos to save position to key instead of info->int_keypos
  Simplify err: condition
  Changed return type for maria_rtree_insert() to my_bool as we are only intressed in ok/fail from this function
storage/maria/ma_rt_index.h:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_rt_key.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Simplify maria_rtree_add_key by combining idenitcal code and removing added_len
storage/maria/ma_rt_key.h:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_rt_mbr.c:
  Changed type of 'nextflag' to uint32
  Added 'to' argument to RT_PAGE_MBR_XXX functions to more clearly see which variables changes value
storage/maria/ma_rt_mbr.h:
  Changed type of 'nextflag' to uint32
storage/maria/ma_rt_split.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  key_length -> key_data_length to catch possible errors
storage/maria/ma_rt_test.c:
  Fixed wrong comment
  Reset recinfo to avoid valgrind varnings
  Fixed wrong argument to create_record() that caused test to fail
storage/maria/ma_search.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Added support of keys with optional trid
  Test for SEARCH_PART_KEY instead of USE_WHOLE_KEY to detect part key reads
  _ma_dpos() -> _ma_row_pos_from_key()
  If there may be keys with transid on the page, have _ma_bin_search() call _ma_seq_search()
  Add _ma_skip_xxx() functions to quickly step over keys (faster than calling get_key() in most cases as we don't have to copy key data)
  Combine similar code at end of _ma_get_binary_pack_key()
  Removed not used function _ma_move_key()
  In _ma_search_next() don't call _ma_search() if we aren't on a nod page.
  Update info->cur_row.trid with trid for found key
  
  
  
  Removed some not needed casts
  Added _ma_trid_from_key()
  Use MARIA_SHARE instead of MARIA_HA as arguments to _ma_rec_pos(), _ma_dpointer() and _ma_xxx_keypos_to_recpos() to make functions faster and smaller
storage/maria/ma_sort.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_sp_defs.h:
  _ma_sp_make_key() now fills in and returns (MARIA_KEY *) value
storage/maria/ma_sp_key.c:
  _ma_sp_make_key() now fills in and returns (MARIA_KEY *) value
  Don't test sizeof(double), test against 8 as we are using float8store()
  Use mi_float8store() instead of doing swap of value (same thing but faster)
storage/maria/ma_state.c:
  maria_versioning() now only calls _ma_block_get_status() if table supports versioning
  Added _ma_row_visible_xxx() functions for different occasions
  When emptying history, set info->state to point to the first history event.
storage/maria/ma_state.h:
  Added _ma_row_visible_xxx() prototypes
storage/maria/ma_static.c:
  Indentation changes
storage/maria/ma_statrec.c:
  Fixed arguments to _ma_dpointer() and _ma_rec_pos()
storage/maria/ma_test1.c:
  Call init_thr_lock() if we have versioning
storage/maria/ma_test2.c:
  Call init_thr_lock() if we have versioning
storage/maria/ma_unique.c:
  Modified functions to use MARIA_KEY
storage/maria/ma_update.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
storage/maria/ma_write.c:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Simplify code by using local variable keyinfo instead if share->keyinfo[i]
  In _ma_enlarge_root(), mark in page_flag if new key has transid
  _ma_dpos() -> _ma_row_pos_from_key()
  Changed return type of _ma_ck_write_tree() to my_bool as we are only testing if result is true or not
  Moved 'reversed' to outside block as area was used later
storage/maria/maria_chk.c:
  Added error if trying to sort with HA_BINARY_PACK_KEY
  Use new interface to get_key() and _ma_dpointer()
  _ma_dpos() -> _ma_row_pos_from_key()
storage/maria/maria_def.h:
  Modified functions to use MARIA_KEY instead of key pointer and key length
  Added 'common' to MARIA_SHARE->state for storing state for transactional tables without versioning
  Added create_trid to MARIA_SHARE
  Removed not used state variables 'process' and 'unique'
  Added defines for handling TRID's in index pages
  Changed to use MARIA_SHARE instead of MARIA_HA for some functions
  Added 'have_versioning' flag if table supports versioning
  Moved key_root_lock from MARIA_SHARE to MARIA_KEYDEF
  Changed last_key to be of type MARIA_KEY. Removed lastkey_length
  lastkey -> lastkey_buff, lastkey2 -> lastkey_buff2
  Added _ma_get_used_and_nod_with_flag() for faster access to page data when page_flag is read
  Added DBUG_DUMP_KEY for easier DBUG_DUMP of a key
  Changed 'nextflag' and assocaited variables to uint32
storage/maria/maria_ftdump.c:
  lastkey -> lastkey_buff
storage/maria/trnman.c:
  Fixed wrong initialization of min_read_from and max_commit_trid
  Added trnman_get_min_safe_trid()
storage/maria/unittest/ma_test_all-t:
  Added --start-from
storage/myisam/mi_check.c:
  Added SEARCH_INSERT, as ha_key_cmp() needs it when doing key comparision for inserting key on page in rowid order
storage/myisam/mi_delete.c:
  Added SEARCH_INSERT, as ha_key_cmp() needs it when doing key comparision for inserting key on page in rowid order
storage/myisam/mi_range.c:
  Updated comment
storage/myisam/mi_write.c:
  Added SEARCH_INSERT, as ha_key_cmp() needs it when doing key comparision for inserting key on page in rowid order
storage/myisam/rt_index.c:
  Fixed wrong parameter to rtree_get_req() which could cause crash
2008-06-26 08:18:28 +03:00
Jani Tolonen
4f14b87d91 Imported fix for bug#29464 from myisam table handler to maria. 2008-06-24 17:14:56 +03:00
Guilhem Bichot
96e2ca52ad Fix for failure of test maria-recover under Windows.
mysql-test/r/maria-recover.result:
  result update
mysql-test/t/maria-recover.test:
  making test independent of / or \ in file names (failed under Windows)
storage/maria/ma_test_force_start.pl:
  indentation
2008-06-16 10:57:25 +02:00
Guilhem Bichot
771a66eaee Port of ma_test_force_start.pl (test program for --maria-force-start-after-recovery-failures) to Windows.
storage/maria/ma_test_force_start.pl:
  port to Windows: detection of where 'mysql' command-line client is (debug/release/etc)), .exe suffix,
  --console instead of --mem, --P instead of --socket, taskkill instead of perl's kill.
2008-06-13 17:39:45 +02:00
Guilhem Bichot
26f685e72a disabling lockman2-t: takes too much time for a unit test (>=15 min), and what it
tests is not used in Maria, this fixes BUG#34744 "Maria Unit test "lockman2" fails
on Mac OS X 10.4 PowerPC 64-bit"

storage/maria/unittest/CMakeLists.txt:
  disabling lockman2-t
storage/maria/unittest/Makefile.am:
  disabling lockman2-t
2008-06-13 11:47:17 +02:00
unknown
abdda9e2d9 More safe flush_horizon variable initialization. 2008-06-12 21:05:31 +03:00
Guilhem Bichot
bbef67f5bd Fix for BUG#35801 "Maria: unreadable log during tests" and
BUG#35823 "Maria: log handler assertion (page[page_offset] & (3 << 6)) == 0x00... fails"
Both random problems can be explained by the REDO phase starting from a log horizon which is not a LSN,
which is the bug fixed here.

storage/maria/ma_recovery.c:
  In Recovery, REDO phase needs to start log reading from a LSN, not a log horizon: start_address was only
  guaranteed to be a horizon, not necessarily a LSN.
  On some machine and test, it happened that start_address was only a log horizon, and run_redo_phase()
  tried to read from there, and log handler naturally refused that:
  ma_loghandler.c:6797: translog_read_record_header_from_buffer: Assertion `translog_is_LSN_chunk(page[page_offset])' failed. And in non-debug build, just the "redo phase failed" message in the error log.
  This was random, because depended on amount of checkpoints which is timing-dependent; also depended on Maria tests
  ran or skipped (so, debug or non-debug builds)... Bad code was introduced by me end of December so it's likely
  to explain lots of random log handler errors we observed since.
2008-06-12 15:49:19 +02:00
Guilhem Bichot
5465dd088d automerge 2008-06-10 22:14:17 +02:00
unknown
7c87c307f3 Fixed non-debug build.
storage/maria/ma_loghandler.c:
  Now we need buffer number to set dirty buffers mask.
2008-06-10 19:14:29 +03:00
Guilhem Bichot
f89c61f5bb Fix for Valgrind errors when running rt_test and ma_rt_test, and segmentation fault
in ma_rt_test -M (BUG#36321); keyinfo/recinfo/keyseg had non-initialized parts.
maria_scan() was not wrapped in maria_scan_init()/end() so "ma_rt_test -M" found no rows.
Preparing for inclusion into ma_test_all-t and ma_test_recovery.pl (still prevented by
BUG#37307 "Maria: R-tree unit test produces corrupted table").

storage/maria/ma_rt_test.c:
  Some members of keyinfo, recinfo, keyseg had non-initialized parts, led to Valgrind errors,
  and also segmentation fault when running with -M (=BLOCK_RECORD) (BUG#36321).
  We now bzero them like they are in mi_test1.
  Other problems:
  - maria_scan() was not wrapped in maria_scan_init()/end() so "ma_rt_test -M" found no rows.
  - --silent had almost no effect, now it really silences normal output.
  - Some errors were going to stdout, they now go to stderr.
  Added option for testing versioning, to fit well into ma_test_all-t.
storage/maria/unittest/ma_test_all-t:
  preparing for running ma_rt_test when ma_rt_test remaining bugs are fixed
storage/maria/unittest/ma_test_recovery.pl:
  preparing for running ma_rt_test when ma_rt_test remaining bugs are fixed
storage/myisam/rt_test.c:
  Some members of keyinfo, recinfo, keyseg were not initialized, led to Valgrind errors.
  We now bzero them like they are in mi_test1.
2008-06-10 15:44:41 +02:00
unknown
0f660db3aa merge 2008-06-10 12:05:09 +03:00
unknown
3967b6cfc7 WL#4401 "Maria - deserialize translog_flush() calls"
storage/maria/ma_loghandler.c:
  New flush procedure added.
storage/maria/unittest/Makefile.am:
  Test of many multi-thread flush added
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Test of many multi-thread flush added
2008-06-10 00:54:30 +03:00
Guilhem Bichot
5f26e7384f Fix for build failures under Windows
storage/maria/CMakeLists.txt:
  add missing file
storage/maria/ma_state.c:
  two include files are in storage/maria, not in include/, so they need "" not <>, or compiler misses them.
2008-06-09 11:06:06 +02:00
Sergei Golubchik
17a9470e08 use "default" plugin configuration by default, not "none".
enable maria in the default plugin configuration

config/ac-macros/plugins.m4:
  typo in comment fixed.
  change default plugin configuration to be "default" not "none".
  don't print default plugin configuration in the help text (as it's "default" anyway)
configure.in:
  use "default" plugin configuration by default, not "none"
storage/maria/plug.in:
  enable maria in the default plugin configuration
2008-06-05 21:48:43 +02:00
Michael Widenius
ab75389acd Automatic merge 2008-06-04 12:44:39 +03:00
Michael Widenius
7d39726ba8 Fixed failing trnman-t unit test
mysql-test/valgrind.supp:
  Fixed suppression rule
storage/maria/unittest/trnman-t.c:
  Test failed becasue it accessed reused structures.
  I fixed this by creating a separate array to hold trids for the transactions
2008-06-04 12:39:54 +03:00
Guilhem Bichot
39049addce Making maria-recover.test work the same with debug and non-debug builds: one error message was specific of
debug builds and is now removed, left only in non-ha-maria programs.

mysql-test/r/maria-recover.result:
  This warning is not thrown anymore when used in ha_maria
mysql-test/t/maria-recover.test:
  In this patch, corruption warnings are unified between debug and non-debug builds, so test can run on both
storage/maria/ha_maria.cc:
  declare that Maria is used from ha_maria
storage/maria/ma_static.c:
  new variable to tell if Maria is used from ha_maria
storage/maria/maria_def.h:
  Comment describing what maria_print_error() does. And change of this macro: it now does nothing when Maria
  is used from ha_maria.
2008-06-04 10:43:12 +02:00
Guilhem Bichot
a5bcb63f45 WL#4374 "Maria - force start if Recovery fails multiple times"
http://forge.mysql.com/worklog/task.php?id=4374
new option --maria-force-start-after-recovery-failures=N; number of consecutive recovery failures (failures
of log reading or recovery processing, anything in [translog_init(),maria_recovery_from_log()])
is stored in the control file; if at a Maria start they are more than N, logs are removed. This is for automated
systems which have to run whatever happens. As tables risk staying corrupted, --maria-recover should also
be used on them: this revision makes maria-recover work (it was disabled).
Fixed bug in translog_is_log_files(). translog_init() now prints message to error log if failed.
Removed \0 in the output of SHOW ENGINE MARIA LOGS; removed hard-coded engine name there.

KNOWN_BUGS.txt:
  As option --maria-force-start-after-recovery-failures is added, it corresponds to the wish "we should fix that if this happens etc".
  LOAD INDEX is not ignored since a few weeks. Listed concurrency bugs have been fixed some time ago.
  Recovery of fulltext and GIS indexes works since a few weeks.
mysql-test/include/maria_make_snapshot.inc:
  configurable prefix in table's name (so far 't' or 't_corrupted')
mysql-test/include/maria_make_snapshot_for_comparison.inc:
  configurable prefix in table's name (so far 't' or 't_corrupted')
mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc:
  configurable prefix in table's name (so far 't' or 't_corrupted')
mysql-test/include/maria_verify_recovery.inc:
  configurable prefix in table's name (so far 't' or 't_corrupted')
mysql-test/lib/mtr_report.pl:
  new test maria-recover.test generates expected corruption warnings in the error log. maria-recovery.test's corrupted table is renamed to t_corrupted1 instead of t1.
mysql-test/r/maria-preload.result:
  result update. maria_pagecache_read* values are similar to the previous version of this file, though a bit bigger
  because using the information_schema and the join leads to some internal maria temp table being used, and thus some
  blocks of it being read.
mysql-test/r/maria-purge.result:
  engine's name in SHOW ENGINE MARIA LOGS changed.
mysql-test/r/maria-recover.result:
  result for new test. We see corruption messages at first SELECT and then none at second SELECT, expected.
mysql-test/r/maria-recovery.result:
  result update
mysql-test/r/maria.result:
  new variables show up
mysql-test/t/disabled.def:
  BUG#34911 is not fixed but the test had been made independent of the bug (workaround). A new bug (crash) has popped recently, so it has to stay
  disabled (BUG#35107).
mysql-test/t/maria-preload.test:
  Work around BUG#34911 "FLUSH STATUS doesn't flush what it should":
  compute differences in status variables before and after relevant queries
mysql-test/t/maria-recover-master.opt:
  test --maria-recover
mysql-test/t/maria-recover.test:
  Test of the --maria-recover option (build a corrupted table and see if it is auto-repaired)
mysql-test/t/maria-recovery-big.test:
  update for new API of include/maria*.inc
mysql-test/t/maria-recovery-bitmap.test:
  update for new API of include/maria*.inc
mysql-test/t/maria-recovery.test:
  update for new API of include/maria*.inc. Corrupted table t1 renamed to t_corrupted1, so that mtr_report.pl
  does not blindly remove all corruption messages for t1 which is
  a common name.
storage/maria/ha_maria.cc:
  Enabling maria-recover.
  Adding option and global variable --maria_force_start_after_recovery_failures: ha_maria_init()
  calls mark_recovery_start() and mark_recovery_success() to keep track of failed consecutive recoveries
  and remove logs if needed.
  Removed \0 in the output of SHOW ENGINE MARIA LOGS; removed hard-coded engine name there.
storage/maria/ma_checkpoint.c:
  new prototype
storage/maria/ma_control_file.c:
  Storing in one byte in the control file, the number of consecutive recovery failures.
storage/maria/ma_control_file.h:
  new prototype
storage/maria/ma_init.c:
  new prototype
storage/maria/ma_locking.c:
  Need to update open_count on disk at first write and close for transactional tables, like we already did for
  non-transactional tables, otherwise we cannot notice that the table is dubious.
storage/maria/ma_loghandler.c:
  translog_is_log_files() is made more generic to serve either to search or to delete logs (the latter is
  for --maria-force-start-after-recovery-failures). It also had a bug (always returned FALSE).
storage/maria/ma_loghandler.h:
  export function because ha_maria::mark_recovery_start() needs it
storage/maria/ma_recovery.c:
  changing name of maria_recover() to distinguish from the maria-recover option.
storage/maria/ma_recovery.h:
  changing name of maria_recover() to distinguish from the maria-recover option.
storage/maria/ma_test_force_start.pl:
  Test of --maria-force-start-after-recovery-failures (and also, to be realistic, of --maria-recover).
  This is standalone because mysql-test-run does not support testing that multiple mysqld restarts expectedly failed.
  I'll have to run it on my machine and also on a Windows machine.
storage/maria/unittest/ma_control_file-t.c:
  adding recovery_failures to the test
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  fix for compiler warning (unused variable in non-debug build)
2008-06-02 22:53:25 +02:00
Michael Widenius
9977cae802 Fixed build errors/warnings caused by my last push
mysql-test/valgrind.supp:
  Added suppression for not relevant warning for memory leak in dlclose
storage/maria/ma_blockrec.c:
  Fixed build error on Windows
storage/maria/ma_delete_all.c:
  Fixed call to wrong function
storage/maria/ma_state.c:
  Added purcov suppression block
  Removed temporary debug printing
2008-06-02 10:27:41 +03:00
unknown
0816d9a70e After merge fixes
mysys/my_handler_errors.h:
  Updated error messages
storage/maria/ha_maria.cc:
  After merge fix
storage/maria/ma_rt_key.c:
  Use share->state.state instead of info->state
storage/maria/ma_rt_test.c:
  After merge fix
2008-05-29 23:56:27 +03: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
5099033c26 WL#3138: Maria - fast "SELECT COUNT(*) FROM t;" and "CHECKSUM TABLE t"
Added argument to maria_end_bulk_insert() to know if the table will be deleted after the operation
Fixed wrong call to strmake
Don't call bulk insert in case of inserting only one row (speed optimization as starting/stopping bulk insert
Allow storing year 2155 in year field
When running with purify/valgrind avoid copying structures over themself
Added hook 'trnnam_end_trans_hook' that is called when transaction ends
Added trn->used_tables that is used to an entry for all tables used by transaction
Fixed that ndb doesn't crash on duplicate key error when start_bulk_insert/end_bulk_insert are not called


include/maria.h:
  Added argument to maria_end_bulk_insert() to know if the table will be deleted after the operation
include/my_tree.h:
  Added macro 'reset_free_element()' to be able to ignore calls to the external free function.
  Is used to optimize end-bulk-insert in case of failures, in which case we don't want write the remaining keys in the tree
mysql-test/install_test_db.sh:
  Upgrade to new mysql_install_db options
mysql-test/r/maria-mvcc.result:
  New tests
mysql-test/r/maria.result:
  New tests
mysql-test/suite/ndb/r/ndb_auto_increment.result:
  Fixed error message now when bulk insert is not always called
mysql-test/suite/ndb/t/ndb_auto_increment.test:
  Fixed error message now when bulk insert is not always called
mysql-test/t/maria-mvcc.test:
  Added testing of versioning of count(*)
mysql-test/t/maria-page-checksum.test:
  Added comment
mysql-test/t/maria.test:
  More tests
mysys/hash.c:
  Code style change
sql/field.cc:
  Allow storing year 2155 in year field
sql/ha_ndbcluster.cc:
  Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
sql/ha_ndbcluster.h:
  Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
sql/ha_partition.cc:
  Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
sql/ha_partition.h:
  Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
sql/handler.cc:
  Don't call get_dup_key() if there is no table object. This can happen if the handler generates a duplicate key error on commit
sql/handler.h:
  Added new argument to end_bulk_insert() to signal if the bulk insert should ignored (ie, the table will be deleted)
sql/item.cc:
  Style fix
  Removed compiler warning
sql/log_event.cc:
  Added new argument to ha_end_bulk_insert()
sql/log_event_old.cc:
  Added new argument to ha_end_bulk_insert()
sql/mysqld.cc:
  Removed compiler warning
sql/protocol.cc:
  Added DBUG
sql/sql_class.cc:
  Added DBUG
  Fixed wrong call to strmake
sql/sql_insert.cc:
  Don't call bulk insert in case of inserting only one row (speed optimization as starting/stopping bulk insert involves a lot of if's)
  Added new argument to ha_end_bulk_insert()
sql/sql_load.cc:
  Added new argument to ha_end_bulk_insert()
sql/sql_parse.cc:
  Style fixes
  Avoid goto in common senario
sql/sql_select.cc:
  When running with purify/valgrind avoid copying structures over themself.  This is not a real bug in itself, but it's a waste of cycles and causes valgrind warnings
sql/sql_select.h:
  Avoid copying structures over themself.  This is not a real bug in itself, but it's a waste of cycles and causes valgrind warnings
sql/sql_table.cc:
  Call HA_EXTRA_PREPARE_FOR_DROP if table created by ALTER TABLE is going to be dropped
  Added new argument to ha_end_bulk_insert()
storage/archive/ha_archive.cc:
  Added new argument to end_bulk_insert()
storage/archive/ha_archive.h:
  Added new argument to end_bulk_insert()
storage/federated/ha_federated.cc:
  Added new argument to end_bulk_insert()
storage/federated/ha_federated.h:
  Added new argument to end_bulk_insert()
storage/maria/Makefile.am:
  Added ma_state.c and ma_state.h
storage/maria/ha_maria.cc:
  Versioning of count(*) and checksum
  - share->state.state is now assumed to be correct, not handler->state
  - Call _ma_setup_live_state() in external lock to get count(*)/checksum versioning. In case of
    not versioned and not concurrent insertable table, file->s->state.state contains the correct state information
  
  Other things:
  - file->s -> share
  - Added DBUG_ASSERT() for unlikely case
  - Optimized end_bulk_insert() to not write anything if table is going to be deleted (as in failed alter table)
  - Indentation changes in external_lock becasue of removed 'goto' caused a big conflict even if very little was changed
storage/maria/ha_maria.h:
  New argument to end_bulk_insert()
storage/maria/ma_blockrec.c:
  Update for versioning of count(*) and checksum
  Keep share->state.state.data_file_length up to date (not info->state->data_file_length)
  Moved _ma_block_xxxx_status() and maria_versioning() functions to ma_state.c
storage/maria/ma_check.c:
  Update and use share->state.state instead of info->state
  info->s to share
  Update info->state at end of repair
  Call _ma_reset_state() to update share->state_history at end of repair
storage/maria/ma_checkpoint.c:
  Call _ma_remove_not_visible_states() on checkpoint to clean up not visible state history from tables
storage/maria/ma_close.c:
  Remember state history for running transaction even if table is closed
storage/maria/ma_commit.c:
  Ensure we always call trnman_commit_trn() even if other calls fails. If we don't do that, the translog and state structures will not be freed
storage/maria/ma_delete.c:
  Versioning of count(*) and checksum:
  - Always update info->state->checksum and info->state->records
storage/maria/ma_delete_all.c:
  Versioning of count(*) and checksum:
  - Ensure that share->state.state is updated, as here is where we store the primary information
storage/maria/ma_dynrec.c:
  Use lock_key_trees instead of concurrent_insert to check if trees should be locked.
  This allows us to lock trees both for concurrent_insert and for index versioning.
storage/maria/ma_extra.c:
  Versioning of count(*) and checksum:
  - Use share->state.state instead of info->state
  - share->concurrent_insert -> share->non_transactional_concurrent_insert
  - Don't update share->state.state from info->state if transactional table
  
  Optimization:
  - Don't flush io_cache or bitmap if we are using FLUSH_IGNORE_CHANGED
storage/maria/ma_info.c:
  Get most state information from current state
storage/maria/ma_init.c:
  Add hash table and free function to store states for closed tables
  Install hook for transaction commit/rollback to update history state
storage/maria/ma_key_recover.c:
  Versioning of count(*) and checksum:
  - Use share->state.state instead of info->state
storage/maria/ma_locking.c:
  Versioning of count(*) and checksum:
  - Call virtual functions (if exists) to restore/update status
  - Move _ma_xxx_status() functions to ma_state.c
  
  info->s -> share
storage/maria/ma_open.c:
  Versioning of count(*) and checksum:
  - For not transactional tables, set info->state to point to new allocated state structure.
  - Initialize new info->state_start variable that points to state at start of transaction
  - Copy old history states from hash table (maria_stored_states) first time the table is opened
  - Split flag share->concurrent_insert to non_transactional_concurrent_insert & lock_key_tree
  - For now, only enable versioning of tables without keys (to be fixed in soon!)
  - Added new virtual function to restore status in maria_lock_database)
  
  More DBUG
storage/maria/ma_page.c:
  Versioning of count(*) and checksum:
  - Use share->state.state instead of info->state
  - Modify share->state.state.key_file_length under share->intern_lock
storage/maria/ma_range.c:
  Versioning of count(*) and checksum:
  - Lock trees based on share->lock_key_trees
  
  info->s -> share
storage/maria/ma_recovery.c:
  Versioning of count(*) and checksum:
  - Use share->state.state instead of info->state
  - Update state information on close and when reenabling logging
storage/maria/ma_rkey.c:
  Versioning of count(*) and checksum:
  - Lock trees based on share->lock_key_trees
storage/maria/ma_rnext.c:
  Versioning of count(*) and checksum:
  - Lock trees based on share->lock_key_trees
storage/maria/ma_rnext_same.c:
  Versioning of count(*) and checksum:
  - Lock trees based on share->lock_key_trees
  - Only skip rows based on file length if non_transactional_concurrent_insert is set
storage/maria/ma_rprev.c:
  Versioning of count(*) and checksum:
  - Lock trees based on share->lock_key_trees
storage/maria/ma_rsame.c:
  Versioning of count(*) and checksum:
  - Lock trees based on share->lock_key_trees
storage/maria/ma_sort.c:
  Use share->state.state instead of info->state
  Fixed indentation
storage/maria/ma_static.c:
  Added maria_stored_state
storage/maria/ma_update.c:
  Versioning of count(*) and checksum:
  - Always update info->state->checksum and info->state->records
  - Remove optimization for index file update as it doesn't work for transactional tables
storage/maria/ma_write.c:
  Versioning of count(*) and checksum:
  - Always update info->state->checksum and info->state->records
storage/maria/maria_def.h:
  Move MARIA_STATUS_INFO to ma_state.h
  
  Changes to MARIA_SHARE:
  - Added state_history to store count(*)/checksum states
  - Added in_trans as counter if table is used by running transactions
  - Split concurrent_insert into lock_key_trees and on_transactional_concurrent_insert.
  - Added virtual function lock_restore_status
  
  Changes to MARIA_HA:
  - save_state -> state_save
  - Added state_start to store state at start of transaction
storage/maria/maria_pack.c:
  Versioning of count(*) and checksum:
  - Use share->state.state instead of info->state
  
  Indentation fixes
storage/maria/trnman.c:
  Added hook 'trnnam_end_trans_hook' that is called when transaction ends
  Added trn->used_tables that is used to an entry for all tables used by transaction
  More DBUG
  Changed return type of trnman_end_trn() to my_bool
  Added trnman_get_min_trid() to get minimum trid in use.
  Added trnman_exists_active_transactions() to check if there exist a running transaction started between two commit id
storage/maria/trnman.h:
  Added 'used_tables'
  Moved all pointers into same groups to get better memory alignment
storage/maria/trnman_public.h:
  Added prototypes for new functions and variables
  Chagned return type of trnman_end_trn() to my_bool
storage/myisam/ha_myisam.cc:
  Added argument to end_bulk_insert() if operation should be aborted
storage/myisam/ha_myisam.h:
  Added argument to end_bulk_insert() if operation should be aborted
storage/maria/ma_state.c:
  Functions to handle state of count(*) and checksum
storage/maria/ma_state.h:
  Structures and declarations to handle state of count(*) and checksum
2008-05-29 18:33:33 +03:00
unknown
5ca17f0dc6 Logical merge of changes in myisam to maria. 2008-05-26 17:10:32 +03:00
unknown
e8899b1fc7 Added dependense to get the file in distribution tarball. 2008-05-07 07:58:13 +03:00
unknown
c415ca9891 Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-advance
into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-loghandlerfixes


storage/maria/ma_loghandler.c:
  Auto merged
2008-05-07 02:29:12 +03:00
unknown
76d9f3c619 Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-bug34695
into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-loghandlerfixes


storage/maria/ma_loghandler.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Auto merged
2008-05-07 02:26:54 +03:00
unknown
ed5fe6d3eb compiler warning on non-debug build 2008-04-24 23:24:21 +02:00
unknown
5e0fc121fb No more 'have_maria' variable, use information schema.engines.
Fix for some pushbuild failures.


BitKeeper/deleted/.del-have_maria.require:
  Delete: mysql-test/r/have_maria.require
mysql-test/include/have_maria.inc:
  no more 'have_maria' variable, use information schema.engines
mysql-test/r/maria-recovery-rtree-ft.result:
  removed piece
mysql-test/t/maria-recovery-rtree-ft.test:
  This portion seems to break on some pushbuild machine, let's disable
  it for now until BUG#36319 is fixed.
sql/set_var.cc:
  no more 'have_maria' variable, use information schema.engines
storage/maria/ma_rt_split.c:
  On non-debug builds, the logging was wrong
2008-04-24 23:13:56 +02:00
unknown
0b421a3e06 compiler warning 2008-04-24 18:43:32 +02:00
unknown
6f829a4f77 Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria
into  gbichot4.local:/home/mysql_src/mysql-maria-monty
2008-04-24 17:34:52 +02: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
bc31f00577 Fixed bugs related to huge records where group list do not
fit in on one page (many chunks type 0 created) (BUG#34695).
Maria log dump now can read unittest logs.


storage/maria/CMakeLists.txt:
  Maria log dump now can read unittest logs.
storage/maria/Makefile.am:
  Maria log dump now can read unittest logs.
storage/maria/unittest/sequence_storage.c:
  New BitKeeper file ``storage/maria/unittest/sequence_storage.c''
storage/maria/unittest/sequence_storage.h:
  New BitKeeper file ``storage/maria/unittest/sequence_storage.h''
2008-04-22 13:04:18 +03:00
unknown
d84e2a7d1d Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria
into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-bug35040


storage/maria/unittest/ma_pagecache_rwconsist.c:
  Auto merged
2008-04-21 17:17:21 +03:00
unknown
047ce0dcdc Problems of partially freed waiting quque fixed (BUG#35040)
mysys/wqueue.c:
  Problems of partially freed waiting quque fixed.
storage/maria/unittest/ma_pagecache_rwconsist.c:
  Explicitly assigned initial value for increasing readability.
  Dbug file flush after each line for better debugging.
  Fixed code style.
2008-04-21 17:14:58 +03:00
unknown
3ad087366e Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria
into  gbichot4.local:/home/mysql_src/mysql-maria-clean
2008-04-16 16:32:25 +02:00
unknown
75c8e2f4be Fix for ma_test_all-t failure and dbug/tests-t failure on Solaris:
on that machine, "perl" calls /usr/local/bin/perl (so this is what
runs unittest's unit.pl), while some test scripts (ma_test_recovery.pl
etc) use /usr/bin/perl which seems to either conflict with /usr/local/bin/perl
or have problems of its own (Perl errors when loading modules).
Instead we use perl from the PATH. /usr/bin/env seems to be available
on lots of Unix machines.


dbug/tests-t.pl:
  look for perl in PATH
storage/maria/unittest/ma_test_all-t:
  Look for perl in PATH
storage/maria/unittest/ma_test_recovery.pl:
  Look for perl in PATH. Close MY_LOG to flush buffers to that diff sees
  the whole file
2008-04-16 16:31:38 +02:00
unknown
e5b4c350b7 possible BUG#22320 removed because it does not help. 2008-04-15 22:42:50 +03:00
unknown
130fb4ddd9 Bug#22320 workaround (second attempt) 2008-04-15 17:41:48 +03:00
unknown
d12c8374bc BUG#22320 work around 2008-04-14 17:33:43 +03:00
unknown
28131daa26 Fix for BUG#35351 "Maria: R-tree index does not return all expected rows"
BitKeeper/triggers/post-commit:
  commits to Maria public list
mysql-test/r/maria-gis-rtree.result:
  result is good now, similar to MyISAM's (gis-rtree.result)
storage/maria/ma_rt_index.c:
  R-tree key-reading code used info->buff as a cache for the next key read,
  but between key read and next key read, there is record read, which
  uses info->buff too. In detail, during a SELECT:
  First key read: maria_rfirst() is called, which calls maria_rtree_find_first() which calls 
  maria_rtree_find_req() which comes here
          if (after_key < last)
          {
            // ! the list of keys is copied to info->buff
            // and info->buff is remembered in info->int_keypos
            info->int_keypos= info->buff;
            info->int_maxpos= info->buff + (last - after_key);
            memcpy(info->buff, after_key, last - after_key);
            info->keyread_buff_used= 0;
          }
  Then record read:
  _ma_read_block_record() (as well as some other functions of
  ma_blockrec.c) overwrites info->buff:
    if (!(buff= pagecache_read(share->pagecache,
                               &info->dfile, ma_recordpos_to_page(record_pos), 0,
                               info->buff, share->page_type,
                               PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
  So, this has the effect that the keys saved by maria_rtree_find_req() are now lost:
  info->int_keypos now contains a copy of a data page!
  Then maria_rnext_same() runs (to find second row), calls maria_rtree_find_next() which
  does:
    if (!info->keyread_buff_used)
    {
      uchar *key= info->int_keypos;
      while (key < info->int_maxpos)
      {
        if (!maria_rtree_key_cmp(keyinfo->seg,
                                 info->first_mbr_key, key,
                                 info->last_rkey_length, search_flag))
  
  i.e. maria_rtree_key_cmp() is doing comparisons on values it reads from the data page.
  Naturally this is bad and no row is found.
  Origin of the bug: MARIA_HA::keyread_buff is new in Maria.
  Solution: use keyread_buff instead of buff (like _ma_search_next() does),
  in R-tree code. Note that ma_blockrec.c functions also use keyread_buff
  but they all are write-functions, which should not be running close
  to next-key-read. Also note that some ma_rt_index.c functions still
  use info->buff, but they are about writes too.
  Thanks Monty for the idea.
2008-04-11 11:53:21 +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
b765997467 WL#3072 - Maria recovery
When applying a REDO_INDEX_[FREE|NEW]_PAGE, update state members only
if record is newer than current state.
Print a warning when an old Maria is zero-ing out portions of the
control file which it does not know.


storage/maria/ma_control_file.c:
  Print a warning when an old Maria is zero-ing out portions of the
  control file which it does not know; it may help us when helping
  troubleshoot customers' and users' problems.
storage/maria/ma_key_recover.c:
  When applying a REDO_INDEX_[FREE|NEW]_PAGE, we should update the state
  members (key_root, key_del) only if this REDO is newer than the current
  state. We cannot just update it unconditionally, because that may
  change it to an old state, which may not be later corrected if all later
  REDOs are entirely skipped due to their page not being in the dirty pages
  list of the checkpoint record.
2008-04-08 15:27:39 +02:00
unknown
2d327efd89 Fixing the little bug that if a new version reads an old control file,
it couldn't entirely write its new information (it could not write
more bytes than the old format wrote).


storage/maria/ma_control_file.c:
  Let ma_control_file_write_and_force() return error if called when
  file is not open.
  When the file was of an old version (no room for our changeable part)
  we upgrade this part. When the file was of a new version we re-use its
  format but zero the parts which we can't maintain.
storage/maria/ma_init.c:
  ma_control_file_write_and_force() now does not assert if called
  when control file is not open.
storage/maria/ma_recovery.c:
  missing ";" (thanks Peter Zaitsev for the bug report and Monty for the patch)
2008-04-07 18:59:20 +02: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
de4834090a Fixed problem switching to the new file is file appeared
to be bigger then limit.
2008-04-04 00:46:33 +03:00
unknown
f094eff1d9 Injecting more "const" declarations into code which does not change
pointed data.
I ran gcc -Wcast-qual on storage/maria, this identified un-needed casts,
a couple of functions which said they had a const parameter though
they changed the pointed content! This is fixed here. Some suspicious
places receive a comment.
The original intention of running -Wcast-qual was to find what code
changes R-tree keys: I added const words, but hidden casts
like those of int2store (casts target to (uint16*)) removed const
checking; -Wcast-qual helped find those hidden casts.
Log handler does not change the content pointed by LEX_STRING::str it
receives, so we now use a struct which has a const inside, to emphasize
this and be able to pass "const uchar*" buffers to log handler
without fear of their content being changed by it.
One-line fix for a merge glitch (when merging from MyISAM).


include/m_string.h:
  As Maria's log handler uses LEX_STRING but never changes the content
  pointed by LEX_STRING::str, and assigns uchar* into this member most
  of the time, we introduce a new struct LEX_CUSTRING
  (C const U unsigned) for the log handler.
include/my_global.h:
  In macros which read pointed content: use const pointers so that
  gcc -Wcast-qual does not warn about casting a const pointer to non-const.
include/my_handler.h:
  In macros which read pointed content: use const pointers so that
  gcc -Wcast-qual does not warn about casting a const pointer to non-const.
  ha_find_null() does not change *a.
include/my_sys.h:
  insert_dynamic() does not change *element.
include/myisampack.h:
  In macros which read pointed content: use const pointers so that
  gcc -Wcast-qual does not warn about casting a const pointer to non-const.
mysys/array.c:
  insert_dynamic() does not change *element
mysys/my_handler.c:
  ha_find_null() does not change *a
storage/maria/ma_bitmap.c:
  Log handler receives const strings now
storage/maria/ma_blockrec.c:
  Log handler receives const strings now.
  _ma_apply_undo_row_delete/update() do change *header.
storage/maria/ma_blockrec.h:
  correct prototype
storage/maria/ma_check.c:
  Log handler receives const strings now. Un-needed casts
storage/maria/ma_checkpoint.c:
  Log handler receives const strings now
storage/maria/ma_checksum.c:
  unneeded cast
storage/maria/ma_commit.c:
  Log handler receives const strings now
storage/maria/ma_create.c:
  Log handler receives const strings now
storage/maria/ma_dbug.c:
  fixing warning of gcc -Wcast-qual
storage/maria/ma_delete.c:
  Log handler receives const strings now
storage/maria/ma_delete_all.c:
  Log handler receives const strings now
storage/maria/ma_delete_table.c:
  Log handler receives const strings now
storage/maria/ma_dynrec.c:
  fixing some warnings of gcc -Wcast-qual. Unneeded casts removed.
  Comment about function which lies.
storage/maria/ma_ft_parser.c:
  fix for warnings of gcc -Wcast-qual, removing unneeded casts
storage/maria/ma_ft_update.c:
  less casts, comment
storage/maria/ma_key.c:
  less casts, stay const (warnings of gcc -Wcast-qual)
storage/maria/ma_key_recover.c:
  Log handler receives const strings now
storage/maria/ma_loghandler.c:
  Log handler receives const strings now
storage/maria/ma_loghandler.h:
  Log handler receives const strings now
storage/maria/ma_loghandler_lsn.h:
  In macros which read pointed content: use const pointers so that
  gcc -Wcast-qual does not warn about casting a const pointer to non-const.
storage/maria/ma_page.c:
  Log handler receives const strings now; more const
storage/maria/ma_recovery.c:
  Log handler receives const strings now
storage/maria/ma_rename.c:
  Log handler receives const strings now
storage/maria/ma_rt_index.c:
  more const, to emphasize that functions don't change pointed content.
  best_key= NULL was forgotten during merge from MyISAM a few days ago,
  was causing a Valgrind warning
storage/maria/ma_rt_index.h:
  new proto
storage/maria/ma_rt_key.c:
  more const
storage/maria/ma_rt_key.h:
  new proto
storage/maria/ma_rt_mbr.c:
  more const for functions which deserve it
storage/maria/ma_rt_mbr.h:
  new prototype
storage/maria/ma_rt_split.c:
  make const what is not changed.
storage/maria/ma_search.c:
  un-needed casts, more const
storage/maria/ma_sp_key.c:
  more const
storage/maria/ma_unique.c:
  un-needed casts.
storage/maria/ma_write.c:
  Log handler receives const strings now
storage/maria/maria_def.h:
  some more const
storage/maria/unittest/ma_test_loghandler-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Log handler receives const strings now
2008-04-03 15:40:25 +02:00
unknown
23536e8709 Added new routines for storing/restoring sequences.
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Nornal command line added.
  Added ability store and replay sequence used in the test.
2008-04-02 18:08:30 +03:00