Commit graph

2503 commits

Author SHA1 Message Date
Monty
8cc53aded9 MDEV-17068 mysql system table is marked as crashed and should be repaired after the server crashes or is killed
- Changed ERROR to WARNING for MyISAM/Aria message
  that are warnings in the check utilities.
  This affects for example "client is using or
  hasn't closed the table properly".
- Print "Table is fixed" if check succeded in
  fixing the table.
2018-08-28 12:14:13 +03:00
Marko Mäkelä
734db318ac Merge 10.3 into 10.4 2018-08-16 10:08:30 +03:00
Alexander Barkov
385ee993d9 A cleanup for MDEV-16852
Changing data types for:
- seconds from longlong to ulonglong
- microseconds from long to ulong
in:
- parameters of calc_time_diff()
- parameters of calc_time_from_sec()
- Members of Sec6_add

This will help to reuse the code easier:
all other functions use ulonglong+long
for seconds/microsecond, e.g.:

- number_to_time()
- number_to_datetime()
- number_to_datetime_with_warn()
- Field_temporal_with_date::store_decimal()
- my_decimal2seconds()
- Item::get_seconds()
2018-08-07 16:26:35 +04:00
Marko Mäkelä
05459706f2 Merge 10.2 into 10.3 2018-08-03 15:57:23 +03:00
Marko Mäkelä
ef3070e997 Merge 10.1 into 10.2 2018-08-02 08:19:57 +03:00
Oleksandr Byelkin
0896d7ebc3 Merge branch '10.0' into bb-10.1-merge 2018-07-19 12:55:54 +02:00
Oleksandr Byelkin
e5c26fdfab Merge branch '5.5' into bb-10.0-merge 2018-07-17 16:56:21 +02:00
Alexander Barkov
e61568ee93 Merge remote-tracking branch 'origin/10.3' into 10.4 2018-07-03 14:02:05 +04:00
Sergei Golubchik
36e59752e7 Merge branch '10.2' into 10.3 2018-06-30 16:39:20 +02:00
Sergey Vojtovich
9d41dd2f39 MDEV-8540 - Crash on server shutdown since 10.0.16
For the purpose of reporting an error to error log, shutdown thread was
attempting to access current_thd->variables.lc_messages->errmsgs->errmsgs.
Whereas current_thd was NULL.

We should log errors according to global lc_messages setting instead of
session setting.
2018-06-27 17:25:26 +04:00
Oleksandr Byelkin
517d718201 MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid
register changes of last_gtid
2018-06-25 19:01:41 +02:00
Sergei Golubchik
b942aa34c1 Merge branch '10.1' into 10.2 2018-06-21 23:47:39 +02:00
Vicențiu Ciorbaru
6e55236c0a Merge branch '10.0-galera' into 10.1 2018-06-12 19:39:37 +03:00
Sergei Golubchik
ced6638773 mysys: ME_ERROR_LOG_ONLY flag 2018-06-04 12:32:23 +02:00
Sergei Golubchik
c9061d1102 mysys: rename ME_xxx flags to match plugin api 2018-06-04 12:32:23 +02:00
Sergei Golubchik
37659ef43b mysys: remove dead ME_xxx flags 2018-06-04 12:32:22 +02:00
Monty
58721c3e38 MDEV-16286 Killed CREATE SEQUENCE leaves sequence in unusable state
Fixed by deleting the sequence if we where not able to initialize it

I also noticed that we didn't always set the error message when
check_killed(), which could lead to aborted queries without error
beeing properly set. Fixed by default setting error message if
check_error() noticed that killed had been called.
This allowed me to remove a lot of calls to thd->send_kill_message().
2018-05-27 19:47:17 +03:00
Jan Lindström
648cf7176c Merge remote-tracking branch 'origin/5.5-galera' into 10.0-galera 2018-05-07 13:49:14 +03:00
Monty
30ebc3ee9e Add likely/unlikely to speed up execution
Added to:
- if (error)
- Lex
- sql_yacc.yy and sql_yacc_ora.yy
- In header files to alloc() calls
- Added thd argument to thd_net_is_killed()
2018-05-07 00:07:32 +03:00
Monty
2ccd6716fc Fix a lot of compiler warnings found by -Wunused 2018-04-26 17:35:12 +03:00
Marko Mäkelä
7396dfcca7 Merge 10.2 into 10.3 2018-04-24 20:59:57 +03:00
Eugene Kosov
7b2bdd8984 register keyword c++17 warning 2018-04-24 12:48:32 +03:00
Marko Mäkelä
39a4985520 Remove most 'register' use in C++
Modern compilers (such as GCC 8) emit warnings that the
'register' keyword is deprecated and not valid C++17.

Let us remove most use of the 'register' keyword.
Code in 'extra/' is not touched.
2018-04-24 12:48:27 +03:00
Marko Mäkelä
c6ba758d1d Merge 10.2 into 10.3 2018-04-23 09:49:58 +03:00
Sergei Petrunia
0c02c91bc1 MyRocks: MDEV-15911: Reduce debug logging on default levels in error log
MyRocks internally will print non-critical messages to
sql_print_verbose_info() which will do what InnoDB does in similar cases:
check if (global_system_variables.log_warnings > 2).
2018-04-19 14:13:28 +03:00
Daniel Black
4ec7b84077 MDEV-8743: use O_CLOEXEC MYSQL_LOG::open / TC_LOG_MMAP::open
For galera compatibility, the main thing is to ensure the FD 1, 2 are
not opened with O_CLOEXEC otherwise galera sst errors don't appear in
the error.log

Files without O_CLOEXEC from the test below:
0 -> /dev/pts/9
1 -> /tmp/error.log (intended)
2 -> /tmp/error.log (intended)
5 -> /tmp/datadir
6 -> /tmp/datadir/aria_log.00000001
(Innodb temp files)
8 -> /tmp/ibIIrhFL (deleted)
9 -> /tmp/ibfx1vai (deleted)
10 -> /tmp/ibAQUKFO (deleted)
11 -> /tmp/ibWBQSHR (deleted)
15 -> /tmp/ibEXEcfo (deleted)

20 -> /tmp/datadir/mysql/host.MYD
22 -> /tmp/datadir/mysql/user.MYD
... (rest of MYD files)

Test for this and the previous commit.

 sql/mysqld --skip-networking --datadir=/tmp/datadir --log-bin=/tmp/datadir/mysqlbin --socket /tmp/s.sock --lc-messages-dir=${PWD}/sql/share --verbose --log-error=/tmp/error.log --general-log-file=/tmp/general.log --general-log=1 --slow-query-log-file=/tmp/slow.log --slow-query-log=1
180302 10:56:41 [Note] sql/mysqld (mysqld 5.5.60-MariaDB-wsrep) starting as process 26056 ...

$ cd /proc/26056
$ ls -la --sort=none fd
total 0
dr-x------. 2 dan dan  0 Mar  2 10:57 .
dr-xr-xr-x. 9 dan dan  0 Mar  2 10:56 ..
lrwx------. 1 dan dan 64 Mar  2 10:57 0 -> /dev/pts/9
l-wx------. 1 dan dan 64 Mar  2 10:57 1 -> /tmp/error.log
l-wx------. 1 dan dan 64 Mar  2 10:57 2 -> /tmp/error.log
lrwx------. 1 dan dan 64 Mar  2 10:57 3 -> /tmp/datadir/mysqlbin.index
lrwx------. 1 dan dan 64 Mar  2 10:57 4 -> /tmp/datadir/aria_log_control
lr-x------. 1 dan dan 64 Mar  2 10:57 5 -> /tmp/datadir
lrwx------. 1 dan dan 64 Mar  2 10:57 6 -> /tmp/datadir/aria_log.00000001
lrwx------. 1 dan dan 64 Mar  2 10:57 7 -> /tmp/datadir/ibdata1
lrwx------. 1 dan dan 64 Mar  2 10:57 8 -> /tmp/ibIIrhFL (deleted)
lrwx------. 1 dan dan 64 Mar  2 10:57 9 -> /tmp/ibfx1vai (deleted)
lrwx------. 1 dan dan 64 Mar  2 10:57 10 -> /tmp/ibAQUKFO (deleted)
lrwx------. 1 dan dan 64 Mar  2 10:57 11 -> /tmp/ibWBQSHR (deleted)
lrwx------. 1 dan dan 64 Mar  2 10:57 12 -> /tmp/datadir/ib_logfile0
lrwx------. 1 dan dan 64 Mar  2 10:57 13 -> /tmp/datadir/ib_logfile1
l-wx------. 1 dan dan 64 Mar  2 10:57 14 -> /tmp/slow.log
lrwx------. 1 dan dan 64 Mar  2 10:57 15 -> /tmp/ibEXEcfo (deleted)
l-wx------. 1 dan dan 64 Mar  2 10:57 16 -> /tmp/general.log
lrwx------. 1 dan dan 64 Mar  2 10:57 17 -> socket:[1897356]
lrwx------. 1 dan dan 64 Mar  2 10:57 18 -> socket:[45335]
l-wx------. 1 dan dan 64 Mar  2 10:57 19 -> /tmp/datadir/mysqlbin.000004
lrwx------. 1 dan dan 64 Mar  2 10:57 20 -> /tmp/datadir/mysql/host.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 21 -> /tmp/datadir/mysql/host.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 22 -> /tmp/datadir/mysql/user.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 23 -> /tmp/datadir/mysql/user.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 24 -> /tmp/datadir/mysql/db.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 25 -> /tmp/datadir/mysql/db.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 26 -> /tmp/datadir/mysql/proxies_priv.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 27 -> /tmp/datadir/mysql/proxies_priv.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 28 -> /tmp/datadir/mysql/tables_priv.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 29 -> /tmp/datadir/mysql/tables_priv.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 30 -> /tmp/datadir/mysql/columns_priv.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 31 -> /tmp/datadir/mysql/columns_priv.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 32 -> /tmp/datadir/mysql/procs_priv.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 33 -> /tmp/datadir/mysql/procs_priv.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 34 -> /tmp/datadir/mysql/servers.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 35 -> /tmp/datadir/mysql/servers.MYI
lrwx------. 1 dan dan 64 Mar  2 10:57 36 -> /tmp/datadir/mysql/event.MYD
lrwx------. 1 dan dan 64 Mar  2 10:57 37 -> /tmp/datadir/mysql/event.MYI

O_CLOEXEC files are those with flags 02000000

/usr/include/bits/fcntl-linux.h:# define __O_CLOEXEC   02000000
/usr/include/bits/fcntl-linux.h:# define O_CLOEXEC      __O_CLOEXEC     /* Set close_on_exec.  */

$ find fdinfo/ -type f -ls -exec cat {} \; | more
  1924720      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/0
pos:    0
flags:  0100002
mnt_id: 25
  1924721      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/1
pos:    9954
flags:  0102001
mnt_id: 82
  1924722      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/2
pos:    10951
flags:  0102001
mnt_id: 82
  1924723      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/3
pos:    116
flags:  02100002
mnt_id: 82
  1924724      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/4
pos:    52
flags:  0100002
mnt_id: 82
lock:   1: POSIX  ADVISORY  WRITE 26056 00:2c:1866365 0 EOF
  1924725      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/5
pos:    0
flags:  0100000
mnt_id: 82
  1924726      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/6
pos:    16384
flags:  0100002
mnt_id: 82
  1924727      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/7
pos:    0
flags:  02100002
mnt_id: 82
lock:   1: POSIX  ADVISORY  WRITE 26056 00:2c:1866491 0 EOF
  1924728      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/8
pos:    0
flags:  0100002
mnt_id: 82
  1924729      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/9
pos:    0
flags:  0100002
mnt_id: 82
  1924730      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/10
pos:    0
flags:  0100002
mnt_id: 82
  1924731      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/11
pos:    0
flags:  0100002
mnt_id: 82
  1924732      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/12
pos:    0
flags:  02100002
mnt_id: 82
lock:   1: POSIX  ADVISORY  WRITE 26056 00:2c:1866492 0 EOF
  1924733      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/13
pos:    0
flags:  02100002
mnt_id: 82
lock:   1: POSIX  ADVISORY  WRITE 26056 00:2c:1866493 0 EOF
  1924734      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/14
pos:    763
flags:  02102001
mnt_id: 82
  1924735      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/15
pos:    0
flags:  0100002
mnt_id: 82
  1924736      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/16
pos:    473
flags:  02102001
mnt_id: 82
  1924737      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/17
