Commit graph

174 commits

Author SHA1 Message Date
Yuchen Pei
d06b6de305
Merge branch '10.5' into 10.6 2024-01-11 12:59:22 +11:00
Sergei Golubchik
761d5c8987 MDEV-33092 Undefined reference to concurrency on Solaris
remove thr_setconcurrency()
followup for 8bbcaab160

Fix by Rainer Orth
2024-01-10 10:16:20 +01:00
Marko Mäkelä
1e1073b810 Merge 10.5 into 10.6 2021-05-04 07:37:38 +03:00
Marko Mäkelä
c6846757ac Merge 10.4 into 10.5 2021-05-03 14:34:48 +03:00
mkaruza
206d630ea0 MDEV-22227 Assertion `state_ == s_exec' failed in wsrep::client_state::start_transaction
Removed redundant code for BF abort transaction in `thr_lock.cc`.

TOI operations will ignore provided lock_wait_timeout and use `LONG_TIMEOUT`
until operation is finished.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2021-04-28 11:11:01 +03:00
Daniel Black
058484687a Add TL_FIRST_WRITE in SQL layer for determining R/W
Use < TL_FIRST_WRITE for determining a READ transaction.

Use TL_FIRST_WRITE as the relative operator replacing TL_WRITE_ALLOW_WRITE
as the minimium WRITE lock type.
2021-04-08 16:51:36 +10:00
Monty
10b88deb74 Changes needed for ColumnStore and insert cache
MCOL-3875 Columnstore write cache

The main change is to change thr_lock function get_status to
return a value that indicates we have to abort the lock.

Other thing:
- Made start_bulk_insert() and end_bulk_insert() protected so that the
  insert cache can use these
2020-06-14 19:39:42 +03:00
Monty
610bb1d2c0 Fixed bug thr_lock_info_init
This bug didn't cause any issues with current usage
2020-05-23 12:29:09 +03:00
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Marko Mäkelä
1f3bcff1f2 Remove unused declarations 2019-04-03 19:46:34 +03:00
Marko Mäkelä
2c1067166d Merge bb-10.2-ext into 10.3 2017-10-04 08:24:06 +03:00
Alexander Barkov
8ae8cd6348 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-10-02 22:35:13 +04:00
Vladislav Vaintroub
eba44874ca MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.
- Fix win64 pointer truncation warnings
(usually coming from misusing 0x%lx and long cast in DBUG)

- Also fix printf-format warnings

Make the above mentioned warnings fatal.

- fix pthread_join on Windows to set return value.
2017-09-28 17:20:46 +00:00
Monty
536215e32f Added DBUG_ASSERT_AS_PRINTF compile flag
If compiling a non DBUG binary with
-DDBUG_ASSERT_AS_PRINTF asserts will be
changed to printf + stack trace (of stack
trace are enabled).

- Changed #ifndef DBUG_OFF to
  #ifdef DBUG_ASSERT_EXISTS
  for those DBUG_OFF that was just used to enable
  assert
- Assert checking that could greatly impact
  performance where changed to DBUG_ASSERT_SLOW which
  is not affected by DBUG_ASSERT_AS_PRINTF
- Added one extra option to my_print_stacktrace() to
  get more silent in case of stack trace printing as
  part of assert.
2017-08-24 01:05:50 +02:00
Monty
44676ed5b1 Cleaned up output from thr_print_locks 2017-08-24 01:04:34 +02:00
Alexander Barkov
9bc3225642 Merge tag 'mariadb-10.2.6' into bb-10.2-ext 2017-05-26 19:32:28 +04:00
Monty
6a779a6d28 Make SEQUENCE working with replication
- Old sequence code forced row based replication for any statements that
  refered to a sequence table. What is new is that row based replication
  is now sequence aware:
   - NEXT VALUE is now generating a short row based event with only
     next_value and round being replicated.
   - Short row based events are now on the slave updated as trough
     SET_VALUE(sequence_name)
   - Full row based events are on the slave updated with a full insert,
     which is practically same as ALTER SEQUENCE.
- INSERT on a SEQUENCE table does now a EXCLUSIVE LOCK to ensure that
  it is logged in binary log before any following NEXT VALUE calls.
- Enable all sequence tests and fixed found bugs
- ALTER SEQUENCE doesn't anymore allow changes that makes the next_value
  outside of allowed range
- SEQUENCE changes are done with TL_WRITE_ALLOW_WRITE. Because of this
  one can generate a statement for MyISAM with both
  TL_WRITE_CONCURRENT_INSERT and TL_WRITE_ALLOW_WRITE. To fix a warning
  I had to add an extra test in thr_lock.c for this.
- Removed UPDATE of SEQUENCE (no need to support this as we
  have ALTER SEQUENCE, which takes the EXCLUSIVE lock properly.
- Removed DBUG_ASSERT() in MDL_context::upgrade_shared_lock. This was
  removed upstream in MySQL 5.6 in 72f823de453.
- Simplified test in decided_logging_format() by using sql_command_flags()
- Fix that we log DROP SEQUENCE correctly.
- Fixed that Aria works with SEQUENCE
2017-05-23 21:12:27 +03:00
Michael Widenius
9933239956 MDEV-10804 main.stat_tables_par fails sporadically in buildbot
This was because of two issues:
- thr_multi_lock_after_thr_lock needed to be hit 3 times before go2 could
  be signaled, because 2 of these happened before statistics_update_start
  was reached.
- The original code didn't take into accunt that thr_locks can be executed in
  any random order, which caused sporadic failures when waiting for 1 lock
  of 3, as if the locks where in different order, there would be a dead-lock.
  Fixed by introducing thr_multi_lock_before_thr_lock which is deterministic.
- Some of the test failures where not noticed as the DEBUG_SYNC timeout
  would cause the test to pass (after 300 seconds).
2017-05-11 17:28:47 +03:00
Sergei Golubchik
da4d71d10d Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
klemens
7be541f281 spelling fixes 2017-03-07 13:38:06 +04:00
kevg
780db8e252 fix build and some warnings 2016-11-24 17:36:02 +03:00
Monty
89685d55d7 Reuse THD for new user connections
- To ensure that mallocs are marked for the correct THD, even if it's
  allocated in another thread, I added the thread_id to the THD constructor
- Added st_my_thread_var to thr_lock_info_init() to avoid a call to my_thread_var
- Moved things from THD::THD() to THD::init()
- Moved some things to THD::cleanup()
- Added THD::free_connection() and THD::reset_for_reuse()
- Added THD to CONNECT::create_thd()
- Added THD::thread_dbug_id and st_my_thread_var->dbug_id. These are needed
  to ensure that we have a constant thread_id used for debugging with a THD,
  even if it changes thread_id (=connection_id)
- Set variables.pseudo_thread_id in constructor. Removed not needed sets.
2016-06-04 09:06:00 +02:00
Monty
3d4a7390c1 MDEV-6150 Speed up connection speed by moving creation of THD to new thread
Creating a CONNECT object on client connect and pass this to the working thread which creates the THD.
Split LOCK_thread_count to different mutexes
Added LOCK_thread_start to syncronize threads
Moved most usage of LOCK_thread_count to dedicated functions
Use next_thread_id() instead of thread_id++

Other things:
- Thread id now starts from 1 instead of 2
- Added cast for thread_id as thread id is now of type my_thread_id
- Made THD->host const (To ensure it's not changed)
- Removed some DBUG_PRINT() about entering/exiting mutex as these was already logged by mutex code
- Fixed that aborted_connects and connection_errors_internal are counted in all cases
- Don't take locks for current_linfo when we set it (not needed as it was 0 before)
2016-02-07 10:34:03 +02:00
Sergei Golubchik
530a6e7481 Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile,
was taken from 10.0-galera
2015-09-03 12:58:41 +02:00
Sergey Vojtovich
d897015d74 MDEV-8399 - [PATCH] Missing Sanity Checks for memory allocation in MariaDB
- since param is quite small store it on stack
- fixed a few memory leaks
2015-07-23 14:33:22 +04:00
Monty
7332af49e4 - Renaming variables so that they don't shadow others (After this patch one can compile with -Wshadow and get much fewer warnings)
- Changed ER(ER_...) to ER_THD(thd, ER_...) when thd was known or if there was many calls to current_thd in the same function.
- Changed ER(ER_..) to ER_THD_OR_DEFAULT(current_thd, ER...) in some places where current_thd is not necessary defined.
- Removing calls to current_thd when we have access to thd

Part of this is optimization (not calling current_thd when not needed),
but part is bug fixing for error condition when current_thd is not defined
(For example on startup and end of mysqld)

Notable renames done as otherwise a lot of functions would have to be changed:
- In JOIN structure renamed:
   examined_rows -> join_examined_rows
   record_count -> join_record_count
- In Field, renamed new_field() to make_new_field()

Other things:
- Added DBUG_ASSERT(thd == tmp_thd) in Item_singlerow_subselect() just to be safe.
- Removed old 'tab' prefix in JOIN_TAB::save_explain_data() and use members directly
- Added 'thd' as argument to a few functions to avoid calling current_thd.
2015-07-06 20:24:14 +03:00
Sergei Golubchik
4b21cd21fe Merge branch '10.0' into merge-wip 2015-01-31 21:48:47 +01:00
Sergei Golubchik
d9c01e4b4a 5.5 merge 2015-01-21 12:03:02 +01:00
Michael Widenius
7cb4a1c61f Fixed MDEV-7314: Deadlock when doing insert-select with Aria
mysql-test/suite/maria/insert_select.result:
  Added test case
mysql-test/suite/maria/insert_select.test:
  Added test case
mysys/thr_lock.c:
  Ensure we don't allow concurrent_insert when a read_no_write lock is in use
2015-01-18 20:38:07 +02:00
Michael Widenius
10ab3e6887 MDEV-4010 Deadlock on concurrent INSERT .. SELECT into an Aria table with statement binary logging
There was a bug in lock handling when mixing INSERT ... SELECT on the same table.


mysql-test/suite/maria/insert_select.result:
  Test case for MDEV_4010
mysql-test/suite/maria/insert_select.test:
  Test case for MDEV_4010
mysys/thr_lock.c:
  We wrongly alldoed TL_WRITE_CONCURRENT_INSERT when there was a TL_READ_NO_INSERT lock
2014-12-15 14:49:23 +02:00
Sergei Golubchik
03ec3511a8 cleanup: galera misc cleanups
also disable galera-specific output in mysql_tzinfo_to_sql,
it'll be enabled later.
2014-10-10 22:27:36 +02:00
Sergei Golubchik
fe0ff58000 compiler warnings 2014-10-01 23:38:26 +02:00
Jan Lindström
df4dd593f2 MDEV-6247: Merge 10.0-galera to 10.1.
Merged lp:maria/maria-10.0-galera up to revision 3879.

Added a new functions to handler API to forcefully abort_transaction,
producing fake_trx_id, get_checkpoint and set_checkpoint for XA. These
were added for future possiblity to add more storage engines that
could use galera replication.
2014-08-26 15:43:46 +03:00
Sergei Golubchik
474fe6d9d9 fixes for test failures
and small collateral changes

mysql-test/lib/My/Test.pm:
  somehow with "print" we get truncated writes sometimes
mysql-test/suite/perfschema/r/digest_table_full.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/dml_handler.result:
  host table is not ported over yet
mysql-test/suite/perfschema/r/information_schema.result:
  host table is not ported over yet
mysql-test/suite/perfschema/r/nesting.result:
  this differs, because we don't rewrite general log queries, and multi-statement
  packets are logged as a one entry. this result file is identical to what mysql-5.6.5
  produces with the --log-raw option.
mysql-test/suite/perfschema/r/relaylog.result:
  MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB.
mysql-test/suite/perfschema/r/server_init.result:
  MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup.
mysql-test/suite/perfschema/r/stage_mdl_global.result:
  this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not
  do that, and this causes useless mutex locks and waits.
mysql-test/suite/perfschema/r/statement_digest.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_consumers.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/perfschema/r/statement_digest_long_query.result:
  md5 hashes of statement digests differ, because yacc token codes are different in mariadb
mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result:
  will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
  will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
2012-09-27 20:09:46 +02:00
Sergei Golubchik
867296c3ed 5.3 merge 2012-03-28 20:25:31 +02:00
Michael Widenius
9ef537ac61 Fixed lp:963603 "Assertion `lock_type != TL_UNLOCK && (lock_type == TL_IGNORE || file->lock.type == TL_UNLOCK)' failed in ha_maria::store_lock with DML, triggers, views"
mysys/thr_lock.c:
  Ensure that all locks are marked as TL_UNLOCK in case of error (Safety fix)
