Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
Syntax change
Keyword AUTO enables partition auto-creation.
create table t1 (x int) with system versioning |
partition by system_time interval 1 hour auto; |
|
create table t1 (x int) with system versioning |
partition by system_time interval 1 month |
starts '2021-01-01 00:00:00' auto partitions 12; |
|
create table t1 (x int) with system versioning |
partition by system_time limit 1000 auto; |
Or with explicit partitions:
create table t1 (x int) with system versioning |
partition by system_time interval 1 hour auto |
(partition p0 history, partition pn current); |
Description
Before executing history-generating DML command add N history
partitions, so that N would be sufficient for potentially generated
history. N > 1 may be required when history is rotated by INTERVAL and
timestamp was jumped to future further than interval value.
If last history partition exceeds LIMIT records before DML command
then new history partition is created and the history filling is
switched to the new partition. Thus LIMIT does not carry strict
limitation and the history partition size must be planned as LIMIT
records plus average number of history one DML generates.
Auto-creation is implemented by synchronous
fast_alter_partition_table() call from the thread of the executed DML
command before the command itself (by the fallback and retry mechanism
similar to Discovery feature, see Open_table_context).
The name for newly added partitions are generated like default
partition names with extension of MDEV-22155 (which avoids name
clashes by extending assignment counter to next free-enough gap).
These DML commands trigger auto-creation:
- DELETE (including multi-delete, excluding DELETE HISTORY)
- UPDATE (including multi-update)
- REPLACE (including REPLACE .. SELECT)
- INSERT .. ON DUPLICATE KEY UPDATE
- LOAD DATA .. REPLACE
MDEV-23642 Locking timeout caused by auto-creation affects original DML
The reasons for this are:
- Do not disrupt main business process (the history is auxiliary
service);
- Consequences are non-fatal (history is not lost, but comes into wrong
partition; fixed by partitioning rebuild);
- There is more freedom for application to fail in this case or
not: it may read warning info and find corresponding error number.
- While non-failing command is easy to handle by an application and
fail it, the opposite is hard to handle: there is no automatic
actions to fix failed command and retry, DBA intervention is
required and until then application is non-functioning.
Attachments
Issue Links
- blocks
-
MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers
- Closed
-
MDEV-25495 Auto-drop old history partition for system-versioned tables that use auto-creation
- In Review
- causes
-
MDEV-25477 Auto-create breaks replication when triggering event was not replicated
- Closed
-
MDEV-27456 Assertion `!thd->is_error()' fails in vers_create_partitions upon DML with ER_UNKNOWN_PARTITION
- Closed
-
MDEV-28567 Assertion `0' in open_tables upon function-related operations
- Closed
-
MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition
- Closed
-
MDEV-29873 MSAN uninitialized value errors in bcmp / prep_alter_part_table upon re-partitioning by system time
- Closed
- includes
-
MDEV-20068 History partition rotation is not done under LOCK TABLES
- Closed
- is blocked by
-
MDEV-25347 DML events for auto-partitioned tables are written into binary log twice
- Closed
- is duplicated by
-
MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers
- Closed
- relates to
-
MDEV-19903 Setup default partitions for system versioning
- Closed
-
MDEV-21003 Per-partition INTERVAL for history partitions
- Open
-
MDEV-21747 Refactor partition auto-creation via direct fast_alter_partition_table()
- Closed
-
MDEV-25475 Auto-create: LIMIT partitions are not auto-created quite as documented
- Closed
-
MDEV-25478 Auto-create: Auto partitioning is unsafe for row-based replication
- Closed
-
MDEV-25479 Auto-create: 2nd and further executions of PS or SP fail to create partition
- Closed
-
MDEV-25482 Auto-create: Server hangs after a failed attempt to create partition
- Closed
-
MDEV-25529 Auto-create: Pre-existing historical data is not partitioned as specified by ALTER
- Stalled
-
MDEV-25531 Auto-create: Bad error message upon failure to create partitions due to ER_TOO_MANY_PARTITIONS_ERROR
- Closed
-
MDEV-25540 Auto-create: There is no clear way to disable auto-creation without ruining existing partitions
- Closed
-
MDEV-25545 Auto-create: ODKU does not cause partition creation
- Closed
-
MDEV-25547 Auto-create: Undetected deadlock lasts longer than the configured timeout
- Closed
-
MDEV-25559 Auto-create: infinite loop after interrupted lock wait
- Closed
-
MDEV-25567 Auto-create: Partition creation happens also when modified columns are not versioned
- Open
-
MDEV-28207 Auto-create: Many partitions generate error: Out of resources when opening file './test/' (Errcode: 24 "Too many open files")
- Open
-
MDEV-28288 System versioning doesn't support correct work for engine=connect and doesn't always give any warnings/errors
- Closed
-
MDEV-28337 Update documentation for SYSTEM_TIME partitioning
- Stalled
-
MDEV-28338 Auto-create: doesn't work for engine=MyRocks with LIMIT
- Open
-
MDEV-28413 System versioning is incorrect in Spider
- Stalled
-
MDEV-28414 Auto-create: If XA transaction is rolled back the created partitions are kept empty and not reused
- Open
-
MDEV-17553 Enable setting start datetime for interval partitioned history of system versioned tables
- Closed
-
MDEV-19938 Reorganize multiple history partitions
- Open
-
MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
- Closed
-
MDEV-22247 History partition overflow leads to wrong SELECT result
- Closed
-
MDEV-23640 Versioned InnoDB table doesn't auto-create partitions in time due to imprecise statistics
- Closed
-
MDEV-23641 Default settings for partitioning and auto-partitioning by system time are not very practical
- Closed
-
MDEV-23642 Locking timeout caused by auto-creation affects original DML
- Closed
-
MDEV-25390 Pruning boundary for history partitions is wrong by 1 second
- Closed