Commit graph

17172 commits

Author SHA1 Message Date
Marko Mäkelä
c051eaba46 MDEV-14988 innodb_read_only tries to modify files if transactions were recovered in COMMITTED state
lock_trx_release_locks(): Relax a debug assertion to allow
recovered TRX_STATE_COMMITTED_IN_MEMORY transactions.

trx_commit_in_memory(): Add DEBUG_SYNC instrumentation.

trx_undo_insert_cleanup(): Skip persistent changes if innodb_read_only
is set. This should only happen when a recovered committed transaction
would be cleaned up at shutdown.
2018-02-13 14:29:32 +02:00
Vicențiu Ciorbaru
6f0b316fbe Update wrong xtradb version
The update was lost during merge.
2018-02-08 21:12:11 +02:00
Marko Mäkelä
5421e3aee7 MDEV-15249 Crash in MVCC read after IMPORT TABLESPACE
PageConverter::adjust_cluster_record(): Instead of writing
the invalid value DB_ROLL_PTR=0, write a value that indicates
a fresh insert, that is, prevents the DB_ROLL_PTR from being
dereferenced in any circumstances.

It can be argued that IMPORT TABLESPACE should actually
update the dict_index_t::trx_id to prevent older transactions
from accessing the table, similar to what I did on table
rebuild in MySQL 5.6.6 in
03f81a55f2
2018-02-08 12:59:32 +02:00
Marko Mäkelä
706ed8552d Revert "MDEV-6928: Add trx pointer to struct mtr_t"
This reverts commit 3486135bb5.

The commit comment ended in the words: "This is needed later."
Apparently the "later" never arrived.
2018-01-29 11:05:17 +02:00
Vicențiu Ciorbaru
61e2f43e05 Remove ut_win_init_time from innodb
The patch was brought in from 5.6.39 merge and we don't need it in
MariaDB
2018-01-25 19:50:13 +02:00
Vicențiu Ciorbaru
f775ee6006 Fix innodb compilation failure on Windows
We don't need to print an error when loading kernel32.dll. If we can't
load it we'll automatically crash. Reviewed by wlad@mariadb.com
2018-01-25 11:34:56 +02:00
Vicențiu Ciorbaru
12c42bd2c7 Remove xtradb "fragmentation-statistics" patches
The patches are implemented using server changes in THD. We are not
interested in having special code for certain storage engines, if
possible.
2018-01-24 20:21:58 +02:00
Vicențiu Ciorbaru
a82bb5d316 Merge branch 'merge-xtradb-5.6' into 10.0 2018-01-24 20:20:11 +02:00
Vicențiu Ciorbaru
3699a4b5c0 Merge branch 'merge-innodb-5.6' into 10.0 2018-01-24 18:23:25 +02:00
Vicențiu Ciorbaru
d81e41e773 Update Tokudb Test Results 2018-01-24 17:54:25 +02:00
Vicențiu Ciorbaru
fc3df561d4 Make TokuDB run on 10.0 2018-01-24 17:26:40 +02:00
Vicențiu Ciorbaru
c5f333adb6 Merge branch 'merge-tokudb-5.6' into 10.0 2018-01-24 17:26:15 +02:00
Vicențiu Ciorbaru
1e88e85503 Squashed commit of connect/10.0:
Main additions:

commit 543c2006a70983c2ce75024bce3679b0c20f9ae6
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Thu Jan 4 13:51:13 2018 +0100

    - Fix MDEV-9844, MDEV-10179, MDEV-14214
     This is done by removing the tbl table type THREAD option
     that causes a multiple of sporadic bugs.
     This may be temporary depending on whether a real fix is found.
      modified:   storage/connect/mysql-test/connect/disabled.def
      modified:   storage/connect/tabtbl.cpp
      modified:   storage/connect/tabtbl.h

