Commit graph

179822 commits

Author SHA1 Message Date
Vladislav Vaintroub
689168be12 MDEV-13852 - redefine WinWriteableFile such as IsSyncThreadSafe()
is set to true, as it should.

Copy and modify original io_win.h header file to a different location
(as we cannot patch anything in submodule). Make sure modified header is
used.
2017-11-16 18:57:18 +00:00
Alexey Botchkov
842dce378a MDEV-14402 JSON_VALUE doesn't escape quote.
Result unescaping added.
2017-11-16 19:59:27 +04:00
Jan Lindström
d7349e204b MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX
MariaDB adjustments to test case innodb-replace-debug and
add missing instrumentation to row0ins.cc.

MariaDB 10.1 does not seem to be affected.
2017-11-16 14:05:49 +02:00
Jan Lindström
eeec64d75e MDEV-9663: InnoDB assertion failure: *cursor->index->name == TEMP_INDEX_PREFIX
Imported missing test case from MySQL 5.7 for

commit 25781c154396dbbc21023786aa3be070057d6999
Author: Annamalai Gurusami <annamalai.gurusami@oracle.com>
Date:   Mon Feb 24 14:00:03 2014 +0530

    Bug #17604730 ASSERTION: *CURSOR->INDEX->NAME == TEMP_INDEX_PREFIX
2017-11-16 13:58:09 +02:00
Alexander Barkov
a0c7d3ff94 MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT 2017-11-16 14:33:28 +04:00
Jan Lindström
0c4d11e819 MDEV-13206: INSERT ON DUPLICATE KEY UPDATE foreign key fail
This is caused by following change:

commit 95d29c99f01882ffcc2259f62b3163f9b0e80c75
Author: Marko Mäkelä <marko.makela@oracle.com>
Date:   Tue Nov 27 11:12:13 2012 +0200

    Bug#15920445 INNODB REPORTS ER_DUP_KEY BEFORE CREATE UNIQUE INDEX COMPLETED

    There is a phase during online secondary index creation where the index has
    been internally completed inside InnoDB, but does not 'officially' exist yet.
    We used to report ER_DUP_KEY in these situations, like this:

    ERROR 23000: Can't write; duplicate key in table 't1'

    What we should do is to let the 'offending' operation complete, but report an
    error to the
    ALTER TABLE t1 ADD UNIQUE KEY (c2):

    ERROR HY000: Index c2 is corrupted
    (This misleading error message should be fixed separately:
    Bug#15920713 CREATE UNIQUE INDEX REPORTS ER_INDEX_CORRUPT INSTEAD OF DUPLICATE)

    row_ins_sec_index_entry_low(): flag the index corrupted instead of
    reporting a duplicate, in case the index has not been published yet.

    rb:1614 approved by Jimmy Yang

Problem is that after we have found duplicate key on primary key
we continue to get necessary gap locks in secondary indexes to
block concurrent transactions from inserting the searched records.
However, search from unique index used in foreign key constraint
could return DB_NO_REFERENCED_ROW if INSERT .. ON DUPLICATE KEY UPDATE
does not contain value for foreign key column. In this case
we should return the original DB_DUPLICATE_KEY error instead
of DB_NO_REFERENCED_ROW.

Consider as a example following:

create table child(a int not null primary key,
b int not null,
c int,
unique key (b),
foreign key (b) references
parent (id)) engine=innodb;

insert into child values (1,1,2);

insert into child(a) values (1) on duplicate key update c = 3;

Now primary key value 1 naturally causes duplicate key error that will be
stored on node->duplicate. If there was no duplicate key error, we should
return the actual no referenced row error. As value for column b used in
both unique key and foreign key is not provided, server uses 0 as a
search value. This is naturally, not found leading to DB_NO_REFERENCED_ROW.
But, we should update the row with primay key value 1 anyway as
requested by on duplicate key update clause.
2017-11-16 11:05:24 +02:00
Jun Su
2401d14e6b Support CRC32 SSE2 implementation under Windows 2017-11-16 09:59:18 +01:00
Aleksey Midenkov
31bd86c8df Tests: dependency on wsrep removed from sql_sequence tests
Affected tests:
sql_sequence.gtid sql_sequence.replication
2017-11-16 16:29:14 +08:00
Vicențiu Ciorbaru
5fdd51e7c0 Removed accidentally added sysvars files 2017-11-16 10:12:21 +02:00
Andrei Elkin
c7e38076f3 MDEV-9510 Segmentation fault in binlog thread causes crash
With combination of --log-bin and Galera the server may crash
reporting two characteristic stacks:

  /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG13mark_xid_doneEmb+0xc7)[0x7f182a8e2cb7]
  /usr/sbin/mysqld(binlog_background_thread+0x2b5)[0x7f182a8e3275]

or

  /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG21do_checkpoint_requestEm+0x9d)[0x7ff395b2dafd]
  /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG20checkpoint_and_purgeEm+0x11)[0x7ff395b2db91]
  /usr/sbin/mysqld(_ZN13MYSQL_BIN_LOG16rotate_and_purgeEb+0xc2)[0x7ff395b300b2]

The reason of the failure appears to be non-matching decrements for
  `xid_count_per_binlog::xid_count`
which can occur when a transaction is executed having its connection issued
`SET @@sql_log_bin=0`. In such case the xid count is not incremented but
its decrements still runs to turn `binlog_xid_count_list` into improper state
which the following FLUSH BINARY LOGS exposes through the crash.

*Note_1*: the regression test reuses an existing galera.sql_log_bin
which does not run stably (even in its base form) by mtr with --log-bin.

*Note_2*: 10.0-galera branch is free of this issue having missed MDEV-7205
fixes.
2017-11-15 22:26:32 +02:00
Andrei Elkin
aae4932775 MDEV-12012/MDEV-11969 Can't remove GTIDs for a stale GTID Domain ID
As reported in MDEV-11969 "there's no way to ditch knowledge" about some
domain that is no longer updated on a server. Besides being of annoyance to
clutter output in DBA console stale domains can prevent the slave
to connect the master as MDEV-12012 witnesses.
What domain is obsolete must be evaluated by the user (DBA) according
to whether the domain info is still relevant and will the domain ever
receive any update.

This patch introduces a method to discard obsolete gtid domains from
the server binlog state. The removal requires no event group from such
domain present in existing binlog files though. If there are any the
containing logs must be first PURGEd in order for

  FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains)

succeed. Otherwise the command returns an error.

The list of obsolete domains can be computed through
intersecting two sets - the earliest (first) binlog's Gtid_list
and the current value of @@global.gtid_binlog_state - and extracting
the domain id components from the intersection list items.
The new DELETE_DOMAIN_ID featured FLUSH continues to rotate binlog
omitting the deleted domains from the active binlog file's Gtid_list.
Notice though when the command is ineffective - that none of requested to delete
domain exists in the binlog state - rotation does not occur.

Obsolete domain deletion is not harmful for connected slaves as long
as master side binlog files *purge* is synchronized with FLUSH-DELETE_DOMAIN_ID.
The slaves must have the last event from purged files processed as usual,
in order not to bump later into requesting a gtid from a file which
was already gone.
While the command is not replicated (as ordinary FLUSH BINLOG LOGS is)
slaves, even though having extra domains, won't suffer from reconnection errors
thanks to master-slave gtid connection protocol allowing the master
to be ignorant about a gtid domain.
Should at failover such slave to be promoted into master role it may run
the ex-master's

 FLUSH BINARY LOGS DELETE_DOMAIN_ID=(list-of-domains)

to clean its own binlog state.

NOTES.
  suite/perfschema/r/start_server_low_digest.result