pos:    0
flags:  02000002
mnt_id: 9
  1924738      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/18
pos:    0
flags:  02
mnt_id: 9
  1924739      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/19
pos:    245
flags:  02100001
mnt_id: 82
  1924740      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/20
pos:    0
flags:  0100002
mnt_id: 82
  1924741      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/21
pos:    503
flags:  0500002
mnt_id: 82
  1924742      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/22
pos:    324
flags:  0100002
mnt_id: 82
  1924743      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/23
pos:    642
flags:  0500002
mnt_id: 82
  1924744      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/24
pos:    880
flags:  0100002
mnt_id: 82
  1924745      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/25
pos:    581
flags:  0500002
mnt_id: 82
  1924746      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/26
pos:    1386
flags:  0100002
mnt_id: 82
  1924747      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/27
pos:    498
flags:  0500002
mnt_id: 82
  1924748      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/28
pos:    0
flags:  0100002
mnt_id: 82
  1924749      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/29
pos:    513
flags:  0500002
mnt_id: 82
  1924750      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/30
pos:    0
flags:  0100002
mnt_id: 82
  1924751      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/31
pos:    494
flags:  0500002
mnt_id: 82
  1924752      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/32
pos:    0
flags:  0100002
mnt_id: 82
  1924753      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/33
pos:    535
flags:  0500002
mnt_id: 82
  1924754      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/34
pos:    0
flags:  0100002
mnt_id: 82
  1924755      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/35
pos:    396
flags:  0500002
mnt_id: 82
  1924756      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/36
pos:    0
flags:  0100002
mnt_id: 82
  1924757      0 -r--------   1  dan      dan             0 Mar  2 10:57 fdinfo/37
pos:    517
flags:  0500002
mnt_id: 82
2018-03-02 10:58:05 +11:00
Vladislav Vaintroub
6c279ad6a7 MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.

This fix excludes rocksdb, spider,spider, sphinx and connect for now.
2018-02-06 12:55:58 +00:00
Alexander Barkov
217fc122c8 Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2018-02-04 18:40:06 +04:00
Monty
d69642dedd Added name to MEM_ROOT for esier debugging
This will make it easier to how memory allocation is done when debugging
with either DBUG or gdb.

Will especially help when debugging stored procedures

Main change is a name argument as second argument to init_alloc_root()
init_sql_alloc()

Other things:
- Added DBUG_ENTER/EXIT to some Virtual_tmp_table functions
2018-02-02 11:08:36 +02:00
Monty
f55dc7f733 Change C_STRING_WITH_LEN to STRING_WITH_LEN
This preserves const str for constant strings

Other things
- A few variables where changed from LEX_STRING to LEX_CSTRING
- Incident_log_event::Incident_log_event and record_incident where
  changed to take LEX_CSTRING* as an argument instead of LEX_STRING
2018-01-30 21:33:56 +02:00
Monty
a7e352b54d Changed database, tablename and alias to be LEX_CSTRING
This was done in, among other things:
- thd->db and thd->db_length
- TABLE_LIST tablename, db, alias and schema_name
- Audit plugin database name
- lex->db
- All db and table names in Alter_table_ctx
- st_select_lex db

Other things:
- Changed a lot of functions to take const LEX_CSTRING* as argument
  for db, table_name and alias. See init_one_table() as an example.
- Changed some function arguments from LEX_CSTRING to const LEX_CSTRING
- Changed some lists from LEX_STRING to LEX_CSTRING
- threads_mysql.result changed because process list_db wasn't always
  correctly updated
- New append_identifier() function that takes LEX_CSTRING* as arguments
- Added new element tmp_buff to Alter_table_ctx to separate temp name
  handling from temporary space
- Ensure we store the length after my_casedn_str() of table/db names
- Removed not used version of rename_table_in_stat_tables()
- Changed Natural_join_column::table_name and db_name() to never return
  NULL (used for print)
