Commit graph

161 commits

Author SHA1 Message Date
Sergei Golubchik
cb1e76e4de Merge branch '10.1' into 10.2 2017-08-17 11:38:34 +02:00
Monty
74543698a7 MDEV-13179 main.errors fails with wrong errno
The problem was that the introduction of max-thread-mem-used can cause
an allocation error very early, even before mysql_parse() is called.
As mysql_parse() calls thd->reset_for_next_command(), which called
clear_error(), the error number was lost.

Fixed by adding an option to have unique messages for each KILL
signal and change max-thread-mem-used to use this new feature.
This removes a lot of problems with the original approach, where
one could get errors signaled silenty almost any time.

ixed by moving clear_error() from reset_for_next_command() to
do_command(), before any memory allocation for the thread.

Related changes:
- reset_for_next_command() now have an optional parameter if we should
  call clear_error() or not. By default it's called, but not anymore from
  dispatch_command() which was the original problem.
- Added optional paramater to clear_error() to force calling of
  reset_diagnostics_area(). Before clear_error() only called
  reset_diagnostics_area() if there was no error, so we normally
  called reset_diagnostics_area() twice.
- This change removed several duplicated calls to clear_error()
  when starting a query.
- Reset max_mem_used on COM_QUIT, to protect against kill during
  quit.
- Use fatal_error() instead of setting is_fatal_error (cleanup)
- Set fatal_error if max_thead_mem_used is signaled.
  (Same logic we use for other places where we are out of resources)
2017-08-07 03:48:58 +03:00
Sergei Golubchik
da4d71d10d Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Sergei Golubchik
4a5d25c338 Merge branch '10.1' into 10.2 2016-12-29 13:23:18 +01:00
Sachin Setiya
0c79de2419 MDEV-11479 Improved wsrep_dirty_reads
Tasks:-
         Changes in wsrep_dirty_reads variable
         1.) Global + Session scope (Current: session-only)
         2.) Can be set using command line.
         3.) Allow all commands that do not change data (besides SELECT)
         4.) Allow prepared Statements that do not change data
         5.) Works with wsrep_sync_wait enabled
2016-12-14 09:30:43 +05:30
kevg
780db8e252 fix build and some warnings 2016-11-24 17:36:02 +03:00
Nirbhay Choubey
9b6bd3f179 MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum enabled
During total-order replication, Query_log_event's checksum_alg
should be explicitly set to the current binlog_checksum as it
is not set for DML queries.
Note: wsrep_replicate_myisam enables replication of DMLs on
MyISAM tables using TOI.
2016-11-07 11:53:59 -05:00
Nirbhay Choubey
9d89c182bc MDEV-9312: storage engine not enforced during galera cluster replication
Postfix: The pre-initialization of wsrep threads is not needed
for mysqldump sst method.
2016-11-07 11:53:57 -05:00
Nirbhay Choubey
6bb6f30ff9 MDEV-9312: storage engine not enforced during galera cluster replication
Perform a post initialization of plugin-related variables
of wsrep threads after their global counterparts have been
initialized.
2016-11-07 11:53:56 -05:00
Monty
7b96416f3c Use sql_mode_t for sql_mode.
This fixed several cases where we where using just ulong for sql_mode
2016-10-05 01:11:08 +03:00
Monty
8be53a389c MDEV-6112 multiple triggers per table
This is similar to MysQL Worklog 3253, but with
a different implementation. The disk format and
SQL syntax is identical with MySQL 5.7.

Fetures supported:
- "Any" ammount of any trigger
- Supports FOLLOWS and PRECEDES to be
  able to put triggers in a certain execution order.

Implementation details:
- Class Trigger added to hold information about a trigger.
  Before this trigger information was stored in a set of lists in
  Table_triggers_list and in Table_triggers_list::bodies
- Each Trigger has a next field that poinst to the next Trigger with the
  same action and time.
- When accessing a trigger, we now always access all linked triggers
- The list are now only used to load and save trigger files.
- MySQL trigger test case (trigger_wl3253) added and we execute these
  identically.
- Even more gracefully handling of wrong trigger files than before. This
  is useful if a trigger file uses functions or syntax not provided by
  the server.
- Each trigger now has a "Created" field that shows when the trigger was
  created, with 2 decimals.

Other comments:
- Many of the changes in test files was done because of the new "Created"
  field in the trigger file. This shows up in SHOW ... TRIGGER and when
  using information_schema.trigger.
- Don't check if all memory is released if on uses --gdb;  This is needed
  to be able to get a list from safemalloc of not freed memory while
  debugging.
- Added option to trim_whitespace() to know how many prefix characters
  was skipped.