sql/lock.cc:
  Ensure that all locks are marked as TL_UNLOCK in case of error
  (This is the real fix for lp:963603)
2012-03-26 13:29:45 +03:00
Michael Widenius
2b625ac3e0 Fixed lp:933719, "Assertion open_tables == 0 ... " in THD::restore_backup_open_tables_state.
This also fixes a (not likely) crashing bug when forcing a thread that was doing a table lock to re-open it's files, for example by creating a trigger.


mysys/thr_lock.c:
  Added more checking to find wrong locks.
  Removed one, not needed, parameter to thr_lock
sql/lock.cc:
  Fixed mysql_lock_tables() to retry with new sql_lock if lock fails. This was needed as table may be closed and reopened between retry's and then the old sql_lock will point to stale data.
sql/mysql_priv.h:
  Updated prototype
sql/sql_base.cc:
  Ensure that all tables are closed if opening of system table failes; This fixes the assert in THD::restore_backup_open_tables_state
sql/sql_handler.cc:
  Updated variable type
2012-02-23 16:43:35 +02:00
Vladislav Vaintroub
62dcaf8c29 merge 5.5 2012-02-27 19:32:44 +01:00
Sergei Golubchik
3f28115e0e 5.3 merge 2012-02-24 14:37:00 +01:00
Vladislav Vaintroub
cfa56f900a address second round review comments 2012-02-16 16:59:04 +01:00
Vladislav Vaintroub
b7cf6abe52 merge 2012-01-24 01:59:03 +01:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Vladislav Vaintroub
67cfb8a5c5 MDEV-82 : Fix place in thr_lock.c where wait-end callback was called without corresponding wait-begin 2012-01-10 16:58:30 +01:00
Vladislav Vaintroub
0cd5cce7a8 Fix compile error 2011-12-27 20:54:29 +01:00
Michael Widenius
e6f5fc1c02 Fixed lp:909051 Options --debug and --disable-debug are known but ambiguous in RelWithDebInfo build
Fixed memory leak printing when doing 'mysqld --version', 'mysqld --debug --help' and 'mysqld --debug --help --verbose'


mysys/my_init.c:
  Moved checking if we should call DBUG_END() before my_thread_end() as otherwise we will not free DBUG variables and files.
mysys/thr_lock.c:
  Fixed compiler warning
sql/mysqld.cc:
  Fixed memory leaks when using mysqld --help and mysqld --version
  Added --debug as an option that works for all builds. For non debug builds we now get a warning.
strings/dtoa.c:
  Fixed valgrind warning (c could contain data outside of the given string)
2011-12-27 20:55:21 +02:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Michael Widenius
ffab2a90dc Patch to get MariaDB to compile on CYGWIN; By Guenter Knauf
Increased number of locks in thr_lock (used only when testing)


include/my_global.h:
  Patch for CYGWIN
mysys/my_getsystime.c:
  Patch for CYGWIN
mysys/thr_lock.c:
  Increase number of locks for testing
2011-12-02 00:24:58 +02:00