diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-02-21 15:16:19 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-02-23 19:17:48 +0100 |
commit | e36c5ec0a50332840c7dcb8e6b08a369ec2a829c (patch) | |
tree | af84bd00042773cabddb4150748601c53d78b783 /sql/partition_element.h | |
parent | 7961bc4b890071f281da88845489cdddc54c289b (diff) | |
download | mariadb-git-e36c5ec0a50332840c7dcb8e6b08a369ec2a829c.tar.gz |
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
Diffstat (limited to 'sql/partition_element.h')
-rw-r--r-- | sql/partition_element.h | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/sql/partition_element.h b/sql/partition_element.h index 162c446a3c2..45900c77cfc 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -90,61 +90,6 @@ typedef struct p_elem_val struct st_ddl_log_memory_entry; -/* Used for collecting MIN/MAX stats on row_end for doing pruning - in SYSTEM_TIME partitiong. */ -class Vers_min_max_stats : public Sql_alloc -{ - static const uint buf_size= 4 + (TIME_SECOND_PART_DIGITS + 1) / 2; - uchar min_buf[buf_size]; - uchar max_buf[buf_size]; - Field_timestampf min_value; - Field_timestampf max_value; - mysql_rwlock_t lock; - -public: - Vers_min_max_stats(const LEX_CSTRING *field_name, TABLE_SHARE *share) : - min_value(min_buf, NULL, 0, Field::NONE, field_name, share, 6), - max_value(max_buf, NULL, 0, Field::NONE, field_name, share, 6) - { - min_value.set_max(); - memset(max_buf, 0, buf_size); - mysql_rwlock_init(key_rwlock_LOCK_vers_stats, &lock); - } - ~Vers_min_max_stats() - { - mysql_rwlock_destroy(&lock); - } - bool update_unguarded(Field *from) - { - return - from->update_min(&min_value, false) + - from->update_max(&max_value, false); - } - bool update(Field *from) - { - mysql_rwlock_wrlock(&lock); - bool res= update_unguarded(from); - mysql_rwlock_unlock(&lock); - return res; - } - my_time_t min_time() - { - mysql_rwlock_rdlock(&lock); - ulong sec_part; - my_time_t res= min_value.get_timestamp(&sec_part); - mysql_rwlock_unlock(&lock); - return res; - } - my_time_t max_time() - { - mysql_rwlock_rdlock(&lock); - ulong sec_part; - my_time_t res= max_value.get_timestamp(&sec_part); - mysql_rwlock_unlock(&lock); - return res; - } -}; - enum stat_trx_field { STAT_TRX_END= 0 |