Commit graph

44 commits

Author SHA1 Message Date
Monty
dfdedd46e4 MDEV-32188 make TIMESTAMP use whole 32-bit unsigned range
This patch extends the timestamp from
2038-01-19 03:14:07.999999 to 2106-02-07 06:28:15.999999
for 64 bit hardware and OS where 'long' is 64 bits.
This is true for 64 bit Linux but not for Windows.

This is done by treating the 32 bit stored int as unsigned instead of
signed.  This is safe as MariaDB has never accepted dates before the epoch
(1970).
The benefit of this approach that for normal timestamp the storage is
compatible with earlier version.

However for tables using system versioning we before stored a
timestamp with the year 2038 as the 'max timestamp', which is used to
detect current values.  This patch stores the new 2106 year max value
as the max timestamp. This means that old tables using system
versioning needs to be updated with mariadb-upgrade when moving them
to 11.4. That will be done in a separate commit.
2024-05-27 12:39:02 +02:00
Monty
1f4a9f086a Removed "<select expression> INTO <destination>" deprication.
This was done after discussions with Igor, Sanja and Bar.

The main reason for removing the deprication was to ensure that MariaDB
is always backward compatible whenever possible.

Other things:
- Added statistics counters, mainly for the feedback plugin.
  - INTO OUTFILE
  - INTO variable
  - If INTO is using the old syntax (end of query)
2023-02-03 11:57:50 +03:00
Sergei Golubchik
ab50321508 MDEV-29813 REPLACE/IGNORE does not work with historical records in InnoDB
note that replace no longer supports system_versioning_insert_history,
the test case is only for ignore
2022-10-26 15:30:39 +02:00
Sergei Golubchik
3b6742a106 don't support REPLACE and INSERT ODKU with system_versioning_insert_history
they'll ignore the value of system_versioning_insert_history,
just as DELETE and UPDATE do
2022-10-26 15:30:39 +02:00
Sergei Golubchik
d94ed0bb2a MDEV-29721 Inconsistency upon inserting history with visible period columns
don't set vers_write=false if one vers column was used explicitly,
instead do vers_update_fields() for columns that do not have explicit
value. So, if row_start has the value and row_end not, row_end will
get max by default.
2022-10-26 15:30:38 +02:00
Sergei Golubchik
8d2ec37a40 MDEV-16546 post-review fixes
* clarify the help text for --system-versioning-insert-history
* move the vers_write=false check from Item_field::fix_fields()
  next to other vers field checks in find_field_in_table()
* move row_start validation from handler::write_row() next to
  vers_update_fields()
* make secure_timestamp check to happen in one place only,
  extract it into a function is_set_timestamp_vorbidden().
* overwriting vers fields is an error, just like setting @@timestamp
* don't run vers_insert_history() for every row
2022-10-26 15:30:38 +02:00
Aleksey Midenkov
a2cda88631 MDEV-16546 System versioning setting to allow history modification
1. system_versioning_insert_history session variable allows
pseudocolumns ROW_START and ROW_END be specified in INSERT,
INSERT..SELECT and LOAD DATA.

2. Cleaned up select_insert::send_data() from setting vers_write as
this parameter is now set on TABLE initialization.

4. Replication of system_versioning_insert_history via option_bits in
OPTIONS_WRITTEN_TO_BIN_LOG.
2022-10-26 15:30:38 +02:00
Oleksandr Byelkin
de745ecf29 MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operations 2018-07-04 19:13:55 +02:00
Sergei Golubchik
052668f500 simplify versioning tests 2018-02-24 00:50:57 +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
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
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
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
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
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
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
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
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
d8aabb44b5
SQL: prohibit ALTER ... AS ROW START|END [fixes #429] 2017-12-25 13:38:03 +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
ee68d019d1 SQL: removed VERS_HIDDEN_FLAG [closes #409] 2017-12-19 16:12:56 +03:00
Aleksey Midenkov
b0d9dc43ca SQL: system_versioning_transaction_registry default OFF 2017-12-18 22:17:52 +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
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
Aleksey Midenkov
b7cd182896 SQL: DEFAULT value for system fields [closes #376] 2017-12-10 23:52:51 +03:00
Aleksey Midenkov
68e160fb25 Tests: removed common.inc from results 2017-12-04 00:49:44 +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
33085349e9 IB, SQL: removed VTQ, added TRT on SQL layer [closes #305] 2017-11-15 00:22:10 +03:00
Aleksey Midenkov
17bd486f36 SQL: thd_start_utime() fix [fixes #284] 2017-10-17 17:20:46 +03:00
Aleksey Midenkov
75bc483d7a Tests: moved concat_execN() to common.inc 2017-09-25 22:07:01 +03:00
Eugene Kosov
99baeaa951 SQL: MAX microseconds for current system rows [fixes #245] 2017-08-18 14:29:22 +03:00
Aleksey Midenkov
bdcce58fad IB: long names in information_schema 2017-07-04 12:09:33 +03:00
Aleksey Midenkov
b19645caf5 Tests: verify_vtq() fix 2017-05-05 20:36:38 +03:00
Aleksey Midenkov
1894fab11a Tests: split versioning.select into combinations 2017-05-05 20:36:32 +03:00
kevg
7aa3ebdd18 SQL, Tests: FOR SYSTEM_TIME for VIEWs [closes #98] 2017-05-05 20:36:27 +03:00
Aleksey Midenkov
a1c36f2e15 SQL: default NULL for sys fields + misc fixes
* sys fields are NULL by default (with exceptions, see comment about NOT_NULL_FLAG in #77);
* error codes renamed, messages cleared out;
* SHOW CREATE TABLE fixed;
* set_max() fix;
* redundant flag setters/getters removed;
* flags are set in sql_yacc.yy, redundant copy_info_about_generated_fields() eliminated.
2017-05-05 20:36:18 +03:00
Aleksey Midenkov
d54d36c45e IB, SQL: (0.4) COMMIT_ID-based ordering of transactions
IB:
* removed CONCURR_TRX from VTQ;
* new fields in VTQ: COMMIT_ID, ISO_LEVEL.

SQL:
* renamed BEGIN_TS, COMMIT_TS to VTQ_BEGIN_TS, VTQ_COMMIT_TS;
* new functions: VTQ_COMMIT_ID, VTQ_ISO_LEVEL, VTQ_TRX_ID, VTQ_TRX_SEES, VTQ_TRX_SEES_EQ;
* versioned SELECT for IB uses VTQ_TRX_SEES, VTQ_TRX_SEES_EQ.

Closes #71
2017-05-05 20:36:17 +03:00
Aleksey Midenkov
d3b737d910 Tests: moved to dedicated versioning suite
Run `mtr --suite=versioning` or `mtr versioning.<test-name>`
2017-05-05 20:36:13 +03:00