- Changed a few ulonglong sql_mode to sql_mode_t, to find some wrong usage
  of sql_mode.
2016-10-05 01:11:07 +03:00
Nirbhay Choubey
6925689ca8 MDEV-9312: storage engine not enforced during galera cluster replication
Postfix: The pre-initialization of wsrep threads is not needed
for mysqldump sst method.
2016-09-29 15:00:20 -04:00
Nirbhay Choubey
7c525ce36b MDEV-9312: storage engine not enforced during galera cluster replication
Perform a post initialization of plugin-related variables
of wsrep threads after their global counterparts have been
initialized.
2016-09-28 13:26:13 -04:00
Sergei Golubchik
06b7fce9f2 Merge branch '10.1' into 10.2 2016-09-09 08:33:08 +02:00
Monty
bbfb5d7c74 Fixed failures for privilege_table_io and wsrep_cluster_address_basic
- Sometimes privilege_table_io printed double rows of roles_mapping
  - Fixed by forcing restart of server when running test
- Wsrep_cluster_address_basic failed in some combinations because
  wsrep_cluster_address was set to NULL
  - Fixed by ensuring it's never set to NULL, only empty string
2016-08-29 20:33:25 +03:00
Nirbhay Choubey
90266e8a0e Merge branch '10.0-galera' into bb-10.1-serg 2016-08-25 15:39:39 -04:00
Nirbhay Choubey
1b7c5dedf7 MDEV-10566: Create role statement replicated inconsistently in Galera Cluster
In galera cluster, the definer (and thus binlog invoker) must be set
for CREATE ROLE before Query_log_event is created during TOI on the
originating node.
2016-08-24 15:32:48 -04:00
Damien Ciabrini
fec296cc10 refs codership/mysql-wsrep#267
Fix Galera crash at startup when compiled with gcc 6
2016-08-21 16:20:08 -04:00
Daniele Sciascia
ea3ff73031 GCF-837 Fix crash when loading wrong provider version
mysqld would crash with "double free or corrruption message"
if wrong provider version was given.
2016-08-21 16:17:17 -04:00
Alexey Yurchenko
90d92d2b49 MW-258 - RSU DDL should not rely on the global wsrep_desync variable value and should always try to desync on its own. 2016-08-21 16:17:07 -04:00
sjaakola
d246630d73 Refs MW-252
- changed the condition when to do implicit desync as part of FTWRL to
  cover only case when node is PC and synced. Donor node has alreaydy desycned
  and other states mean that node is not in cluster, so desync is not even possible.
2016-08-21 16:17:05 -04:00
sjaakola
8ec50ebda3 Refs MW-252
- reverted from tracking donor servicing thread. With xtrabackup SST,
  xtrabackup thread will call FTWRL and node is desynced upfront
- Skipping desync in FTWRL if node is operating as donor
2016-08-21 16:17:02 -04:00
Nirbhay Choubey
ba4ed3ee84 MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
The memory alloc-ed initially for wsrep_sst_auth to store the
value specified in config was lost as the global variable was
reset while in process of masking it and thus, could never be
reclaimed on shutdown.
2016-08-03 13:36:12 -04:00
Nirbhay Choubey
77a8ae07a9 Cleanup around wsrep system variables. 2016-07-30 14:40:47 -04:00
Nirbhay Choubey
355bf4fbb5 Cleanup around wsrep mdl exception. 2016-07-30 14:36:41 -04:00
Sergei Golubchik
932646b1ff Merge branch '10.1' into 10.2 2016-06-30 16:38:05 +02:00
Nirbhay Choubey
7ff44b1a83 MDEV-10161: wsrep_sync_wait not enabled when set to 1 in config file
Since wsrep_sync_wait & wsrep_causal_reads variables are related,
they are always kept in sync whenever one of them changes.
Same is tried on server start, where wsrep_sync_wait get updated
based on wsrep_causal_reads' value. But, since wsrep_causal_reads
is OFF by default, wsrep_sync_wait's value gets modified and loses
its WSREP_SYNC_WAIT_BEFORE_READ bit.

Fixed by syncing wsrep_sync_wait & wsrep_causal_reads values
individually on server start in mysqld_get_one_option() based
on command line arguments used.
2016-06-27 18:30:07 -04:00
Nirbhay Choubey
48a0a66ffa MDEV-10186: mysqld crash when runtime setting wsrep_cluster_address without wsrep_on=ON
On wsrep_cluster_address update, node restarts the replication
and attempts to connect to the new address. In this process it
makes a call to wsrep provider's connect API, which could lead
to segfault if wsrep provider is not loaded (wsrep_on=OFF).

