maria:bb-10.6-MDEV-16983-period-fk

Last commit made on 2021-02-19
Get this branch:
git clone -b bb-10.6-MDEV-16983-period-fk https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.6-MDEV-16983-period-fk
Repository:
lp:maria

Recent commits

bbd65f5... by Nikita Malyavin

Period: add versioning combination

05a4773... by Nikita Malyavin

MDEV-16983 Application-time periods: foreign key PART 4/4

Handle NULLs

a7185ef... by Nikita Malyavin

MDEV-16983 Application-time periods: foreign key PART 3/4

Support self-referencing foreign keys

ecbdef8... by Nikita Malyavin

MDEV-16983 Application-time periods: foreign key PART 2/4

Add correct update check, which preserves referential integrity on not-updated part of period

02b8904... by Nikita Malyavin

MDEV-16983 Application-time periods: foreign key PART 1/4

This work adds support for FOREIGN KEYS for SQL:2011 Application-time
periods feature.
* Two hidden keys are added in key matching a referred foreign key;
* Referential integrity check is done completely on sql layer, in handler;
* A new struct FOREIGN_KEY is introduced to store a prelocked referential
 metadata in TABLE

Limitations:
* Only versionde-to-versioned and plain-to-plain references are supported
 at this moment
* innodb: a flag denoting a period is added to FK flags,
 see dict_create_add_foreign_to_dictionary() and dict_load_foreign().
 In this way only one period per table is supported, and it's quite
 poorly scalable.

In this commit:
* Update is treated as delete + insert which causes false-positives.
 (will bi fixed in PART 2)
* Self-referencing tables have false-negatives during deletes, since
 the same row could be fetched during lookup (will be fixed in PART 3)
* NULL fields are not supported (will be fixed in part 4)

0a52576... by Nikita Malyavin

DONT MERGE

4d4000c... by Nikita Malyavin

Add referenced table to prelocking list during CREATE TABLE with FK

1e73124... by Nikita Malyavin

Prelock child tables in addition to parent ones

259fb1c... by Nikita Malyavin

MDEV-16978 Application-time periods: WITHOUT OVERLAPS

* The overlaps check is implemented on a handler level per row command.
  It creates a separate cursor (actually, another handler instance) and
  caches it inside the original handler, when ha_update_row or
  ha_insert_row is issued. Cursor closes on unlocking the handler.

* Containing the same key in index means unique constraint violation
  even in usual terms. So we fetch left and right neighbours and check
  that they have same key prefix, excluding from the key only the period part.
  If it doesnt match, then there's no such neighbour, and the check passes.
  Otherwise, we check if this neighbour intersects with the considered key.

* The check does not introduce new error and fails with ER_DUPP_KEY error.
  This might break REPLACE workflow and should be fixed separately

0515577... by Sergei Golubchik

cleanup: prepare "update_handler" for WITHOUT OVERLAPS

* rename to a generic name
* move remaning initializations from query exec to prepare time
* simplify/unify key handling in open_table_from_share and delayed
* remove dead code
* move tests where they belong