is re-recorded as consequence of internal parser codes changes.
2017-11-15 22:26:32 +02:00
Alexander Barkov
1c34608436 MDEV-14404 Don't use LEX::check_exists in ALTER SEQUENCE 2017-11-15 19:18:28 +04:00
Oleksandr Byelkin
88cc6db0a4 MDEV-13453: Executing a query via CTE requires more permissions than the query itself
Fix of nondebuging version issue
2017-11-15 13:25:55 +01:00
Alexander Barkov
7663773e56 MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar"
This problem was earlier fixed in bb-10.2-ext.
Adding tests only.
2017-11-15 14:42:04 +04:00
Alexander Barkov
ac8e0507fe MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters
The patch for MDEV-11146 fixed this problem earlier.
Only adding tests from the report.
2017-11-15 14:34:04 +04:00
Alexander Barkov
b8f906dd4b MDEV-12846 sql_mode=ORACLE: using Oracle-style placeholders in direct query execution makes the server crash 2017-11-15 14:18:46 +04:00
Marko Mäkelä
5e7435c4b0 Correct a merge error (remove a bogus #ifdef) 2017-11-15 08:53:31 +02:00
Daniel Black
3948f4b4dc mysys: Remove freebsd freopen implementation
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=79887
was fixed in 7.4 and 8.2.

Both of these reached end of life in February 2011
https://www.freebsd.org/releases/

Signed-off-by: Daniel Black <daniel@linux.vnet.ibm.com>
2017-11-15 11:37:32 +08:00
Marko Mäkelä
761e6574c8 MDEV-14396 Assertion failed in create_option_need_rebuild
Relax a too strict debug assertion, and add a test.
2017-11-15 02:41:45 +02:00
Daniel Bartholomew
7e1326cfcf bump the VERSION 2017-11-14 17:23:17 -05:00
Igor Babaev
3afc9629fd Fixed bug mdev-13453 Executing a query via CTE requires more permissions
than the query itself

ACL checks were not properly supported for tables used in CTE
specifications. This patch fixes the problem.
2017-11-14 12:23:31 -08:00
Alexander Barkov
765452dbef MDEV-14388 Server crashes in handle_select / val_uint in ORACLE mode 2017-11-14 16:31:10 +04:00
Alexey Botchkov
24184938ad MDEV-11881 Empty coordinates must be rejected in GeoJSON objects.
Check for the empty 'coordinates' array.
2017-11-14 13:36:50 +04:00
Oleksandr Byelkin
0f43279cc4 MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
Repeat reworked solution of procedures for all posible Sp (functions &
triggers).
2017-11-14 08:54:21 +01:00
Vladislav Vaintroub
05103c84ec MDEV-14205 Windows : fix race condition writing into error log and setvbuf
Do not do reopen_fstreams/setbuf twice during server startup on Windows.
fprintf(stderr,..) might crash, if setbuf is executed at the same time.
2017-11-13 18:41:55 +00:00
Alexander Barkov
071aece907 MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES 2017-11-13 21:58:00 +04:00
Vladislav Vaintroub
5632652804 update C/C 2017-11-13 14:59:43 +00:00
Vladislav Vaintroub
f48d56c459 MDEV-14192 Apply marko's patch 2017-11-13 14:58:18 +00:00
Oleksandr Byelkin
0611797729 Fix of result code check by Monty's request. 2017-11-13 13:04:21 +01:00
Marko Mäkelä
e94c9d24f6 MDEV-14378 In ALGORITHM=INPLACE, use a common name for the intermediate tables or partitions
Allow DROP TABLE `#mysql50##sql-...._.` to drop tables that were
being rebuilt by ALGORITHM=INPLACE

NOTE: If the server is killed after the table-rebuilding ALGORITHM=INPLACE
commits inside InnoDB but before the .frm file has been replaced, then
the recovery will involve something else than DROP TABLE.

NOTE: If the server is killed in a true inplace ALTER TABLE commits
inside InnoDB but before the .frm file has been replaced, then we
are really out of luck. To properly handle that situation, we would
need a transactional mysql.ddl_fixup table that directs recovery to
rename or remove files.

prepare_inplace_alter_table_dict(): Use the altered_table->s->table_name
for generating the new_table_name.

table_name_t::part_suffix: The start of the partition name suffix.

table_name_t::dbend(): Return the end of the schema name.

table_name_t::dblen(): Return the length of the schema name, in bytes.

table_name_t::basename(): Return the name without the schema name.

table_name_t::part(): Return the partition name, or NULL if none.

row_drop_table_for_mysql(): Assert for #sql, not #sql-ib.
2017-11-13 11:12:29 +02:00
Oleksandr Byelkin
d1b666b5c6 MDEV-14346: incorrect result of intersect with ANY/ALL/IN subquery
Reinit internal state of select_unit before using to correctly run it after first time.
2017-11-13 10:02:59 +01:00
Oleksandr Byelkin
d2bf101cbf MDEV-13723: Server crashes in ha_heap::find_unique_row or Assertion `0' failed in st_select_lex_unit::optimize with INTERSECT
With INTERSECT/EXCEPT fact that subquery item of IN/ALL/ANY was not assigned value does not mean that temporary table used for calculating unit is empty (records could be deleted).
2017-11-13 09:41:29 +01:00
Sergei Golubchik
8b18a44fa7 mroonga after-merge CMakeLists.txt fixes
1. remove erroneously committed *.orig
2. fix LZ4 detection on Mac OS X and FreeBSD. Cannot do

   pkg_check_modules(LIBLZ4 liblz4)
   find_library(LIBLZ4_LIBS ... )

because find_library(X) does not do anything if X is defined (documented),
and pkg_check_modules(Y) sets Y_LIBS to "" (undocumented!)
2017-11-13 13:11:53 +08:00
Marko Mäkelä
b2dd5232d4 InnoDB: Remove ut_vsnprintf() and the use of my_vsnprintf(); use vsnprintf() 2017-11-13 04:32:56 +02:00
Marko Mäkelä
c19ef508b8 InnoDB: Remove ut_snprintf() and the use of my_snprintf(); use snprintf() 2017-11-13 02:11:48 +02:00
Marko Mäkelä
17bd6ed29a Remove STATUS_VERBOSE (there is no visible output) 2017-11-12 17:27:36 +02:00
Alexey Botchkov
1e2d4f677e MDEV-13971 crash in skip_num_constant.
Character bigger than 0x60 wasn't handled properly
        inside a numeric constant.
2017-11-11 13:54:56 +04:00
Igor Babaev
dcbf2823c7 Fixed MDEV-13994 Bad join results with orderby_uses_equalities=on.
This patch effectively blocks the optimization that uses multiple
equalities for ORDER BY to remove tmp table in the case when
the first table happens to be the result of materialization of
a semi-join nest. Currently there is no code at the execution level
that would support the optimization in this case.
2017-11-10 14:01:29 -08:00
Elena Stepanova
1fdf11669c Updated list of unstable tests for 10.1.29 release 2017-11-10 21:06:58 +02:00
Marko Mäkelä
a48aa0cd56 Merge bb-10.2-ext into 10.3 2017-11-10 16:12:45 +02:00
Marko Mäkelä
8409f721ff setval(): Do not fall through from GET_FLAGSET to GET_BIT 2017-11-10 16:11:15 +02:00
Marko Mäkelä
386e5d476e Merge 10.2 into bb-10.2-ext 2017-11-10 16:07:01 +02:00
Marko Mäkelä
589b0b3655 Allow innodb_open_files to be exceeded 2017-11-10 16:06:44 +02:00
Marko Mäkelä
fa00fedaac MDEV-14100 Assertion `!is_user_rec || leaf || ...
rec_get_offsets_func(): Relax a bogus debug assertion.
It would fail when we are operating on a copied prefix
of a node pointer record.
2017-11-10 15:58:52 +02:00
Marko Mäkelä
9618c04e3f Follow-up fix of MDEV-13795/MDEV-14332
row_log_table_apply_op(): Remove references to dict_table_t::n_vcols.
Virtual column information is no longer being written to the log.

row_log_t: Remove the unused fields n_old_col, n_old_vcol.
2017-11-10 15:58:52 +02:00
Oleksandr Byelkin
623ed1c204 MDEV-13723: Server crashes in ha_heap::find_unique_row or Assertion `0' failed in st_select_lex_unit::optimize with INTERSECT
With INTERSECT/EXCEPT fact that subquery item of IN/ALL/ANY was not assigned value does not mean that temporary table used for calculating unit is empty (records could be deleted).
2017-11-10 14:31:50 +01:00
Marko Mäkelä
1ca72a0c0d Merge 10.2 into bb-10.2-ext 2017-11-10 08:27:09 +02:00
Sergei Golubchik
2a4e4335c4 Merge branch 'github/10.0-galera' into 10.1 2017-11-10 01:38:03 +01:00
Sergei Golubchik
7002291b8a Merge branch '10.0' into 10.1 2017-11-10 01:14:58 +01:00
Sergei Golubchik
d79fd5ba7f Merge branch 'ks-10.1-mroonga' into 10.1 2017-11-10 01:14:55 +01:00