commit 54bc4ea024ca5fb5c137c618084d8cccfba2ee3f
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Fri Nov 3 16:21:56 2017 +0100

    - Fix MDEV-13925: Actually this fixes SELECT queries when
      the WHERE clause have single quote.
      modified:   storage/connect/ha_connect.cc

    - Use Windows VirtualAlloc and VirtualFree for the Sarea workspace
      modified:   storage/connect/global.h
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/plgdbutl.cpp
      modified:   storage/connect/plugutil.cpp
      modified:   storage/connect/user_connect.cc

    - Change inihandl from c to c++.
      Because it now includes global.h that contains a bool function definition
      that make compile to fail on Linux.
      modified:   storage/connect/CMakeLists.txt
      removed:    storage/connect/inihandl.c
      added:      storage/connect/inihandl.cpp

    - Fix MDEV-13860 CONNECT engine does not build with JDBC without ODBC.
      By including Sergei's patch in connect_assisted_discovery.
      modified:   storage/connect/ha_connect.cc

commit c07064d31a4d7ee0533fec144648d93873c0dd17
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Oct 18 00:11:00 2017 +0200

    - Update version number
      modified:   storage/connect/ha_connect.cc

    - Include MONGO in all Java enabled distributions
      Mongo will be enabled only for 10.2 and 10.3
      modified:   storage/connect/CMakeLists.txt

    - Change JDBC_SUPPORT to JAVA_SUPPORT which also replaces MONGO_SUPPORT
      MONGO_SUPPORT is now just used to enable the MONGO table type
      modified:   storage/connect/filter.cpp
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h
      modified:   storage/connect/mongo.cpp
      modified:   storage/connect/mycat.cc
      modified:   storage/connect/plgdbutl.cpp
      modified:   storage/connect/tabjson.cpp
      modified:   storage/connect/tabjson.h

    - Move MakeSelector function from FILTER to mongo.cpp
      modified:   storage/connect/filter.cpp
      modified:   storage/connect/filter.h
      modified:   storage/connect/cmgoconn.cpp
      modified:   storage/connect/jmgoconn.cpp
      modified:   storage/connect/mongo.cpp

    - Do mongo_init only on first use of the MongoDB C Driver
      This will permit to delay load the mongo lib on Windows
      modified:   storage/connect/cmgoconn.cpp
      modified:   storage/connect/cmgoconn.h
      modified:   storage/connect/ha_connect.cc

    - Replace NEW_VAR by a test on MYSQL_VERSION_ID
      modified:   storage/connect/ha_connect.cc

    - Suppress enable_mongo session variable
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc

    - Make some function headers identical in .h and .cc file
      (replacing const char* by PCSZ)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - Change a parameter type from uchar* to const uchar*
      (for ScanRecord and CheckRecord)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - Changes on LIKE and NOT LIKE does not fix a bug yet
      modified:   storage/connect/ha_connect.cc

    - Suppress PIVOT_SUPPORT (PIVOT type is unconditionnal)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc

    - Change the strz function from inline to static
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - export the JavaConn class and the MgoColumns and IsNum functions
      modified:   storage/connect/javaconn.h
      modified:   storage/connect/json.h
      modified:   storage/connect/mongo.h

    - Fix MDEV-13924
      modified:   storage/connect/jdbconn.cpp

    - Make a temporary fix for the compiler bug in CalculateArray
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/tabjson.cpp

    - Typo
      modified:   storage/connect/jdbccat.h
      modified:   storage/connect/reldef.h
      modified:   storage/connect/tabext.h
      modified:   storage/connect/tabjmg.cpp
      modified:   storage/connect/tabxml.h
      modified:   storage/connect/valblk.h
      modified:   storage/connect/value.h
      modified:   storage/connect/xtable.h

    - Fix a bug in MONGO tests by changing 'MONGO' to $TYPE
      modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

    - Record test results to reflect all changes
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result

commit 3da90fd112e7d5ee6f0bd9c3fc3eeb4529b30e93
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Oct 11 12:21:56 2017 +0200

    Fix MDEV-13924 modified: storage/connect/jdbconn.cpp

commit 2566e67da80f291414f02c7dd6a8ca3557161d26
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Mon Sep 11 16:38:41 2017 +0200

    Enable MONGO for the C driver. Modified: modified:   storage/connect/CMakeLists.txt

