diff options
Diffstat (limited to 'innobase/include')
-rw-r--r-- | innobase/include/dict0dict.h | 26 | ||||
-rw-r--r-- | innobase/include/dict0mem.h | 10 | ||||
-rw-r--r-- | innobase/include/sync0sync.h | 1 | ||||
-rw-r--r-- | innobase/include/univ.i | 6 |
4 files changed, 43 insertions, 0 deletions
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h index b4ff9e90c75..cec1430c9e9 100644 --- a/innobase/include/dict0dict.h +++ b/innobase/include/dict0dict.h @@ -88,6 +88,32 @@ ulint dict_col_get_clust_pos( /*===================*/ dict_col_t* col); +/************************************************************************ +Initializes the autoinc counter. It is not an error to initialize already +initialized counter. */ + +void +dict_table_autoinc_initialize( +/*==========================*/ + dict_table_t* table, /* in: table */ + ib_longlong value); /* in: value which was assigned to a row */ +/************************************************************************ +Gets the next autoinc value, 0 if not yet initialized. */ + +ib_longlong +dict_table_autoinc_get( +/*===================*/ + /* out: value for a new row, or 0 */ + dict_table_t* table); /* in: table */ +/************************************************************************ +Updates the autoinc counter if the value supplied is bigger than the +current value. If not inited, does nothing. */ + +void +dict_table_autoinc_update( +/*======================*/ + dict_table_t* table, /* in: table */ + ib_longlong value); /* in: value which was assigned to a row */ /************************************************************************** Adds a table object to the dictionary cache. */ diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h index 42b9cb55270..be9cd42b7be 100644 --- a/innobase/include/dict0mem.h +++ b/innobase/include/dict0mem.h @@ -302,6 +302,16 @@ struct dict_table_struct{ for MySQL SHOW TABLE STATUS; this counter is not protected by any latch, because this is only used for heuristics */ + /*----------------------*/ + mutex_t autoinc_mutex; + /* mutex protecting the autoincrement + counter */ + ibool autoinc_inited; + /* TRUE if the autoinc counter has been + inited; MySQL gets the init value by executing + SELECT MAX(auto inc column) */ + ib_longlong autoinc;/* autoinc counter value already given to + a row */ ulint magic_n;/* magic number */ }; #define DICT_TABLE_MAGIC_N 76333786 diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h index 03dd45816aa..4b12dd3c86d 100644 --- a/innobase/include/sync0sync.h +++ b/innobase/include/sync0sync.h @@ -372,6 +372,7 @@ Memory pool mutex */ latching order checking */ #define SYNC_LEVEL_NONE 2000 /* default: level not defined */ #define SYNC_DICT 1000 +#define SYNC_DICT_AUTOINC_MUTEX 999 #define SYNC_PURGE_IS_RUNNING 997 #define SYNC_DICT_HEADER 995 #define SYNC_IBUF_HEADER 914 diff --git a/innobase/include/univ.i b/innobase/include/univ.i index fa5a8aef389..d29ca83b0fc 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -155,6 +155,12 @@ typedef unsigned long int ulint; typedef long int lint; +#ifdef __WIN__ +typedef __int64 ib_longlong; +#else +typedef longlong ib_longlong; +#endif + /* The following type should be at least a 64-bit floating point number */ typedef double utfloat; |