Commit graph

181000 commits

Author SHA1 Message Date
Sergei Golubchik
3c87973235 MDEV-14990 mysql_upgrade fails with ERROR 1408 (HY000) at line 566: Event Scheduler: An error occurred when initializing system tables
Don't check mysql.db and mysql.user from event schedule on startup.

Event schedule should only check its own mysql.event table, it has
no business checking other system tables. In particular, it's ridiculous
for event schedule to fail when privilege tables are not the newest,
because sql_acl.cc supports old privilege tables just fine.
2018-02-13 00:23:57 +01:00
Sergei Golubchik
f7621f17bd rename mysql.user and mysql.db column
Truncate_versioning_priv->Delete_history_priv

because the command and the privilege were renamed
2018-02-12 23:43:48 +01:00
Sergei Golubchik
f51ecfee93 MDEV-15146 SQLError[4122]: View is not system versioned
don't expand AS OF in views, and, in particular, don't auto-add
AS OF NOW().
2018-02-12 23:43:48 +01:00
Sergei Golubchik
39157fbf05 Remove ER_NON_VERSIONED_FIELD_IN_HISTORICAL_QUERY 2018-02-12 23:43:47 +01:00
Sergei Golubchik
d0f5e56a20 MDEV-14785 SYSTEM_INVISIBLE behaviour not consistent
Hide INVISIBLE_SYSTEM columns from writes and from fix_vcol_expr().
2018-02-12 23:43:47 +01:00
Sergei Golubchik
34ee747f55 cleanup: remove MARK_COLUMNS_NONE 2018-02-12 23:12:30 +01:00
Sergei Golubchik
103715d0fa cleanup: renames
enum_mark_columns -> enum_column_usage
mark_used_columns -> column_usage

further commits will replace MARK_COLUMN_NONE with
COLUMN_READ and COLUMN_WRITE that convey the intention
without causing columns to be marked
2018-02-12 22:49:10 +01:00
Sergei Golubchik
8cd3d2d941 fixes for ctags 2018-02-12 14:14:35 +01:00
Sergei Golubchik
4fd48678ae ALTER TABLE ... DROP COLUMN sys_start
update all unique keys, not just PK
2018-02-12 14:14:35 +01:00
Sergei Golubchik
dfd42ed990 ALTER TABLE ... DROP COLUMN sys_start should rename a "dropped" column 2018-02-12 14:14:35 +01:00
Sergei Golubchik
c847089e6e Cannot DROP VERSIONING without dropping all visible AS ROW fields 2018-02-12 13:46:08 +01:00
Sergei Golubchik
f3a49e7020 Don't allow adding AS ROW START column to a not versioned table 2018-02-12 13:46:08 +01:00
Sergei Golubchik
bc0ac28f69 ALTER TABLE ... DROP VERSIONING
don't add columns to the drop list, INVISIBLE_SYSTEM columns
cannot be recognized as specified by the user
2018-02-12 13:46:07 +01:00
Sergei Golubchik
59ca71d496 INVISIBLE columns in USING and NATURAL JOIN
* don't disclose INVISIBLE_FULL columns in USING and NATURAL JOIN
* other INVISIBLE columns must me mentioned by name in USING,
  they are hidden from NATURAL JOIN
2018-02-12 13:46:07 +01:00
Sergei Golubchik
7a42f28e16 cleanup: mark_common_columns() 2018-02-12 13:35:13 +01:00
Sergei Golubchik
031c85ca56 cleanup: remove duplicated code 2018-02-12 13:35:12 +01:00
Sergei Golubchik
7fa88d4435 cleanup: simplify fill_record() 2018-02-12 13:35:12 +01:00
Sergei Golubchik
34857b9166 cleanup: find_field_in_table()
don't duplicate functionality, use TABLE::find_field_by_name()

also, set cached_field_index_ptr for _rowid field
2018-02-12 13:35:12 +01:00
Sergei Golubchik
f894f902a4 cleanup: TABLE::find_field_by_name
use name hash, just like find_field_in_table() does
2018-02-12 13:35:11 +01:00
Sergei Golubchik
711f3dd7f5 MDEV-13417 UPDATE produces wrong values if an updated column is later used as an update source
replication tests
2018-02-12 13:14:23 +01:00
Jerome Brauge
d943d7f712 MDEV-13417 UPDATE produces wrong values if an updated column is later used as an update source
Standard compatible behavior for UPDATE: all assignments in SET
are executed "simultaneously", not left-to-right. And `SET a=b,b=a`
will swap the values.
2018-02-12 13:14:23 +01:00
Sergei Golubchik
355ee6877b MDEV-13946 Server RPMs have dependency on "which"
cleanup. use "command -v" instead of "which"
simplify some checks.
2018-02-12 12:46:34 +01:00
Vladislav Vaintroub
2232784f00 Fix inadverent change in Sql_alloc
For placement new, throw() exception specification was removed by
accident in 8fe04a3df3 , making  debug
tests, that simulate out-of-memory situations, fail (e.g filesort_debug)
2018-02-10 00:07:39 +00:00
Vladislav Vaintroub
17c9ed6725 Fix perfschema tests in debug mode.
Correctly initialize fake IPs.
2018-02-10 00:00:10 +00:00
Marko Mäkelä
e3cf577948 MDEV-14663 Assertion page_is_root(block->frame) failed in innobase_add_instant_try
innobase_add_instant_try(): If the leftmost leaf page does not contain
other records than the 'default row', only empty the table if there
are no successor pages.

When a table or partition which was not empty during a previous
instant ADD COLUMN became empty later, and now with this subsequent
instant ADD COLUMN we have the opportunity to convert the empty table
or partition to 'non-instant' format.

Similarly, if the table or partition is empty to begin with, that is,
it does not even contain a 'default row' record, we can use the
'non-instant' format.
2018-02-08 22:45:16 +02:00
Marko Mäkelä
32170f8c6d Add page_has_prev(), page_has_next(), page_has_siblings()
Until now, InnoDB inefficiently compared the aligned fields
FIL_PAGE_PREV, FIL_PAGE_NEXT to the byte-order-agnostic value FIL_NULL.
2018-02-08 22:34:21 +02:00
Jan Lindström
3969d97e6a MDEV-14427: encryption.innodb-bad-key-change failed in buildbot
Timing problem as sometimes table is marked as encrypted but
sometimes we are not sure and table is just marked missing.
2018-02-08 14:57:39 +02:00
Vladislav Vaintroub
627d33d9cf Innodb, Windows : Reenable compiler optimizations for mem0mem.cc
Compiler optimizations were switched off due to
MySQL Bug #19424, #36366, #34297, due to an alleged compiler bug.
No  proper analysis of code generation was done back then, thus proof of
a compiler bug is missing.

Even if there was a compiler bug 13 years ago, it could have been fixed.
Will wait and see if there are any complains or crashes
2018-02-08 12:16:06 +00:00
Vladislav Vaintroub
6c5d364956 MDEV-14953 - rename libmysqld.so to libmariadbd.so 2018-02-08 12:02:49 +00:00
Marko Mäkelä
bbdb47ffe4 Revert an accidental change
trx_undo_rec_copy(): Use a debug assertion. In a non-debug build,
with len<0 (which this assertion is really testing for)
we should still typically crash due to running out of memory.
2018-02-08 12:28:07 +02:00
Marko Mäkelä
7660d8c94e Remove dict_table_t::is_clust()
Replace all occurrences of the is_clust() method with is_primary(),
because that is what is actually meant. (Also the change buffer
tree would count as a clustered index.)
2018-02-08 12:18:07 +02:00
Marko Mäkelä
609d0a9194 MDEV-14407 Assertion failure during rollback
Rollback attempted to dereference DB_ROLL_PTR=0, which cannot possibly
be a valid undo log pointer. A safer canonical value would be
roll_ptr_t(1) << ROLL_PTR_INSERT_FLAG_POS
which is what was chosen in MDEV-12288, corresponding to reset_trx_id.

No deterministic test case for the bug was found. The simplest test
cases may be related to MDEV-11415, which suppresses undo logging for
ALGORITHM=COPY operations. In those operations, in the spirit of
MDEV-12288, we should actually have written reset_trx_id instead of
using the transaction identifier of the current transaction
(and a bogus value of DB_ROLL_PTR=0). However, thanks to MySQL Bug#28432
which I had fixed in MySQL 5.6.8 as part of WL#6255, access to the
rebuilt table by earlier-started transactions should actually have been
refused with ER_TABLE_DEF_CHANGED.

reset_trx_id: Move the definition to data0type.cc and the declaration
to data0type.h.

btr_cur_ins_lock_and_undo(): When undo logging is disabled, use the
safe value that corresponds to reset_trx_id.

btr_cur_optimistic_insert(): Validate the DB_TRX_ID,DB_ROLL_PTR before
inserting into a clustered index leaf page.

ins_node_t::sys_buf[]: Replaces row_id_buf and trx_id_buf and some
heap usage.

row_ins_alloc_sys_fields(): Init ins_node_t::sys_buf[] to reset_trx_id.

row_ins_buf(): Only if undo logging is enabled, copy trx->id
to node->sys_buf. Otherwise, rely on the initialization in
row_ins_alloc_sys_fields().

row_purge_reset_trx_id(): Invoke mlog_write_string() with reset_trx_id
directly. (No functional change.)

trx_undo_page_report_modify(): Assert that the DB_ROLL_PTR is not 0.

trx_undo_get_undo_rec_low(): Assert that the roll_ptr is valid before
trying to dereference it.

dict_index_t::is_primary(): Check if the index is the primary key.

PageConverter::adjust_cluster_record(): Fix
MDEV-15249 Crash in MVCC read after IMPORT TABLESPACE
by resetting the system fields to reset_trx_id instead of writing
the current transaction ID (which will be committed at the
end of the IMPORT TABLESPACE) and DB_ROLL_PTR=0.
This can partially be viewed as a follow-up fix of MDEV-12288,
because IMPORT should already then have written
DB_TRX_ID=0 and DB_ROLL_PTR=1<<55 to prevent unnecessary
DB_TRX_ID lookups in subsequent accesses to the table.
2018-02-08 12:14:34 +02:00
Vladislav Vaintroub
e2387835ef Cleanup - removed warning suppression - no longer needed. 2018-02-07 20:23:10 +00:00
Vladislav Vaintroub
53476abce8 Windows, compiling : use /permissive- switch to improve conformance
fix a couple "initialization skipped by goto" and other new errors.
2018-02-07 20:22:30 +00:00
Vladislav Vaintroub
8fe04a3df3 Windows, compile : reenable previously disabled warning C4291
no matching operator delete found; memory will not be freed if initialization throws an exception

Added a no-op delete() for MEM_ROOT based placement-new()
2018-02-07 20:19:40 +00:00
Vladislav Vaintroub
282b652028 Windows, compiling : reenable warning C4996 (deprecated functions)
But set _CRT_NONSTDC_NO_WARNINGS to silence silly warnings about
ANSI C function being non-standard

Remove now deprecated GetVersion()/GetVersionEx(),except single case
where where it is really needed, in feedback plugin. Remove checks for
Windows NT.

Avoid old IPv4-only inet_aton, which generated the warning.
2018-02-07 20:17:38 +00:00
Vladislav Vaintroub
d995dd2865 Windows : reenable warning C4805 (unsafe mix of types in bool operations) 2018-02-07 20:12:12 +00:00
Andrei Elkin
7bcf5e2907 MDEV-15238 rpl.perf_buildin_semisync_issue40 sporadically fails on BB
The test was used to result in mismatch due to unaccounted specifics
of the master-slave handshake protocol that sets the Slave_IO_Running
status to true while the semisync master status is set to active a bit later.

The test is refined to expect that.
2018-02-07 19:59:20 +02:00
Monty
029ab11cc8 Update wrong result test found by fix to mysql_upgrade 2018-02-07 13:29:08 +02:00
Monty
6ba06cf763 On upgrade Truncate_versioning_privilege was not correct set
Fixed that Truncate_versioning_privilege works as any other privilege
during upgrade:

- If the privilege field does not exists, add it to the user and db tables.
  If the user had super_privilege then the user will also get the new
  Truncate_versioning_privilege.

This is done to ensure that if one has GRANT ALL PRIVILEGE before, one
will continue to have it after running mysql_upgrade.

This also fixes a bug where the Truncate_versioning_privilege
2018-02-07 02:39:40 +02:00
Monty
a0417ccc3a Added error message for index file full 2018-02-06 20:38:36 +02:00
Marko Mäkelä
883496782f Merge bb-10.2-ext into 10.3 2018-02-06 17:12:17 +02:00
Marko Mäkelä
560b9895d4 MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
dict_tf_is_valid(): Allow no-rollback tables in ROW_FORMAT=REDUNDANT.
2018-02-06 17:09:26 +02:00
Marko Mäkelä
eda142590f Improve the documentation of some TRX_RSEG fields 2018-02-06 15:44:21 +02:00
Vladislav Vaintroub
502e2445e6 Fix warnings 2018-02-06 14:22:15 +01: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
Igor Babaev
f271100836 Fixed mdev-15162 Query with CTE hangs if assignment operator (:=) is used
If setting user variable was used in the specification of a recursive CTE
then Item_func_set_user_var::fix_fields() went into an infinite loop.
2018-02-05 18:07:31 -08:00
Igor Babaev
465979eabf Fixed mdev-15119 CTE, referencing another CTE, that is declared after,
does not return error

Corrected the code of st_select_lex::find_table_def_in_with_clauses() for
a proper identification of CTE references used in embedded CTEs.
2018-02-05 10:48:28 -08:00
Alexander Barkov
b4db96da58 MDEV-15176: comment fix "1 00:10:10" -> "24:10:10"
Applying https://github.com/MariaDB/server/pull/594
to bb-10.2-ext
2018-02-05 13:22:58 +04:00
Alexander Barkov
d67dcb7bb5 MDEV-15205 Remove mysql_type_to_time_type() 2018-02-04 22:55:54 +04:00