commit 27ae11db830c5d62bbf8b8b13cab976b74efe7dd
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Tue Sep 5 19:52:04 2017 +0200

    - Update version number
      modified:   storage/connect/ha_connect.cc

    - Regard columns with binary charset as string (was binary)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/tabmysql.cpp
      modified:   storage/connect/tabutil.cpp

    - Support length 0 for CHAR and VARCHAR
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/reldef.cpp
      modified:   storage/connect/value.cpp

    - Add ACCEPT option for void columns in discovery
      modified:   storage/connect/tabjson.cpp

    - Update some tests because of above change
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
      modified:   storage/connect/mysql-test/connect/r/odbc_oracle.result
      modified:   storage/connect/mysql-test/connect/r/updelx.result
      modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

commit f6ee6cd1d42d861fa50fea8d9a7079347b7ddfd6
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Sat Sep 2 16:06:10 2017 +0200

    - Fix MongoDB C Driver adding for CMAKE.
      Requires MongoDB C Driver version 1.7 now available
      modified:   storage/connect/CMakeLists.txt

    - Add more trace to tbl_thread.test (to debug failure)
      modified:   storage/connect/mysql-test/connect/r/tbl_thread.result
      modified:   storage/connect/mysql-test/connect/t/tbl_thread.test
2018-01-24 16:12:52 +02:00
Vicențiu Ciorbaru
b20f821e07 Fix Innodb ASAN error on init
Backport 7c03edf2fe from xtradb to innodb
2018-01-24 15:18:36 +02:00
Vicențiu Ciorbaru
d833bb65d5 Merge remote-tracking branch '5.5' into 10.0 2018-01-24 12:29:31 +02:00
Monty
d5d0c62459 Fixed a few compiler warnings 2018-01-24 00:09:34 +02:00
Monty
b3c7cf81e3 Fix for MDEV-14141 Crash in print_keydup_error()
May also fix: MDEV-14970 "MariaDB crashed with signal 11 and Aria table"

I am not able to reproduce a crash, however there was no protection in
print_keydup_error() if the storage engine reported the wrong key number.

This patch adds such a protection and should stop any further crashes
in this case.

Other things:
- Added extra protection in Aria to not set errkey to more than number of
  keys. (Don't think this is cause of this crash, but better safe than
  sorry)
- Extend test_if_equal_repl_errors() to handle different cases of
  ER_DUP_ENTRY. This is just mainly precaution for the future.
2018-01-24 00:09:34 +02:00
Marko Mäkelä
8637931f11 Add ASAN instrumentation (and more strict Valgrind) to InnoDB
mem_heap_free_heap_top(): Remove UNIV_MEM_ASSERT_W() and unpoison
the memory region first, because part of it may have been poisoned
by an earlier mem_heap_free_top() call.
Poison the address range at the end.

mem_heap_block_free(): Poison the address range at the end.

UNIV_MEM_ASSERT_AND_ALLOC(): Replace with UNIV_MEM_ALLOC().
We want to keep the address ranges poisoned (unaccessible) as
long as possible.

