1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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
This commit is contained in:
Sergei Golubchik
2018-02-21 15:16:19 +01:00
parent 7961bc4b89
commit e36c5ec0a5
16 changed files with 463 additions and 974 deletions

View File

@@ -575,8 +575,6 @@ struct TABLE_STATISTICS_CB
bool histograms_are_read;
};
class Vers_min_max_stats;
enum vers_sys_type_t
{
VERS_UNDEFINED= 0,
@@ -777,27 +775,6 @@ struct TABLE_SHARE
bool vtmd;
uint16 row_start_field;
uint16 row_end_field;
uint32 hist_part_id;
Vers_min_max_stats** stat_trx;
ulonglong stat_serial; // guards check_range_constants() updates
bool busy_rotation;
mysql_mutex_t LOCK_rotation;
mysql_cond_t COND_rotation;
mysql_rwlock_t LOCK_stat_serial;
void vers_init()
{
hist_part_id= UINT_MAX32;
busy_rotation= false;
stat_trx= NULL;
stat_serial= 0;
mysql_mutex_init(key_TABLE_SHARE_LOCK_rotation, &LOCK_rotation, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_TABLE_SHARE_COND_rotation, &COND_rotation, NULL);
mysql_rwlock_init(key_rwlock_LOCK_stat_serial, &LOCK_stat_serial);
}
void vers_destroy();
Field *vers_start_field()
{
@@ -809,12 +786,6 @@ struct TABLE_SHARE
return field[row_end_field];
}
void vers_wait_rotation()
{
while (busy_rotation)
mysql_cond_wait(&COND_rotation, &LOCK_rotation);
}
/**
Cache the checked structure of this table.