Fixed by making sure that it proceeds only if a provider is
loaded.
2016-06-27 18:15:47 -04:00
Nirbhay Choubey
7f9fcfe00e Code cleanup (wsrep patch). 2016-06-27 18:07:43 -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
Sergei Golubchik
935033aea7 fix wsrep test crashes on startup 2016-06-05 11:24:10 +02:00
Sergei Golubchik
562c1df7d9 cleanup: thread_count
move thread_count handling into THD:
* increment thread_count in THD constructor
* decrement thread_count in THD destructor
* never modify thread_count directly!
2016-06-04 09:06:00 +02:00
Nirbhay Choubey
de7eafc7ce MDEV-6368: assertion xid_seqno > trx_sys_cur_xid_seqno
- Validate the specified wsrep_start_position value by also
checking the return status of wsrep->sst_received. This also
ensures that changes in wsrep_start_position is not allowed
when the node is not in JOINING state.
- Do not allow decrease in seqno within same UUID.
- The initial checkpoint in SEs should be [0...:-1].
2016-05-31 20:37:00 -04:00
Monty
636bb59034 Final fixes for Memory_used
- Change some static variables to dynamic to ensure that we don't do any memory
  allocations before server starts or stops
- Print more memory information on SIGHUP. Fixed output.
- Write out if memory was lost if run with --debug-at-exit
- Fixed wrong #ifdef in sql_cache.cc
2016-04-28 17:15:38 +03:00
Sergei Golubchik
00d1db7a38 Merge branch '10.1' into 10.2 2016-02-25 18:19:55 +01:00
Nirbhay Choubey
0251232f8c Fix to ensure updates in gtid_slave_state table do not get binlogged.
Also, renamed wsrep_skip_append_keys to wsrep_ignore_table.
Test case : galera.galera_as_slave_gtid.test
2016-02-24 23:32:37 -05:00
Nirbhay Choubey
cceec7858f Merge branch '10.0-galera' into bb-10.1-serg 2016-02-24 01:21:40 -05:00
Daniele Sciascia
ace86a2375 refs codership/mysql-wsrep#201
- Fixes query cache so that it is aware of wsrep_sync_wait.
  Query cache would return (possibly stale) results to the
  client, regardless of the value of wsrep_sync_wait.
- Includes the test case that reproduced the issue.
2016-02-22 17:46:22 -05:00
sjaakola
4bdf0258b6 refs MW-246
- skipping desync and resync before and after DDL execution in RSU mode, if wsrep_desync is set upfront
2016-02-17 16:02:57 -05:00
Monty
b3093073b1 Changed my_thread_id to int64 to fix compilation problem with
my_atomic_add32_explicit on windows
Fixed that server_audit.c also works if one compiles with safemalloc
Fixed compiler warnings
2016-02-08 22:34:41 +02:00
Monty
1ab711bebb Corrected freeing of thd when running with wsrep and thread pool
This is needed because of the new code where THD creation was moved to the new thread
2016-02-07 15:23:08 +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
a2330c820a MDEV-8208 Sporadic SEGFAULT on startup
different fix. remove old ones, wait for THD to be fully
initialized before continuing with the server startup process.

This reverts commits db2e21b, 13615c5, 3f515a0, 70113ee.
2016-01-25 17:04:09 +01:00
Sergei Golubchik
7697bf0bd7 Merge branch 'github/10.0-galera' into 10.1
Note: some tests fail, just as they failed before the merge!
2015-12-22 10:32:33 +01:00
Sergei Golubchik
7f19330c59 Merge branch 'github/10.0-galera' into 10.1 2015-11-19 17:48:36 +01:00
Philip Stoev
52a910395a refs codership/mysql-wsrep#202 Fix bad cherry-pick (and the compiler warnings it generated) 2015-10-19 04:14:51 -07:00
Philip Stoev
43b2a451fe refs codership/mysql-wsrep#202 Added schema info into wsrep messages
Added schema info to wsrep messages above debug level.
2015-10-19 01:56:04 -07:00
Nirbhay Choubey
ddb93b427e WSREP_TO_ISOLATION_BEGIN should be called with the table list. 2015-10-14 05:14:06 -04:00
Nirbhay Choubey
6927459e5b MDEV-8208: Sporadic SEGFAULT on startup
Addendum:
* Before calling THD::init_for_queries(), flip the current_thd to wsrep
thread so that memory gets allocated for the right THD.
* Use wsrep_creating_startup_threads instead of plugins_are_initialized
as the condition for the execution of THD::init_for_queries() within
start_wsrep_THD(), as use of latter could still leave some room for
race.
2015-09-25 18:50:57 -04:00