UNIV_MEM_ASSERT_AND_FREE(): Replace with UNIV_MEM_FREE().
2018-01-23 20:34:05 +02:00
Vicențiu Ciorbaru
f6716cef7e 5.6.38-83.0 2018-01-23 19:20:10 +02:00
Marko Mäkelä
70a9b12de9 Silence -Wimplicit-fallthrough 2018-01-23 18:08:55 +02:00
Vicențiu Ciorbaru
cd33250d2a 5.6.38-83.0 2018-01-23 18:04:34 +02:00
Vicențiu Ciorbaru
3dfe148074 5.6.39 2018-01-23 17:43:37 +02:00
Vicențiu Ciorbaru
a04b07eb34 Fix TokuDB Not building
We don't check for DLSYM in CMake, check for DLOPEN instead.
2018-01-23 00:03:41 +02:00
Sergei Golubchik
ea78c5744b MDEV-13988 connect.drop-open-error fails
PCOLRES::Length is the length in characters, not in bytes
(because it's printed as length in "VARCHAR(N)").
So convert it into characters using cs->mbmaxlen.
2018-01-22 20:26:34 +01:00
Marko Mäkelä
431607237d MDEV-12173 "Error: trying to do an operation on a dropped tablespace"
InnoDB is issuing a 'noise' message that is not a sign of abnormal
operation. The only issuers of it are the debug function
lock_rec_block_validate() and the change buffer merge.
While the error should ideally never occur in transactional locking,
we happen to know that DISCARD TABLESPACE and TRUNCATE TABLE and
possibly DROP TABLE are breaking InnoDB table locks.

When it comes to the change buffer merge, the message simply is useless
noise. We know perfectly well that a tablespace can be dropped while a
change buffer merge is pending. And the code is prepared to handle that,
which is demonstrated by the fact that whenever the message was issued,
InnoDB did not crash.

fil_inc_pending_ops(): Remove the parameter print_err.
2018-01-22 16:58:13 +02:00
Sergei Golubchik
03eb15933d improve ASAN instrumentation: InnoDB/XtraDB 2018-01-22 11:39:54 +01:00
Sergei Golubchik
f2408e7e6a Free memory in unit tests. Makes ASAN happier. 2018-01-22 11:39:54 +01:00
Sergei Golubchik
36eb0b7a55 improve ASAN instrumentation: table->record[0]
instrument table->record[0], table->record[1] and share->default_values.

One should not access record image beyond share->reclength, even
if table->record[0] has some unused space after it (functions that
work with records, might get a copy of the record as an argument,
and that copy - not being record[0] - might not have this buffer space
at the end). See b80fa4000d and 444587d8a3
2018-01-22 11:39:54 +01:00
Sergei Golubchik
22ae3843db Correct TRASH() macro usage
TRASH was mapped to TRASH_FREE and was supposed to be used for memory
that should not be accessed anymore, while TRASH_ALLOC() is to be
used for uninitialized but to-be-used memory.

But sometimes TRASH() was used in the latter sense.

Remove TRASH() macro, always use explicit TRASH_ALLOC() or TRASH_FREE().
2018-01-22 11:39:54 +01:00
Sergei Golubchik
204cb85aab Fix compilation without dlopen 2018-01-22 11:39:54 +01:00
Marko Mäkelä
906ce0962d MDEV-7049 MySQL#74585 - InnoDB: Failing assertion: *mbmaxlen < 5 in file ha_innodb.cc line 1904
InnoDB limited the maximum number of bytes per character to 4.
But, the filename character set that was introduced in MySQL 5.1
uses up to 5 bytes per character.

To allow InnoDB tables to be created with wider characters, let
us split the mbminmaxlen fields into mbminlen, mbmaxlen, and increase
the limit to 7 bytes per character. This will increase the payload size
of dtype_t and dict_col_t by one bit. The storage size will be unchanged
(54 bits and 77 bits will use the same number of bytes as the
previous sizes 53 and 76 bits).
2018-01-22 11:18:10 +02:00
Sergei Golubchik
fafdac3365 Merge branch 'merge/merge-xtradb-5.5' into 5.5 2018-01-18 17:56:28 +01:00
Sergei Golubchik
2d52d3c1bf Merge branch 'mysql/5.5' into 5.5 2018-01-18 17:54:48 +01:00
Marko Mäkelä
5e87f49a99 Make row_mysql_table_id_reassign() static 2018-01-18 09:29:49 +02:00
Sergei Golubchik
85a5e58d71 5.5.58-38.10 2018-01-17 17:28:33 +01:00
Sergei Golubchik
b80fa4000d bug: ha_heap was unilaterally increasing reclength
MEMORY engine needs the record length to be at least sizeof(void*),
because it stores a pointer there (linking deleted records into a list).
So when the reclength is less than sizeof(void*), it's set to sizeof(void*).
That is done inside heap_create(), and the upper layer doesn't know
that the engine writes beyond share->reclength.

While it's usually safe (in-memory record size is rounded up to
sizeof(double), so even if share->reclength is too small,
share->rec_buff_len is not), it could cause problems in the code that
copies records and expects them to fix in share->reclength,
e.g. in partitioning.
2018-01-16 23:31:29 +01:00
Sergei Golubchik
d7b84f9413 compiler warning
gcc 6 issues a warning about a suspicious construct

  while(0);
  {
     some code
  }