- thd->get_db() now returns db as a printable string (thd->db.str or "")
2018-01-30 21:33:55 +02:00
Marko Mäkelä
4ef25dbfd8 Merge bb-10.2-ext into 10.3 2018-01-15 19:11:28 +02:00
Marko Mäkelä
39f236a2f5 Merge 10.2 into bb-10.2-ext 2018-01-15 16:41:10 +02:00
Eugene Kosov
72136ae75c Compilation speed (#546)
Speed up compilation

Standard C++ headers contribute a lot to compilation time. Avoid algorithm
and sstream in frequently used headers.
2018-01-14 20:50:45 +04:00
Marko Mäkelä
145ae15a33 Merge bb-10.2-ext into 10.3 2018-01-04 09:22:59 +02:00
Monty
fbab79c9b8 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts:
	cmake/make_dist.cmake.in
	mysql-test/r/func_json.result
	mysql-test/r/ps.result
	mysql-test/t/func_json.test
	mysql-test/t/ps.test
	sql/item_cmpfunc.h
2018-01-01 19:39:59 +02:00
Monty
322c637c1c Fixed compiler warnings about possible uninitialized variables 2018-01-01 14:10:22 +02:00
Monty
e64184134a mysqlbinlog now prints "# Number of rows" and stops on errors
Main problem was that no log-event print function checked for disk
full error on the IO_CACHE.
All changes in this patch only affects mysqlbinlog, not the server!

- Changed all log-event print functions to return 1 on error
- Fixed memory usage when not using --flashback.
- Added printing of number of rows in row events. Can be disabled with
  --print-row-count=0
- Print annotated rows when using mysqlbinlog --short-form
- Fixed that mysqlbinlog --debug works
- Fixed create_drop_binlog.test test failure
- Reorganized fields in PRINT_EVENT_INFO to be according to size to
  optimize storage
- Don't change print_row_event_position or print_row_counts if set by user
- Remove some testing of argument to my_free is 0
- base64-output=never is now supported and works in all context
- Updated help information for --base64-output and --short-form
- print_row_count is now on by default. Reset automatically if --short-form
  is used
- Removed obsolote warning for mysql 5.6.0
- More DBUG_PRINT for mysqltest.cc
- my_b_write_byte() now checks for flush failures. This fixed a memory
  overrun on disk full
- my_b_printf() now returns 1 on failure, 0 on ok.  This simplifies code
  and no old code was using the old return value of my_b_printf().
- my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok
- Fixed some error conditions in log printing that was not previously
  handled.
- Slave_rows_error_report() can now handle longlong positions
- Write_on_release_cache() rewritten so that we can detect errors
  on flush. Not depending on automatic release anymore.
- Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS
- Fixed that copy_event_cache_to_string_and_reinit() works with strings
  longer than 4G (Changed to use LEX_STRING instead of String)
- Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are
  anyway restricted to UINT32_MAX
- Fixed bug in rpl_binlog_state::write_to_iocache() which hide write
  failures (duplicate variable name)
- Fixed bug in String::append if original string was not allocated
- Stop mysqlbinlog output at once if there is an error.
- Before printing error message, flush result file. This ensures that
  the error message is printed last. (Easier to find)
2017-12-29 13:35:41 +02:00
Vicențiu Ciorbaru
9aeb5d01d6 Merge remote-tracking branch 'origin/10.1' into bb-10.2-vicentiu 2017-12-28 19:27:00 +02:00
Sachin Setiya
2fe6186124 MDEV-10715 Galera: Replicate MariaDB GTID to other nodes in the cluster
Problem:- Gtid are not transferred in Galera Cluster.

Solution:- We need to transfer gtid in the case on either when cluster is
slave/master in async replication. In normal Gtid replication gtid are generated on
recieving node itself and it is always on sync with other nodes. Because galera keeps
node in sync , So all nodes get same no of event groups. So the issue arises when
say galera is slave in async replication.
A
|    (Async replication)
D <-> E <-> F  {Galera replication}
So what should happen is that all node should apply the master gtid but this does
node happen, becuase node E, F does not recieve gtid from D in write set , So what E(or F)
does is that it applies wsrep_gtid_domain_id, D server-id , E gtid next seq no. This
generated gtid does not always work when say A has different domain id.

So In this commit, on galera node when we see that this event is recieved from master
we simply write Gtid_Log_Event in write_set and send it to other nodes.
2017-12-25 13:57:42 +05:30
Andrei Elkin
f279d3c43a MDEV-13073. This part converts the Ali patch`s identifiers to the MariaDB standard. Also some renaming is done as well as white spaces removal. 2017-12-18 13:43:38 +02:00
Andrei Elkin
74b35b6874 MDEV-13073. This part patch weeds out RUN_HOOK from the server as semisync
is defined statically. Consequently the observer interfaces are removed
as well.
2017-12-18 13:43:37 +02:00
Andrei Elkin
e972125f11 MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality.
Semisync is turned to be static instead of plugin so its functions
are invoked at the same points as RUN_HOOKS.
The RUN_HOOKS and the observer interface remain to be removed by later
patch.

Todo:
  React on killed status by repl_semisync_master.wait_after_sync(). Currently
  Repl_semi_sync_master::commit_trx does not check the killed status.

  There were few bugfixes found that are present in mysql and its unclear
  whether/how they are covered. Those include:

  Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS
  Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL
                 HAS BAD PERFORMANCE
  Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
2017-12-18 13:43:37 +02:00
Monty
abceaa7542 Optimize RUN_HOOK() call
RUN_HOOK() is only called if semisync is enabled

As the server can't disable the hooks if something is in progress, I added
a new variable, run_hooks_enabled, that is set the first time semi sync is
used. This means that RUN_HOOK will have no overhead, unless semi sync
master or slave has been enabled once.

Some of the changes was just to get rid of warnings for embedded server
2017-12-18 13:43:37 +02:00
Monty
13770edbcb Changed from using LOCK_log to LOCK_binlog_end_pos for binary log
Part of MDEV-13073 AliSQL Optimize performance of semisync

The idea it to use a dedicated lock detecting if there is new data in
the master's binary log instead of the overused LOCK_log.

Changes:
- Use dedicated COND variables for the relay and binary log signaling.
  This was needed as we where the old 'update_cond' variable was used
  with different mutex's, which could cause deadlocks.
   - Relay log uses now COND_relay_log_updated and LOCK_log
   - Binary log uses now COND_bin_log_updated and LOCK_binlog_end_pos
- Renamed signal_cnt to relay_signal_cnt (as we now have two signals)
- Added some missing error handling in MYSQL_BIN_LOG::new_file_impl()
- Reformatted some comments with old style
- Renamed m_key_LOCK_binlog_end_pos to key_LOCK_binlog_end_pos
- Changed 'signal_update()' to update_binlog_end_pos() which works for
  both relay and binary log
2017-12-18 13:43:37 +02:00
Monty
ea37c129f9 Removed not used lock argument from read_log_event 2017-12-18 13:43:36 +02:00
Andrei Elkin
15219eb08a MDEV-14290 Binlog rotate crashes when two commit_checkpoint_notify capable engines.
The crash (sometimes assert) in MYSQL_BIN_LOG::mark_xid_done was caused by a
fact that log.cc:binlog_background_thread_queue could become a cyclic list.
This possibility becomes real with two checkpoint capable engines that
may execute TC_LOG_BINLOG::commit_checkpoint_notify() in succession before
binlog_background thread gets control and eventually finds a freed memory
while otherwise endlessly looping in while(queue).

It is fixed with counting the notificaion kind instead of en-listing the same notificaion kind in commit_checkpoint_notify as formerly. The while(queue) of binlog background thread is refined to pay attention to the new counter. In effectno more access to free memory is possible.
2017-12-11 12:41:45 +02:00
Monty
c4581735d0 Cleanups
- Remove not used thd_rpl_is_parallel()
- Remove not used mysql_notify_thread_having_shared_lock()
- Remove not needed LOCK_thread_count from MYSQL_BIN_LOG::reset_logs()
  - LOCK_thread_count is not protecting against rollback, so this
    code and comment is not needed
- Remove mutex_locks in slave.cc that are not needed.
  Added THD::assert_not_linked() to ensure that it was safe to remove
- Fixed not repeatable test load_data_stmt_view
- Updated binlog_killed to test removal of mutex
  (thanks to Andrei Elkin for test)
- More code comments
2017-12-08 11:38:22 +02:00
Marko Mäkelä
7cb3520c06 Merge bb-10.2-ext into 10.3 2017-11-30 08:16:37 +02:00
Alexander Barkov
5b697c5a23 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-11-29 12:06:48 +04:00