diff options
author | Monty <monty@mariadb.org> | 2017-09-27 22:48:05 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-12-03 13:58:35 +0200 |
commit | dc17ac1638ef67b5dc5956d7e4ef802b6b37fbe9 (patch) | |
tree | a4d0b527c70700c65cac857ea9da1fab1a95ad71 /sql/ha_partition.h | |
parent | 2f09b28e0f7f8e4291003a9b46c62b54f3bf4454 (diff) | |
download | mariadb-git-dc17ac1638ef67b5dc5956d7e4ef802b6b37fbe9.tar.gz |
Adding support for auto_increment in the partition engine.
Contains Spiral patches:
022_mariadb-10.2.0.auto_increment.diff MDEV-7720
030: 030_mariadb-10.2.0.partition_auto_inc_init.diff MDEV-7726
These patches have the following differences compared to the original
patches:
- Added the new #defines for the feature in spd_environ.h instead of in
handler.h because these #defines are needed by Spider and are not needed
by the server.
- Cleaned up code related to the removed variable m_need_info_for_auto_inc
. Changed variable assignment in lock_auto_increment() and
unlock_auto_increment() so that the assignments are done under locks.
- Added a test case.
- Added test result changes resulting from a bug that was fixed by these
patches.
Original author: Kentoku SHIBA
First reviewer: Jacob Mathew
Second reviewer: Michael Widenius
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index ba99660bea3..3187dc5dc62 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1137,6 +1137,8 @@ public: auto_increment_column_changed ------------------------------------------------------------------------- */ + virtual bool need_info_for_auto_inc(); + virtual bool can_use_for_auto_inc_init(); virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, @@ -1144,16 +1146,17 @@ public: virtual void release_auto_increment(); private: virtual int reset_auto_increment(ulonglong value); + void update_next_auto_inc_val(); virtual void lock_auto_increment() { /* lock already taken */ if (auto_increment_safe_stmt_log_lock) return; - DBUG_ASSERT(!auto_increment_lock); - if(table_share->tmp_table == NO_TMP_TABLE) + if (table_share->tmp_table == NO_TMP_TABLE) { - auto_increment_lock= TRUE; part_share->lock_auto_inc(); + DBUG_ASSERT(!auto_increment_lock); + auto_increment_lock= TRUE; } } virtual void unlock_auto_increment() @@ -1163,10 +1166,10 @@ private: It will be set to false and thus unlocked at the end of the statement by ha_partition::release_auto_increment. */ - if(auto_increment_lock && !auto_increment_safe_stmt_log_lock) + if (auto_increment_lock && !auto_increment_safe_stmt_log_lock) { - part_share->unlock_auto_inc(); auto_increment_lock= FALSE; + part_share->unlock_auto_inc(); } } virtual void set_auto_increment_if_higher(Field *field) @@ -1174,7 +1177,8 @@ private: ulonglong nr= (((Field_num*) field)->unsigned_flag || field->val_int() > 0) ? field->val_int() : 0; lock_auto_increment(); - DBUG_ASSERT(part_share->auto_inc_initialized); + DBUG_ASSERT(part_share->auto_inc_initialized || + !can_use_for_auto_inc_init()); /* must check when the mutex is taken */ if (nr >= part_share->next_auto_inc_val) part_share->next_auto_inc_val= nr + 1; |