2018-01-15 15:57:03 +01:00
Oleksandr Byelkin
a5285a8fb7 Fixed misleading voariable names. 2018-01-11 17:24:29 +01:00
Oleksandr Byelkin
abb9e703d2 MDEV-14690: Assertion `page_link == &fake_link' failed in pagecache_write_part
Fix the call to correspond protocoll of pagecache call.
Fix of misleading variables names.
2018-01-11 17:24:29 +01:00
Monty
1f18bd630a MDEV-8200 aria bug with insert select and lock tables
This bug happens when locking the same Aria "transactional" table
(page format) more then once with LOCK TABLES and inserting into one
of them with INSERT ... SELECT when the table is empty.

Fixed by ensuring we don't use fast bulk insert if table is opened
twice with LOCK TABLES (as this changes table->s->state)

Code changes:
- Added use_count to MARIA_USED_TABLES to be able to check if
  table is opened twice for a statement/lock table
- Don't clear history or reset info->start_state if we
  don't have versioning. One reason for the bug was
  was that info->start_state was set to point to different
  states for the two tables.  If there is no versioning
  info->start_state should always point to info->s->state.common.

Other things:
- Fixed also some typos that was noticed while scanning the code
- More DBUG_PRINT
2018-01-11 16:39:29 +02:00
Marko Mäkelä
4c1479545d Merge 5.5 into 10.0 2018-01-11 10:16:52 +02:00
Marko Mäkelä
bdcd7f79e4 MDEV-14916 InnoDB reports warning for "Purge reached the head of the history list"
The warning was originally added in
commit c67663054a
(MySQL 4.1.12, 5.0.3) to trace claimed undo log corruption that
was analyzed in https://lists.mysql.com/mysql/176250
on November 9, 2004.

Originally, the limit was 20,000 undo log headers or transactions,
but in commit 9d6d1902e0
in MySQL 5.5.11 it was increased to 2,000,000.

The message can be triggered when the progress of purge is prevented
by a long-running transaction (or just an idle transaction whose
read view was started a long time ago), by running many transactions
that UPDATE or DELETE some records, then starting another transaction
with a read view, and finally by executing more than 2,000,000
transactions that UPDATE or DELETE records in InnoDB tables. Finally,
when the oldest long-running transaction is completed, purge would
run up to the next-oldest transaction, and there would still be more
than 2,000,000 transactions to purge.

Because the message can be triggered when the database is obviously
not corrupted, it should be removed. Heavy users of InnoDB should be
monitoring the "History list length" in SHOW ENGINE INNODB STATUS;
there is no need to spam the error log.
2018-01-11 09:55:10 +02:00
Marko Mäkelä
a9c55c0059 MDEV-13814 Extra logging when innodb_log_archive=ON
Backport the fix from 10.0.33 to 5.5, in case someone compiles XtraDB
with -DUNIV_LOG_ARCHIVE
2018-01-10 10:21:52 +02:00
Marko Mäkelä
a408e881cf MDEV-14174 crash on start with innodb-track-changed-pages
The XtraDB option innodb_track_changed_pages causes
the function log_group_read_log_seg() to be invoked
even when recv_sys==NULL, leading to the SIGSEGV.

This regression was caused by
MDEV-11027 InnoDB log recovery is too noisy
2018-01-10 09:27:01 +02:00
Marko Mäkelä
c903ba2f1e MDEV-13205 InnoDB: Failing assertion: !dict_index_is_online_ddl(index) upon ALTER TABLE
dict_foreign_find_index(): Ignore incompletely created indexes.
After a failed ADD UNIQUE INDEX, an incompletely created index
could be left behind until the next ALTER TABLE statement.
2018-01-08 14:26:55 +02:00
Marko Mäkelä
4496fd71f4 Fix a truncation warning introduced in MDEV-12323 2018-01-04 20:39:00 +02:00
Marko Mäkelä
8ac1982fcc Merge 5.5 into 10.0 2018-01-03 20:40:41 +02:00
Marko Mäkelä
84c9c8b2e9 Silence some -Wimplicit-fallthrough by proper spelling 2018-01-03 15:01:17 +02:00
Marko Mäkelä
51e4650ed0 Merge 5.5 into 10.0 2018-01-02 21:52:46 +02:00
Marko Mäkelä
20fab71b14 Follow-up to MDEV-14799: Remove bogus debug assertions
trx_undo_rec_get_partial_row(): When the PRIMARY KEY includes a
column prefix of an externally stored column, the already parsed
part of the undo log record may contain a reference to
an off-page column. This is the case in the bug58912 test in
innodb.innodb.
2018-01-02 21:41:39 +02:00