Commit 61b2618d authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into bb-10.2-ext

parents ac2db256 6ca35c14
Subproject commit ba8310e82dac659482f04cd2e270e666da072f95
Subproject commit 931450c3f8793f2653f6292847cbc005b30ed3b6
......@@ -47,12 +47,24 @@ SET @@SESSION.foreign_key_checks = @old_foreign_key_checks;
#
# Test that TRUNCATE resets auto-increment.
#
CREATE TABLE t1 (a INT PRIMARY KEY NOT NULL AUTO_INCREMENT);
INSERT INTO t1 VALUES (NULL), (NULL);
CREATE TABLE t1 (a INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
b INT, c INT, d INT, e INT, f INT, g INT, h INT, i INT, j INT, k INT,
l INT, m INT, n INT, o INT, p INT, q INT, r INT, s INT, t INT, u INT,
KEY(b),KEY(c),KEY(d),KEY(e),KEY(f),KEY(g),KEY(h),KEY(i),KEY(j),KEY(k),
KEY(l),KEY(m),KEY(n),KEY(o),KEY(p),KEY(q),KEY(r),KEY(s),KEY(t),KEY(u),
KEY(c,b),KEY(d,b),KEY(e,b),KEY(f,b),KEY(g,b),KEY(h,b),KEY(i,b),KEY(j,b),
KEY(k,b),KEY(l,b),KEY(m,b),KEY(n,b),KEY(o,b),KEY(p,b),KEY(q,b),KEY(r,b),
KEY(s,b),KEY(t,b),KEY(u,b),
KEY(d,c),KEY(e,c),KEY(f,c),KEY(g,c),KEY(h,c),KEY(i,c),KEY(j,c),
KEY(k,c),KEY(l,c),KEY(m,c),KEY(n,c),KEY(o,c),KEY(p,c),KEY(q,c),KEY(r,c),
KEY(s,c),KEY(t,c),KEY(u,c),
KEY(e,d),KEY(f,d),KEY(g,d),KEY(h,d),KEY(i,d),KEY(j,d)
) ENGINE=InnoDB;
INSERT INTO t1 () VALUES (), ();
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1';
AUTO_INCREMENT
3
SELECT * FROM t1 ORDER BY a;
SELECT a FROM t1 ORDER BY a;
a
1
2
......@@ -60,8 +72,8 @@ TRUNCATE TABLE t1;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1';
AUTO_INCREMENT
1
INSERT INTO t1 VALUES (NULL), (NULL);
SELECT * FROM t1 ORDER BY a;
INSERT INTO t1 () VALUES (), ();
SELECT a FROM t1 ORDER BY a;
a
1
2
......
......@@ -52,13 +52,24 @@ SET @@SESSION.foreign_key_checks = @old_foreign_key_checks;
--echo # Test that TRUNCATE resets auto-increment.
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY NOT NULL AUTO_INCREMENT);
INSERT INTO t1 VALUES (NULL), (NULL);
CREATE TABLE t1 (a INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
b INT, c INT, d INT, e INT, f INT, g INT, h INT, i INT, j INT, k INT,
l INT, m INT, n INT, o INT, p INT, q INT, r INT, s INT, t INT, u INT,
KEY(b),KEY(c),KEY(d),KEY(e),KEY(f),KEY(g),KEY(h),KEY(i),KEY(j),KEY(k),
KEY(l),KEY(m),KEY(n),KEY(o),KEY(p),KEY(q),KEY(r),KEY(s),KEY(t),KEY(u),
KEY(c,b),KEY(d,b),KEY(e,b),KEY(f,b),KEY(g,b),KEY(h,b),KEY(i,b),KEY(j,b),
KEY(k,b),KEY(l,b),KEY(m,b),KEY(n,b),KEY(o,b),KEY(p,b),KEY(q,b),KEY(r,b),
KEY(s,b),KEY(t,b),KEY(u,b),
KEY(d,c),KEY(e,c),KEY(f,c),KEY(g,c),KEY(h,c),KEY(i,c),KEY(j,c),
KEY(k,c),KEY(l,c),KEY(m,c),KEY(n,c),KEY(o,c),KEY(p,c),KEY(q,c),KEY(r,c),
KEY(s,c),KEY(t,c),KEY(u,c),
KEY(e,d),KEY(f,d),KEY(g,d),KEY(h,d),KEY(i,d),KEY(j,d)
) ENGINE=InnoDB;
INSERT INTO t1 () VALUES (), ();
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1';
SELECT * FROM t1 ORDER BY a;
SELECT a FROM t1 ORDER BY a;
TRUNCATE TABLE t1;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1';
INSERT INTO t1 VALUES (NULL), (NULL);
SELECT * FROM t1 ORDER BY a;
INSERT INTO t1 () VALUES (), ();
SELECT a FROM t1 ORDER BY a;
DROP TABLE t1;
......@@ -24,6 +24,7 @@
#include <time.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#ifndef _WIN32
#include <syslog.h>
......@@ -140,7 +141,7 @@ static size_t loc_write(File Filedes, const uchar *Buffer, size_t Count)
{
size_t writtenbytes;
#ifdef _WIN32
writtenbytes= my_win_write(Filedes, Buffer, Count);
writtenbytes= (size_t)_write(Filedes, Buffer, (unsigned int)Count);
#else
writtenbytes= write(Filedes, Buffer, Count);
#endif
......@@ -154,10 +155,29 @@ static File loc_open(const char *FileName, int Flags)
/* Special flags */
{
File fd;
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
#ifdef _WIN32
HANDLE h;
/*
We could just use _open() here. but prefer to open in unix-similar way
just like my_open() does it on Windows.
This gives atomic multiprocess-safe appends, and possibility to rename
or even delete file while it is open, and CRT lacks this features.
*/
assert(Flags == (O_APPEND | O_CREAT | O_WRONLY));
h= CreateFile(FileName, FILE_APPEND_DATA,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE)
{
fd= -1;
my_osmaperr(GetLastError());
}
else
{
fd= _open_osfhandle((intptr)h, O_WRONLY|O_BINARY);
}
#else
fd = open(FileName, Flags, my_umask);
fd= open(FileName, Flags, my_umask);
#endif
my_errno= errno;
return fd;
......@@ -173,7 +193,7 @@ static int loc_close(File fd)
err= close(fd);
} while (err == -1 && errno == EINTR);
#else
err= my_win_close(fd);
err= close(fd);
#endif
my_errno=errno;
return err;
......@@ -203,32 +223,9 @@ static int loc_rename(const char *from, const char *to)
}
static my_off_t loc_seek(File fd, my_off_t pos, int whence)
{
os_off_t newpos= -1;
#ifdef _WIN32
newpos= my_win_lseek(fd, pos, whence);
#else
newpos= lseek(fd, pos, whence);
#endif
if (newpos == (os_off_t) -1)
{
my_errno= errno;
return MY_FILEPOS_ERROR;
}
return (my_off_t) newpos;
}
static my_off_t loc_tell(File fd)
{
os_off_t pos;
#if defined (HAVE_TELL) && !defined (_WIN32)
pos= tell(fd);
#else
pos= loc_seek(fd, 0L, MY_SEEK_CUR);
#endif
os_off_t pos= IF_WIN(_telli64(fd),lseek(fd, 0, SEEK_CUR));
if (pos == (os_off_t) -1)
{
my_errno= errno;
......@@ -992,7 +989,7 @@ static int start_logging()
if (output_type == OUTPUT_FILE)
{
char alt_path_buffer[FN_REFLEN+1+DEFAULT_FILENAME_LEN];
MY_STAT *f_stat;
struct stat *f_stat= (struct stat *)alt_path_buffer;
const char *alt_fname= file_path;
while (*alt_fname == ' ')
......@@ -1007,7 +1004,7 @@ static int start_logging()
{
/* See if the directory exists with the name of file_path. */
/* Log file name should be [file_path]/server_audit.log then. */
if ((f_stat= my_stat(file_path, (MY_STAT *)alt_path_buffer, MYF(0))) &&
if (stat(file_path, (struct stat *)alt_path_buffer) == 0 &&
S_ISDIR(f_stat->st_mode))
{
size_t p_len= strlen(file_path);
......
......@@ -827,7 +827,7 @@ MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags)
we may allocate too much, but better safe than memory overrun.
And in the FLUSH case, the memory is released quickly anyway.
*/
sql_lock->lock_count= locks - locks_buf;
sql_lock->lock_count= (uint)(locks - locks_buf);
DBUG_ASSERT(sql_lock->lock_count <= lock_count);
DBUG_PRINT("info", ("sql_lock->table_count %d sql_lock->lock_count %d",
sql_lock->table_count, sql_lock->lock_count));
......
......@@ -1328,7 +1328,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
}
/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
user_host_len= (uint)(strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
sctx->priv_user, "[",
sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
sctx->host ? sctx->host : "", " [",
......
......@@ -92,7 +92,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_RETURN(1);
}
elength= wlength - (ebuffer - wbuffer);
elength= wlength - (uint)(ebuffer - wbuffer);
set_iv(iv, pos_in_file, crypt_data->inbuf_counter);
if (encryption_crypt(ebuffer, elength, info->buffer, &length,
......@@ -184,7 +184,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
my_errno= 1;
DBUG_RETURN(info->error= -1);
}
wlength= elength + ebuffer - wbuffer;
wlength= elength + (uint)(ebuffer - wbuffer);
if (length == info->buffer_length)
{
......
......@@ -1484,8 +1484,8 @@ uint maria_multi_check(THD *thd, char *packet, uint packet_length)
size_t subpacket_length= net_field_length((uchar **)&packet_start);
size_t length_length= packet_start - packet;
// length of command + 3 bytes where that length was stored
DBUG_PRINT("info", ("sub-packet length: %ld + %d command: %x",
(ulong)subpacket_length, (int) length_length,
DBUG_PRINT("info", ("sub-packet length: %zu + %zu command: %x",
subpacket_length, length_length,
packet_start[3]));
if (subpacket_length == 0 ||
......
......@@ -1223,7 +1223,8 @@ fil_space_extend_must_retry(
default:
ut_ad(space->purpose == FIL_TYPE_TABLESPACE
|| space->purpose == FIL_TYPE_IMPORT);
if (space->purpose == FIL_TYPE_TABLESPACE) {
if (space->purpose == FIL_TYPE_TABLESPACE
&& !space->is_being_truncated) {
fil_flush_low(space);
}
return(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment