Commit graph

529 commits

Author SHA1 Message Date
Eugene Kosov
44016ec0ca MDEV-16211 Contents of transaction_registry not replicated by Galera
Patch fixes two bugs:
1) BEGIN_TIMESTAMP of MYSQL.TRANSACTION_REGISTY is '0-0-0' on replication record insertion
2) BEGIN_TIMESTAMP equals COMMMIT_TIMESTAMP in MYSQL.TRANSACTION_REGISTRY

Fixed by calling THD::set_time() at appropriate places
2018-10-01 17:53:20 +03:00
Marko Mäkelä
1bf3e8ab43 Merge 10.3 into 10.4 2018-09-11 21:31:03 +03:00
Nikita Malyavin
db3be33ec8 MDEV-16783 Assertion `!conds' failed in mysql_delete upon 2nd execution of SP with DELETE HISTORY
* remove assertion
* do not setup `conds` if it's already cached

Fixes #823
2018-08-24 11:20:06 +02:00
Oleksandr Byelkin
de745ecf29 MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operations 2018-07-04 19:13:55 +02:00
Aleksey Midenkov
7c0779da7c MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned table
* ignore CHECK constraint for historical rows;
* FOREIGN KEY test case.

TODO:
MDEV-16301 IB: use real table name for error messages on ALTER

Closes tempesta-tech/mariadb#491
Closes #748
2018-06-30 16:12:45 +02:00
Eugene Kosov
b5184c7efb MDEV-15947 ASAN heap-use-after-free in Item_ident::print or in my_strcasecmp_utf8 or unexpected ER_BAD_FIELD_ERROR upon call of stored procedure reading from versioned table
Closes #728
2018-06-30 16:12:36 +02:00
Eugene Kosov
133cfe39f1 MDEV-15645 Assertion `table->insert_values' failed in write_record upon REPLACE into a view with underlying versioned table
Right temporary storage for system versioning operations is table->record[2],
not table->insert_values

Closes #712
2018-06-30 16:12:28 +02:00
Eugene Kosov
9dc81f7d38 MDEV-16330 Allow instant change of WITH SYSTEM VERSIONING column attribute
Changing columns WITH/WITHOUT SYSTEM VERSIONING doens't require to read data at
all. Thus it should be an instant operation.

Patch also fixes a bug when ALTER_COLUMN_UNVERSIONED wasn't passed to InnoDB
to change its internal structures.

change_field_versioning_try(): apply WITH/WITHOUT SYSTEM VERSIONING
change in SYS_COLUMNS for one field.

change_fields_versioning_try(): apply WITH/WITHOUT SYSTEM VERSIONING
change in SYS_COLUMNS for every changed field in a table.

change_fields_versioning_cache(): update cache for versioning property
of columns.
2018-06-20 19:23:48 +03:00
Eugene Kosov
748ef3ec91 MDEV-15991 Server crashes in setup_on_expr upon calling SP or function executing DML on versioned tables
Do not try to set versioning conditions on every SP call. It may work
incorrectly, but it's a general bug described in MDEV-774.
This patch makes system versioning stuff consistent with other code and
also fixes a use-after-free bug.

Closes #756
2018-06-03 23:25:43 +02:00
Aleksey Midenkov
b1efff46cd Vers cleanups
* Always-false vers_select_conds_t::from_query
* Debug helpers

Closes #684
2018-06-03 23:25:43 +02:00
Sergei Golubchik
486682b1da cleanup: vers tests, remove create_table procedure 2018-06-03 23:25:43 +02:00
Eugene Kosov
aa5683d12e MDEV-15380 Index for versioned table gets corrupt after partitioning and DELETE
In a test case Update occurs between Search and Delete/Update. This corrupts rowid
which Search saves for Delete/Update. Patch prevents this by using of
HA_EXTRA_REMEMBER_POS and HA_EXTRA_RESTORE_POS in a partition code.

This situation possibly occurs only with system versioning table and partition.
MyISAM and Aria engines are affected.

