Fixed bug in auto-increment handling with InnoDB
Some small speedups Docs/manual.texi: Changelog client/mysqldump.c: Fixed quoting problem for table names when using --opt mysys/mf_casecnv.c: Speed up some common string functions sql-bench/test-insert.sh: Small changes that shouldn't affect results sql-bench/test-select.sh: Small changes that shouldn't affect results sql/field.h: Added reset() functions to speed up some common things sql/gen_lex_hash.cc: Smaller hash table sql/ha_innobase.cc: Fixed bug in auto-increment handling with InnoDB
This commit is contained in:
parent
0733b85d75
commit
30774b3549
@ -46672,6 +46672,8 @@ not yet 100% confident in this code.
|
||||
@appendixsubsec Changes in release 3.23.42
|
||||
@itemize @bullet
|
||||
@item
|
||||
Fixed bug in @code{InnoDB} and @code{AUTO_INCREMENT} columns.
|
||||
@item
|
||||
Applied large patch for OS/2 from Yuri Dario.
|
||||
@item
|
||||
Fixed problem with InnoDB when one could get the error @code{Can't
|
||||
|
@ -37,7 +37,7 @@
|
||||
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
|
||||
**/
|
||||
|
||||
#define DUMP_VERSION "8.14"
|
||||
#define DUMP_VERSION "8.15"
|
||||
|
||||
#include <global.h>
|
||||
#include <my_sys.h>
|
||||
@ -1224,6 +1224,7 @@ static int dump_all_tables_in_db(char *database)
|
||||
{
|
||||
char *table;
|
||||
uint numrows;
|
||||
char table_buff[NAME_LEN+3];
|
||||
|
||||
if (init_dumping(database))
|
||||
return 1;
|
||||
@ -1233,7 +1234,7 @@ static int dump_all_tables_in_db(char *database)
|
||||
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
|
||||
for (numrows=0 ; (table = getTableName(1)) ; numrows++)
|
||||
{
|
||||
dynstr_append(&query, table);
|
||||
dynstr_append(&query, quote_name(table,table_buff));
|
||||
dynstr_append(&query, " READ /*!32311 LOCAL */,");
|
||||
}
|
||||
if (numrows && mysql_real_query(sock, query.str, query.length-1))
|
||||
@ -1263,6 +1264,7 @@ static int dump_all_tables_in_db(char *database)
|
||||
static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
uint numrows;
|
||||
char table_buff[NAME_LEN+3];
|
||||
|
||||
if (init_dumping(db))
|
||||
return 1;
|
||||
@ -1274,7 +1276,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
|
||||
for (i=0 ; i < tables ; i++)
|
||||
{
|
||||
dynstr_append(&query, table_names[i]);
|
||||
dynstr_append(&query, quote_name(table_names[i],table_buff));
|
||||
dynstr_append(&query, " READ /*!32311 LOCAL */,");
|
||||
}
|
||||
if (mysql_real_query(sock, query.str, query.length-1))
|
||||
|
@ -31,14 +31,16 @@
|
||||
void caseup_str(my_string str)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
register uint32 l;
|
||||
register char *end=str+(uint) strlen(str);
|
||||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register char *end=str+(uint) strlen(str);
|
||||
while (*str)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
|
||||
else *str=toupper(*str),++str;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
while ((*str = toupper(*str)) != 0)
|
||||
@ -50,14 +52,16 @@ void caseup_str(my_string str)
|
||||
void casedn_str(my_string str)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
register uint32 l;
|
||||
register char *end=str+(uint) strlen(str);
|
||||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register char *end=str+(uint) strlen(str);
|
||||
while (*str)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
|
||||
else *str=tolower(*str),++str;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
while ((*str= tolower(*str)) != 0)
|
||||
@ -70,14 +74,16 @@ void casedn_str(my_string str)
|
||||
void caseup(my_string str, uint length)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
register uint32 l;
|
||||
register char *end=str+length;
|
||||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register char *end=str+length;
|
||||
while (str<end)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
|
||||
else *str=toupper(*str),++str;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for ( ; length>0 ; length--, str++)
|
||||
@ -89,14 +95,16 @@ void caseup(my_string str, uint length)
|
||||
void casedn(my_string str, uint length)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
register uint32 l;
|
||||
register char *end=str+length;
|
||||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register char *end=str+length;
|
||||
while (str<end)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
|
||||
else *str=tolower(*str),++str;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for ( ; length>0 ; length--, str++)
|
||||
@ -143,10 +151,10 @@ skipp:
|
||||
int my_strcasecmp(const char *s, const char *t)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
register uint32 l;
|
||||
register const char *end=s+(uint) strlen(s);
|
||||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register const char *end=s+(uint) strlen(s);
|
||||
while (s<end)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, s,end)))
|
||||
@ -172,10 +180,10 @@ int my_strcasecmp(const char *s, const char *t)
|
||||
int my_casecmp(const char *s, const char *t, uint len)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
register uint32 l;
|
||||
register const char *end=s+len;
|
||||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register const char *end=s+len;
|
||||
while (s<end)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, s,end)))
|
||||
|
@ -562,7 +562,7 @@ if ($limits->{'group_functions'})
|
||||
fetch_all_rows($dbh,"select min(id) from bench1");
|
||||
fetch_all_rows($dbh,"select max(id) from bench1");
|
||||
fetch_all_rows($dbh,"select sum(id+0.0) from bench1");
|
||||
fetch_all_rows($dbh,"select min(id3),max(id3),sum(id3 +0.0) from bench1");
|
||||
fetch_all_rows($dbh,"select min(id3),max(id3),sum(id3-0.0) from bench1");
|
||||
if ($limits->{'group_func_sql_min_str'})
|
||||
{
|
||||
fetch_all_rows($dbh,"select min(dummy1),max(dummy1) from bench1");
|
||||
@ -579,7 +579,7 @@ if ($limits->{'group_functions'})
|
||||
|
||||
|
||||
$count++;
|
||||
$sth=$dbh->prepare($query="select count(*),sum(id+0.0),min(id),max(id),avg(id+0.0) from bench1") or die $DBI::errstr;
|
||||
$sth=$dbh->prepare($query="select count(*),sum(id+0.0),min(id),max(id),avg(id-0.0) from bench1") or die $DBI::errstr;
|
||||
$sth->execute or die $DBI::errstr;
|
||||
@row=$sth->fetchrow_array;
|
||||
if ($row[0] != $total_rows ||
|
||||
|
@ -136,12 +136,12 @@ if ($limits->{'group_functions'})
|
||||
print "Test if the database has a query cache\n";
|
||||
|
||||
# First ensure that the table is read into memory
|
||||
fetch_all_rows($dbh,"select sum(idn+$tmp),sum(rev_idn+$tmp) from bench1");
|
||||
fetch_all_rows($dbh,"select sum(idn+$tmp),sum(rev_idn-$tmp) from bench1");
|
||||
|
||||
$loop_time=new Benchmark;
|
||||
for ($tests=0 ; $tests < $opt_loop_count ; $tests++)
|
||||
{
|
||||
fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1");
|
||||
fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn-$tests) from bench1");
|
||||
}
|
||||
$end_time=new Benchmark;
|
||||
print "Time for select_query_cache ($opt_loop_count): " .
|
||||
@ -153,7 +153,7 @@ if ($limits->{'group_functions'})
|
||||
$loop_time=new Benchmark;
|
||||
for ($tests=0 ; $tests < $opt_loop_count ; $tests++)
|
||||
{
|
||||
fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1");
|
||||
fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn-$tests) from bench1");
|
||||
}
|
||||
$end_time=new Benchmark;
|
||||
print "Time for select_query_cache2 ($opt_loop_count): " .
|
||||
|
14
sql/field.h
14
sql/field.h
@ -300,6 +300,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -328,6 +329,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -356,6 +358,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -389,6 +392,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -423,6 +427,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -449,6 +454,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { bzero(ptr,sizeof(float)); }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -480,6 +486,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { bzero(ptr,sizeof(double)); }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -505,6 +512,7 @@ public:
|
||||
void store(const char *to, uint length) { null[0]=1; }
|
||||
void store(double nr) { null[0]=1; }
|
||||
void store(longlong nr) { null[0]=1; }
|
||||
void reset(void) {}
|
||||
double val_real(void) { return 0.0;}
|
||||
longlong val_int(void) { return 0;}
|
||||
String *val_str(String *value,String *value2)
|
||||
@ -528,6 +536,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -588,6 +597,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -615,6 +625,7 @@ public:
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void store_time(TIME *ltime,timestamp_type type);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -643,6 +654,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -673,6 +685,7 @@ public:
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void store_time(TIME *ltime,timestamp_type type);
|
||||
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
@ -922,6 +935,7 @@ public:
|
||||
void store(const char *to,uint length);
|
||||
void store(double nr);
|
||||
void store(longlong nr);
|
||||
void reset() { bzero(ptr,packlength); }
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
String *val_str(String*,String *);
|
||||
|
@ -472,7 +472,7 @@ int main(int argc,char **argv)
|
||||
int error;
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
start_value=487844L; best_t1=4969454L; best_t2=2266538L; best_type=2; /* mode=4567 add=5 type: 0 */
|
||||
start_value=4597269L; best_t1=6001982L; best_t2=5063828L; best_type=4; /* mode=4513 add=8 type: 0 */
|
||||
if (get_options(argc,(char **) argv))
|
||||
exit(1);
|
||||
|
||||
|
@ -1334,6 +1334,8 @@ ha_innobase::write_row(
|
||||
autoincrement field */
|
||||
|
||||
auto_inc = table->next_number_field->val_int();
|
||||
if (auto_inc == 0)
|
||||
auto_inc= user_thd->next_insert_id;
|
||||
|
||||
if (auto_inc != 0) {
|
||||
/* This call will calculate the max of the
|
||||
|
Loading…
x
Reference in New Issue
Block a user