Commit graph

24 commits

Author SHA1 Message Date
Sergei Golubchik
ef781162ff Merge branch '10.4' into 10.5 2022-05-09 22:04:06 +02:00
Sergei Golubchik
a70a1cf3f4 Merge branch '10.3' into 10.4 2022-05-08 23:03:08 +02:00
Rucha Deodhar
9b2d36660b MDEV-20207: Assertion ! is_set() failed in Diagnostics_area::set_eof_status
upon HANDLER READ

Analysis: The error state is not stored while checking condition and key
name.
Fix: Return true while checking condition and key name if error is reported
because geometry object can't be created from the data in the index value
for HANDLER READ.
2022-04-26 12:40:11 +05:30
Monty
4102f1589c Aria will now register it's transactions
MDEV-22531 Remove maria::implicit_commit()
MDEV-22607 Assertion `ha_info->ht() != binlog_hton' failed in
           MYSQL_BIN_LOG::unlog_xa_prepare

From the handler point of view, Aria now looks like a transactional
engine. One effect of this is that we don't need to call
maria::implicit_commit() anymore.

This change also forces the server to call trans_commit_stmt() after doing
any read or writes to system tables.  This work will also make it easier
to later allow users to have system tables in other engines than Aria.

To handle the case that Aria doesn't support rollback, a new
handlerton flag, HTON_NO_ROLLBACK, was added to engines that has
transactions without rollback (for the moment only binlog and Aria).

Other things
- Moved freeing of MARIA_SHARE to a separate function as the MARIA_SHARE
  can be still part of a transaction even if the table has closed.
- Changed Aria checkpoint to use the new MARIA_SHARE free function. This
  fixes a possible memory leak when using S3 tables
- Changed testing of binlog_hton to instead test for HTON_NO_ROLLBACK
- Removed checking of has_transaction_manager() in handler.cc as we can
  assume that as the transaction was started by the engine, it does
  support transactions.
- Added new class 'start_new_trans' that can be used to start indepdendent
  sub transactions, for example while reading mysql.proc, using help or
  status tables etc.
- open_system_tables...() and open_proc_table_for_Read() doesn't anymore
  take a Open_tables_backup list. This is now handled by 'start_new_trans'.
- Split thd::has_transactions() to thd::has_transactions() and
  thd::has_transactions_and_rollback()
- Added handlerton code to free cached transactions objects.
  Needed by InnoDB.

squash! 2ed35999f2a2d84f1c786a21ade5db716b6f1bbc
2020-05-23 12:29:10 +03:00
Vicențiu Ciorbaru
45bc7574fb MDEV-18650: Options deprecated in previous versions - storage_engine
Remove usage of deprecated variable storage_engine. It was deprecated in 5.5 but
it never issued a deprecation warning. Make it issue a warning in 10.5.1.

Replaced with default_storage_engine.
2020-02-13 13:42:01 +02:00
Monty
163b34fe25 Optimize flush tables with read lock (FTWRL) to not wait for select's
Part of MDEV-5336 Implement LOCK FOR BACKUP

The idea is that instead of waiting in close_cached_tables() for all
tables to be closed, we instead call flush_tables() that does:
- Flush not used objects in table cache to free memory
- Collect all tables that are open
- Call HA_EXTRA_FLUSH on the objects, to get them into "closed state"
- Added HA_EXTRA_FLUSH support to archive and CSV
- Added multi-user protection to HA_EXTRA_FLUSH in MyISAM and Aria

The benefit compared to old code is:
- FTWRL doesn't have to wait for long running read operations or
  open HANDLER's
2018-12-09 22:12:25 +02:00
Varun Gupta
93c360e3a5 MDEV-15253: Default optimizer setting changes for MariaDB 10.4
use_stat_tables= PREFERABLY
optimizer_use_condition_selectivity= 4
2018-12-09 09:22:00 +05:30
Oleksandr Byelkin
de745ecf29 MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operations 2018-07-04 19:13:55 +02:00
Sergey Vojtovich
d665e79c5b MDEV-7660 - MySQL WL#6671 "Improve scalability by not using thr_lock.c locks
for InnoDB tables"

Don't use thr_lock.c locks for InnoDB tables. Below is list of changes that
were needed to implement this:
- HANDLER OPEN acquireis MDL_SHARED_READ instead of MDL_SHARED
- HANDLER READ calls external_lock() even if SE is not going to be locked by
  THR_LOCK
- InnoDB lock wait timeouts are now honored which are much shorter by default
  than server lock wait timeouts (1 year vs 50 seconds)
- with @@autocommit= 1 LOCK TABLES disables autocommit implicitely, though
  user still sees @@autocommt= 1
- the above starts implicit transaction
- transactions started by LOCK TABLES are now rolled back on disconnect
  (previously everything was committed due to autocommit)
- transactions started by LOCK TABLES are now rolled back by ROLLBACK
  (previously everything was committed due to autocommit)
- it is now impossible to change BINLOG_FORMAT under LOCK TABLES (at least
  to statement) due to running transaction
- LOCK TABLES WRITE is additionally handled by MDL
- ...in contrast LOCK TABLES READ protection against DML is pure InnoDB
- combining transactional and non-transactional tables under LOCK TABLES
  may cause rolled back changes in transactional table and "committed"
  changes in non-transactional table
- user may disable innodb_table_locks, which will cause LOCK TABLES to be
  noop basically

Removed tests for BUG#45143 and BUG#55930 which cover InnoDB + THR_LOCK. To
operate properly these tests require code flow to go through THR_LOCK debug
sync points, which is not the case after this patch. These tests are removed
by WL#6671 as well. An alternative is to port them to different storage engine.
2016-11-03 16:35:15 +04:00
Nirbhay Choubey
7305be2f7e MDEV-5535: Cannot reopen temporary table
mysqld maintains a list of TABLE objects for all temporary
tables created within a session in THD. Here each table is
represented by a TABLE object.

A query referencing a particular temporary table for more
than once, however, failed with ER_CANT_REOPEN_TABLE error
because a TABLE_SHARE was allocate together with the TABLE,
so temporary tables always had only one TABLE per TABLE_SHARE.

This patch lift this restriction by separating TABLE and
TABLE_SHARE objects and storing TABLE_SHAREs for temporary
tables in a list in THD, and TABLEs in a list within their
respective TABLE_SHAREs.
2016-06-10 18:39:43 -04:00
Sergey Vojtovich
282497dd6d MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
Sergei Golubchik
d28d3ba40d 10.0-base merge 2013-12-16 13:02:21 +01:00
Sergei Golubchik
c6d30805db 5.5 merge 2013-11-23 00:50:54 +01:00
Sergei Golubchik
fa3f8a18b2 mysql-5.5.34 merge
(some patches reverted, test case added)
2013-11-19 13:16:25 +01:00
Sergei Golubchik
8367241d5a update handler.* tests 2013-07-12 21:41:20 +02:00
Sergei Golubchik
3ad01d00f2 error messages: name the storage engine explicitly,
instead of "used storage engine" and similar changes.
2013-04-09 23:27:07 +02:00
Sergei Golubchik
2ccf247e93 after merge changes:
* rename all debugging related command-line options
  and variables to start from "debug-", and made them all
  OFF by default.
* replace "MySQL" with "MariaDB" in error messages
* "Cast ... converted ... integer to it's ... complement"
  is now a note, not a warning
* @@query_cache_strip_comments now has a session scope,
  not global.
2011-12-12 23:58:40 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Michael Widenius
52b64be318 Fixed compiler warnings
client/readline.cc:
  Initialize not used variable (to kill wrong compiler warning)
mysql-test/suite/handler/aria.result:
  Updated test result
mysql-test/suite/handler/handler.inc:
  Changed index to ensure rows are in a fixed order
mysql-test/suite/handler/heap.result:
  Updated test result
mysql-test/suite/handler/innodb.result:
  Updated test result
mysql-test/suite/handler/myisam.result:
  Updated test result
plugin/handler_socket/handlersocket/Makefile.am:
  Use CXX flags to compile
sql/filesort.cc:
  Initialize variable that may be used
sql/log.cc:
  Initialize not used variable (to kill wrong compiler warning)
sql/opt_range_mrr.cc:
  Fixed cast to avoid compiler warning
storage/xtradb/fil/fil0fil.c:
  Added cast to avoid compiler warning
2011-02-25 20:15:27 +02:00
Michael Widenius
6c610ed979 Fixed build issues
- Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client
- Fixed bug in heap tables when doing handler read next-prev over last row


BUILD/compile-dist:
  - Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client
cmd-line-utils/libedit/vi.c:
  Fixed compiler warning about not checking return value for write
mysql-test/r/index_intersect.result:
  Updated results (missed this file in my last push)
mysql-test/suite/handler/aria.result:
  Updated test results
mysql-test/suite/handler/handler.inc:
  Changed test to use read next/read prev on key where there are duplicates that can come in different order depending on system
  Added testing of read next-prev over last row and read prev-next around first row
mysql-test/suite/handler/heap.result:
  Updated test results
mysql-test/suite/handler/init.inc:
  More rows to test
mysql-test/suite/handler/innodb.result:
  Updated test results
mysql-test/suite/handler/interface.result:
  Updated test results
mysql-test/suite/handler/myisam.result:
  Updated test results
mysql-test/t/variables-big.test:
  Fixed test to not fail on windows
mysql-test/valgrind.supp:
  Removed not matching fun: to get rid of valgrind warning
storage/heap/hp_rfirst.c:
  Added state so that we know if we have an active position in the index.
storage/heap/hp_rkey.c:
  Added state so that we know if we have an active position in the index.
storage/heap/hp_rnext.c:
  Handle reading several next after finding the last row (this caused a crash before)
storage/heap/hp_rprev.c:
  Handle reading several prev after finding the first row (this caused a crash before)
storage/xtradb/buf/buf0buf.c:
  Fixed compiler warning about uninitialized value
2011-02-23 14:46:16 +02:00
Michael Widenius
bda130e6b3 Updated test results for 5.3
Changed handler.inc to make test row order independent

mysql-test/r/table_elim.result:
  Updated test results for 5.3
mysql-test/suite/handler/aria.result:
  Updated result
mysql-test/suite/handler/handler.inc:
  Changed handler.inc to make test row order independent
mysql-test/suite/handler/heap.result:
  Updated result
mysql-test/suite/handler/innodb.result:
  Updated result
mysql-test/suite/handler/myisam.result:
  Updated result
2011-01-13 02:59:11 +02:00
Michael Widenius
0d01dd200f Added HANDLER support for MEMORY tables
Added key and file version numbers to MEMORY tables so that we can detect if someone has changed them between HANDLER calls.


mysql-test/suite/handler/aria.result:
  Fixed result after test changes
mysql-test/suite/handler/handler.inc:
  Changed test to use combined key to ensure rows are returned in a pre-determinated order.
mysql-test/suite/handler/heap.result:
  New result
mysql-test/suite/handler/heap.test:
  Added test for HANDLER + HEAP
mysql-test/suite/handler/innodb.result:
  Fixed result after test changes
mysql-test/suite/handler/myisam.result:
  Fixed result after test changes
sql/sql_handler.cc:
  Fixed wrong parameter to ha_index_next_same()
storage/heap/ha_heap.cc:
  Abort key scan if table has changed.
  Abort table scan if table has been recreated.
storage/heap/ha_heap.h:
  Added support for HANDLER
storage/heap/hp_clear.c:
  Increase version number so that we can notice changes if using HANDLER
storage/heap/hp_delete.c:
  Increase key data version number on key changes.
storage/heap/hp_rfirst.c:
  Remember version of key data
  Give error if using read-first on hash key.
storage/heap/hp_rkey.c:
  Remember version of key data
storage/heap/hp_rlast.c:
  Remember version of key data
  Give error if using read-last on hash key.
storage/heap/hp_rnext.c:
  Fixed that we get next key from last search.
storage/heap/hp_rprev.c:
  Fixed that we get previous key from last search.
storage/heap/hp_scan.c:
  Remember version of key and file data
storage/heap/hp_update.c:
  Increase key data version number on key changes.
storage/heap/hp_write.c:
  Increase key data version number on key changes.
2011-01-11 18:51:59 +02:00
Michael Widenius
050c004f5e Merge with 5.1
Fixes to get Aria handler tests to work.
Fixes LP#697597 "HANDLER + Aria asserts in maria-5.3-handler"
2011-01-11 15:36:41 +02:00
Michael Widenius
505c663a1e - Fixed that Aria works with HANDLER commands
- Added test case for Aria
- Tested HANDLER with HEAP (changes to HEAP code will be pushed in 5.3)
- Moved all HANDLER test to suite/handler.


mysql-test/Makefile.am:
  Added suite/handler
mysql-test/mysql-test-run.pl:
  Added suite/handler
mysql-test/r/lock_multi.result:
  Remove test that is already in handler test suite
mysql-test/suite/handler/aria.result:
  Test for HANDLER with Aria storage engine
mysql-test/suite/handler/aria.test:
  Test for HANDLER with Aria storage engine
mysql-test/suite/handler/handler.inc:
  Extended the general handler test
  Moved interface testing to 'interface.test'
mysql-test/suite/handler/init.inc:
  Common init for handler tests.
mysql-test/suite/handler/innodb.result:
  New results
mysql-test/suite/handler/innodb.test:
  Update to use new include files
mysql-test/suite/handler/interface.result:
  Test of HANDLER interface (not storage engine dependent parts)
mysql-test/suite/handler/interface.test:
  Test of HANDLER interface (not storage engine dependent parts)
mysql-test/suite/handler/myisam.result:
  New results
mysql-test/suite/handler/myisam.test:
  Update to use new include files
mysql-test/t/lock_multi.test:
  Remove test that is already in handler test suite
mysys/tree.c:
  Added missing handling of read previous (showed up in HEAP testing)
sql/handler.cc:
  Don't marka 'HA_ERR_RECORD_CHANGED' as fatal (can be used with HANDLER READ, especially with MEMORY ENGINE)
sql/handler.h:
  Added prototype for can_continue_handler_scan()
sql/sql_handler.cc:
  Re-initialize search if we switch from key to table search.
  Check if handler can continue searching between calls (via can_continue_handler_scan())
  Don't write common not fatal errors to log
storage/maria/ma_extra.c:
  Don't set index 0 as default. This forces call to ma_check_index() to set up index variables.
storage/maria/ma_ft_boolean_search.c:
  Ensure that info->last_key.keyinfo is set
storage/maria/ma_open.c:
  Don't set index 0 as default. This forces call to ma_check_index() to set up index variables.
storage/maria/ma_rkey.c:
  Trivial optimization
storage/maria/ma_rnext.c:
  Added missing code from mi_rnext.c to ensure that handler next/prev works.
storage/maria/ma_rsame.c:
  Simple optimizations
storage/maria/ma_search.c:
  Initialize info->last_key once and for all when we change keys.
storage/maria/ma_unique.c:
  Ensure that info->last_key.keyinfo is up to date.
2011-01-10 23:22:40 +02:00