fix by midenok
Closes #705
2018-05-22 13:11:14 +02:00
Aleksey Midenkov
21eccff625 MDEV-15979 DELETE HISTORY from a table with transaction-precise versioning causes Assertion `table_list->vers_conditions.type == SYSTEM_TIME_BEFORE' failure
* Fix versioning.truncate,trx_id to create transaction-based tables
* Fix SYSTEM_TIME_BEFORE condition for VERS_TRX_ID
2018-05-17 15:33:42 +02:00
Alexander Barkov
46be31982a MDEV-16094 Crash when using AS OF with a stored function
MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs

Problem:

Vers_history_point::resolve_unit() tested item->result_type() before
item->fix_fields() was called.

- Item_func_get_user_var::result_type() returned REAL_RESULT by default.
  This caused MDEV-16100.
- Item_func_sp::result_type() crashed on assert.
  This caused MDEV-16094

Changes:
1. Adding item->fix_fields() into Vers_history_point::resolve_unit()
   before using data type specific properties of the history point
   expression.

2. Adding a new virtual method Type_handler::Vers_history_point_resolve_unit()

3. Implementing type-specific
   Type_handler_xxx::Type_handler::Vers_history_point_resolve_unit()
    in the way to:
    a. resolve temporal and general purpose string types to TIMESTAMP
    b. resolve BIT and general purpose INT types to TRANSACTION
    c. disallow use of non-relevant data type expressions in FOR SYSTEM_TIME

    Note, DOUBLE and DECIMAL data types are disallowed intentionally.
    - DOUBLE does not have enough precision to hold huge BIGINT UNSIGNED values
    - DECIMAL rounds on conversion to INT
    Both lack of precision and rounding might potentionally lead to
    very unpredictable results when a wrong transaction ID would be chosen.
    If one really wants dangerous use of DOUBLE and DECIMAL, explicit CAST
    can be used:

      FOR SYSTEM_TIME AS OF CAST(double_or_decimal AS UNSIGNED)

    QQ: perhaps DECIMAL(N,0) could still be allowed.

4. Adding a new virtual method Item::type_handler_for_system_time(),
   to make HEX hybrids and bit literals work as TRANSACTION rather
   than TIMESTAMP.

5. sql_yacc.yy: replacing the rule temporal_literal to "TIMESTAMP TEXT_STRING".
   Other temporal literals now resolve to TIMESTAMP through the new
   Type_handler methods. No special grammar needed. This removed
   a few shift/resolve conflicts.
   (TIMESTAMP related conflicts in "history_point:" will be removed separately)

6. Removing the "timestamp_only" parameter from
   vers_select_conds_t::resolve_units() and Vers_history_point::resolve_unit().
   It was a hint telling that a table did not have any TRANSACTION-aware
   system time columns, so it's OK to resolve to TIMESTAMP in case of uncertainty.
   In the new reduction it works as follows:
   - the decision between TIMESTAMP and TRANSACTION is first made
     based only on the expression data type only
   - then, in case if the expression resolved to TRANSACTION, the table
     is checked if TRANSACTION-aware columns really exist.
   This way is safer against possible ALTER TABLE statements changing
   ROW START and ROW END columns from "BIGINT UNSIGNED" to "TIMESTAMP(x)"
   or the other way around.
2018-05-15 09:33:29 +04:00
Igor Babaev
1b45ede6ab Adjusted test results after mdev-15159. 2018-05-14 19:02:06 -07:00
Eugene Kosov
f08b8fd58d MDEV-15980 FOR SYSTEM_TIME BETWEEN and FROM .. TO work with negative intervals
Fixed by using exactly the same filtering conditions as specified by standard
in 7.6 <table reference> General Rules
2018-05-12 10:16:46 +02:00
Aleksey Midenkov
b1e75d290e MDEV-14823, MDEV-15956 Versioning error messages fixes
MDEV-14823 Wrong error message upon selecting from a system_time partition
MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
2018-05-12 10:16:46 +02:00
Aleksey Midenkov
ce2cf855bf MDEV-16043 Assertion thd->Item_change_list::is_empty() failed in mysql_parse upon SELECT from a view reading from a versioned table
Lost restore_active_arena().
Using of Query_arena_stmt is suggested instead.
2018-05-12 10:16:46 +02:00
Sergei Golubchik
8b2fa0ab25 remove obsolete rdiff 2018-05-12 10:16:46 +02:00
Aleksey Midenkov
68cad6aa24 MDEV-16024 transaction_registry.begin_timestamp is wrong for explicit transactions
Store transaction start time in thd->transaction.start_time.
THD::transaction_time() wraps over transaction.start_time taking into
account current status of BEGIN.
2018-05-12 10:16:46 +02:00
Aleksey Midenkov
fd4153f083 MDEV-16010 Too many rows with AS OF point_in_the_past_or_NULL 2018-05-12 10:16:46 +02:00
Aleksey Midenkov
fddaaf7295 MDEV-15978 Add Feature_system_versioning status variable 2018-05-12 10:16:46 +02:00
Eugene Kosov
fe10bf870c MDEV-15893 Rename VTQ to TRT 2018-05-12 10:16:46 +02:00
Sergei Golubchik
a4272bf154 versioning: use @@timestamp
Don't use hidden system time in versioning,
but keep the system time logic in THD
to workaround low-res system clock and
replication not versioned to versioned.

This reverts MDEV-14788 (System versioning cannot
be based on local timestamps, as it is now).
Versioning is based on local timestamps again,
but timestamps are protected by MDEV-15923
(option to control who can set session @@timestamp).
2018-05-12 10:16:46 +02:00
Sergei Golubchik
531acda484 MDEV-14820 System versioning is applied incorrectly to CTEs
Make sure that SELECT_LEX_UNIT::derived, behaves as documented
(points to the "TABLE_LIST representing this union in the
embedding select"). For recursive CTE this was not necessarily
the case, it could've pointed to the TABLE_LIST inside the CTE,
not in the embedding select.

To fix:
* don't update unit->derived in mysql_derived_prepare(), pass derived
  as an argument to st_select_lex_unit::prepare()
* prefer to set unit->derived in TABLE_LIST::init_derived()
  to the TABLE_LIST in the embedding select, not to the recursive
  reference. Fail if there are many TABLE_LISTs in the embedding
  select with conflicting FOR SYSTEM_TIME clauses.

cleanup:
* remove redundant THD* argument from st_select_lex_unit::prepare()
2018-05-12 10:16:45 +02:00
Thirunarayanan Balathandayuthapani
85cc6b70bd MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT
Introduced new alter algorithm type called NOCOPY & INSTANT for
inplace alter operation.

NOCOPY - Algorithm refuses any alter operation that would
rebuild the clustered index. It is a subset of INPLACE algorithm.

INSTANT - Algorithm allow any alter operation that would
modify only meta data. It is a subset of NOCOPY algorithm.

Introduce new variable called alter_algorithm. The values are
DEFAULT(0), COPY(1), INPLACE(2), NOCOPY(3), INSTANT(4)

Message to deprecate old_alter_table variable and make it alias
for alter_algorithm variable.

alter_algorithm variable for slave is always set to default.
2018-05-07 14:58:11 +05:30
Sergei Golubchik
41983fd3b1 MDEV-15788 versioning.partition, versioning.rpl fail on most windows builds in buildbot
fix versioning.partition failures:
* Make the test stable by setting timestamp to fixed values.
2018-04-12 21:20:02 +02:00
Sergei Golubchik
9bd3af97df MDEV-15413 Unexpected errors upon CREATE TABLE .. WITH SYSTEM VERSIONING AS SELECT ...
numerous fixes for CREATE ... SELECT with system versioning:
In CREATE ... SELECT the table is created based on the result set,
field properties do not count. That is
* field invisibility is *not* copied over
* AS ROW START/END is *not* copied over
* the history is *not* copied over
* system row_start/row_end fields can *not* be created from the SELECT part
2018-04-10 13:12:36 +02:00
Aleksey Midenkov
72dd813f7e MDEV-15427 IB: TRX_ID based operations inside transaction generate history
[closes tempesta-tech#472]
2018-04-10 13:12:36 +02:00
Sergei Golubchik
a4251d6f18 MDEV-15391 Server crashes in JOIN::fix_all_splittings_in_plan or Assertion `join->best_read < double(1.79...e+308L)' failed
vers_setup_conds() used to AND all conditions on row_start/row_end
columns and store it either in the WHERE clause or in the ON
clause for some table. In some cases this caused ON clause
to have conditions for tables that aren't part of that ON's join.

Fixed to put a table's condition always in the ON clause of the
corresponding table.

Removed unnecessary ... `OR row_end IS NULL` clause, it's not needed
in the ON clause.

Simplified handling on PS and SP.
2018-04-10 13:12:36 +02:00
Sergei Golubchik
1a86fc5f14 MDEV-15378 Valid query causes invalid view definition due to syntax limitation in FOR SYSTEM_TIME
fix parsing of the AS OF clause
2018-04-10 13:12:36 +02:00
Eugene Kosov
bb56a06d26 MDEV-15062 Information Schema COLUMNS Table does not show system versioning information
get_schema_column_record(): print 'WITHOUT SYSTEM VERSIONING` in 'EXTRA'
for such fields
2018-04-10 13:12:36 +02:00
Sergei Golubchik
041e9de6f8 wording: don't prohibit 2018-04-10 13:12:36 +02:00
Aleksey Midenkov
689f83d0ce MDEV-14790 System versioning for system tables does not work as expected
disallow system versioning for tables in mysql database
2018-04-10 13:12:36 +02:00
Sergei Golubchik
7dcf1b5049 dead code in versioning/common.inc 2018-04-10 13:12:36 +02:00
Sergei Golubchik
35678c9572 dead code - related to vtmd
(will be added back when it'll be used)
2018-04-10 13:12:36 +02:00
Eugene Kosov
19a182b1ea MDEV-15364 FOREIGN CASCADE operations in system versioned referenced tables
Make foreign system versioning tables work in CASCADE UPDATE/SET NULL.
In that case basically row update is performed. This patch makes insert
of a historical row performed too.

row_update_versioned_insert(): restores btr_pcur_t, reads row from it, makes
row historical and inserts to table.

row_ins_check_foreign_constraint(): disable constraint check for historical
rows because it has no sense. Also check will fail always, because referenced
table is updated at that point.

row_update_cascade_for_mysql(): insert historical row for system versioning
tables before updating current row.

revert DATA_VERSIONED -> DATA_UNVERSIONED
2018-03-27 22:35:10 +03:00
Aleksey Midenkov
0cf97ad5b9 IB: CASCADE operation for DELETE
* Removed "Not supported for TIMESTAMP-based" error
* Fixed code duplication with node->vers_set_fields()
* Recovered foreign.test

[closes tempesta-tech#473]
2018-03-19 17:32:46 +03:00
Alexander Barkov
583eb96c24 MDEV-11952 Oracle-style packages: stage#5
- CREATE PACKAGE [BODY] statements are now
  entirely written to mysql.proc with type='PACKAGE' and type='PACKAGE BODY'.
- CREATE PACKAGE BODY now supports IF NOT EXISTS
- DROP PACKAGE BODY now supports IF EXISTS
- CREATE OR REPLACE PACKAGE [BODY] is now supported
- CREATE PACKAGE [BODY] now support the DEFINER clause:

    CREATE DEFINER user@host PACKAGE pkg ... END;
    CREATE DEFINER user@host PACKAGE BODY pkg ... END;

- CREATE PACKAGE [BODY] now supports SQL SECURITY and COMMENT clauses, e.g.:

    CREATE PACKAGE p1 SQL SECURITY INVOKER COMMENT "comment" AS ... END;

- Package routines are now created from the package CREATE PACKAGE BODY
  statement and don't produce individual records in mysql.proc.

- CREATE PACKAGE BODY now supports package-wide variables.
  Package variables can be read and set inside package routines.
  Package variables are stored in a separate sp_rcontext,
  which is cached in THD on the first packate routine call.

- CREATE PACKAGE BODY now supports the initialization section.

- All public routines (i.e. declared in CREATE PACKAGE)
  must have implementations in CREATE PACKAGE BODY

- Only public package routines are available outside of the package

- {CREATE|DROP} PACKAGE [BODY] now respects CREATE ROUTINE and ALTER ROUTINE
  privileges

- "GRANT EXECUTE ON PACKAGE BODY pkg" is now supported

- SHOW CREATE PACKAGE [BODY] is now supported

- SHOW PACKAGE [BODY] STATUS is now supported

- CREATE and DROP for PACKAGE [BODY] now works for non-current databases

- mysqldump now supports packages

- "SHOW {PROCEDURE|FUNCTION) CODE pkg.routine" now works for package routines

- "SHOW PACKAGE BODY CODE pkg" now works (the package initialization section)

- A new package body level MDL was added

- Recursive calls for package procedures are now possible

- Routine forward declarations in CREATE PACKATE BODY are now supported.

- Package body variables now work as SP OUT parameters

- Package body variables now work as SELECT INTO targets

- Package body variables now support ROW, %ROWTYPE, %TYPE
2018-02-25 21:08:19 +04:00
Sergei Golubchik
83ea839fb1 MDEV-15405 Mixed replication fails with "Could not execute Delete_rows_v1 event" upon DELETE HISTORY
Allow slave thread to set time for system versioning

Note that every binlog event stores now(0), while microseconds
are only stored when they're actually used in the query.

Meaning for unversioned->versioned replication, there will be
no microseconds. Need to compensate for that.
2018-02-25 14:31:15 +01:00
Sergei Golubchik
9b59f78d16 MDEV-15395 Wrong result or Assertion `old_part_id == m_last_part' failed in ha_partition::update_row on slave
Revert commit fd240a10e3 and add a test case
2018-02-24 12:29:18 +01:00
Sergei Golubchik
22073cbf3b omit system invisible fields from the duplicate key error
just as SHOW CREATE TABLE omits them from the index definition
2018-02-24 01:28:51 +01:00
Sergei Golubchik
5c7a40e3cf MDEV-15330 Server crash or assertion `table->insert_values' failure in write_record upon LOAD DATA
copy the corresponding line from mysql_prepare_insert()
2018-02-24 01:28:51 +01:00
Sergei Golubchik
fd240a10e3 MDEV-15395 Wrong result or Assertion `old_part_id == m_last_part' failed in ha_partition::update_row on slave
RBR cannot work with system versioning on the master.

row_end column is either system time (not @@timestamp) with microsecond
precision or transaction id. Either way, it'll certainly be different
on the slave. So if the master row contains row_end column, it won't
match on the slave. And if we ignore row_end when comparing,
then some other row might match instead.
2018-02-24 01:28:50 +01:00
Sergei Golubchik
485325e7e3 don't allow TIMESTAMP(6) versioning and FK with CASCADE or SET NULL 2018-02-24 01:28:50 +01:00
Sergei Golubchik
17f8e0ecdf unify error messages a bit 2018-02-24 01:28:45 +01:00
Sergei Golubchik
f3088112cb MDEV-14645: AS OF TIMESTAMP is misused as TRX_ID
Remove 1668efb722 that introduced a special magic
behavior for UNIX_TIMESTAMP() in the AS OF context
2018-02-24 00:50:58 +01:00
Sergei Golubchik
33366b1098 remove @@system_versioning_innodb_algorithm_simple
and delete few garbage-in-garbage-out tests
2018-02-24 00:50:57 +01:00
Aleksey Midenkov
5fb08323e1 Tests: versioning.foreign check row_end after constraint execution 2018-02-24 00:50:57 +01:00
Sergei Golubchik
052668f500 simplify versioning tests 2018-02-24 00:50:57 +01:00
Aleksey Midenkov
dd7d169593 MDEV-14767 system_versioning_alter_history breaks ALTER replication
Vers SQL: force VERS_ALTER_HISTORY_KEEP behavior in the slave thread
2018-02-24 00:50:57 +01:00
Aleksey Midenkov
3f4d03b0dd Tests: partitioning cases for duplicate bugs
MDEV-15191 Assertion `bit < (map)->n_bits' failed in bitmap_is_set
upon INSERT

MDEV-15036 Assertion `!is_set() || (m_status == DA_OK_BULK
&& is_bulk_op())' in Diagnostics_area::set_ok_status or unexpected
ER_RANGE_NOT_INCREASING_ERROR
2018-02-24 00:50:56 +01:00
Eugene Kosov
68c994436a MDEV-15168 Unexpected ER_VERS_ENGINE_UNSUPPORTED upon dropping versioning on a partitioned table
Vers_parse_info::fix_alter_info(): disallow DROP SYSTEM VERSIONING
for system_time partitioned tables.
2018-02-24 00:50:56 +01:00
Sergei Golubchik
f685604aaa MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
add a test case
2018-02-24 00:50:56 +01:00
Sergei Golubchik
62b5427394 cannot rotate both by INTERVAL and LIMIT 2018-02-24 00:50:56 +01:00
Sergei Golubchik
dfb6f96eaf MDEV-15190 Bad error for non-versioned table PARTITION BY SYSTEM_TIME 2018-02-24 00:50:56 +01:00
Eugene Kosov
edeeaac451 MDEV-14829 Assertion `0' failed in Protocol::end_statement upon concurrent UPDATE
vers_insert_history_row(): do not insert rows with zero or negative lifetime.

mysql_update(): properly handle error from vers_insert_history_row()
2018-02-24 00:50:55 +01:00
Aleksey Midenkov
75afaa7e00 MDEV-15001 no tests for system_versioning_innodb_algorithm_simple
Vers SQL: TRT fix getting TRX_ID by COMMIT_TS

Fixed wrong assumption that records are ordered by COMMIT_TS.
This is anyway a quick hack until tempesta-tech#314 is done.

See also FIXME and TODO in TR_table::query(MYSQL_TIME, bool).

Test: SEES case for trx_id.test [closes #456]
2018-02-24 00:50:55 +01:00
Sergei Golubchik
e36c5ec0a5 PARTITION BY SYSTEM_TIME INTERVAL ...
Lots of changes:
* calculate the current history partition in ::external_lock(),
  not in ::write_row() or ::update_row()
* remove dynamically collected per-partition row_end stats
* no full table scan in open_table_from_share to calculate these
  stats, no manual MDL/thr_locks in open_table_from_share
* no shared stats in TABLE_SHARE = no mutexes or condition waits when
  calculating current history partition
* always compare timestamps, don't convert them to MYSQL_TIME
  (avoid DST ambiguity, and it's faster too)
* correct interval handling, 1 month = 1 month, not 30 * 24 * 3600 seconds
* save/restore first partition start time, and count intervals from there
* only allow to drop first partitions if INTERVAL
* when adding new history partitions, split the data in the last history
  parition, if it was overflowed
* show partition boundaries in INFORMATION_SCHEMA.PARTITIONS
2018-02-23 19:17:48 +01:00
Sergei Golubchik
f38ef43013 cleanup: remove *.opt files from the versioning suite
use include/have_xxx.inc when some feature needs to be present
(because --xxx in the opt file will fail if the xxx is not compiled in)

set variables in the test, not on the command line, to avoid unnecessary
server restarts (they're must slower than SET).
2018-02-23 15:33:23 +01:00
Aleksey Midenkov
f1bd02d994 MDEV-15004 parser greedily parses AS OF TIMESTAMP
* TIMESTAMP precedence fixed.
2018-02-23 15:33:23 +01:00
Aleksey Midenkov
df0e1817c7 Vers SQL: partition rotation by INTERVAL fix
Update partition stats on ha_partition::write_row()
2018-02-23 15:33:22 +01:00
Sergei Golubchik
45e1c9bb6d cleanup: remove a pretty formatting function from a test 2018-02-23 15:33:22 +01:00
Sergei Golubchik
9fa715b84d MDEV-14798 Add, drop system versioning semantic and syntax
SQL: DROP PERIOD FOR SYSTEM_TIME syntax

and remove ER_VERS_SYS_FIELD_EXISTS

originally by: Eugene Kosov
2018-02-23 15:33:22 +01:00
Sergei Golubchik
9f6a7ed2d7 SQL: Truncate history of partitioned table [fixes #399, closes #403]
also, don't rotate versioning partitions for DELETE HISTORY

originally by: Aleksey Midenkov
2018-02-23 15:33:21 +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
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
Marko Mäkelä
921c5e9314 Merge bb-10.2-ext into 10.3
MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY

Move a test from innodb.rename_table_debug to innodb.alter_copy.

ha_innobase::extra(HA_EXTRA_BEGIN_ALTER_COPY): Register id-versioned
tables so that mysql.transaction_registry will be updated, even for
empty tables that are subjected to ALTER TABLE…ALGORITHM=COPY.
2018-01-30 21:26:53 +02:00
Alexander Barkov
2e43c4584e Fixing versioning.insert and versioning.replace test failes.
Tests started to fail after a merge of MDEV-15107 (from bb-10.2-ext to 10.3),
because MDEV-15107 additionally fixed this problem:
  MDEV-15112 Inconsistent evaluation of spvariable=0 in strict mode

Modifying tests not to reply on the pre-MDEV-15112 behavior.
2018-01-29 19:52:34 +04:00
Sergei Golubchik
bd87c872c0 cleanup: don't generate tests with SP or PS
unless it's a test of SP or PS
2018-01-13 02:01:35 +01:00
Sergei Golubchik
558ee2ee84 fix --embedded tests 2018-01-13 02:01:35 +01:00
Sergei Golubchik
826f615fc9 MDEV-14788 System versioning cannot be based on local timestamps, as it is now
followup to be81b00c84
Fix updates and deletes too
2018-01-13 02:01:35 +01:00
Sergei Golubchik
6a8cf407d2 fix tests on windows 2018-01-13 02:01:35 +01:00
Sergei Golubchik
28bed45469 debug: don't hide row_start/row_end columns for testing 2018-01-13 02:01:35 +01:00
Sergei Golubchik
5d3bae242c remove dead VERS_EXPERIMENTAL code
changed to use DBUG keywords instead,
so that the code is compiled and tested

added tests.
2018-01-13 02:01:34 +01:00
Sergei Golubchik
a544f920e3 remove "Transaction-based system versioning is EXPERIMENTAL" warning
and the system_versioning_transaction_registry variable.
The user enables transaction registry by specifying BIGINT for
row_start/row_end columns.

check mysql.transaction_registry structure on the first open,
not on startup. Avoid warnings unless transaction_registry
is actually used.
2018-01-13 02:01:34 +01:00
Aleksey Midenkov
93e8ee4ae1 MDEV-14923 Assertion upon INSERT into locked versioned partitioned table 2018-01-13 01:53:12 +01:00
Eugene Kosov
fbed4ca4f1 MDEV-14816 Assertion join->best_read < double(1.797...e+308L) failed in bool greedy_search 2018-01-12 21:20:24 +01:00
Eugene Kosov
f96b1a4e39 MDEV-14798 Add, drop system versioning semantic and syntax 2018-01-12 21:20:23 +01:00
Eugene Kosov
eedab70c1c MDEV-14871 Server crashes in fill_record / fill_record_n_invoke_before_triggers upon inserting into versioned table with trigger 2018-01-10 12:43:06 +03:00
Sergei Golubchik
26971c9aea SQL: versioning info in INFORMATION_SCHEMA
* show SYSTEM VERSIONED in INFORMATION_SCHEMA.TABLES
* show ROW START/ROW END columns in INFORMATION_SCHEMA.COLUMNS
2018-01-10 11:54:21 +03:00
Sergei Golubchik
6470a9343d Tests: use bigint in versioning.create,trx_id 2018-01-10 11:53:20 +03:00
Sergei Golubchik
c777add74f Tests: inserting an explicit value into a vers column
must behave as any other generated column: an error in the strict mode,
a warning otherwise.
2018-01-09 15:52:04 +03:00
Sergei Golubchik
b85efdc3af rename system_time columns
sys_trx_start -> row_start
sys_trx_end -> row_end
2018-01-09 15:49:07 +03:00
Sergei Golubchik
be81b00c84 MDEV-14788 System versioning cannot be based on local timestamps, as it is now
use system time, not @@timestamp
2018-01-09 15:38:50 +03:00
Sergei Golubchik
d20d7a92c0 make versioning plugin more clearly a test-only thing
rename to test_versioning
set maturity to experimental
2018-01-09 15:29:43 +03:00
Sergei Golubchik
ca4dbcff69 Tests: system columns *not* being auto-renamed (create, alter)
it's correct, they preserve their documented names
2018-01-09 14:18:39 +03:00
Sergei Golubchik
35b679b924 SQL: error messages
remove unused error messages
reword ER_VERS_SYS_FIELD_NOT_HIDDEN->ER_VERS_SYS_FIELD_EXISTS
2018-01-09 14:16:47 +03:00
Sergei Golubchik
e6a7457653 SQL: derived, hiding, error messages
Many related changes.

Note that AS OF condition must always be pushed down to physical tables,
it cannot be applied to a derived or a view. Thus:

* no versioning for internal temporary tables, they can never store
  historical data.
* remove special versioning code from mysql_derived_prepare and
  remove ER_VERS_DERIVED_PROHIBITED - derived can have no historical
  data and cannot be prohibited for system versioning related reasons.
* do not expand select list for derived/views with sys vers fields,
  derived/views can never have historical data.
* remove special invisiblity rules for sys vers fields, they are no
  longer needed after the previous change
* remove system_versioning_hide, it lost the meaning after the
  previous change.
* remove ER_VERS_SYSTEM_TIME_CLASH, it's no "clash", the inner
  AS OF clause always wins.
* non-versioned fields in a historical query

reword the warning text, downgrade to note, don't
replace values with NULLs
2018-01-09 14:12:41 +03:00
Sergei Golubchik
b06b5c3eab Tests: disabled cte.test
CTE don't work, report MDEV-14820
2018-01-09 13:57:33 +03:00
Sergei Golubchik
1a0b986e78 MDEV-14764 Confusing error message: Table t1 must have at least one temporal column
compiler warning (mix of bool and enum in ?:)
2018-01-09 13:56:31 +03:00
Eugene Kosov
5dddbafa4e
MDEV-14821 Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op()) failed in Diagnostics_area::set_ok_status 2018-01-08 13:32:02 +03:00
Aleksey Midenkov
912769b7dc SQL: lower priority of warning in vers_part_rotate() for ALTER [fixes #446] 2018-01-06 11:56:51 +03:00
Eugene Kosov
dbf21ff396
MDEV-14787 CREATE does not allow tables with versioning columns only, but ALTER does 2018-01-03 15:51:23 +03:00
Aleksey Midenkov
b8b5d8d87d MDEV-14828 Server crashes in JOIN::prepare / setup_fields on 2nd execution of PS [fixes #437] 2018-01-02 15:28:50 +03:00
Aleksey Midenkov
8efca72f4a MDEV-14792 INSERT without column list into table with explicit versioning columns produces bad data 2018-01-01 23:37:02 +03:00
Eugene Kosov
157150cfcf MDEV-14769 Temporary table can be altered into system versioning + system_versioning_alter_history has no effect 2018-01-01 23:37:02 +03:00
Aleksey Midenkov
7069071d7d MDEV-14786 Server crashes in Item_cond::transform on 2nd execution of SP querying from a view [fixes #436] 2018-01-01 23:34:39 +03:00
Eugene Kosov
d72462a29b SQL: TRX_ID to TIMESTAMP versioning switch [fixes #428] 2017-12-29 00:23:20 +03:00
Aleksey Midenkov
d1e4c5d13e MDEV-14748 Assertion in ha_myisammrg::attach_children() [fixes #434] 2017-12-29 00:23:20 +03:00
Sergei Golubchik
9daf583ab6 fix CREATE ... SELECT
move table->vers_update_fields() where it belongs - into fill_record(),
right after table_arg->update_virtual_fields()
2017-12-29 00:23:13 +03:00
Sergei Golubchik
1a06a48230 Tests: ER_VERS_DUPLICATE_ROW_START_END check 2017-12-29 00:23:13 +03:00
Eugene Kosov
0fe67f2ef9 MDEV-14744 Assertion `table->versioned() == m_prebuilt->table->versioned()' failed in ha_innobase::open 2017-12-29 00:23:07 +03:00
Aleksey Midenkov
04451f0f8a MDEV-14765 Server crashes in Sys_var_vers_asof::update 2017-12-26 15:25:39 +03:00
Aleksey Midenkov
11c6882741 MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES 2017-12-26 15:25:39 +03:00
Aleksey Midenkov
4236f589b6 MDEV-14751 Server crashes in TABLE::versioned on 2nd execution of SP [fixes #431]
SQL: TABLE_LIST cleanup on free_tmp_table()

May affect non-versioning tests (main suite passed).
2017-12-26 15:25:39 +03:00
Eugene Kosov
d8aabb44b5
SQL: prohibit ALTER ... AS ROW START|END [fixes #429] 2017-12-25 13:38:03 +03:00
Aleksey Midenkov
ea49441c41 Partition: uninitialized vers_info fix 2017-12-22 16:40:09 +03:00
Aleksey Midenkov
57f827cdd6 MDEV-14741 Assertion '(trx)->start_file == 0' failed
in row_truncate_table_for_mysql()
2017-12-22 14:52:17 +03:00
Aleksey Midenkov
1e8eae40ce MDEV-14740 Locking assertion for system_time partitioning
Assertion `thd->locked_tables_mode <= LTM_LOCK_TABLES ||
!thd->lex->requires_prelocking()' failed in lock_tables().
2017-12-22 12:51:48 +03:00
Aleksey Midenkov
7e39f70044 MDEV-14722 Partition: assertion in ha_commit_trans() for sub-statement 2017-12-21 16:15:56 +03:00
Aleksey Midenkov
e65a695f28 Tests: disabled embedded for versioning.trx_id [#387]
Error ER_VERS_TRT_IS_DISABLED is not thrown.
2017-12-21 15:08:34 +03:00
Eugene Kosov
aa4d1bedfc
MDEV-14689 Server crashes in find_field_in_tables on 2nd execution of PS with versioned table and view
SQL: wrong usage of Item::transform()
2017-12-21 14:59:46 +03:00
Eugene Kosov
6dc75b5f89
MDEV-14632 Assertion `!((new_col->prtype ^ col->prtype) & ~256U)' failed in row_log_table_apply_convert_mrec
ha_innobase::check_if_supported_inplace_alter(): enabled non-rebuilding operations for trx_id-based system-versioning tables

Also added better error message for not implemented operations.
2017-12-21 14:59:18 +03:00
Aleksey Midenkov
5c760d952b Parser: default SYSTEM_TIME ALL for DELETE HISTORY 2017-12-21 10:48:48 +03:00
Aleksey Midenkov
36888cc531 MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [fixes #422] 2017-12-21 10:25:32 +03:00
Eugene Kosov
a04a283469
MDEV-14692 Server crash in MDL_ticket::has_stronger_or_equal_type
SQL: disable system-versioning stuff on TEMPORARY tables
2017-12-21 10:14:25 +03:00
Eugene Kosov
acdfacee75
IB: TRT is not updated on ADD SYSTEM VERSIONING [fixes #413] 2017-12-20 22:46:28 +03:00
Eugene Kosov
4bc268d406
MDEV-14632 Assertion `!((new_col->prtype ^ col->prtype) & ~256U)' failed in row_log_table_apply_convert_mrec
SQL, IB: proper fix is to disable unimplemented Online DDL for system-versioned tables inside InnoDB
2017-12-20 19:42:15 +03:00
Eugene Kosov
b13f1cc59a
MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION 2017-12-20 16:41:42 +03:00
Aleksey Midenkov
7eff2080fd MDEV-14687 DELETE HISTORY in prepared stmt crash [fixes #421]
Also fixes broken truncate after 617e108fb6
2017-12-20 16:12:32 +03:00
Aleksey Midenkov
c5d0c38efc MDEV-14676 Redundancy in error codes
ER_VERS_NOT_VERSIONED vs ER_VERSIONING_REQUIRED
2017-12-19 22:05:25 +03:00
Aleksey Midenkov
fc21529f14 MDEV-14683 Possible redundancy in error codes
ER_VERS_GENERATED_ALWAYS_NOT_EMPTY vs ER_VERS_ALTER_SYSTEM_FIELD

Related to #310 (91ba4f04be).
2017-12-19 21:55:40 +03:00
Sergei Golubchik
617e108fb6 s/TRUNCATE ... TO/DELETE HISTORY FROM ... BEFORE/ 2017-12-19 16:35:38 +03:00
Aleksey Midenkov
ee68d019d1 SQL: removed VERS_HIDDEN_FLAG [closes #409] 2017-12-19 16:12:56 +03:00
Eugene Kosov
8ba06032ae
MDEV-14684 Assertion `table' failed in mysql_delete
SQL: disable TRUNCATE table_name TO statement for VIEWs
2017-12-19 15:12:11 +03:00
Aleksey Midenkov
04bed58acf SQL: partitioning CREATE, ALTER fixes
MDEV-14688 Assertion `tab_part_info->part_type == LIST_PARTITION' failed in prep_alter_part_table
MDEV-14673 Assertion `part_elem->type() == partition_element::AS_OF_NOW' failed in check_partition_info
2017-12-18 22:17:53 +03:00
Aleksey Midenkov
b0d9dc43ca SQL: system_versioning_transaction_registry default OFF 2017-12-18 22:17:52 +03:00
Aleksey Midenkov
82379ce14d SQL: error messages revised 2017-12-18 19:11:54 +03:00
Aleksey Midenkov
b55a149194
Timestamp-based versioning for InnoDB [closes #209]
* Removed integer_fields check
* Reworked Vers_parse_info::check_sys_fields()
* Misc renames
* versioned as vers_sys_type_t

* Removed versioned_by_sql(), versioned_by_engine()

versioned() works as before;
versioned(VERS_TIMESTAMP) is versioned_by_sql();
versioned(VERS_TRX_ID) is versioned_by_engine().

* create_tmp_table() fix
* Foreign constraints for timestamp-based
* Range auto-specifier fix
* SQL: 1-row partition rotation fix [fixes #260]
* Fix 'drop system versioning, algorithm=inplace'
2017-12-18 19:03:51 +03:00
Eugene Kosov
9b55cc73f1
SQL, IB: unversioned fields with ALTER TABLE [fixes #401] 2017-12-15 20:37:36 +03:00
Aleksey Midenkov
4624e565f3 System Versioning 1.0 pre6
Merge remote-tracking branch 'mariadb/bb-10.3-temporal-serg' into trunk
2017-12-15 18:12:18 +03:00
Aleksey Midenkov
70d7672377 SQL: MDEV-14633 Assertion on TRT read [fixes #406] 2017-12-15 16:42:25 +03:00
Eugene Kosov
0e0f1126e6
MDEV-14649 Assertion `t->mysql_col_len == 8' failed in row_insert_for_mysql
SQL: add check for internal partition table type

Also fixes MDEV-14654
2017-12-15 16:35:53 +03:00
Aleksey Midenkov
73606a3977 System Versioning 1.0 pre5 [closes #407]
Merge branch '10.3' into trunk

Both field_visibility and VERS_HIDDEN_FLAG exist independently.

TODO:
VERS_HIDDEN_FLAG should be replaced with SYSTEM_INVISIBLE (or COMPLETELY_INVISIBLE?).
2017-12-15 15:18:59 +03:00
Sergei Golubchik
84e14bff4a privilege: s/delete versioning rows/delete history/ 2017-12-14 20:19:20 +01:00
Sergei Golubchik
18405e5fd9 Partitioning syntax for versioning
partition by system_time (
    partition p0 history,
    partition pn current
 )
2017-12-14 20:19:14 +01:00
Aleksey Midenkov
2ae2876a6c MDEV-14652 NATURAL JOIN crash in mark_common_columns() [fixes #405]
SQL: reverted NATURAL JOIN fix #161 (deprecated by #383)
2017-12-14 21:31:38 +03:00
Aleksey Midenkov
27187443ef MDEV-14650 Assertion 0 failed in TABLE::vers_update_fields [fixes #402]
SQL: fixed selecion of handlerton by respecting partitioning
2017-12-14 19:45:11 +03:00
Aleksey Midenkov
ab5ec0f346 SQL: disable truncate history on partitioned [fixes #399] 2017-12-14 19:11:02 +03:00
Aleksey Midenkov
f96815fe97 SQL: unit resolution Item_field not yet accessible [fixes #398] 2017-12-14 18:42:53 +03:00
Aleksey Midenkov
1668efb722 MDEV-14645: AS OF TIMESTAMP is misused as TRX_ID [fixes #396] 2017-12-14 18:14:21 +03:00
Aleksey Midenkov
2e3b580ba4 SQL: inner/outer system_time consistency [fixes #384] 2017-12-14 13:43:37 +03:00
Sergei Golubchik
f149013393 rename versioning_* variables 2017-12-14 11:31:44 +01:00
Aleksey Midenkov
eab471260b Paritioning: better error for disabled IB engine 2017-12-13 23:51:30 +03:00
Sergei Golubchik
ca6454bcfe for now, remove FOR SYSTEM_TIME at the end of the query
non-standard, redundant, potentially risky in the future,
hides bugs. See #383, #384, #385

Fixed a parser bug where
SELECT * FROM (t1 join t2) FOR SYSTEM_TIME ...
was not an error.
2017-12-13 21:51:20 +01:00
Sergei Golubchik
a1141e226d fix nullable autoinc test w/o versioning 2017-12-13 21:44:31 +01:00
Sergei Golubchik
e77080c7d5 if a table is partitioned by system_time, its partitions are not versioned
they store history and the history does not have history
2017-12-13 21:44:30 +01:00
Sergei Golubchik
21d0a9fe3b yet another error message fix 2017-12-13 21:32:52 +01:00
Aleksey Midenkov
8e8363bb75 SQL: VIEW system fields propagation removed [fixes #393] 2017-12-13 18:23:32 +03:00
Aleksey Midenkov
bc4a86699d SQL: recursive CTE inner derived vers_conditions [fix #385] 2017-12-13 15:31:46 +03:00
Eugene Kosov
717f274b87 MDEV-14631 Assertion `!sys_trx_start && !sys_trx_end' failed in crete_tmp_table
SQL: remove unneeded assertion
SQL: disallow set sys_trx fields in INSERT ... SELECT

Fixes by @midenok.
2017-12-12 22:33:49 +03:00
Eugene Kosov
c66a20b494 SQL: better check for partition engine [#366]
Cleaned up by @midenok.
2017-12-12 22:01:39 +03:00
Aleksey Midenkov
459f40a232
SQL: create..select revisited [closes #370] 2017-12-12 21:30:49 +03:00
Aleksey Midenkov
a0e137c4a9 SQL: RIGHT JOIN in derived [fix #383] 2017-12-12 20:39:44 +03:00
Eugene Kosov
cb4657e3b4
MDEV-14627 SQL: disallow ADD SYSTEM VERSIONING for system-versioned tables
SQL: disallow ADD SYSTEM VERSIONING for system-versioned tables
2017-12-12 14:56:28 +03:00
Eugene Kosov
9c718de2ed Tests: versioning.derived fix for buildbot 2017-12-12 01:04:07 +03:00
Aleksey Midenkov
79dd77e6ae System Versioning 1.0 pre3
Merge branch '10.3' into trunk
2017-12-11 15:43:41 +03:00
Aleksey Midenkov
b7cd182896 SQL: DEFAULT value for system fields [closes #376] 2017-12-10 23:52:51 +03:00
Eugene Kosov
2968543f8d IB: NULL instead of autodecrement [closes #373] 2017-12-08 19:37:24 +03:00
Aleksey Midenkov
947aa0bab9 SQL: vers_setup_select() misc refactoring
Renamed to SELECT_LEX::vers_setup_conds().
Moved optimized fields check to JOIN::vers_check_items().
2017-12-08 19:37:24 +03:00
Aleksey Midenkov
ad51d77f79 SQL: WHERE top level item [#365 bug 11]
Tests affected (forced mode):

main.range main.range_mrr_icp
2017-12-08 16:26:18 +03:00
Eugene Kosov
8c9c302016 SQL: fix implicit sys fields for implicit engine of partitioned table [#366] 2017-12-08 16:26:18 +03:00
Eugene Kosov
03b54a6b8a SQL: table with duplicate ROW START/END columns [fixes #369] 2017-12-08 16:26:17 +03:00
Aleksey Midenkov
84b718ae70 SQL: derived SYSTEM_TIME clash detection [closes #371] 2017-12-08 16:26:17 +03:00
Sergei Golubchik
b3fe45bcd4 rephrase error messages, fix quoting 2017-12-08 16:26:17 +03:00
Sergei Golubchik
903be4e6be remove my_error_as and one unnecessary error message 2017-12-08 16:26:16 +03:00
Sergei Golubchik
ea1ccfa500 SQL: regression fix: make NOW a valid identifier again [#363]
* again, as in 10.2, NOW is a keyword only if followed by parentheses
* use AS OF CURRENT_TIMESTAMP or AS OF NOW()
* AS OF CURRENT_TIMESTAMP and AS OF NOW() mean AS OF NOW(6),
  not AS OF NOW(0), (same behavior as in a DEFAULT clause)
2017-12-08 16:24:56 +03:00
Sergei Golubchik
d3845132fc remove 'vers_auto_decrement'
Do not generate fake values when adding an auto-inc column to a versioned
table. This is not a auto-inc issue, but a more general case of adding
a not nullalble unique column to a table with history. We don't support
it yet, not even with a special auto-inc hack. As a workaround, one
can use a nullable unique column, that works.
2017-12-05 18:01:43 +03:00
Sergei Golubchik
e60da371d1 fix versioning tests not to fail w/o innodb 2017-12-05 17:46:01 +03:00
Sergei Golubchik
8dd84ec7f3 versioning/common.inc must "have_innodb"
because it'll fail to start without it
2017-12-05 17:42:27 +03:00
Sergei Golubchik
3198bc839d Parser: unreserve keywords
SELECT * FROM t1 FOR SYSTEM_TIME AS OF ...

becomes ambiguous, but it's the same as with

SELECT ... UNION SELECT ... ORDER BY ...
2017-12-05 15:09:09 +03:00
Aleksey Midenkov
6ac773421f SQL: WHERE cond freed prematurely for PS [#365 bug 10]
Applicable to vanilla version.
Applies to Item_cond_and, etc.: items with allocating copy_andor_structure().

Tests affected (forced mode):

main.subselect_sj
main.subselect_sj_jcl6
2017-12-05 14:32:34 +03:00
Aleksey Midenkov
3d88a72f76 SQL: fix subquery not a derived table [#365 bug 9]
Tests affected (forced mode):

main.ps \
main.user_var \
main.myisam_explain_non_select_all \
main.opt_tvc \
main.subselect \
main.subselect_no_exists_to_in \
main.derived \
main.derived_opt \
main.update
2017-12-05 14:32:33 +03:00
Aleksey Midenkov
56adced376 SQL,IB: REPLACE semantics [#365 bug 8] 2017-12-04 13:19:37 +03:00
Aleksey Midenkov
5bf14f93a4 Tests: fix combinations 2017-12-04 00:49:44 +03:00
Aleksey Midenkov
68e160fb25 Tests: removed common.inc from results 2017-12-04 00:49:44 +03:00
Aleksey Midenkov
70b82f641c SQL: duplicate of historical row fix [#365 bug 7]
Tests affected (forced mode):

main.type_timestamp
2017-12-02 19:52:27 +03:00
Eugene Kosov
a3802ecb58 IB: assertion failure on delete with foreign [#366] 2017-12-02 12:54:32 +03:00
Aleksey Midenkov
5c820a7125 SQL: create_like_table strip versioning for tmp tables [#365 bug 6]
Tests affected (forced versioning):

rpl.rpl_row_merge_engine
2017-12-01 12:21:49 +03:00
Aleksey Midenkov
b9225bb52c SQL: outdated select_lex->where fix [#365 bug 5]
Affected tests (forced mode):

main.index_merge_myisam

After optimization versioning AND takes operands from WHERE AND
leaving `select_lex->where` as empty dangling AND.
2017-11-30 23:23:21 +03:00
Aleksey Midenkov
e4b86780ae SQL: optimized transformer fix [#365 bug 4]
Affected tests (forced mode):

main.win
main.selectivity_innodb
main.subselect_cache
main.analyze_stmt_orderby

Related to #226 (909867d014).
2017-11-30 08:31:38 +03:00
Aleksey Midenkov
2305666a05 SQL: insert delayed fix [#365 bug 3]
Affected tests (forced mode): rpl.rpl_timezone
2017-11-29 11:58:18 +03:00
Aleksey Midenkov
47ea526efa IB: get template with virtual columns [#365 bug 1]
Affected tests (forced mode): binlog_encryption.encrypted_slave
2017-11-29 10:48:10 +03:00
Aleksey Midenkov
f924a94d2f SQL: disable versioned DML for transaction_registry=off [closes #364] 2017-11-28 18:38:54 +03:00
Aleksey Midenkov
f826f1249b Tests: suppress tinyint error for ppc64le [#347] 2017-11-28 14:21:00 +03:00
Aleksey Midenkov
f9d875d212 SQL: disable engine change [fixes #358] 2017-11-27 19:48:36 +03:00
Aleksey Midenkov
1e3620cc39 Tests: commit_id, truncate for Windows fix [#307] 2017-11-27 16:31:18 +03:00
Eugene Kosov
62470fc787 SQL: recreate PRIMARY KEY on DROP SYSTEM VERSIONING [#348] 2017-11-27 15:07:34 +03:00
Aleksey Midenkov
0c571f8c4e SQL: versioning_alter_history ERROR mode [closes #350]
Disabled DROP and SURVIVE modes.
2017-11-27 15:07:34 +03:00
Aleksey Midenkov
7320c683b9 Parser: disable SV for tmp tables [closes #344] 2017-11-27 15:07:33 +03:00
Marko Mäkelä
0b89a42ffc Remove the flag vers_update_trt
THD::vers_update_trt, trx_t::vers_update_trt, trx_savept_t::vers_update_trt:
Remove. Instead, determine from trx_t::mod_tables whether versioned
columns were affected by the transaction.

handlerton::prepare_commit_versioned: Replaces vers_get_trt_data.
Return the transaction start ID and also the commit ID, in case
the transaction modified any system-versioned columns (0 if not).

TR_table::store_data(): Remove (merge with update() below).

TR_table::update(): Add the parameters start_id, end_id.

ha_commit_trans(): Remove a condition on SQLCOM_ALTER_TABLE.
If we need something special for ALTER TABLE...ALGORITHM=INPLACE,
that can be done inside InnoDB by modifying trx_t::mod_tables.

innodb_prepare_commit_versioned(): Renamed from innodb_get_trt_data().
Check trx_t::mod_tables to see if any changes to versioned columns
are present.

trx_mod_table_time_t: A pair of logical timestamps, replacing the
undo_no_t in trx_mod_tables_t. Keep track of not only the first
modification to a persistent table in each transaction, but also
the first modification of a versioned column in a table.

dtype_t, dict_col_t: Add the accessor is_any_versioned(), to check
if the type refers to a system-versioned user or system column.

upd_t::affects_versioned(): Check if an update affects a versioned
column.

trx_undo_report_row_operation(): If a versioned column is affected
by the update, invoke trx_mod_table_time_t::set_versioned().

trx_rollback_to_savepoint_low(): If all changes to versioned columns
were rolled back, invoke trx_mod_table_time_t::rollback_versioned(),
so that trx_mod_table_time_t::is_versioned() will no longer hold.
2017-11-27 15:07:33 +03:00
Aleksey Midenkov
cbe93291e4 SQL,IB: add auto_inc copy mode fix [#347]
Related to #212.

Extra update of sys_trx_start removed [#87].
2017-11-23 18:31:55 +03:00
Marko Mäkelä
b612f3baa2 Tests: more fine-grained TRT check 2017-11-23 17:44:47 +03:00
Aleksey Midenkov
3d51315912 Tests: disabled DDL survival tests [#196] 2017-11-23 17:44:39 +03:00
Eugene Kosov
91ba4f04be SQL: prohibit column conversion to system fields for non-empty table [fixes #310] 2017-11-22 15:31:03 +03:00
Aleksey Midenkov
9980886cab Revert "SQL: 1-row partition rotation fix [fixes #260]"
Related to IB partitioning only.
This reverts commit 7e764ae188.
2017-11-17 11:25:52 +03:00
Eugene Kosov
f9b8c908a0 SQL: ADD/DROP SYSTEM VERSIONING syntax for ALTER TABLE 2017-11-17 11:25:49 +03:00
Aleksey Midenkov
cc6701a7b3 Tests: vtmd, optimized, partition 2017-11-15 00:22:11 +03:00
Aleksey Midenkov
33085349e9 IB, SQL: removed VTQ, added TRT on SQL layer [closes #305] 2017-11-15 00:22:10 +03:00
Aleksey Midenkov
a80c71dfbb Scripts: bootstrap fix [#307] 2017-11-13 19:11:04 +03:00
Aleksey Midenkov
73f655d576 SQL: VIEW without VERS_COMMIT_TS + CTE fix [fixes #295] 2017-11-13 19:11:03 +03:00
Aleksey Midenkov
9aae0be8f9 SQL: disabled SYSTEM_TIME partitioning for InnoDB [fixes #294] 2017-11-13 19:11:02 +03:00
Aleksey Midenkov
0ab99d2f34 SQL: no_replicate for VTMD [fixes #289] 2017-11-13 19:11:02 +03:00
Aleksey Midenkov
335bfb3421 Tests: view.test combinations 2017-11-13 19:11:02 +03:00
Aleksey Midenkov
7ebd12e779 SQL: VIEW of UNION [fixes #293] 2017-11-13 19:11:02 +03:00
Aleksey Midenkov
d70bb5e64e SQL: delete from VIEW [fixes #291] 2017-11-13 19:11:02 +03:00
Aleksey Midenkov
c9520cb0c4 SQL: sysvar versioning_asof_timestamp [fixes #292, #279] 2017-11-13 19:11:02 +03:00
Aleksey Midenkov
d8d7251019 System Versioning pre0.12
Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
2017-11-07 00:37:49 +03:00
Aleksey Midenkov
17bd486f36 SQL: thd_start_utime() fix [fixes #284] 2017-10-17 17:20:46 +03:00
Eugene Kosov
d7a484b04f SQL: segfault after make_select() in VTMD 2017-10-04 13:36:31 +03:00
Aleksey Midenkov
1d056f5abc SQL: not a VTMD table warning [related to #199] 2017-10-03 00:31:44 +03:00
Aleksey Midenkov
5e42511ce1 SQL: SELECT from archive table [closes #127] 2017-09-28 13:16:04 +03:00
Eugene Kosov
c5801dd67b SQL: hide archive tables [closes #193] 2017-09-27 22:08:20 +03:00
Aleksey Midenkov
e9e3cb0f6e SQL: VTMD for SHOW CREATE fixes [related to #125] 2017-09-27 20:42:22 +03:00
Aleksey Midenkov
75bc483d7a Tests: moved concat_execN() to common.inc 2017-09-25 22:07:01 +03:00
Aleksey Midenkov
11a9d8f7e3 Tests: typo fix in cte.test
Related to c2c8808a16
2017-09-20 13:14:16 +03:00
Aleksey Midenkov
6c9b71d734 SQL: VTMD for OR REPLACE [fixes #270] 2017-09-20 13:07:15 +03:00
Aleksey Midenkov
9ba635fda3 SQL: VIEW with UNION fix [fixes #269] 2017-09-14 14:38:49 +03:00
Aleksey Midenkov
7e764ae188 SQL: 1-row partition rotation fix [fixes #260] 2017-09-13 10:57:46 +03:00
Eugene Kosov
78d2430aa2 Tests: VTMD + modify column 2017-09-12 16:27:44 +03:00
Eugene Kosov
a49239b57a SQL: truncate syntax and privilege [closes #229] 2017-09-08 10:22:24 +03:00
Aleksey Midenkov
904b69cd9e SQL: partitioning misc fixes [closes #242]
* cleanup: *never* use assert(A && B)
* vers_setup_1() revisited
* vers_setup_2() renamed
* partition_element::type removed
* Copy ctor instead of memcpy()
* Handle return value from check_range_constants()
* Malloc error fix
* error, style, misc fixes
2017-09-07 15:49:11 +03:00
Aleksey Midenkov
88ccf759c1 SQL: pruning, derived, view fixes [fixes #244] 2017-09-01 19:05:20 +03:00
Eugene Kosov
c2a70c8050 SQL, IB: option to drop historical rows on ALTER [closes #249] 2017-09-01 12:41:46 +03:00
Eugene Kosov
b4cd2d3c12 Tests: duplicate system versioning field 2017-08-18 15:30:55 +03:00
Eugene Kosov
99baeaa951 SQL: MAX microseconds for current system rows [fixes #245] 2017-08-18 14:29:22 +03:00
Aleksey Midenkov
d3d2ea9fd5 SQL, Parser: system_time logic and syntax fixes [closes #237] 2017-08-08 17:12:16 +03:00
Aleksey Midenkov
53370de103 IB: partition-wise ha_innopart::rnd_init() [fixes #208] 2017-08-04 17:17:28 +03:00
Eugene Kosov
5ce6044b1c SQL: remove versioning only when hidden system fields
[closes #211]
2017-08-03 16:03:19 +03:00
Aleksey Midenkov
c2c8808a16 SQL: compare TRX_ID fields against timestamps [closes #231] 2017-08-03 16:01:16 +03:00
Eugene Kosov
d998da0306 SQL: replication fixes [fixes #234] 2017-07-31 11:44:12 +03:00
Aleksey Midenkov
aa292666cc Parser: moved 'for system_time' before alias
Due to standard (see 7.6 <table reference>).
2017-07-23 17:08:00 +03:00
Aleksey Midenkov
c2f6214671 Tests: renamed optimized_fields to optimized 2017-07-21 07:53:58 +03:00
Eugene Kosov
c99bd3ac1a Tests: truncate.test: get rid of transaction number 2017-07-20 17:15:11 +03:00
Eugene Kosov
f8b6256992 SQL: disallow ALTER CHANGE of system fields [fixes #213] 2017-07-19 23:06:07 +03:00
Eugene Kosov
909867d014 SQL: optimized fields fix for NOT NULL [fixes #226] 2017-07-13 18:48:30 +03:00
Aleksey Midenkov
91c8b43e77 Parser: syntax for query system_time [closes #230]
Eliminated `QUERY FOR`.
2017-07-12 12:10:13 +03:00
Aleksey Midenkov
60e456df33 SQL: system_time propagation from derived table [fixes #228] 2017-07-12 10:36:52 +03:00
Aleksey Midenkov
dcb54040bc SQL: VTQ testing iface moved to plugin [closes #224] 2017-07-07 17:52:23 +03:00
Eugene Kosov
42a0289de9 Tests: optimized fields 2017-07-06 16:19:16 +03:00
Eugene Kosov
1903b407da SQL: ignore columns WITHOUT VERSIONING [fixes #220] 2017-07-04 17:45:14 +03:00
Aleksey Midenkov
bdcce58fad IB: long names in information_schema 2017-07-04 12:09:33 +03:00
Aleksey Midenkov
72de7721b9 SQL: No implicit versioning when created from SELECT [closes #219] 2017-07-03 17:38:59 +03:00