Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
This commit is contained in:
commit
30e7d6709f
@ -1707,7 +1707,8 @@ copy_back()
|
||||
if it exists. */
|
||||
|
||||
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);
|
||||
if (!file_exists("ib_logfile0")) {
|
||||
MY_STAT stat_arg;
|
||||
if (!my_stat("ib_logfile0", &stat_arg, MYF(0)) || !stat_arg.st_size) {
|
||||
/* After completed --prepare, redo log files are redundant.
|
||||
We must delete any redo logs at the destination, so that
|
||||
the database will not jump to a different log sequence number
|
||||
|
@ -79,7 +79,7 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
||||
cp->delta_buf_base = static_cast<byte *>(malloc(buf_size));
|
||||
memset(cp->delta_buf_base, 0, buf_size);
|
||||
cp->delta_buf = static_cast<byte *>
|
||||
(ut_align(cp->delta_buf_base, UNIV_PAGE_SIZE_MAX));
|
||||
(ut_align(cp->delta_buf_base, cursor->page_size.physical()));
|
||||
|
||||
/* write delta meta info */
|
||||
snprintf(meta_name, sizeof(meta_name), "%s%s", dst_name,
|
||||
|
@ -2460,7 +2460,7 @@ static os_thread_ret_t log_copying_thread(void*)
|
||||
|
||||
log_copying_running = false;
|
||||
my_thread_end();
|
||||
os_thread_exit(NULL);
|
||||
os_thread_exit();
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -2483,7 +2483,7 @@ static os_thread_ret_t io_watching_thread(void*)
|
||||
|
||||
io_watching_thread_running = false;
|
||||
|
||||
os_thread_exit(NULL);
|
||||
os_thread_exit();
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -2523,7 +2523,7 @@ data_copy_thread_func(
|
||||
pthread_mutex_unlock(&ctxt->count_mutex);
|
||||
|
||||
my_thread_end();
|
||||
os_thread_exit(NULL);
|
||||
os_thread_exit();
|
||||
OS_THREAD_DUMMY_RETURN;
|
||||
}
|
||||
|
||||
@ -4022,8 +4022,7 @@ xb_space_create_file(
|
||||
}
|
||||
|
||||
ret = os_file_set_size(path, *file,
|
||||
FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE,
|
||||
false);
|
||||
FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE);
|
||||
if (!ret) {
|
||||
msg("xtrabackup: cannot set size for file %s\n", path);
|
||||
os_file_close(*file);
|
||||
@ -4414,13 +4413,20 @@ xtrabackup_apply_delta(
|
||||
if (offset_on_page == 0xFFFFFFFFUL)
|
||||
break;
|
||||
|
||||
uchar *buf = incremental_buffer + page_in_buffer * page_size;
|
||||
const os_offset_t off = os_offset_t(offset_on_page)*page_size;
|
||||
|
||||
if (off == 0) {
|
||||
/* Read tablespace size from page 0,
|
||||
and extend the file to specified size.*/
|
||||
os_offset_t n_pages = mach_read_from_4(buf + FSP_HEADER_OFFSET + FSP_SIZE);
|
||||
success = os_file_set_size(dst_path, dst_file, n_pages*page_size);
|
||||
if (!success)
|
||||
goto error;
|
||||
}
|
||||
|
||||
success = os_file_write(IORequestWrite,
|
||||
dst_path, dst_file,
|
||||
incremental_buffer +
|
||||
page_in_buffer * page_size,
|
||||
(offset_on_page <<
|
||||
page_size_shift),
|
||||
page_size);
|
||||
dst_path, dst_file, buf, off, page_size);
|
||||
if (!success) {
|
||||
goto error;
|
||||
}
|
||||
@ -4430,8 +4436,10 @@ xtrabackup_apply_delta(
|
||||
}
|
||||
|
||||
free(incremental_buffer_base);
|
||||
if (src_file != OS_FILE_CLOSED)
|
||||
if (src_file != OS_FILE_CLOSED) {
|
||||
os_file_close(src_file);
|
||||
os_file_delete(0,src_path);
|
||||
}
|
||||
if (dst_file != OS_FILE_CLOSED)
|
||||
os_file_close(dst_file);
|
||||
return TRUE;
|
||||
@ -4785,7 +4793,8 @@ xtrabackup_prepare_func(char** argv)
|
||||
if (!ok) goto error_cleanup;
|
||||
}
|
||||
|
||||
srv_operation = SRV_OPERATION_RESTORE;
|
||||
srv_operation = xtrabackup_export
|
||||
? SRV_OPERATION_RESTORE_EXPORT : SRV_OPERATION_RESTORE;
|
||||
|
||||
if (innodb_init_param()) {
|
||||
goto error_cleanup;
|
||||
|
@ -336,9 +336,14 @@ sub start_kill {
|
||||
|
||||
sub dump_core {
|
||||
my ($self)= @_;
|
||||
return if IS_WINDOWS;
|
||||
my $pid= $self->{SAFE_PID};
|
||||
die "Can't get core from not started process" unless defined $pid;
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
system("$safe_kill $pid dump");
|
||||
return 1;
|
||||
}
|
||||
|
||||
_verbose("Sending ABRT to $self");
|
||||
kill ("ABRT", $pid);
|
||||
return 1;
|
||||
|
@ -25,6 +25,7 @@ SET(INSTALL_ARGS
|
||||
IF (WIN32)
|
||||
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
|
||||
MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
|
||||
TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
|
||||
ELSE()
|
||||
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
|
||||
ENDIF()
|
||||
|
@ -25,6 +25,80 @@
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <psapi.h>
|
||||
#include <DbgHelp.h>
|
||||
|
||||
static int create_dump(DWORD pid)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char working_dir[MAX_PATH];
|
||||
int ret= -1;
|
||||
HANDLE process= INVALID_HANDLE_VALUE;
|
||||
HANDLE file= INVALID_HANDLE_VALUE;
|
||||
char *p;
|
||||
|
||||
process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)pid);
|
||||
if (!process)
|
||||
{
|
||||
fprintf(stderr,"safe_kill : cannot open process pid=%u to create dump, last error %u\n",
|
||||
pid, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
DWORD size = MAX_PATH;
|
||||
if (QueryFullProcessImageName(process, 0, path, &size) == 0)
|
||||
{
|
||||
fprintf(stderr,"safe_kill : cannot read process path for pid %u, last error %u\n",
|
||||
pid, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((p = strrchr(path, '.')) == 0)
|
||||
p= path + strlen(path);
|
||||
|
||||
strncpy(p, ".dmp", path + MAX_PATH - p);
|
||||
|
||||
/* Create dump in current directory.*/
|
||||
const char *filename= strrchr(path, '\\');
|
||||
if (filename == 0)
|
||||
filename = path;
|
||||
else
|
||||
filename++;
|
||||
|
||||
if (!GetCurrentDirectory(MAX_PATH, working_dir))
|
||||
{
|
||||
fprintf(stderr, "GetCurrentDirectory failed, last error %u",GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
|
||||
0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fprintf(stderr,"safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n",
|
||||
filename, working_dir, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0,0,0))
|
||||
{
|
||||
fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n",
|
||||
filename, working_dir, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
fprintf(stderr, "Minidump written to %s, directory %s\n", filename, working_dir);
|
||||
|
||||
exit:
|
||||
if(process!= 0 && process != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(process);
|
||||
|
||||
if (file != 0 && file != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv )
|
||||
{
|
||||
@ -37,12 +111,16 @@ int main(int argc, const char** argv )
|
||||
signal(SIGBREAK, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "safe_kill <pid>\n");
|
||||
if ((argc != 2 && argc != 3) || (argc == 3 && strcmp(argv[2],"dump"))) {
|
||||
fprintf(stderr, "safe_kill <pid> [dump]\n");
|
||||
exit(2);
|
||||
}
|
||||
pid= atoi(argv[1]);
|
||||
|
||||
if (argc == 3)
|
||||
{
|
||||
return create_dump(pid);
|
||||
}
|
||||
_snprintf(safe_process_name, sizeof(safe_process_name),
|
||||
"safe_process[%d]", pid);
|
||||
|
||||
|
@ -86,7 +86,7 @@ select * from t2,t where t2.c=t.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||
explain
|
||||
select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t
|
||||
where t2.c=t.a;
|
||||
@ -176,7 +176,7 @@ select * from t2 where c in (select c from t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2)
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||
explain
|
||||
select * from t2
|
||||
where c in (select c from (select count(*) as c from t1
|
||||
@ -245,8 +245,8 @@ select * from t as r1, t as r2 where r1.a=r2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
explain
|
||||
select * from (select distinct a from t1 where b >= 'c') as r1,
|
||||
(select distinct a from t1 where b >= 'c') as r2
|
||||
@ -370,7 +370,7 @@ select * from t2,t where t2.c=t.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
explain
|
||||
@ -598,7 +598,7 @@ select * from v2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 5 test.t2.c 2
|
||||
3 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||
# with clause in the specification of a view that whose definition
|
||||
# table alias for a with table
|
||||
create view v3 as
|
||||
@ -1055,3 +1055,27 @@ deallocate prepare stmt1;
|
||||
deallocate prepare stmt2;
|
||||
drop view v1,v2;
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-13796: UNION of two materialized CTEs
|
||||
#
|
||||
CREATE TABLE t1 (id int, k int);
|
||||
CREATE TABLE t2 (id int);
|
||||
INSERT INTO t1 VALUES (3,5), (1,7), (4,3);
|
||||
INSERT INTO t2 VALUES (4), (3), (2);
|
||||
WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
|
||||
d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
|
||||
SELECT * FROM d1 UNION SELECT * FROM d2;
|
||||
SUM(k)
|
||||
8
|
||||
explain WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
|
||||
d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
|
||||
SELECT * FROM d1 UNION SELECT * FROM d2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 3
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
||||
4 UNION <derived3> ALL NULL NULL NULL NULL 9
|
||||
3 DERIVED t1 ALL NULL NULL NULL NULL 3
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -86,7 +86,7 @@ select t2.a from t1,t2 where t1.a+1=t2.a
|
||||
select * from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 30
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
3 UNION t1 ALL NULL NULL NULL NULL 5
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
@ -114,7 +114,7 @@ select t2.a from t1,t2 where t1.a+1=t2.a
|
||||
select * from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5
|
||||
3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
@ -691,13 +691,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 5 c.h_id 2 100.00
|
||||
1 PRIMARY <derived3> ref key0 key0 5 c.w_id 2 100.00
|
||||
3 SUBQUERY folks ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||
3 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||
4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL
|
||||
2 UNCACHEABLE SUBQUERY <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||
2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 with recursive ancestor_couple_ids as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
|
||||
# simple mutual recursion
|
||||
@ -877,7 +877,7 @@ where p.id = a.father or p.id = a.mother
|
||||
select * from ancestors;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00
|
||||
2 SUBQUERY folks ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||
2 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
|
||||
3 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00
|
||||
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
@ -1236,7 +1236,7 @@ where p.id = ma.mother
|
||||
select * from ancestors;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12
|
||||
2 SUBQUERY folks ALL NULL NULL NULL NULL 12 Using where
|
||||
2 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
|
||||
3 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12
|
||||
3 RECURSIVE UNION <derived2> ref key0 key0 5 test.p.id 2
|
||||
4 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12
|
||||
@ -1300,14 +1300,14 @@ from prev_gen
|
||||
select ancestors.name, ancestors.dob from ancestors;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24
|
||||
4 SUBQUERY folks ALL NULL NULL NULL NULL 12 Using where
|
||||
4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
|
||||
6 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12
|
||||
5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
|
||||
NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
|
||||
3 SUBQUERY folks ALL NULL NULL NULL NULL 12 Using where
|
||||
3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
|
||||
2 RECURSIVE UNION folks ALL PRIMARY NULL NULL NULL 12
|
||||
2 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL
|
||||
5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
|
||||
NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
|
||||
explain FORMAT=JSON
|
||||
with recursive
|
||||
prev_gen
|
||||
@ -1353,7 +1353,6 @@ EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 4,
|
||||
"operation": "UNION",
|
||||
"table": {
|
||||
"table_name": "folks",
|
||||
"access_type": "ALL",
|
||||
@ -1382,7 +1381,6 @@ EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"operation": "UNION",
|
||||
"table": {
|
||||
"table_name": "folks",
|
||||
"access_type": "ALL",
|
||||
@ -1489,7 +1487,6 @@ EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"operation": "UNION",
|
||||
"table": {
|
||||
"table_name": "v",
|
||||
"access_type": "ALL",
|
||||
@ -1757,7 +1754,6 @@ EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"operation": "UNION",
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
@ -1840,7 +1836,7 @@ select t2.a from t1,t2 where t1.a+1=t2.a
|
||||
select * from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5
|
||||
4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL
|
||||
@ -2387,7 +2383,6 @@ ANALYZE
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"operation": "UNION",
|
||||
"table": {
|
||||
"message": "No tables used"
|
||||
}
|
||||
@ -2794,7 +2789,7 @@ SELECT c1 FROM t, cte
|
||||
) SELECT COUNT(*) FROM cte;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
|
||||
@ -2812,7 +2807,7 @@ SELECT c2 FROM t, cte
|
||||
) SELECT COUNT(*) FROM cte;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
|
||||
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
|
||||
|
@ -152,6 +152,9 @@ json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]')
|
||||
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
|
||||
json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]')
|
||||
1
|
||||
select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
|
||||
json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}')
|
||||
1
|
||||
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
|
||||
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]")
|
||||
1
|
||||
@ -402,6 +405,13 @@ abc
|
||||
select json_unquote('abc');
|
||||
json_unquote('abc')
|
||||
abc
|
||||
create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1;
|
||||
insert into t1 values ('abc'),('def');
|
||||
select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
|
||||
fld
|
||||
{"foo": "{\"bar\": \"abc\"}", "qux": "abc"}
|
||||
{"foo": "{\"bar\": \"def\"}", "qux": "def"}
|
||||
drop table t1;
|
||||
select json_object("a", json_object("b", "abcd"));
|
||||
json_object("a", json_object("b", "abcd"))
|
||||
{"a": {"b": "abcd"}}
|
||||
@ -443,6 +453,11 @@ json_length('{"a": 1, "b": {"c": 30}}', '$.b')
|
||||
select json_length('{"a": 1, "b": {"c": 30}}');
|
||||
json_length('{"a": 1, "b": {"c": 30}}')
|
||||
2
|
||||
select json_length('{}{');
|
||||
json_length('{}{')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 3
|
||||
create table json (j INT);
|
||||
show create table json;
|
||||
Table Create Table
|
||||
@ -705,6 +720,11 @@ json_data
|
||||
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
|
||||
json_data
|
||||
{"user": "Jožko Mrkvičká"}
|
||||
select json_contains_path('{"foo":"bar"}', 'one', '$[]');
|
||||
json_contains_path('{"foo":"bar"}', 'one', '$[]')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
|
@ -485,6 +485,25 @@ ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText
|
||||
select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
|
||||
ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'))
|
||||
0
|
||||
SELECT ST_RELATE(
|
||||
ST_DIFFERENCE(
|
||||
GEOMETRYFROMTEXT('
|
||||
MULTILINESTRING(
|
||||
( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
|
||||
28978 6548, 45720 32057, 53345 3221 ),
|
||||
( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
|
||||
( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
|
||||
( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
|
||||
( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
|
||||
)
|
||||
'),
|
||||
GEOMETRYFROMTEXT('POINT(46061 13545)')
|
||||
),
|
||||
GEOMETRYFROMTEXT('POINT(4599 60359)'),
|
||||
'F*FFFF**F'
|
||||
) as relate_res;
|
||||
relate_res
|
||||
0
|
||||
DROP TABLE IF EXISTS p1;
|
||||
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
|
||||
BEGIN
|
||||
|
@ -12,3 +12,27 @@ WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
|
||||
id
|
||||
2
|
||||
DROP TABLE t1;
|
||||
create table t1 (p point default "qwer");
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
create table t1 (p point default 0);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
create table t1 (p point not null default st_geometryfromtext('point 0)'));
|
||||
ERROR 42000: Invalid default value for 'p'
|
||||
create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
|
||||
insert into t1 values(default);
|
||||
select st_astext(p) from t1;
|
||||
st_astext(p)
|
||||
POINT(0 0)
|
||||
drop table t1;
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
|
||||
set timestamp=10;
|
||||
insert into t1 values(default);
|
||||
ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
|
||||
set timestamp=10;
|
||||
alter table t1 add column i int;
|
||||
ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
|
@ -2140,3 +2140,35 @@ drop database db1;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
set global sql_mode=default;
|
||||
USE test;
|
||||
#
|
||||
# End of 10.0 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.1 tests
|
||||
#
|
||||
#
|
||||
# MDEV-13242 Wrong results for queries with row constructors and information_schema
|
||||
#
|
||||
CREATE TABLE tt1(c1 INT);
|
||||
CREATE TABLE tt2(c2 INT);
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1', 'c1'));
|
||||
count(*)
|
||||
1
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt2', 'c2'));
|
||||
count(*)
|
||||
1
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2'));
|
||||
count(*)
|
||||
2
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (SELECT 'tt1','c1' FROM dual UNION SELECT 'tt2', 'c2' FROM dual);
|
||||
count(*)
|
||||
2
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
|
||||
count(*)
|
||||
2
|
||||
SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
|
||||
column_name
|
||||
c1
|
||||
c2
|
||||
DROP TABLE tt1, tt2;
|
||||
|
@ -772,5 +772,31 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table if exists t1;
|
||||
#
|
||||
# MDEV-11586 UNION of FLOAT type results in erroneous precision
|
||||
#
|
||||
CREATE TABLE t1 (f FLOAT);
|
||||
INSERT INTO t1 VALUES (1.1);
|
||||
SELECT f FROM t1 UNION SELECT 1;
|
||||
f
|
||||
1.100000023841858
|
||||
1
|
||||
SELECT 1 UNION SELECT f FROM t1;
|
||||
1
|
||||
1
|
||||
1.100000023841858
|
||||
SELECT f FROM t1 UNION SELECT 2147483647;
|
||||
f
|
||||
1.100000023841858
|
||||
2147483647
|
||||
SELECT 2147483647 UNION SELECT f FROM t1;
|
||||
2147483647
|
||||
2147483647
|
||||
1.100000023841858
|
||||
SELECT CASE WHEN 0 THEN (SELECT f FROM t1) ELSE 2147483647 END AS c1,
|
||||
CASE WHEN 1 THEN 2147483647 ELSE (SELECT f FROM t1) END AS c2;
|
||||
c1 c2
|
||||
2147483647 2147483647
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -10,14 +10,5 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
innodb_defragment_fill_factor : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.defrag_mdl-9155 : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defrag_concurrent : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defrag_stats : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defrag_stats_many_tables : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defragment : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defragment_fill_factor : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defragment_small : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb.innodb_defrag_binlog : MDEV-11336 Fix and enable innodb_defragment
|
||||
innodb-wl5980-alter : MDEV-9469 / MDEV-13668 extra crash in 10.2
|
||||
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
|
||||
|
@ -857,3 +857,33 @@ DROP TABLE dest_db.t1;
|
||||
DROP TABLE source_db.t1;
|
||||
DROP DATABASE source_db;
|
||||
DROP DATABASE dest_db;
|
||||
USE test;
|
||||
#
|
||||
# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
|
||||
iNSERT INTO t1 VALUES (10);
|
||||
ALTER TABLE t1 ADD b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
|
||||
ERROR 22003: Out of range value for column 'b' at row 1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
10
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
|
||||
iNSERT INTO t1 VALUES (10);
|
||||
ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
10 2001-01-01
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
|
||||
iNSERT INTO t1 VALUES (10);
|
||||
ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
10 10:20:30
|
||||
DROP TABLE t1;
|
||||
|
@ -37,3 +37,13 @@ Level Code Message
|
||||
show errors;
|
||||
Level Code Message
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
|
||||
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column 'b' at row 1
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES NULL
|
||||
DROP TABLE t1;
|
||||
|
@ -3,7 +3,15 @@ select @@global.innodb_stats_persistent;
|
||||
@@global.innodb_stats_persistent
|
||||
0
|
||||
set global innodb_defragment_stats_accuracy = 80;
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c INT, KEY second(a, b),KEY third(c)) ENGINE=INNODB;
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b VARCHAR(256),
|
||||
c INT,
|
||||
g GEOMETRY NOT NULL,
|
||||
t VARCHAR(256),
|
||||
KEY second(a, b),
|
||||
KEY third(c),
|
||||
SPATIAL gk(g),
|
||||
FULLTEXT INDEX fti(t)) ENGINE=INNODB;
|
||||
connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
||||
connect con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
||||
connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
||||
@ -40,9 +48,9 @@ count(stat_value) > 0
|
||||
connection con1;
|
||||
optimize table t1;;
|
||||
connection default;
|
||||
INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000);;
|
||||
INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000, Point(1,1),'More like a test but different.');;
|
||||
connection con2;
|
||||
INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000);;
|
||||
INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000, Point(1,1),'Totally different text book.');;
|
||||
connection con3;
|
||||
DELETE FROM t1 where a between 1 and 100;;
|
||||
connection con4;
|
||||
@ -59,6 +67,9 @@ disconnect con4;
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
15723
|
||||
|
@ -1,4 +1,12 @@
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||
WHERE engine = 'innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||
FOUND 1 /InnoDB: Log file .*ib_logfile0 size 0 is too small/ in mysqld.1.err
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (42);
|
||||
SELECT * FROM t1;
|
||||
|
@ -494,6 +494,34 @@ eval ALTER TABLE $source_db.t1 DROP INDEX index2, algorithm=inplace;
|
||||
eval DROP TABLE $source_db.t1;
|
||||
eval DROP DATABASE $source_db;
|
||||
eval DROP DATABASE $dest_db;
|
||||
USE test;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
|
||||
iNSERT INTO t1 VALUES (10);
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
ALTER TABLE t1 ADD b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# DATETIME-to-DATE truncation is OK
|
||||
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
|
||||
iNSERT INTO t1 VALUES (10);
|
||||
--enable_info
|
||||
ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
|
||||
--disable_info
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# DATETIME-to-TIME truncation is OK
|
||||
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
|
||||
iNSERT INTO t1 VALUES (10);
|
||||
--enable_info
|
||||
ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
|
||||
--disable_info
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -19,3 +19,13 @@ ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED;
|
||||
show warnings;
|
||||
show errors;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
|
||||
DESCRIBE t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -16,7 +16,26 @@ select @@global.innodb_stats_persistent;
|
||||
set global innodb_defragment_stats_accuracy = 80;
|
||||
|
||||
# Create table.
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c INT, KEY second(a, b),KEY third(c)) ENGINE=INNODB;
|
||||
#
|
||||
# TODO: Currently we do not defragment spatial indexes,
|
||||
# because doing it properly would require
|
||||
# appropriate logic around the SSN (split
|
||||
# sequence number).
|
||||
#
|
||||
# Also do not defragment auxiliary tables related to FULLTEXT INDEX.
|
||||
#
|
||||
# Both types added to this test to make sure they do not cause
|
||||
# problems.
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b VARCHAR(256),
|
||||
c INT,
|
||||
g GEOMETRY NOT NULL,
|
||||
t VARCHAR(256),
|
||||
KEY second(a, b),
|
||||
KEY third(c),
|
||||
SPATIAL gk(g),
|
||||
FULLTEXT INDEX fti(t)) ENGINE=INNODB;
|
||||
|
||||
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
@ -36,7 +55,7 @@ let $i = $data_size;
|
||||
while ($i)
|
||||
{
|
||||
eval
|
||||
INSERT INTO t1 VALUES ($data_size + 1 - $i, REPEAT('A', 256), $i);
|
||||
INSERT INTO t1 VALUES ($data_size + 1 - $i, REPEAT('A', 256), $i, Point($i,$i), 'This is a test message.');
|
||||
dec $i;
|
||||
}
|
||||
--enable_query_log
|
||||
@ -69,10 +88,10 @@ connection con1;
|
||||
--send optimize table t1;
|
||||
|
||||
connection default;
|
||||
--send INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000);
|
||||
--send INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000, Point(1,1),'More like a test but different.');
|
||||
|
||||
connection con2;
|
||||
--send INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000);
|
||||
--send INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000, Point(1,1),'Totally different text book.');
|
||||
|
||||
connection con3;
|
||||
--send DELETE FROM t1 where a between 1 and 100;
|
||||
@ -103,6 +122,7 @@ disconnect con3;
|
||||
disconnect con4;
|
||||
|
||||
optimize table t1;
|
||||
check table t1 extended;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t1 force index (second);
|
||||
|
@ -23,14 +23,33 @@ call mtr.add_suppression("InnoDB: Log file .*ib_logfile[01].* size");
|
||||
call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
|
||||
FLUSH TABLES;
|
||||
--enable_query_log
|
||||
let MYSQLD_DATADIR= `select @@datadir`;
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
|
||||
--source include/shutdown_mysqld.inc
|
||||
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile.old
|
||||
write_file $MYSQLD_DATADIR/ib_logfile0;
|
||||
EOF
|
||||
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||
WHERE engine = 'innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
|
||||
--let $restart_parameters= --innodb-thread-concurrency=1 --innodb-log-file-size=1m --innodb-log-files-in-group=2
|
||||
--source include/restart_mysqld.inc
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
eval $check_no_innodb;
|
||||
--remove_file $MYSQLD_DATADIR/ib_logfile0
|
||||
--move_file $MYSQLD_DATADIR/ib_logfile.old $MYSQLD_DATADIR/ib_logfile.0
|
||||
--source include/shutdown_mysqld.inc
|
||||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 0 is too small;
|
||||
--source include/search_pattern_in_file.inc
|
||||
--source include/start_mysqld.inc
|
||||
CHECK TABLE t1;
|
||||
|
||||
--let $restart_parameters= --innodb-thread-concurrency=100 --innodb-log-file-size=10M --innodb-log-files-in-group=2
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (42);
|
||||
|
||||
@ -52,9 +71,7 @@ SELECT * FROM t1;
|
||||
|
||||
INSERT INTO t1 VALUES (0),(123);
|
||||
|
||||
let MYSQLD_DATADIR= `select @@datadir`;
|
||||
let SEARCH_ABORT = NOT FOUND;
|
||||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
|
||||
BEGIN;
|
||||
DELETE FROM t1 WHERE a>0;
|
||||
|
@ -743,3 +743,19 @@ ALTER TABLE t1 ADD SPATIAL INDEX(p);
|
||||
ALTER TABLE t1 FORCE, LOCK=NONE;
|
||||
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
|
||||
DROP TABLE t1;
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
|
||||
set timestamp=10;
|
||||
insert into t1 values(default);
|
||||
ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
|
||||
set timestamp=10;
|
||||
alter table t1 add column i int;
|
||||
ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD COLUMN b POINT DEFAULT '0';
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
DROP TABLE t1;
|
||||
|
@ -743,3 +743,23 @@ ALTER TABLE t1 ADD SPATIAL INDEX(p);
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 FORCE, LOCK=NONE;
|
||||
DROP TABLE t1;
|
||||
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
|
||||
set timestamp=10;
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
insert into t1 values(default);
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
|
||||
set timestamp=10;
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
alter table t1 add column i int;
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
|
||||
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
ALTER TABLE t1 ADD COLUMN b POINT DEFAULT '0';
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -9,6 +9,7 @@ INSERT INTO t VALUES('foobar2');
|
||||
# remove datadir
|
||||
# xtrabackup move back
|
||||
# restart server
|
||||
ib_logfile0
|
||||
SELECT * FROM t;
|
||||
c
|
||||
foobar1
|
||||
|
@ -24,6 +24,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
||||
--enable_result_log
|
||||
|
||||
--list_files $targetdir ib_logfile*
|
||||
--cat_file $targetdir/ib_logfile0
|
||||
|
||||
SELECT * FROM t;
|
||||
DROP TABLE t;
|
||||
|
@ -724,3 +724,22 @@ deallocate prepare stmt2;
|
||||
|
||||
drop view v1,v2;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13796: UNION of two materialized CTEs
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (id int, k int);
|
||||
CREATE TABLE t2 (id int);
|
||||
INSERT INTO t1 VALUES (3,5), (1,7), (4,3);
|
||||
INSERT INTO t2 VALUES (4), (3), (2);
|
||||
|
||||
let $q=
|
||||
WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
|
||||
d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
|
||||
SELECT * FROM d1 UNION SELECT * FROM d2;
|
||||
|
||||
eval $q;
|
||||
eval explain $q;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -56,6 +56,7 @@ select json_contains('[1, {"a":1}]', '{}');
|
||||
select json_contains('[1, {"a":1}]', '{"a":1}');
|
||||
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
|
||||
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
|
||||
select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
|
||||
|
||||
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
|
||||
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
|
||||
@ -163,6 +164,14 @@ drop table t1;
|
||||
|
||||
select json_unquote('"abc"');
|
||||
select json_unquote('abc');
|
||||
#
|
||||
# MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument.
|
||||
#
|
||||
create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1;
|
||||
insert into t1 values ('abc'),('def');
|
||||
|
||||
select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
|
||||
drop table t1;
|
||||
|
||||
select json_object("a", json_object("b", "abcd"));
|
||||
select json_object("a", '{"b": "abcd"}');
|
||||
@ -179,6 +188,7 @@ select json_length('{}');
|
||||
select json_length('[1, 2, {"a": 3}]');
|
||||
select json_length('{"a": 1, "b": {"c": 30}}', '$.b');
|
||||
select json_length('{"a": 1, "b": {"c": 30}}');
|
||||
select json_length('{}{');
|
||||
|
||||
create table json (j INT);
|
||||
show create table json;
|
||||
@ -361,6 +371,12 @@ select json_array(5,json_query('[1,2]','$'));
|
||||
SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
|
||||
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
|
||||
|
||||
#
|
||||
# MDEV-12312 JSON_CONTAINS_PATH does not detect invalid path and returns TRUE.
|
||||
#
|
||||
|
||||
select json_contains_path('{"foo":"bar"}', 'one', '$[]');
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
@ -363,5 +363,24 @@ select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT
|
||||
select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
|
||||
select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
|
||||
|
||||
# MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
|
||||
SELECT ST_RELATE(
|
||||
ST_DIFFERENCE(
|
||||
GEOMETRYFROMTEXT('
|
||||
MULTILINESTRING(
|
||||
( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
|
||||
28978 6548, 45720 32057, 53345 3221 ),
|
||||
( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
|
||||
( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
|
||||
( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
|
||||
( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
|
||||
)
|
||||
'),
|
||||
GEOMETRYFROMTEXT('POINT(46061 13545)')
|
||||
),
|
||||
GEOMETRYFROMTEXT('POINT(4599 60359)'),
|
||||
'F*FFFF**F'
|
||||
) as relate_res;
|
||||
|
||||
--source include/gis_debug.inc
|
||||
|
||||
|
@ -15,3 +15,31 @@ SELECT id FROM t1
|
||||
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field
|
||||
#
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
create table t1 (p point default "qwer");
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
create table t1 (p point default 0);
|
||||
--error ER_INVALID_DEFAULT
|
||||
create table t1 (p point not null default st_geometryfromtext('point 0)'));
|
||||
create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
|
||||
insert into t1 values(default);
|
||||
select st_astext(p) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
|
||||
set timestamp=10;
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
insert into t1 values(default);
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
|
||||
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
|
||||
set timestamp=10;
|
||||
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
||||
alter table t1 add column i int;
|
||||
drop table t1;
|
||||
SET timestamp=default;
|
||||
|
||||
|
@ -1861,3 +1861,29 @@ disconnect con1;
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
set global sql_mode=default;
|
||||
|
||||
USE test;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.0 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.1 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13242 Wrong results for queries with row constructors and information_schema
|
||||
--echo #
|
||||
|
||||
CREATE TABLE tt1(c1 INT);
|
||||
CREATE TABLE tt2(c2 INT);
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1', 'c1'));
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt2', 'c2'));
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2'));
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (SELECT 'tt1','c1' FROM dual UNION SELECT 'tt2', 'c2' FROM dual);
|
||||
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
|
||||
SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
|
||||
DROP TABLE tt1, tt2;
|
||||
|
@ -533,6 +533,21 @@ show create table t1;
|
||||
|
||||
drop table if exists t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11586 UNION of FLOAT type results in erroneous precision
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (f FLOAT);
|
||||
INSERT INTO t1 VALUES (1.1);
|
||||
SELECT f FROM t1 UNION SELECT 1;
|
||||
SELECT 1 UNION SELECT f FROM t1;
|
||||
SELECT f FROM t1 UNION SELECT 2147483647;
|
||||
SELECT 2147483647 UNION SELECT f FROM t1;
|
||||
SELECT CASE WHEN 0 THEN (SELECT f FROM t1) ELSE 2147483647 END AS c1,
|
||||
CASE WHEN 1 THEN 2147483647 ELSE (SELECT f FROM t1) END AS c2;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -117,7 +117,7 @@ ELSE()
|
||||
IF(CMAKE_VERSION LESS "3.0")
|
||||
SET(GIT_TAG "1.0.8")
|
||||
ELSE()
|
||||
SET(GIT_TAG "1.1.27")
|
||||
SET(GIT_TAG "1.2.11")
|
||||
ENDIF()
|
||||
|
||||
SET(AWS_SDK_PATCH_COMMAND )
|
||||
|
@ -1478,19 +1478,33 @@ end:
|
||||
bool save_tx_read_only= thd->tx_read_only;
|
||||
thd->tx_read_only= false;
|
||||
|
||||
if (WSREP(thd))
|
||||
{
|
||||
/*
|
||||
This code is processing event execution and does not have client
|
||||
connection. Here, event execution will now execute a prepared
|
||||
DROP EVENT statement, but thd->lex->sql_command is set to
|
||||
SQLCOM_CREATE_PROCEDURE
|
||||
DROP EVENT will be logged in binlog, and we have to
|
||||
replicate it to make all nodes have consistent event definitions
|
||||
Wsrep DDL replication is triggered inside Events::drop_event(),
|
||||
and here we need to prepare the THD so that DDL replication is
|
||||
possible, essentially it requires setting sql_command to
|
||||
SQLCOMM_DROP_EVENT, we will switch sql_command for the duration
|
||||
of DDL replication only.
|
||||
*/
|
||||
const enum_sql_command sql_command_save= thd->lex->sql_command;
|
||||
const bool sql_command_set= WSREP(thd);
|
||||
|
||||
if (sql_command_set)
|
||||
thd->lex->sql_command = SQLCOM_DROP_EVENT;
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
}
|
||||
|
||||
ret= Events::drop_event(thd, &dbname, &name, FALSE);
|
||||
|
||||
WSREP_TO_ISOLATION_END;
|
||||
if (sql_command_set)
|
||||
{
|
||||
WSREP_TO_ISOLATION_END;
|
||||
thd->lex->sql_command = sql_command_save;
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
#endif
|
||||
thd->tx_read_only= save_tx_read_only;
|
||||
thd->security_ctx->master_access= saved_master_access;
|
||||
}
|
||||
|
@ -335,6 +335,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
|
||||
|
||||
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
if (lock_object_name(thd, MDL_key::EVENT,
|
||||
parse_data->dbname.str, parse_data->name.str))
|
||||
@ -417,6 +418,10 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
|
||||
thd->restore_stmt_binlog_format(save_binlog_format);
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
|
||||
@ -457,6 +462,9 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
|
||||
|
||||
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
if (lock_object_name(thd, MDL_key::EVENT,
|
||||
parse_data->dbname.str, parse_data->name.str))
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -541,6 +549,10 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
|
||||
|
||||
thd->restore_stmt_binlog_format(save_binlog_format);
|
||||
DBUG_RETURN(ret);
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
|
||||
@ -582,6 +594,8 @@ Events::drop_event(THD *thd, const LEX_CSTRING *dbname,
|
||||
if (check_access(thd, EVENT_ACL, dbname->str, NULL, NULL, 0, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
/*
|
||||
Turn off row binlogging of this statement and use statement-based so
|
||||
that all supporting tables are updated for DROP EVENT command.
|
||||
@ -603,6 +617,10 @@ Events::drop_event(THD *thd, const LEX_CSTRING *dbname,
|
||||
|
||||
thd->restore_stmt_binlog_format(save_binlog_format);
|
||||
DBUG_RETURN(ret);
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
13
sql/field.cc
13
sql/field.cc
@ -240,7 +240,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]=
|
||||
//MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
|
||||
MYSQL_TYPE_FLOAT, MYSQL_TYPE_VARCHAR,
|
||||
//MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
|
||||
MYSQL_TYPE_FLOAT, MYSQL_TYPE_FLOAT,
|
||||
MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT,
|
||||
//MYSQL_TYPE_DATE MYSQL_TYPE_TIME
|
||||
MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
|
||||
//MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
|
||||
@ -2240,15 +2240,15 @@ Field *Field::clone(MEM_ROOT *root, my_ptrdiff_t diff)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void Field::set_default()
|
||||
int Field::set_default()
|
||||
{
|
||||
if (default_value)
|
||||
{
|
||||
Query_arena backup_arena;
|
||||
table->in_use->set_n_backup_active_arena(table->expr_arena, &backup_arena);
|
||||
(void) default_value->expr->save_in_field(this, 0);
|
||||
int rc= default_value->expr->save_in_field(this, 0);
|
||||
table->in_use->restore_active_arena(table->expr_arena, &backup_arena);
|
||||
return;
|
||||
return rc;
|
||||
}
|
||||
/* Copy constant value stored in s->default_values */
|
||||
my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->s->default_values -
|
||||
@ -2257,6 +2257,7 @@ void Field::set_default()
|
||||
if (maybe_null_in_table())
|
||||
*null_ptr= ((*null_ptr & (uchar) ~null_bit) |
|
||||
(null_ptr[l_offset] & null_bit));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -9558,7 +9559,7 @@ Field_bit::unpack(uchar *to, const uchar *from, const uchar *from_end,
|
||||
}
|
||||
|
||||
|
||||
void Field_bit::set_default()
|
||||
int Field_bit::set_default()
|
||||
{
|
||||
if (bit_len > 0)
|
||||
{
|
||||
@ -9566,7 +9567,7 @@ void Field_bit::set_default()
|
||||
uchar bits= get_rec_bits(bit_ptr + col_offset, bit_ofs, bit_len);
|
||||
set_rec_bits(bits, bit_ptr, bit_ofs, bit_len);
|
||||
}
|
||||
Field::set_default();
|
||||
return Field::set_default();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -958,7 +958,7 @@ public:
|
||||
my_ptrdiff_t l_offset= (my_ptrdiff_t) (record - table->record[0]);
|
||||
return ptr + l_offset;
|
||||
}
|
||||
virtual void set_default();
|
||||
virtual int set_default();
|
||||
|
||||
bool has_update_default_function() const
|
||||
{
|
||||
@ -3762,7 +3762,7 @@ public:
|
||||
virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
|
||||
virtual const uchar *unpack(uchar *to, const uchar *from,
|
||||
const uchar *from_end, uint param_data);
|
||||
virtual void set_default();
|
||||
virtual int set_default();
|
||||
|
||||
Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
|
||||
uchar *new_ptr, uint32 length,
|
||||
|
@ -4680,6 +4680,8 @@ public:
|
||||
bool fix_fields(THD *thd, Item **it);
|
||||
void cleanup();
|
||||
|
||||
Item *get_orig_item() const { return orig_item; }
|
||||
|
||||
/* Methods of getting value which should be cached in the cache */
|
||||
void save_val(Field *to);
|
||||
double val_real();
|
||||
|
@ -66,9 +66,9 @@ String *Item_func_geometry_from_text::val_str(String *str)
|
||||
srid= (uint32)args[1]->val_int();
|
||||
|
||||
str->set_charset(&my_charset_bin);
|
||||
str->length(0);
|
||||
if (str->reserve(SRID_SIZE, 512))
|
||||
return 0;
|
||||
str->length(0);
|
||||
str->q_append(srid);
|
||||
if ((null_value= !Geometry::create_from_wkt(&buffer, &trs, str, 0)))
|
||||
return 0;
|
||||
@ -1323,6 +1323,8 @@ static int setup_relate_func(Geometry *g1, Geometry *g2,
|
||||
}
|
||||
else
|
||||
func->repeat_expression(shape_a);
|
||||
if (func->reserve_op_buffer(1))
|
||||
return 1;
|
||||
func->add_operation(op_matrix(nc%3), 1);
|
||||
if (do_store_shapes)
|
||||
{
|
||||
@ -1493,11 +1495,13 @@ longlong Item_func_spatial_precise_rel::val_int()
|
||||
Gcalc_function::op_intersection, 2);
|
||||
func.add_operation(Gcalc_function::op_internals, 1);
|
||||
shape_a= func.get_next_expression_pos();
|
||||
if ((null_value= g1.store_shapes(&trn)))
|
||||
if ((null_value= g1.store_shapes(&trn)) ||
|
||||
func.reserve_op_buffer(1))
|
||||
break;
|
||||
func.add_operation(Gcalc_function::op_internals, 1);
|
||||
shape_b= func.get_next_expression_pos();
|
||||
if ((null_value= g2.store_shapes(&trn)))
|
||||
if ((null_value= g2.store_shapes(&trn)) ||
|
||||
func.reserve_op_buffer(1))
|
||||
break;
|
||||
func.add_operation(Gcalc_function::v_find_t |
|
||||
Gcalc_function::op_intersection, 2);
|
||||
@ -1732,6 +1736,8 @@ int Item_func_buffer::Transporter::single_point(double x, double y)
|
||||
{
|
||||
if (buffer_op == Gcalc_function::op_difference)
|
||||
{
|
||||
if (m_fn->reserve_op_buffer(1))
|
||||
return 1;
|
||||
m_fn->add_operation(Gcalc_function::op_false, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -581,7 +581,8 @@ String *Item_func_json_quote::val_str(String *str)
|
||||
|
||||
void Item_func_json_unquote::fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_utf8_general_ci);
|
||||
collation.set(&my_charset_utf8_general_ci,
|
||||
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
|
||||
max_length= args[0]->max_length;
|
||||
maybe_null= 1;
|
||||
}
|
||||
@ -1011,6 +1012,8 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
|
||||
case JSON_VALUE_ARRAY:
|
||||
if (value->value_type != JSON_VALUE_ARRAY)
|
||||
{
|
||||
loc_js= *value;
|
||||
set_js= FALSE;
|
||||
while (json_scan_next(js) == 0 && js->state != JST_ARRAY_END)
|
||||
{
|
||||
int c_level, v_scalar;
|
||||
@ -1021,6 +1024,11 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
|
||||
if (!(v_scalar= json_value_scalar(js)))
|
||||
c_level= json_get_level(js);
|
||||
|
||||
if (set_js)
|
||||
*value= loc_js;
|
||||
else
|
||||
set_js= TRUE;
|
||||
|
||||
if (check_contains(js, value))
|
||||
{
|
||||
if (json_skip_level(js))
|
||||
@ -1452,7 +1460,8 @@ void Item_func_json_array::fix_length_and_dec()
|
||||
|
||||
if (arg_count == 0)
|
||||
{
|
||||
collation.set(&my_charset_utf8_general_ci);
|
||||
collation.set(&my_charset_utf8_general_ci,
|
||||
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
|
||||
tmp_val.set_charset(&my_charset_utf8_general_ci);
|
||||
max_length= 2;
|
||||
return;
|
||||
@ -2126,6 +2135,7 @@ longlong Item_func_json_length::val_int()
|
||||
json_engine_t je;
|
||||
uint length= 0;
|
||||
uint array_counters[JSON_DEPTH_LIMIT];
|
||||
int err;
|
||||
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0;
|
||||
@ -2167,7 +2177,7 @@ longlong Item_func_json_length::val_int()
|
||||
if (json_value_scalar(&je))
|
||||
return 1;
|
||||
|
||||
while (json_scan_next(&je) == 0 &&
|
||||
while (!(err= json_scan_next(&je)) &&
|
||||
je.state != JST_OBJ_END && je.state != JST_ARRAY_END)
|
||||
{
|
||||
switch (je.state)
|
||||
@ -2186,6 +2196,12 @@ longlong Item_func_json_length::val_int()
|
||||
};
|
||||
}
|
||||
|
||||
if (!err)
|
||||
{
|
||||
/* Parse to the end of the JSON just to check it's valid. */
|
||||
while (json_scan_next(&je) == 0) {}
|
||||
}
|
||||
|
||||
if (!je.s.error)
|
||||
return length;
|
||||
|
||||
|
@ -3593,7 +3593,7 @@ bool Item_func_group_concat::setup(THD *thd)
|
||||
syntax of this function). If there is no ORDER BY clause, we don't
|
||||
create this tree.
|
||||
*/
|
||||
init_tree(tree, (uint) MY_MIN(thd->variables.max_heap_table_size,
|
||||
init_tree(tree, (size_t)MY_MIN(thd->variables.max_heap_table_size,
|
||||
thd->variables.sortbuff_size/16), 0,
|
||||
tree_key_length,
|
||||
group_concat_key_cmp_with_order, NULL, (void*) this,
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
{
|
||||
nodebeg= (MY_XML_NODE*) pxml->ptr();
|
||||
nodeend= (MY_XML_NODE*) (pxml->ptr() + pxml->length());
|
||||
numnodes= nodeend - nodebeg;
|
||||
numnodes= (uint)(nodeend - nodebeg);
|
||||
}
|
||||
void prepare(String *nodeset)
|
||||
{
|
||||
@ -615,7 +615,7 @@ public:
|
||||
if ((node->parent == flt->num) &&
|
||||
(node->type == MY_XML_NODE_TEXT))
|
||||
{
|
||||
fake->set_value(node->beg, node->end - node->beg,
|
||||
fake->set_value(node->beg, (uint)(node->end - node->beg),
|
||||
collation.collation);
|
||||
if (args[1]->val_int())
|
||||
return 1;
|
||||
@ -817,7 +817,7 @@ String *Item_nodeset_func_predicate::val_nodeset(String *str)
|
||||
Item_func *comp_func= (Item_func*)args[1];
|
||||
uint pos= 0, size;
|
||||
prepare(str);
|
||||
size= fltend - fltbeg;
|
||||
size= (uint)(fltend - fltbeg);
|
||||
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
|
||||
{
|
||||
nodeset_func->context_cache.length(0);
|
||||
@ -836,7 +836,7 @@ String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset)
|
||||
Item_nodeset_func *nodeset_func= (Item_nodeset_func*) args[0];
|
||||
prepare(nodeset);
|
||||
MY_XPATH_FLT *flt;
|
||||
uint pos, size= fltend - fltbeg;
|
||||
uint pos, size= (uint)(fltend - fltbeg);
|
||||
for (pos= 0, flt= fltbeg; flt < fltend; flt++)
|
||||
{
|
||||
nodeset_func->context_cache.length(0);
|
||||
@ -995,7 +995,7 @@ static Item *create_comparator(MY_XPATH *xpath,
|
||||
else if (a->type() == Item::XPATH_NODESET &&
|
||||
b->type() == Item::XPATH_NODESET)
|
||||
{
|
||||
uint len= xpath->query.end - context->beg;
|
||||
uint len= (uint)(xpath->query.end - context->beg);
|
||||
set_if_smaller(len, 32);
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"XPATH error: "
|
||||
@ -1399,7 +1399,7 @@ MY_XPATH_FUNC *
|
||||
my_xpath_function(const char *beg, const char *end)
|
||||
{
|
||||
MY_XPATH_FUNC *k, *function_names;
|
||||
uint length= end-beg;
|
||||
uint length= (uint)(end-beg);
|
||||
switch (length)
|
||||
{
|
||||
case 1: return 0;
|
||||
@ -1961,7 +1961,7 @@ static int my_xpath_parse_PrimaryExpr_literal(MY_XPATH *xpath)
|
||||
return 0;
|
||||
xpath->item= new (xpath->thd->mem_root)
|
||||
Item_string(xpath->thd, xpath->prevtok.beg + 1,
|
||||
xpath->prevtok.end - xpath->prevtok.beg - 2,
|
||||
(uint)(xpath->prevtok.end - xpath->prevtok.beg - 2),
|
||||
xpath->cs);
|
||||
return 1;
|
||||
}
|
||||
@ -2499,13 +2499,13 @@ static int my_xpath_parse_Number(MY_XPATH *xpath)
|
||||
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_DOT))
|
||||
{
|
||||
xpath->item= new (thd->mem_root) Item_int(thd, xpath->prevtok.beg,
|
||||
xpath->prevtok.end - xpath->prevtok.beg);
|
||||
(uint)(xpath->prevtok.end - xpath->prevtok.beg));
|
||||
return 1;
|
||||
}
|
||||
my_xpath_parse_term(xpath, MY_XPATH_LEX_DIGITS);
|
||||
|
||||
xpath->item= new (thd->mem_root) Item_float(thd, beg,
|
||||
xpath->prevtok.end - beg);
|
||||
(uint)(xpath->prevtok.end - beg));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2632,7 +2632,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
|
||||
{
|
||||
xpath->item= NULL;
|
||||
DBUG_ASSERT(xpath->query.end > dollar_pos);
|
||||
uint len= xpath->query.end - dollar_pos;
|
||||
uint len= (uint)(xpath->query.end - dollar_pos);
|
||||
set_if_smaller(len, 32);
|
||||
my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.*s'",
|
||||
MYF(0), len, dollar_pos);
|
||||
@ -2660,7 +2660,7 @@ my_xpath_parse_NodeTest_QName(MY_XPATH *xpath)
|
||||
if (!my_xpath_parse_QName(xpath))
|
||||
return 0;
|
||||
DBUG_ASSERT(xpath->context);
|
||||
uint len= xpath->prevtok.end - xpath->prevtok.beg;
|
||||
uint len= (uint)(xpath->prevtok.end - xpath->prevtok.beg);
|
||||
xpath->context= nametestfunc(xpath, xpath->axis, xpath->context,
|
||||
xpath->prevtok.beg, len);
|
||||
return 1;
|
||||
@ -2759,7 +2759,7 @@ bool Item_xml_str_func::fix_fields(THD *thd, Item **ref)
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
uint clen= xpath.query.end - xpath.lasttok.beg;
|
||||
uint clen= (uint)(xpath.query.end - xpath.lasttok.beg);
|
||||
set_if_smaller(clen, 32);
|
||||
my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.*s'",
|
||||
MYF(0), clen, xpath.lasttok.beg);
|
||||
|
@ -1131,7 +1131,7 @@ int append_query_string(CHARSET_INFO *csinfo, String *to,
|
||||
|
||||
*ptr++= '\'';
|
||||
}
|
||||
to->length(orig_len + ptr - beg);
|
||||
to->length((uint32)(orig_len + ptr - beg));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -10036,7 +10036,7 @@ Execute_load_query_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
p= strmake(p, STRING_WITH_LEN(" INTO "));
|
||||
p= strmake(p, query+fn_pos_end, q_len-fn_pos_end);
|
||||
|
||||
error= Query_log_event::do_apply_event(rgi, buf, p-buf);
|
||||
error= Query_log_event::do_apply_event(rgi, buf, (uint32)(p-buf));
|
||||
|
||||
/* Forging file name for deletion in same buffer */
|
||||
*fname_end= 0;
|
||||
@ -10488,7 +10488,7 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
|
||||
if (static_cast<size_t>(m_rows_end - m_rows_cur) <= length)
|
||||
{
|
||||
size_t const block_size= 1024;
|
||||
ulong cur_size= m_rows_cur - m_rows_buf;
|
||||
size_t cur_size= m_rows_cur - m_rows_buf;
|
||||
DBUG_EXECUTE_IF("simulate_too_big_row_case1",
|
||||
cur_size= UINT_MAX32 - (block_size * 10);
|
||||
length= UINT_MAX32 - (block_size * 10););
|
||||
@ -10501,21 +10501,21 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
|
||||
DBUG_EXECUTE_IF("simulate_too_big_row_case4",
|
||||
cur_size= UINT_MAX32 - (block_size * 10);
|
||||
length= (block_size * 10) - block_size + 1;);
|
||||
ulong remaining_space= UINT_MAX32 - cur_size;
|
||||
size_t remaining_space= UINT_MAX32 - cur_size;
|
||||
/* Check that the new data fits within remaining space and we can add
|
||||
block_size without wrapping.
|
||||
*/
|
||||
if (length > remaining_space ||
|
||||
if (cur_size > UINT_MAX32 || length > remaining_space ||
|
||||
((length + block_size) > remaining_space))
|
||||
{
|
||||
sql_print_error("The row data is greater than 4GB, which is too big to "
|
||||
"write to the binary log.");
|
||||
DBUG_RETURN(ER_BINLOG_ROW_LOGGING_FAILED);
|
||||
}
|
||||
ulong const new_alloc=
|
||||
size_t const new_alloc=
|
||||
block_size * ((cur_size + length + block_size - 1) / block_size);
|
||||
|
||||
uchar* const new_buf= (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc,
|
||||
uchar* const new_buf= (uchar*)my_realloc((uchar*)m_rows_buf, new_alloc,
|
||||
MYF(MY_ALLOW_ZERO_PTR|MY_WME));
|
||||
if (unlikely(!new_buf))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
@ -11248,11 +11248,11 @@ bool Rows_log_event::write_compressed()
|
||||
uchar *m_rows_cur_tmp = m_rows_cur;
|
||||
bool ret = true;
|
||||
uint32 comlen, alloc_size;
|
||||
comlen= alloc_size= binlog_get_compress_len(m_rows_cur_tmp - m_rows_buf_tmp);
|
||||
comlen= alloc_size= binlog_get_compress_len((uint32)(m_rows_cur_tmp - m_rows_buf_tmp));
|
||||
m_rows_buf = (uchar *)my_safe_alloca(alloc_size);
|
||||
if(m_rows_buf &&
|
||||
!binlog_buf_compress((const char *)m_rows_buf_tmp, (char *)m_rows_buf,
|
||||
m_rows_cur_tmp - m_rows_buf_tmp, &comlen))
|
||||
(uint32)(m_rows_cur_tmp - m_rows_buf_tmp), &comlen))
|
||||
{
|
||||
m_rows_cur= comlen + m_rows_buf;
|
||||
ret= Log_event::write();
|
||||
@ -12488,7 +12488,7 @@ Rows_log_event::write_row(rpl_group_info *rgi,
|
||||
the size of the first row and use that value to initialize
|
||||
storage engine for bulk insertion */
|
||||
DBUG_ASSERT(!(m_curr_row > m_curr_row_end));
|
||||
ulong estimated_rows= 0;
|
||||
ha_rows estimated_rows= 0;
|
||||
if (m_curr_row < m_curr_row_end)
|
||||
estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row);
|
||||
else if (m_curr_row == m_curr_row_end)
|
||||
|
@ -8800,8 +8800,8 @@ static int mysql_init_variables(void)
|
||||
|
||||
/* Set directory paths */
|
||||
mysql_real_data_home_len=
|
||||
strmake_buf(mysql_real_data_home,
|
||||
get_relative_path(MYSQL_DATADIR)) - mysql_real_data_home;
|
||||
(uint)(strmake_buf(mysql_real_data_home,
|
||||
get_relative_path(MYSQL_DATADIR)) - mysql_real_data_home);
|
||||
/* Replication parameters */
|
||||
master_info_file= (char*) "master.info",
|
||||
relay_log_info_file= (char*) "relay-log.info";
|
||||
|
@ -499,9 +499,9 @@ int SEL_IMERGE::or_sel_tree(RANGE_OPT_PARAM *param, SEL_TREE *tree)
|
||||
if (trees_next == trees_end)
|
||||
{
|
||||
const int realloc_ratio= 2; /* Double size for next round */
|
||||
uint old_elements= (trees_end - trees);
|
||||
uint old_size= sizeof(SEL_TREE**) * old_elements;
|
||||
uint new_size= old_size * realloc_ratio;
|
||||
size_t old_elements= (trees_end - trees);
|
||||
size_t old_size= sizeof(SEL_TREE**) * old_elements;
|
||||
size_t new_size= old_size * realloc_ratio;
|
||||
SEL_TREE **new_trees;
|
||||
if (!(new_trees= (SEL_TREE**)alloc_root(param->mem_root, new_size)))
|
||||
return -1;
|
||||
@ -846,10 +846,10 @@ SEL_TREE::SEL_TREE(SEL_TREE *arg, bool without_merges,
|
||||
SEL_IMERGE::SEL_IMERGE(SEL_IMERGE *arg, uint cnt,
|
||||
RANGE_OPT_PARAM *param) : Sql_alloc()
|
||||
{
|
||||
uint elements= (arg->trees_end - arg->trees);
|
||||
size_t elements= (arg->trees_end - arg->trees);
|
||||
if (elements > PREALLOCED_TREES)
|
||||
{
|
||||
uint size= elements * sizeof (SEL_TREE **);
|
||||
size_t size= elements * sizeof (SEL_TREE **);
|
||||
if (!(trees= (SEL_TREE **)alloc_root(param->mem_root, size)))
|
||||
goto mem_err;
|
||||
}
|
||||
@ -951,7 +951,7 @@ int imerge_list_or_list(RANGE_OPT_PARAM *param,
|
||||
uint rc;
|
||||
bool is_last_check_pass= FALSE;
|
||||
SEL_IMERGE *imerge= im1->head();
|
||||
uint elems= imerge->trees_next-imerge->trees;
|
||||
uint elems= (uint)(imerge->trees_next-imerge->trees);
|
||||
MEM_ROOT *mem_root= current_thd->mem_root;
|
||||
|
||||
im1->empty();
|
||||
@ -1051,7 +1051,7 @@ int imerge_list_or_tree(RANGE_OPT_PARAM *param,
|
||||
SEL_TREE *or_tree= new (mem_root) SEL_TREE (tree, FALSE, param);
|
||||
if (or_tree)
|
||||
{
|
||||
uint elems= imerge->trees_next-imerge->trees;
|
||||
uint elems= (uint)(imerge->trees_next-imerge->trees);
|
||||
rc= imerge->or_sel_tree_with_checks(param, elems, or_tree,
|
||||
TRUE, &is_last_check_pass);
|
||||
if (!is_last_check_pass)
|
||||
@ -2897,7 +2897,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
|
||||
uint keynr;
|
||||
uint max_quick_key_parts= 0;
|
||||
MY_BITMAP *used_fields= &table->cond_set;
|
||||
double table_records= table->stat_records();
|
||||
double table_records= (double)table->stat_records();
|
||||
DBUG_ENTER("calculate_cond_selectivity_for_table");
|
||||
|
||||
table->cond_selectivity= 1.0;
|
||||
@ -3994,8 +3994,8 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
|
||||
store_length_array,
|
||||
range_par->min_key,
|
||||
range_par->max_key,
|
||||
tmp_min_key - range_par->min_key,
|
||||
tmp_max_key - range_par->max_key,
|
||||
(uint)(tmp_min_key - range_par->min_key),
|
||||
(uint)(tmp_max_key - range_par->max_key),
|
||||
flag,
|
||||
&ppar->part_iter);
|
||||
if (!res)
|
||||
@ -4659,7 +4659,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
|
||||
}
|
||||
}
|
||||
|
||||
uint n_child_scans= imerge->trees_next - imerge->trees;
|
||||
size_t n_child_scans= imerge->trees_next - imerge->trees;
|
||||
|
||||
if (!n_child_scans)
|
||||
DBUG_RETURN(NULL);
|
||||
@ -5203,7 +5203,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
|
||||
INDEX_SCAN_INFO **scan_ptr;
|
||||
INDEX_SCAN_INFO *cpk_scan= NULL;
|
||||
TABLE *table= param->table;
|
||||
uint n_index_scans= tree->index_scans_end - tree->index_scans;
|
||||
uint n_index_scans= (uint)(tree->index_scans_end - tree->index_scans);
|
||||
|
||||
if (!n_index_scans)
|
||||
return 1;
|
||||
@ -5846,7 +5846,7 @@ TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree,
|
||||
}
|
||||
}
|
||||
|
||||
count= tree->index_scans_end - tree->index_scans;
|
||||
count= (uint)(tree->index_scans_end - tree->index_scans);
|
||||
for (i= 0; i < count; i++)
|
||||
{
|
||||
index_scan= tree->index_scans[i];
|
||||
@ -6506,7 +6506,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
|
||||
intersect_scans_best););
|
||||
|
||||
*are_all_covering= intersect->is_covering;
|
||||
uint best_num= intersect_scans_best - intersect_scans;
|
||||
uint best_num= (uint)(intersect_scans_best - intersect_scans);
|
||||
ror_intersect_cpy(intersect, intersect_best);
|
||||
|
||||
/*
|
||||
@ -6688,7 +6688,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
|
||||
TRP_ROR_INTERSECT *trp;
|
||||
if (!(trp= new (param->mem_root) TRP_ROR_INTERSECT))
|
||||
DBUG_RETURN(trp);
|
||||
uint best_num= (ror_scan_mark - tree->ror_scans);
|
||||
uint best_num= (uint)(ror_scan_mark - tree->ror_scans);
|
||||
if (!(trp->first_scan= (ROR_SCAN_INFO**)alloc_root(param->mem_root,
|
||||
sizeof(ROR_SCAN_INFO*)*
|
||||
best_num)))
|
||||
@ -11476,7 +11476,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
uint count= ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer);
|
||||
uint count= ranges.elements - (uint)(cur_range - (QUICK_RANGE**) ranges.buffer);
|
||||
if (count == 0)
|
||||
{
|
||||
/* Ranges have already been used up before. None is left for read. */
|
||||
@ -11521,7 +11521,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
uint count= ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer);
|
||||
uint count= ranges.elements - (uint)(cur_range - (QUICK_RANGE**) ranges.buffer);
|
||||
if (count == 0)
|
||||
{
|
||||
/* Ranges have already been used up before. None is left for read. */
|
||||
@ -11975,7 +11975,7 @@ void QUICK_SELECT_I::add_key_and_length(String *key_names,
|
||||
bool *first)
|
||||
{
|
||||
char buf[64];
|
||||
uint length;
|
||||
size_t length;
|
||||
KEY *key_info= head->key_info + index;
|
||||
|
||||
if (*first)
|
||||
@ -12529,7 +12529,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
|
||||
{
|
||||
cur_group_prefix_len+= cur_part->store_length;
|
||||
++cur_group_key_parts;
|
||||
max_key_part= cur_part - cur_index_info->key_part + 1;
|
||||
max_key_part= (uint)(cur_part - cur_index_info->key_part) + 1;
|
||||
used_key_parts_map.set_bit(max_key_part);
|
||||
}
|
||||
else
|
||||
@ -13252,7 +13252,7 @@ get_field_keypart(KEY *index, Field *field)
|
||||
part < end; part++)
|
||||
{
|
||||
if (field->eq(part->field))
|
||||
return part - index->key_part + 1;
|
||||
return (uint)(part - index->key_part + 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -199,9 +199,9 @@ walk_right_n_up:
|
||||
{
|
||||
{
|
||||
RANGE_SEQ_ENTRY *cur= &seq->stack[seq->i];
|
||||
uint min_key_length= cur->min_key - seq->param->min_key;
|
||||
uint max_key_length= cur->max_key - seq->param->max_key;
|
||||
uint len= cur->min_key - cur[-1].min_key;
|
||||
size_t min_key_length= cur->min_key - seq->param->min_key;
|
||||
size_t max_key_length= cur->max_key - seq->param->max_key;
|
||||
size_t len= cur->min_key - cur[-1].min_key;
|
||||
if (!(min_key_length == max_key_length &&
|
||||
!memcmp(cur[-1].min_key, cur[-1].max_key, len) &&
|
||||
!key_tree->min_flag && !key_tree->max_flag))
|
||||
@ -238,7 +238,7 @@ walk_up_n_right:
|
||||
|
||||
/* Ok got a tuple */
|
||||
RANGE_SEQ_ENTRY *cur= &seq->stack[seq->i];
|
||||
uint min_key_length= cur->min_key - seq->param->min_key;
|
||||
uint min_key_length= (uint)(cur->min_key - seq->param->min_key);
|
||||
|
||||
range->ptr= (char*)(intptr)(key_tree->part);
|
||||
if (cur->min_key_flag & GEOM_FLAG)
|
||||
@ -256,13 +256,13 @@ walk_up_n_right:
|
||||
range->range_flag= cur->min_key_flag | cur->max_key_flag;
|
||||
|
||||
range->start_key.key= seq->param->min_key;
|
||||
range->start_key.length= cur->min_key - seq->param->min_key;
|
||||
range->start_key.length= (uint)(cur->min_key - seq->param->min_key);
|
||||
range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts);
|
||||
range->start_key.flag= (cur->min_key_flag & NEAR_MIN ? HA_READ_AFTER_KEY :
|
||||
HA_READ_KEY_EXACT);
|
||||
|
||||
range->end_key.key= seq->param->max_key;
|
||||
range->end_key.length= cur->max_key - seq->param->max_key;
|
||||
range->end_key.length= (uint)(cur->max_key - seq->param->max_key);
|
||||
range->end_key.flag= (cur->max_key_flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
|
||||
HA_READ_AFTER_KEY);
|
||||
range->end_key.keypart_map= make_prev_keypart_map(cur->max_key_parts);
|
||||
|
@ -768,12 +768,12 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
|
||||
key_part_map org_key_part_used= *key_part_used;
|
||||
if (eq_type || between || max_fl == less_fl)
|
||||
{
|
||||
uint length= (key_ptr-ref->key_buff)+part->store_length;
|
||||
uint length= (uint)(key_ptr-ref->key_buff)+part->store_length;
|
||||
if (ref->key_length < length)
|
||||
{
|
||||
/* Ultimately ref->key_length will contain the length of the search key */
|
||||
ref->key_length= length;
|
||||
ref->key_parts= (part - keyinfo->key_part) + 1;
|
||||
ref->key_parts= (uint)(part - keyinfo->key_part) + 1;
|
||||
}
|
||||
if (!*prefix_len && part+1 == field_part)
|
||||
*prefix_len= length;
|
||||
|
@ -848,7 +848,7 @@ bool check_func_dependency(JOIN *join,
|
||||
*/
|
||||
uint and_level=0;
|
||||
build_eq_mods_for_cond(join->thd, &dac, &last_eq_mod, &and_level, cond);
|
||||
if (!(dac.n_equality_mods= last_eq_mod - dac.equality_mods))
|
||||
if (!(dac.n_equality_mods= (uint)(last_eq_mod - dac.equality_mods)))
|
||||
return FALSE; /* No useful conditions */
|
||||
|
||||
List<Dep_module> bound_modules;
|
||||
@ -1061,7 +1061,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
|
||||
eq_mod < equality_mods + n_equality_mods;
|
||||
eq_mod++)
|
||||
{
|
||||
deps_recorder.expr_offset= eq_mod - equality_mods;
|
||||
deps_recorder.expr_offset= (uint)(eq_mod - equality_mods);
|
||||
deps_recorder.visited_other_tables= FALSE;
|
||||
eq_mod->unbound_args= 0;
|
||||
|
||||
@ -1079,7 +1079,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
|
||||
Dep_value_field* field_val;
|
||||
while ((field_val= it++))
|
||||
{
|
||||
uint offs= field_val->bitmap_offset + eq_mod - equality_mods;
|
||||
uint offs= (uint)(field_val->bitmap_offset + eq_mod - equality_mods);
|
||||
bitmap_set_bit(&expr_deps, offs);
|
||||
}
|
||||
}
|
||||
@ -1158,7 +1158,7 @@ void build_eq_mods_for_cond(THD *thd, Dep_analysis_context *ctx,
|
||||
if (cond->type() == Item_func::COND_ITEM)
|
||||
{
|
||||
List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
uint orig_offset= *eq_mod - ctx->equality_mods;
|
||||
size_t orig_offset= *eq_mod - ctx->equality_mods;
|
||||
|
||||
/* AND/OR */
|
||||
if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
|
||||
|
@ -256,7 +256,7 @@ sql_create_definition_file(const LEX_CSTRING *dir,
|
||||
File handler;
|
||||
IO_CACHE file;
|
||||
char path[FN_REFLEN+1]; // +1 to put temporary file name for sure
|
||||
int path_end;
|
||||
size_t path_end;
|
||||
File_option *param;
|
||||
DBUG_ENTER("sql_create_definition_file");
|
||||
DBUG_PRINT("enter", ("Dir: %s, file: %s, base %p",
|
||||
|
@ -1674,7 +1674,7 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
|
||||
bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr,
|
||||
char *end_token, bool is_subpart)
|
||||
{
|
||||
uint expr_len= end_token - start_token;
|
||||
size_t expr_len= end_token - start_token;
|
||||
char *func_string= (char*) thd->memdup(start_token, expr_len);
|
||||
|
||||
if (!func_string)
|
||||
|
@ -80,7 +80,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
|
||||
unsigned int null_mask= 1U;
|
||||
for ( ; (field= *p_field) ; p_field++)
|
||||
{
|
||||
if (bitmap_is_set(cols, p_field - table->field))
|
||||
if (bitmap_is_set(cols, (uint)(p_field - table->field)))
|
||||
{
|
||||
my_ptrdiff_t offset;
|
||||
if (field->is_null(rec_offset))
|
||||
@ -262,7 +262,7 @@ unpack_row(rpl_group_info *rgi,
|
||||
No need to bother about columns that does not exist: they have
|
||||
gotten default values when being emptied above.
|
||||
*/
|
||||
if (bitmap_is_set(cols, field_ptr - begin_ptr))
|
||||
if (bitmap_is_set(cols, (uint)(field_ptr - begin_ptr)))
|
||||
{
|
||||
if ((null_mask & 0xFF) == 0)
|
||||
{
|
||||
@ -434,7 +434,7 @@ unpack_row(rpl_group_info *rgi,
|
||||
if (master_reclength)
|
||||
{
|
||||
if (*field_ptr)
|
||||
*master_reclength = (*field_ptr)->ptr - table->record[0];
|
||||
*master_reclength = (ulong)((*field_ptr)->ptr - table->record[0]);
|
||||
else
|
||||
*master_reclength = table->s->reclength;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ unpack_row_old(rpl_group_info *rgi,
|
||||
{
|
||||
Field *const f= *field_ptr;
|
||||
|
||||
if (bitmap_is_set(cols, field_ptr - begin_ptr))
|
||||
if (bitmap_is_set(cols, (uint)(field_ptr - begin_ptr)))
|
||||
{
|
||||
f->move_field_offset(offset);
|
||||
ptr= f->unpack(f->ptr, ptr, row_buffer_end, 0);
|
||||
@ -149,14 +149,14 @@ unpack_row_old(rpl_group_info *rgi,
|
||||
}
|
||||
}
|
||||
else
|
||||
bitmap_clear_bit(rw_set, field_ptr - begin_ptr);
|
||||
bitmap_clear_bit(rw_set, (uint)(field_ptr - begin_ptr));
|
||||
}
|
||||
|
||||
*row_end = ptr;
|
||||
if (master_reclength)
|
||||
{
|
||||
if (*field_ptr)
|
||||
*master_reclength = (*field_ptr)->ptr - table->record[0];
|
||||
*master_reclength = (ulong)((*field_ptr)->ptr - table->record[0]);
|
||||
else
|
||||
*master_reclength = table->s->reclength;
|
||||
}
|
||||
|
@ -7675,8 +7675,11 @@ ER_SLAVE_SAME_ID
|
||||
ER_FLASHBACK_NOT_SUPPORTED
|
||||
eng "Flashback does not support %s %s"
|
||||
|
||||
# MARIAROCKS-TODO: Should we add RocksDB error messages here or use some other
|
||||
# solution?
|
||||
|
||||
|
||||
#
|
||||
# MyRocks error messages
|
||||
#
|
||||
ER_KEYS_OUT_OF_ORDER
|
||||
eng "Keys are out order during bulk load"
|
||||
|
||||
@ -7710,39 +7713,40 @@ ER_UNSUPPORTED_COLLATION
|
||||
ER_METADATA_INCONSISTENCY
|
||||
eng "Table '%s' does not exist, but metadata information exists inside MyRocks. This is a sign of data inconsistency. Please check if '%s.frm' exists, and try to restore it if it does not exist."
|
||||
|
||||
ER_CF_DIFFERENT
|
||||
eng "Column family ('%s') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag."
|
||||
|
||||
ER_RDB_TTL_DURATION_FORMAT
|
||||
eng "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer."
|
||||
|
||||
ER_RDB_STATUS_GENERAL
|
||||
eng "Status error %d received from RocksDB: %s"
|
||||
|
||||
ER_RDB_STATUS_MSG
|
||||
eng "%s, Status error %d received from RocksDB: %s"
|
||||
|
||||
ER_RDB_TTL_UNSUPPORTED
|
||||
eng "TTL support is currently disabled when table has a hidden PK."
|
||||
|
||||
ER_RDB_TTL_COL_FORMAT
|
||||
eng "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration."
|
||||
|
||||
ER_PER_INDEX_CF_DEPRECATED
|
||||
eng "The per-index column family option has been deprecated"
|
||||
|
||||
ER_KEY_CREATE_DURING_ALTER
|
||||
eng "MyRocks failed creating new key definitions during alter."
|
||||
|
||||
ER_SK_POPULATE_DURING_ALTER
|
||||
eng "MyRocks failed populating secondary key during alter."
|
||||
|
||||
ER_CF_DIFFERENT
|
||||
eng "Column family ('%s') flag (%d) is different from an existing flag (%d). Assign a new CF flag, or do not change existing CF flag."
|
||||
|
||||
ER_RDB_STATUS_GENERAL
|
||||
eng "Status error %d received from RocksDB: %s"
|
||||
|
||||
ER_RDB_STATUS_MSG
|
||||
eng "%s, Status error %d received from RocksDB: %s"
|
||||
# MyRocks messages end
|
||||
ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
|
||||
eng "Window functions can not be used as arguments to group functions."
|
||||
|
||||
ER_NET_OK_PACKET_TOO_LARGE
|
||||
eng "OK packet too large"
|
||||
|
||||
ER_RDB_TTL_UNSUPPORTED
|
||||
eng "TTL support is currently disabled when table has secondary indexes or hidden PK."
|
||||
|
||||
ER_RDB_TTL_COL_FORMAT
|
||||
eng "TTL column (%s) in MyRocks must be an unsigned non-null 64-bit integer, exist inside the table, and have an accompanying ttl duration."
|
||||
|
||||
ER_RDB_TTL_DURATION_FORMAT
|
||||
eng "TTL duration (%s) in MyRocks must be an unsigned non-null 64-bit integer."
|
||||
|
||||
ER_PER_INDEX_CF_DEPRECATED
|
||||
eng "The per-index column family option has been deprecated"
|
||||
|
||||
ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
|
||||
eng "Window functions can not be used as arguments to group functions."
|
||||
|
||||
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
||||
eng "Illegal parameter data types %s and %s for operation '%s'"
|
||||
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
|
@ -2565,7 +2565,7 @@ uint Gis_multi_polygon::init_from_opresult(String *bin,
|
||||
n_poly++;
|
||||
}
|
||||
bin->write_at_position(np_pos, n_poly);
|
||||
return opres - opres_orig;
|
||||
return (uint)(opres - opres_orig);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12398,7 +12398,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
|
||||
char *end= user + packet_length;
|
||||
/* Safe because there is always a trailing \0 at the end of the packet */
|
||||
char *passwd= strend(user) + 1;
|
||||
uint user_len= passwd - user - 1;
|
||||
uint user_len= (uint)(passwd - user - 1);
|
||||
char *db= passwd;
|
||||
char db_buff[SAFE_NAME_LEN + 1]; // buffer to store db in utf8
|
||||
char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
|
||||
|
@ -5479,7 +5479,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
|
||||
|
||||
if (field_ptr && *field_ptr)
|
||||
{
|
||||
*cached_field_index_ptr= field_ptr - table->field;
|
||||
*cached_field_index_ptr= (uint)(field_ptr - table->field);
|
||||
field= *field_ptr;
|
||||
}
|
||||
else
|
||||
|
@ -4286,7 +4286,7 @@ my_bool Query_cache::move_by_type(uchar **border,
|
||||
*pprev = block->pprev,
|
||||
*pnext = block->pnext,
|
||||
*new_block =(Query_cache_block *) *border;
|
||||
uint tablename_offset = block->table()->table() - block->table()->db();
|
||||
size_t tablename_offset = block->table()->table() - block->table()->db();
|
||||
char *data = (char*) block->data();
|
||||
uchar *key;
|
||||
size_t key_length;
|
||||
@ -4595,7 +4595,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path,
|
||||
filename= tablename + dirname_length(tablename + 2) + 2;
|
||||
/* Find start of databasename */
|
||||
for (dbname= filename - 2 ; dbname[-1] != FN_LIBCHAR ; dbname--) ;
|
||||
*db_length= (filename - dbname) - 1;
|
||||
*db_length= (uint32)(filename - dbname) - 1;
|
||||
DBUG_PRINT("qcache", ("table '%-.*s.%s'", *db_length, dbname, filename));
|
||||
|
||||
DBUG_RETURN((uint) (strmake(strmake(key, dbname,
|
||||
|
@ -990,7 +990,7 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
|
||||
been done yet.
|
||||
*/
|
||||
if (with_elem && sl->master_unit() == with_elem->spec)
|
||||
break;
|
||||
break;
|
||||
With_clause *with_clause=sl->get_with_clause();
|
||||
if (with_clause)
|
||||
{
|
||||
@ -1038,13 +1038,21 @@ bool TABLE_LIST::set_as_with_table(THD *thd, With_element *with_elem)
|
||||
}
|
||||
with= with_elem;
|
||||
if (!with_elem->is_referenced() || with_elem->is_recursive)
|
||||
{
|
||||
derived= with_elem->spec;
|
||||
if (derived->get_master() != select_lex &&
|
||||
!is_with_table_recursive_reference())
|
||||
{
|
||||
derived->move_as_slave(select_lex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(derived= with_elem->clone_parsed_spec(thd, this)))
|
||||
return true;
|
||||
derived->with_element= with_elem;
|
||||
}
|
||||
derived->first_select()->linkage= DERIVED_TABLE_TYPE;
|
||||
with_elem->inc_references();
|
||||
return false;
|
||||
}
|
||||
|
@ -1006,7 +1006,7 @@ update_binlog:
|
||||
These DDL methods and logging are protected with the exclusive
|
||||
metadata lock on the schema.
|
||||
*/
|
||||
if (write_to_binlog(thd, query, query_pos -1 - query, db, db_len))
|
||||
if (write_to_binlog(thd, query, (uint)(query_pos -1 - query), db, db_len))
|
||||
{
|
||||
error= true;
|
||||
goto exit;
|
||||
@ -1024,7 +1024,7 @@ update_binlog:
|
||||
These DDL methods and logging are protected with the exclusive
|
||||
metadata lock on the schema.
|
||||
*/
|
||||
if (write_to_binlog(thd, query, query_pos -1 - query, db, db_len))
|
||||
if (write_to_binlog(thd, query, (uint)(query_pos -1 - query), db, db_len))
|
||||
{
|
||||
error= true;
|
||||
goto exit;
|
||||
|
@ -406,7 +406,7 @@ void JOIN_CACHE::create_flag_fields()
|
||||
}
|
||||
|
||||
/* Theoretically the new value of flag_fields can be less than the old one */
|
||||
flag_fields= copy-field_descr;
|
||||
flag_fields= (uint)(copy-field_descr);
|
||||
}
|
||||
|
||||
|
||||
@ -1374,7 +1374,7 @@ uint JOIN_CACHE::write_record_data(uchar * link, bool *is_full)
|
||||
}
|
||||
/* Save the offset of the field to put it later at the end of the record */
|
||||
if (copy->referenced_field_no)
|
||||
copy->offset= cp-curr_rec_pos;
|
||||
copy->offset= (uint)(cp-curr_rec_pos);
|
||||
|
||||
switch (copy->type) {
|
||||
case CACHE_BLOB:
|
||||
@ -1778,7 +1778,7 @@ uint JOIN_CACHE::read_flag_fields()
|
||||
memcpy(copy->str, pos, copy->length);
|
||||
pos+= copy->length;
|
||||
}
|
||||
return (pos-init_pos);
|
||||
return (uint)(pos-init_pos);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2392,6 +2392,30 @@ st_select_lex_node *st_select_lex_node:: insert_chain_before(
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Detach the node from its master and attach it to a new master
|
||||
*/
|
||||
|
||||
void st_select_lex_node::move_as_slave(st_select_lex_node *new_master)
|
||||
{
|
||||
exclude_from_tree();
|
||||
if (new_master->slave)
|
||||
{
|
||||
st_select_lex_node *curr= new_master->slave;
|
||||
for ( ; curr->next ; curr= curr->next) ;
|
||||
prev= &curr->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev= &new_master->slave;
|
||||
new_master->slave= this;
|
||||
}
|
||||
next= 0;
|
||||
master= new_master;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Exclude a node from the tree lex structure, but leave it in the global
|
||||
list of nodes.
|
||||
@ -4521,7 +4545,8 @@ void st_select_lex::set_explain_type(bool on_the_fly)
|
||||
pos_in_table_list=NULL for e.g. post-join aggregation JOIN_TABs.
|
||||
*/
|
||||
if (tab->table && tab->table->pos_in_table_list &&
|
||||
tab->table->pos_in_table_list->with)
|
||||
tab->table->pos_in_table_list->with &&
|
||||
tab->table->pos_in_table_list->with->is_recursive)
|
||||
{
|
||||
uses_cte= true;
|
||||
break;
|
||||
|
@ -631,6 +631,7 @@ public:
|
||||
}
|
||||
st_select_lex_node *insert_chain_before(st_select_lex_node **ptr_pos_to_insert,
|
||||
st_select_lex_node *end_chain_node);
|
||||
void move_as_slave(st_select_lex_node *new_master);
|
||||
friend class st_select_lex_unit;
|
||||
friend bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel);
|
||||
friend bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
|
||||
|
@ -5245,7 +5245,6 @@ end_with_restore_list:
|
||||
if (res)
|
||||
break;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
switch (lex->sql_command) {
|
||||
case SQLCOM_CREATE_EVENT:
|
||||
{
|
||||
@ -5279,7 +5278,6 @@ end_with_restore_list:
|
||||
&lex->spname->m_name);
|
||||
break;
|
||||
case SQLCOM_DROP_EVENT:
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
if (!(res= Events::drop_event(thd,
|
||||
&lex->spname->m_db, &lex->spname->m_name,
|
||||
lex->if_exists())))
|
||||
@ -6019,7 +6017,6 @@ end_with_restore_list:
|
||||
Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands
|
||||
as specified through the thd->lex->create_view->mode flag.
|
||||
*/
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
res= mysql_create_view(thd, first_table, thd->lex->create_view->mode);
|
||||
break;
|
||||
}
|
||||
@ -6035,7 +6032,6 @@ end_with_restore_list:
|
||||
case SQLCOM_CREATE_TRIGGER:
|
||||
{
|
||||
/* Conditionally writes to binlog. */
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
res= mysql_create_or_drop_trigger(thd, all_tables, 1);
|
||||
|
||||
break;
|
||||
@ -6043,7 +6039,6 @@ end_with_restore_list:
|
||||
case SQLCOM_DROP_TRIGGER:
|
||||
{
|
||||
/* Conditionally writes to binlog. */
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
res= mysql_create_or_drop_trigger(thd, all_tables, 0);
|
||||
break;
|
||||
}
|
||||
@ -6108,13 +6103,11 @@ end_with_restore_list:
|
||||
my_ok(thd);
|
||||
break;
|
||||
case SQLCOM_INSTALL_PLUGIN:
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
if (! (res= mysql_install_plugin(thd, &thd->lex->comment,
|
||||
&thd->lex->ident)))
|
||||
my_ok(thd);
|
||||
break;
|
||||
case SQLCOM_UNINSTALL_PLUGIN:
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment,
|
||||
&thd->lex->ident)))
|
||||
my_ok(thd);
|
||||
|
@ -2128,12 +2128,16 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
bool error;
|
||||
int argc=orig_argc;
|
||||
char **argv=orig_argv;
|
||||
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
|
||||
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
|
||||
DBUG_ENTER("mysql_install_plugin");
|
||||
|
||||
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
|
||||
if (!opt_noacl && check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
/* need to open before acquiring LOCK_plugin or it will deadlock */
|
||||
if (! (table = open_ltable(thd, &tables, TL_WRITE,
|
||||
MYSQL_LOCK_IGNORE_TIMEOUT)))
|
||||
@ -2166,8 +2170,6 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
|
||||
See also mysql_uninstall_plugin() and initialize_audit_plugin()
|
||||
*/
|
||||
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
|
||||
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
|
||||
if (mysql_audit_general_enabled())
|
||||
mysql_audit_acquire_plugins(thd, event_class_mask);
|
||||
|
||||
@ -2199,6 +2201,10 @@ err:
|
||||
if (argv)
|
||||
free_defaults(argv);
|
||||
DBUG_RETURN(error);
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
|
||||
@ -2265,6 +2271,8 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
TABLE_LIST tables;
|
||||
LEX_CSTRING dl= *dl_arg;
|
||||
bool error= false;
|
||||
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
|
||||
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
|
||||
DBUG_ENTER("mysql_uninstall_plugin");
|
||||
|
||||
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
|
||||
@ -2272,6 +2280,8 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
if (!opt_noacl && check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
/* need to open before acquiring LOCK_plugin or it will deadlock */
|
||||
if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -2297,8 +2307,6 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
|
||||
See also mysql_install_plugin() and initialize_audit_plugin()
|
||||
*/
|
||||
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
|
||||
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
|
||||
if (mysql_audit_general_enabled())
|
||||
mysql_audit_acquire_plugins(thd, event_class_mask);
|
||||
|
||||
@ -2329,6 +2337,10 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
|
||||
|
||||
mysql_mutex_unlock(&LOCK_plugin);
|
||||
DBUG_RETURN(error);
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
|
||||
|
@ -2680,7 +2680,7 @@ static int send_events(binlog_send_info *info, IO_CACHE* log, LOG_INFO* linfo,
|
||||
Gtid_list_log_event glev(&info->until_binlog_state, 0);
|
||||
|
||||
if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg) ||
|
||||
fake_gtid_list_event(info, &glev, &info->errmsg, my_b_tell(log)))
|
||||
fake_gtid_list_event(info, &glev, &info->errmsg, (uint32)my_b_tell(log)))
|
||||
{
|
||||
info->error= ER_UNKNOWN_ERROR;
|
||||
return 1;
|
||||
@ -2690,7 +2690,7 @@ static int send_events(binlog_send_info *info, IO_CACHE* log, LOG_INFO* linfo,
|
||||
|
||||
if (info->until_gtid_state &&
|
||||
is_until_reached(info, &ev_offset, event_type, &info->errmsg,
|
||||
my_b_tell(log)))
|
||||
(uint32)my_b_tell(log)))
|
||||
{
|
||||
if (info->errmsg)
|
||||
{
|
||||
@ -2745,7 +2745,7 @@ static int send_one_binlog_file(binlog_send_info *info,
|
||||
if (end_pos <= 1)
|
||||
{
|
||||
/** end of file or error */
|
||||
return end_pos;
|
||||
return (int)end_pos;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6142,7 +6142,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
|
||||
{
|
||||
TABLE *table= s->table;
|
||||
double sel= table->cond_selectivity;
|
||||
double table_records= table->stat_records();
|
||||
double table_records= (double)table->stat_records();
|
||||
dbl_records= table_records * sel;
|
||||
return dbl_records;
|
||||
}
|
||||
@ -6168,7 +6168,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
|
||||
if (s->table->quick_condition_rows != s->found_records)
|
||||
records= s->table->quick_condition_rows;
|
||||
|
||||
dbl_records= records;
|
||||
dbl_records= (double)records;
|
||||
return dbl_records;
|
||||
}
|
||||
|
||||
@ -6859,7 +6859,7 @@ static void choose_initial_table_order(JOIN *join)
|
||||
if ((emb_subq= get_emb_subq(*tab)))
|
||||
break;
|
||||
}
|
||||
uint n_subquery_tabs= tabs_end - tab;
|
||||
uint n_subquery_tabs= (uint)(tabs_end - tab);
|
||||
|
||||
if (!n_subquery_tabs)
|
||||
DBUG_VOID_RETURN;
|
||||
@ -6887,7 +6887,7 @@ static void choose_initial_table_order(JOIN *join)
|
||||
last_tab_for_subq < subq_tabs_end &&
|
||||
get_emb_subq(*last_tab_for_subq) == cur_subq_nest;
|
||||
last_tab_for_subq++) {}
|
||||
uint n_subquery_tables= last_tab_for_subq - subq_tab;
|
||||
uint n_subquery_tables= (uint)(last_tab_for_subq - subq_tab);
|
||||
|
||||
/*
|
||||
Walk the original array and find where this subquery would have been
|
||||
@ -6905,7 +6905,7 @@ static void choose_initial_table_order(JOIN *join)
|
||||
if (!need_tables)
|
||||
{
|
||||
/* Move away the top-level tables that are after top_level_tab */
|
||||
uint top_tail_len= last_top_level_tab - top_level_tab - 1;
|
||||
size_t top_tail_len= last_top_level_tab - top_level_tab - 1;
|
||||
memmove(top_level_tab + 1 + n_subquery_tables, top_level_tab + 1,
|
||||
sizeof(JOIN_TAB*)*top_tail_len);
|
||||
last_top_level_tab += n_subquery_tables;
|
||||
@ -7651,7 +7651,7 @@ double JOIN::get_examined_rows()
|
||||
JOIN_TAB *tab= first_breadth_first_tab();
|
||||
JOIN_TAB *prev_tab= tab;
|
||||
|
||||
examined_rows= tab->get_examined_rows();
|
||||
examined_rows= (double)tab->get_examined_rows();
|
||||
|
||||
while ((tab= next_breadth_first_tab(first_breadth_first_tab(),
|
||||
top_join_tab_count, tab)))
|
||||
@ -7949,7 +7949,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
|
||||
}
|
||||
if (keyparts > 1)
|
||||
{
|
||||
ref_keyuse_steps[keyparts-2]= keyuse - prev_ref_keyuse;
|
||||
ref_keyuse_steps[keyparts-2]= (uint16)(keyuse - prev_ref_keyuse);
|
||||
prev_ref_keyuse= keyuse;
|
||||
}
|
||||
}
|
||||
@ -9311,8 +9311,8 @@ bool JOIN::get_best_combination()
|
||||
j= j->bush_root_tab;
|
||||
}
|
||||
|
||||
top_join_tab_count= join_tab_ranges.head()->end -
|
||||
join_tab_ranges.head()->start;
|
||||
top_join_tab_count= (uint)(join_tab_ranges.head()->end -
|
||||
join_tab_ranges.head()->start);
|
||||
|
||||
update_depend_map(this);
|
||||
DBUG_RETURN(0);
|
||||
@ -10888,7 +10888,7 @@ static uint make_join_orderinfo(JOIN *join)
|
||||
if (join->need_tmp)
|
||||
return join->table_count;
|
||||
tab= join->get_sort_by_join_tab();
|
||||
return tab ? tab-join->join_tab : join->table_count;
|
||||
return tab ? (uint)(tab-join->join_tab) : join->table_count;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -11905,8 +11905,8 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
str.append(" final_pushdown_cond");
|
||||
print_where(tab->select_cond, str.c_ptr_safe(), QT_ORDINARY););
|
||||
}
|
||||
uint n_top_tables= join->join_tab_ranges.head()->end -
|
||||
join->join_tab_ranges.head()->start;
|
||||
uint n_top_tables= (uint)(join->join_tab_ranges.head()->end -
|
||||
join->join_tab_ranges.head()->start);
|
||||
|
||||
join->join_tab[n_top_tables - 1].next_select=0; /* Set by do_select */
|
||||
|
||||
@ -12130,7 +12130,7 @@ ha_rows JOIN_TAB::get_examined_rows()
|
||||
SQL_SELECT *sel= filesort? filesort->select : this->select;
|
||||
|
||||
if (sel && sel->quick && use_quick != 2)
|
||||
examined_rows= sel->quick->records;
|
||||
examined_rows= (double)sel->quick->records;
|
||||
else if (type == JT_NEXT || type == JT_ALL ||
|
||||
type == JT_HASH || type ==JT_HASH_NEXT)
|
||||
{
|
||||
@ -12140,19 +12140,19 @@ ha_rows JOIN_TAB::get_examined_rows()
|
||||
@todo This estimate is wrong, a LIMIT query may examine much more rows
|
||||
than the LIMIT itself.
|
||||
*/
|
||||
examined_rows= limit;
|
||||
examined_rows= (double)limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (table->is_filled_at_execution())
|
||||
examined_rows= records;
|
||||
examined_rows= (double)records;
|
||||
else
|
||||
{
|
||||
/*
|
||||
handler->info(HA_STATUS_VARIABLE) has been called in
|
||||
make_join_statistics()
|
||||
*/
|
||||
examined_rows= table->stat_records();
|
||||
examined_rows= (double)table->stat_records();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13981,7 +13981,7 @@ static int compare_fields_by_table_order(Item *field1,
|
||||
tab2= tab2->bush_root_tab;
|
||||
}
|
||||
|
||||
cmp= tab1 - tab2;
|
||||
cmp= (int)(tab1 - tab2);
|
||||
|
||||
if (!cmp)
|
||||
{
|
||||
@ -17145,7 +17145,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
||||
share->default_values= table->record[1]+alloc_length;
|
||||
}
|
||||
copy_func[0]=0; // End marker
|
||||
param->func_count= copy_func - param->items_to_copy;
|
||||
param->func_count= (uint)(copy_func - param->items_to_copy);
|
||||
|
||||
setup_tmp_table_column_bitmaps(table, bitmaps);
|
||||
|
||||
@ -17829,7 +17829,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
|
||||
Emulate behaviour by making column not-nullable when creating the
|
||||
table.
|
||||
*/
|
||||
uint cols= (*recinfo-start_recinfo);
|
||||
uint cols= (uint)(*recinfo-start_recinfo);
|
||||
start_recinfo[cols-1].null_bit= 0;
|
||||
}
|
||||
}
|
||||
@ -21047,7 +21047,7 @@ static int test_if_order_by_key(JOIN *join,
|
||||
(1) this is an extended key
|
||||
(2) we've reached its end
|
||||
*/
|
||||
key_parts= (key_part - table->key_info[idx].key_part);
|
||||
key_parts= (uint)(key_part - table->key_info[idx].key_part);
|
||||
if (have_pk_suffix &&
|
||||
reverse == 0 && // all were =const so far
|
||||
key_parts == table->key_info[idx].ext_key_parts &&
|
||||
@ -24688,7 +24688,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
|
||||
}
|
||||
else
|
||||
{
|
||||
double examined_rows= get_examined_rows();
|
||||
double examined_rows= (double)get_examined_rows();
|
||||
|
||||
eta->rows_set= true;
|
||||
eta->rows= (ha_rows) examined_rows;
|
||||
@ -26073,8 +26073,8 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
|
||||
Start from quick select's rows and cost. These are always cheaper than
|
||||
full index scan/cost.
|
||||
*/
|
||||
double best_rows= table->quick_rows[keynr];
|
||||
double best_cost= table->quick_costs[keynr];
|
||||
double best_rows= (double)table->quick_rows[keynr];
|
||||
double best_cost= (double)table->quick_costs[keynr];
|
||||
|
||||
/*
|
||||
Check if ref(const) access was possible on this index.
|
||||
@ -26108,7 +26108,7 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
|
||||
|
||||
if (ref_rows > 0)
|
||||
{
|
||||
double tmp= ref_rows;
|
||||
double tmp= (double)ref_rows;
|
||||
/* Reuse the cost formula from best_access_path: */
|
||||
set_if_smaller(tmp, (double) tab->join->thd->variables.max_seeks_for_key);
|
||||
if (table->covering_keys.is_set(keynr))
|
||||
@ -26119,7 +26119,7 @@ static bool get_range_limit_read_cost(const JOIN_TAB *tab,
|
||||
if (tmp < best_cost)
|
||||
{
|
||||
best_cost= tmp;
|
||||
best_rows= ref_rows;
|
||||
best_rows= (double)ref_rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26232,7 +26232,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
|
||||
|
||||
if (join)
|
||||
{
|
||||
uint tablenr= tab - join->join_tab;
|
||||
uint tablenr= (uint)(tab - join->join_tab);
|
||||
read_time= join->best_positions[tablenr].read_time;
|
||||
for (uint i= tablenr+1; i < join->table_count; i++)
|
||||
fanout*= join->best_positions[i].records_read; // fanout is always >= 1
|
||||
|
@ -3460,7 +3460,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
prefix_end=strnmov(name_buffer, prefix, sizeof(name_buffer)-1);
|
||||
if (*prefix)
|
||||
*prefix_end++= '_';
|
||||
len=name_buffer + sizeof(name_buffer) - prefix_end;
|
||||
len=(int)(name_buffer + sizeof(name_buffer) - prefix_end);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
bool is_wsrep_var= FALSE;
|
||||
@ -3803,6 +3803,15 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (item->type() == Item::ROW_ITEM)
|
||||
{
|
||||
Item_row *item_row= static_cast<Item_row*>(item);
|
||||
for (uint i= 0; i < item_row->cols(); i++)
|
||||
{
|
||||
if (!uses_only_table_name_fields(item_row->element_index(i), table))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (item->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
Item_field *item_field= (Item_field*)item;
|
||||
@ -3822,6 +3831,11 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
|
||||
item_field->field_name.length)))
|
||||
return 0;
|
||||
}
|
||||
else if (item->type() == Item::EXPR_CACHE_ITEM)
|
||||
{
|
||||
Item_cache_wrapper *tmp= static_cast<Item_cache_wrapper*>(item);
|
||||
return uses_only_table_name_fields(tmp->get_orig_item(), table);
|
||||
}
|
||||
else if (item->type() == Item::REF_ITEM)
|
||||
return uses_only_table_name_fields(item->real_item(), table);
|
||||
|
||||
@ -5435,7 +5449,7 @@ static void store_column_type(TABLE *table, Field *field, CHARSET_INFO *cs,
|
||||
*/
|
||||
tmp_buff= strchr(column_type.c_ptr_safe(), ' ');
|
||||
table->field[offset]->store(column_type.ptr(),
|
||||
(tmp_buff ? tmp_buff - column_type.ptr() :
|
||||
(tmp_buff ? (uint)(tmp_buff - column_type.ptr()) :
|
||||
column_type.length()), cs);
|
||||
|
||||
is_blob= (field->type() == MYSQL_TYPE_BLOB);
|
||||
@ -6405,7 +6419,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
|
||||
table->field[5]->store(STRING_WITH_LEN("NO"), cs);
|
||||
}
|
||||
|
||||
definer_len= (strxmov(definer, tables->definer.user.str, "@",
|
||||
definer_len= (uint)(strxmov(definer, tables->definer.user.str, "@",
|
||||
tables->definer.host.str, NullS) - definer);
|
||||
table->field[6]->store(definer, definer_len, cs);
|
||||
if (tables->view_suid)
|
||||
|
@ -843,7 +843,7 @@ public:
|
||||
else
|
||||
{
|
||||
stat_field->set_notnull();
|
||||
stat_field->store(table->collected_stats->cardinality);
|
||||
stat_field->store(table->collected_stats->cardinality,true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1054,7 +1054,7 @@ public:
|
||||
switch (i) {
|
||||
case COLUMN_STAT_MIN_VALUE:
|
||||
if (table_field->type() == MYSQL_TYPE_BIT)
|
||||
stat_field->store(table_field->collected_stats->min_value->val_int());
|
||||
stat_field->store(table_field->collected_stats->min_value->val_int(),true);
|
||||
else
|
||||
{
|
||||
table_field->collected_stats->min_value->val_str(&val);
|
||||
@ -1063,7 +1063,7 @@ public:
|
||||
break;
|
||||
case COLUMN_STAT_MAX_VALUE:
|
||||
if (table_field->type() == MYSQL_TYPE_BIT)
|
||||
stat_field->store(table_field->collected_stats->max_value->val_int());
|
||||
stat_field->store(table_field->collected_stats->max_value->val_int(),true);
|
||||
else
|
||||
{
|
||||
table_field->collected_stats->max_value->val_str(&val);
|
||||
@ -1630,7 +1630,7 @@ public:
|
||||
of the parameters to be passed to the constructor of the Unique object.
|
||||
*/
|
||||
|
||||
Count_distinct_field(Field *field, uint max_heap_table_size)
|
||||
Count_distinct_field(Field *field, size_t max_heap_table_size)
|
||||
{
|
||||
table_field= field;
|
||||
tree_key_length= field->pack_length();
|
||||
@ -1728,7 +1728,7 @@ class Count_distinct_field_bit: public Count_distinct_field
|
||||
{
|
||||
public:
|
||||
|
||||
Count_distinct_field_bit(Field *field, uint max_heap_table_size)
|
||||
Count_distinct_field_bit(Field *field, size_t max_heap_table_size)
|
||||
{
|
||||
table_field= field;
|
||||
tree_key_length= sizeof(ulonglong);
|
||||
@ -1824,7 +1824,7 @@ public:
|
||||
if ((calc_state=
|
||||
(Prefix_calc_state *) thd->alloc(sizeof(Prefix_calc_state)*key_parts)))
|
||||
{
|
||||
uint keyno= key_info-table->key_info;
|
||||
uint keyno= (uint)(key_info-table->key_info);
|
||||
for (i= 0, state= calc_state; i < key_parts; i++, state++)
|
||||
{
|
||||
/*
|
||||
@ -2438,7 +2438,7 @@ int alloc_histograms_for_table_share(THD* thd, TABLE_SHARE *table_share,
|
||||
inline
|
||||
void Column_statistics_collected::init(THD *thd, Field *table_field)
|
||||
{
|
||||
uint max_heap_table_size= thd->variables.max_heap_table_size;
|
||||
size_t max_heap_table_size= (size_t)thd->variables.max_heap_table_size;
|
||||
TABLE *table= table_field->table;
|
||||
uint pk= table->s->primary_key;
|
||||
|
||||
@ -3719,14 +3719,14 @@ double get_column_avg_frequency(Field * field)
|
||||
*/
|
||||
if (!table->s->field)
|
||||
{
|
||||
res= table->stat_records();
|
||||
res= (double)table->stat_records();
|
||||
return res;
|
||||
}
|
||||
|
||||
Column_statistics *col_stats= field->read_stats;
|
||||
|
||||
if (!col_stats)
|
||||
res= table->stat_records();
|
||||
res= (double)table->stat_records();
|
||||
else
|
||||
res= col_stats->get_avg_frequency();
|
||||
return res;
|
||||
@ -3765,7 +3765,7 @@ double get_column_range_cardinality(Field *field,
|
||||
double res;
|
||||
TABLE *table= field->table;
|
||||
Column_statistics *col_stats= field->read_stats;
|
||||
double tab_records= table->stat_records();
|
||||
double tab_records= (double)table->stat_records();
|
||||
|
||||
if (!col_stats)
|
||||
return tab_records;
|
||||
|
@ -230,7 +230,7 @@ uint explain_filename(THD* thd,
|
||||
{
|
||||
db_name= table_name;
|
||||
/* calculate the length */
|
||||
db_name_len= tmp_p - db_name;
|
||||
db_name_len= (int)(tmp_p - db_name);
|
||||
tmp_p++;
|
||||
table_name= tmp_p;
|
||||
}
|
||||
@ -252,7 +252,7 @@ uint explain_filename(THD* thd,
|
||||
case 's':
|
||||
if ((tmp_p[1] == 'P' || tmp_p[1] == 'p') && tmp_p[2] == '#')
|
||||
{
|
||||
part_name_len= tmp_p - part_name - 1;
|
||||
part_name_len= (int)(tmp_p - part_name - 1);
|
||||
subpart_name= tmp_p + 3;
|
||||
tmp_p+= 3;
|
||||
}
|
||||
@ -284,7 +284,7 @@ uint explain_filename(THD* thd,
|
||||
}
|
||||
if (part_name)
|
||||
{
|
||||
table_name_len= part_name - table_name - 3;
|
||||
table_name_len= (int)(part_name - table_name - 3);
|
||||
if (subpart_name)
|
||||
subpart_name_len= strlen(subpart_name);
|
||||
else
|
||||
@ -357,7 +357,7 @@ uint explain_filename(THD* thd,
|
||||
to_p= strnmov(to_p, " */", end_p - to_p);
|
||||
}
|
||||
DBUG_PRINT("exit", ("to '%s'", to));
|
||||
DBUG_RETURN(to_p - to);
|
||||
DBUG_RETURN((uint)(to_p - to));
|
||||
}
|
||||
|
||||
|
||||
@ -553,7 +553,7 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
|
||||
pos= strxnmov(pos, end - pos, tbbuff, ext, NullS);
|
||||
|
||||
DBUG_PRINT("exit", ("buff: '%s'", buff));
|
||||
DBUG_RETURN(pos - buff);
|
||||
DBUG_RETURN((uint)(pos - buff));
|
||||
}
|
||||
|
||||
|
||||
@ -2134,7 +2134,7 @@ static uint32 comment_length(THD *thd, uint32 comment_pos,
|
||||
for (query+= 3; query < query_end; query++)
|
||||
{
|
||||
if (query[-1] == '*' && query[0] == '/')
|
||||
return (char*) query - *comment_start + 1;
|
||||
return (uint32)((char*) query - *comment_start + 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2724,7 +2724,7 @@ bool quick_rm_table(THD *thd, handlerton *base, const char *db,
|
||||
bool error= 0;
|
||||
DBUG_ENTER("quick_rm_table");
|
||||
|
||||
uint path_length= table_path ?
|
||||
size_t path_length= table_path ?
|
||||
(strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) :
|
||||
build_table_filename(path, sizeof(path)-1, db, table_name, reg_ext, flags);
|
||||
if (mysql_file_delete(key_file_frm, path, MYF(0)))
|
||||
@ -6550,7 +6550,7 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
table_key;
|
||||
ha_alter_info->index_add_buffer
|
||||
[ha_alter_info->index_add_count++]=
|
||||
new_key - ha_alter_info->key_info_buffer;
|
||||
(uint)(new_key - ha_alter_info->key_info_buffer);
|
||||
/* Mark all old fields which are used in newly created index. */
|
||||
DBUG_PRINT("info", ("index changed: '%s'", table_key->name));
|
||||
}
|
||||
@ -6574,7 +6574,7 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
/* Key not found. Add the offset of the key to the add buffer. */
|
||||
ha_alter_info->index_add_buffer
|
||||
[ha_alter_info->index_add_count++]=
|
||||
new_key - ha_alter_info->key_info_buffer;
|
||||
(uint)(new_key - ha_alter_info->key_info_buffer);
|
||||
DBUG_PRINT("info", ("index added: '%s'", new_key->name));
|
||||
}
|
||||
else
|
||||
|
@ -172,7 +172,7 @@ TEST_join(JOIN *join)
|
||||
in order not to garble the tabular output below.
|
||||
*/
|
||||
String ref_key_parts[MAX_TABLES];
|
||||
int tables_in_range= jt_range->end - jt_range->start;
|
||||
int tables_in_range= (int)(jt_range->end - jt_range->start);
|
||||
for (i= 0; i < tables_in_range; i++)
|
||||
{
|
||||
JOIN_TAB *tab= jt_range->start + i;
|
||||
|
@ -274,7 +274,7 @@ to_ascii(CHARSET_INFO *cs,
|
||||
*dst++= static_cast<char>(wc);
|
||||
}
|
||||
*dst= '\0';
|
||||
return dst - dst0;
|
||||
return (uint)(dst - dst0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -453,6 +453,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
||||
my_error(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
if (!create)
|
||||
{
|
||||
@ -616,6 +617,10 @@ end:
|
||||
my_ok(thd);
|
||||
|
||||
DBUG_RETURN(result);
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(true);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ bool compare_record(const TABLE *table)
|
||||
{
|
||||
if (field->real_maybe_null())
|
||||
{
|
||||
uchar null_byte_index= field->null_ptr - table->record[0];
|
||||
uchar null_byte_index= (uchar)(field->null_ptr - table->record[0]);
|
||||
|
||||
if (((table->record[0][null_byte_index]) & field->null_bit) !=
|
||||
((table->record[1][null_byte_index]) & field->null_bit))
|
||||
|
@ -430,6 +430,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
||||
lex->link_first_table_back(view, link_to_local);
|
||||
view->open_type= OT_BASE_ONLY;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||
|
||||
if (check_dependencies_in_with_clauses(lex->with_clauses_list))
|
||||
{
|
||||
res= TRUE;
|
||||
@ -708,6 +710,10 @@ err:
|
||||
lex->link_first_table_back(view, link_to_local);
|
||||
unit->cleanup();
|
||||
DBUG_RETURN(res || thd->is_error());
|
||||
#ifdef WITH_WSREP
|
||||
error:
|
||||
DBUG_RETURN(true);
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
|
||||
|
@ -392,8 +392,8 @@ LEX::create_item_for_sp_var(LEX_CSTRING *name, sp_variable *spvar,
|
||||
DBUG_ASSERT(spcont && spvar);
|
||||
|
||||
/* Position and length of the SP variable name in the query. */
|
||||
pos_in_q= start_in_q - sphead->m_tmp_query;
|
||||
len_in_q= end_in_q - start_in_q;
|
||||
pos_in_q= (uint)(start_in_q - sphead->m_tmp_query);
|
||||
len_in_q= (uint)(end_in_q - start_in_q);
|
||||
|
||||
item= new (thd->mem_root)
|
||||
Item_splocal(thd, name, spvar->offset, spvar->sql_type(),
|
||||
|
@ -339,7 +339,7 @@ int find_string_in_array(LEX_CSTRING * const haystack, LEX_CSTRING * const needl
|
||||
if (!cs->coll->strnncollsp(cs, (uchar *) pos->str, pos->length,
|
||||
(uchar *) needle->str, needle->length))
|
||||
{
|
||||
return (pos - haystack);
|
||||
return (int)(pos - haystack);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -1469,7 +1469,7 @@ static Sys_var_ulonglong Sys_max_heap_table_size(
|
||||
"max_heap_table_size",
|
||||
"Don't allow creation of heap tables bigger than this",
|
||||
SESSION_VAR(max_heap_table_size), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(16384, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
|
||||
VALID_RANGE(16384, SIZE_T_MAX), DEFAULT(16*1024*1024),
|
||||
BLOCK_SIZE(1024));
|
||||
|
||||
static ulong mdl_locks_cache_size;
|
||||
|
@ -2523,7 +2523,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
the correct null_bytes can now be set, since bitfields have been taken
|
||||
into account
|
||||
*/
|
||||
share->null_bytes= (null_pos - (uchar*) null_flags +
|
||||
share->null_bytes= (uint)(null_pos - (uchar*) null_flags +
|
||||
(null_bit_pos + 7) / 8);
|
||||
share->last_null_bit_pos= null_bit_pos;
|
||||
share->null_bytes_for_compare= null_bits_are_used ? share->null_bytes : 0;
|
||||
@ -6013,8 +6013,8 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
|
||||
/* The field belongs to a merge view or information schema table. */
|
||||
Field_translator *translated_field= view_field_it.field_translator();
|
||||
nj_col= new Natural_join_column(translated_field, table_ref);
|
||||
field_count= table_ref->field_translation_end -
|
||||
table_ref->field_translation;
|
||||
field_count= (uint)(table_ref->field_translation_end -
|
||||
table_ref->field_translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -981,13 +981,18 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
|
||||
null_count+= field->length & 7;
|
||||
|
||||
if (field->default_value && !field->default_value->flags &&
|
||||
!(field->flags & BLOB_FLAG))
|
||||
(!(field->flags & BLOB_FLAG) ||
|
||||
field->real_field_type() == MYSQL_TYPE_GEOMETRY))
|
||||
{
|
||||
Item *expr= field->default_value->expr;
|
||||
|
||||
int res= !expr->fixed && // may be already fixed if ALTER TABLE
|
||||
expr->fix_fields(thd, &expr);
|
||||
if (!res)
|
||||
res= expr->save_in_field(regfield, 1);
|
||||
if (!res && (field->flags & BLOB_FLAG))
|
||||
regfield->reset();
|
||||
|
||||
/* If not ok or warning of level 'note' */
|
||||
if (res != 0 && res != 3)
|
||||
{
|
||||
@ -996,6 +1001,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
|
||||
delete regfield; //To avoid memory leak
|
||||
goto err;
|
||||
}
|
||||
delete regfield; //To avoid memory leak
|
||||
}
|
||||
else if (regfield->real_type() == MYSQL_TYPE_ENUM &&
|
||||
(field->flags & NOT_NULL_FLAG))
|
||||
|
@ -351,7 +351,7 @@ void CSORT::Qstx(int *base, int *max)
|
||||
|
||||
zlo = zhi = cnm = 0; // Avoid warning message
|
||||
|
||||
lo = max - base; // Number of elements as longs
|
||||
lo = (int)(max - base); // Number of elements as longs
|
||||
|
||||
if (Dup)
|
||||
cnm = Cmpnum(lo);
|
||||
@ -472,7 +472,7 @@ void CSORT::Qstx(int *base, int *max)
|
||||
i = him + 1;
|
||||
|
||||
if (Pof)
|
||||
Pof[him - Pex] = Pof[mid - Pex] = i - j;
|
||||
Pof[him - Pex] = Pof[mid - Pex] = (int)(i - j);
|
||||
|
||||
/*******************************************************************/
|
||||
/* Look at sizes of the two partitions, do the smaller one first */
|
||||
@ -481,8 +481,8 @@ void CSORT::Qstx(int *base, int *max)
|
||||
/* But only repeat (recursively or by branching) if the partition */
|
||||
/* is of at least size THRESH. */
|
||||
/*******************************************************************/
|
||||
lo = j - base;
|
||||
hi = max - i;
|
||||
lo = (int)(j - base);
|
||||
hi = (int)(max - i);
|
||||
|
||||
if (Dup) { // Update progress information
|
||||
zlo = Cmpnum(lo);
|
||||
@ -726,7 +726,7 @@ void CSORT::Qstc(int *base, int *max)
|
||||
|
||||
zlo = zhi = cnm = 0; // Avoid warning message
|
||||
|
||||
lo = max - base; // Number of elements as longs
|
||||
lo = (int)(max - base); // Number of elements as longs
|
||||
|
||||
if (Dup)
|
||||
cnm = Cmpnum(lo);
|
||||
@ -853,7 +853,7 @@ void CSORT::Qstc(int *base, int *max)
|
||||
/* the offset array values indicating break point and block size. */
|
||||
/*******************************************************************/
|
||||
if (Pof)
|
||||
Pof[lt - Pex] = Pof[(jj - 1) - Pex] = jj - lt;
|
||||
Pof[lt - Pex] = Pof[(jj - 1) - Pex] = (int)(jj - lt);
|
||||
|
||||
/*******************************************************************/
|
||||
/* Look at sizes of the two partitions, do the smaller one first */
|
||||
@ -862,8 +862,8 @@ void CSORT::Qstc(int *base, int *max)
|
||||
/* But only repeat (recursively or by branching) if the partition */
|
||||
/* is of at least size THRESH. */
|
||||
/*******************************************************************/
|
||||
lo = lt - base;
|
||||
hi = gt - Swix;
|
||||
lo = (int)(lt - base);
|
||||
hi = (int)(gt - Swix);
|
||||
|
||||
if (Dup) { // Update progress information
|
||||
zlo = Cmpnum(lo);
|
||||
|
@ -13,6 +13,7 @@
|
||||
#elif defined(MSX4)
|
||||
#import "msxml4.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
|
||||
#elif defined(MSX6)
|
||||
#pragma warning(suppress : 4192)
|
||||
#import "msxml6.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
|
||||
#else // MSX4
|
||||
#error MSX? is not defined
|
||||
@ -540,7 +541,7 @@ PXNODE DOMNODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
|
||||
|
||||
// If name has the format m[n] only m is taken as node name
|
||||
if ((p = strchr(name, '[')))
|
||||
pn = BufAlloc(g, name, p - name);
|
||||
pn = BufAlloc(g, name, (int)(p - name));
|
||||
else
|
||||
pn = name;
|
||||
|
||||
|
@ -247,7 +247,7 @@ int MAPFAM::GetRowID(void)
|
||||
/***********************************************************************/
|
||||
int MAPFAM::GetPos(void)
|
||||
{
|
||||
return Fpos - Memory;
|
||||
return (int)(Fpos - Memory);
|
||||
} // end of GetPos
|
||||
|
||||
/***********************************************************************/
|
||||
@ -255,7 +255,7 @@ int MAPFAM::GetPos(void)
|
||||
/***********************************************************************/
|
||||
int MAPFAM::GetNextPos(void)
|
||||
{
|
||||
return Mempos - Memory;
|
||||
return (int)(Mempos - Memory);
|
||||
} // end of GetNextPos
|
||||
|
||||
/***********************************************************************/
|
||||
@ -368,7 +368,7 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
|
||||
} // endif Mempos
|
||||
|
||||
// Set caller line buffer
|
||||
len = (Mempos - Fpos) - n;
|
||||
len = (int)(Mempos - Fpos) - n;
|
||||
|
||||
// Don't rely on ENDING setting
|
||||
if (len > 0 && *(Mempos - 2) == '\r')
|
||||
@ -428,7 +428,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
||||
/* not required here, just setting of future Spos and Tpos. */
|
||||
/*******************************************************************/
|
||||
Tpos = Spos = Fpos;
|
||||
} else if ((n = Fpos - Spos) > 0) {
|
||||
} else if ((n = (int)(Fpos - Spos)) > 0) {
|
||||
/*******************************************************************/
|
||||
/* Non consecutive line to delete. Move intermediate lines. */
|
||||
/*******************************************************************/
|
||||
@ -461,7 +461,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
||||
/*****************************************************************/
|
||||
/* Remove extra records. */
|
||||
/*****************************************************************/
|
||||
n = Tpos - Memory;
|
||||
n = (int)(Tpos - Memory);
|
||||
|
||||
#if defined(__WIN__)
|
||||
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
|
||||
@ -627,7 +627,7 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
|
||||
break;
|
||||
|
||||
// Set caller line buffer
|
||||
len = (Mempos - Fpos) - Ending;
|
||||
len = (int)(Mempos - Fpos) - Ending;
|
||||
memcpy(Tdbp->GetLine(), Fpos, len);
|
||||
Tdbp->GetLine()[len] = '\0';
|
||||
return RC_OK;
|
||||
|
@ -537,7 +537,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
|
||||
while (*NxtLine++ != '\n') ;
|
||||
|
||||
// Set caller line buffer
|
||||
n = NxtLine - CurLine - Ending;
|
||||
n = (int)(NxtLine - CurLine - Ending);
|
||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
||||
Tdbp->GetLine()[n] = '\0';
|
||||
return RC_OK;
|
||||
@ -588,7 +588,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
|
||||
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
|
||||
|
||||
// Set caller line buffer
|
||||
n = NxtLine - CurLine - Ending;
|
||||
n = (int)(NxtLine - CurLine - Ending);
|
||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
||||
Tdbp->GetLine()[n] = '\0';
|
||||
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
||||
@ -1087,7 +1087,7 @@ bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
||||
/***********************************************************************/
|
||||
int ZLBFAM::ReadBuffer(PGLOBAL g)
|
||||
{
|
||||
int n;
|
||||
size_t n;
|
||||
void *rdbuf;
|
||||
|
||||
/*********************************************************************/
|
||||
@ -1299,7 +1299,7 @@ int ZLBFAM::WriteBuffer(PGLOBAL g)
|
||||
else
|
||||
NxtLine = CurLine + Lrecl;
|
||||
|
||||
BlkLen = NxtLine - To_Buf;
|
||||
BlkLen = (int)(NxtLine - To_Buf);
|
||||
|
||||
if (WriteCompressedBuffer(g)) {
|
||||
Closing = TRUE; // To tell CloseDB about a Write error
|
||||
|
@ -1351,7 +1351,7 @@ int BLKFAM::GetPos(void)
|
||||
/***********************************************************************/
|
||||
int BLKFAM::GetNextPos(void)
|
||||
{
|
||||
return Fpos + NxtLine - CurLine;
|
||||
return (int)(Fpos + NxtLine - CurLine);
|
||||
} // end of GetNextPos
|
||||
|
||||
/***********************************************************************/
|
||||
@ -1396,7 +1396,8 @@ int BLKFAM::SkipRecord(PGLOBAL, bool header)
|
||||
/***********************************************************************/
|
||||
int BLKFAM::ReadBuffer(PGLOBAL g)
|
||||
{
|
||||
int i, n, rc = RC_OK;
|
||||
int i, rc = RC_OK;
|
||||
size_t n;
|
||||
|
||||
/*********************************************************************/
|
||||
/* Sequential reading when Placed is not true. */
|
||||
@ -1497,7 +1498,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
|
||||
|
||||
fin:
|
||||
// Store the current record file position for Delete and Update
|
||||
Fpos = BlkPos[CurBlk] + CurLine - To_Buf;
|
||||
Fpos = (int)(BlkPos[CurBlk] + CurLine - To_Buf);
|
||||
return rc;
|
||||
} // end of ReadBuffer
|
||||
|
||||
@ -1524,7 +1525,7 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
|
||||
|
||||
// Now start the writing process.
|
||||
NxtLine = CurLine + strlen(CurLine);
|
||||
BlkLen = NxtLine - To_Buf;
|
||||
BlkLen = (int)(NxtLine - To_Buf);
|
||||
|
||||
if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) {
|
||||
sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));
|
||||
|
@ -748,7 +748,7 @@ UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
|
||||
/***********************************************************************/
|
||||
int UNZFAM::GetFileLength(PGLOBAL g)
|
||||
{
|
||||
int len = (zutp && zutp->entryopen) ? Top - Memory
|
||||
int len = (zutp && zutp->entryopen) ? (int)(Top - Memory)
|
||||
: TXTFAM::GetFileLength(g) * 3;
|
||||
|
||||
if (trace)
|
||||
@ -1088,7 +1088,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
|
||||
|
||||
// Prepare to write the new line
|
||||
strcat(strcpy(To_Buf, Tdbp->GetLine()), (Bin) ? CrLf : "\n");
|
||||
len = strchr(To_Buf, '\n') - To_Buf + 1;
|
||||
len = (int)(strchr(To_Buf, '\n') - To_Buf + 1);
|
||||
return zutp->writeEntry(g, To_Buf, len);
|
||||
} // end of WriteBuffer
|
||||
|
||||
|
@ -283,7 +283,7 @@ static void yy_fatal_error YY_PROTO(( const char msg[] ));
|
||||
*/
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
yytext_ptr = yy_bp; \
|
||||
yyleng = yy_cp - yy_bp; \
|
||||
yyleng = (int)(yy_cp - yy_bp); \
|
||||
yy_hold_char = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
yy_c_buf_p = yy_cp;
|
||||
@ -695,7 +695,7 @@ case YY_STATE_EOF(dqt):
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
/* Amount of text matched not including the EOB char. */
|
||||
int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
|
||||
int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr - 1);
|
||||
|
||||
/* Undo the effects of YY_DO_BEFORE_ACTION. */
|
||||
*yy_cp = yy_hold_char;
|
||||
@ -862,7 +862,7 @@ static int yy_get_next_buffer()
|
||||
/* Try to read more data. */
|
||||
|
||||
/* First move last chars to start of buffer. */
|
||||
number_to_move = yy_c_buf_p - yytext_ptr;
|
||||
number_to_move = (int)(yy_c_buf_p - yytext_ptr);
|
||||
|
||||
for ( i = 0; i < number_to_move; ++i )
|
||||
*(dest++) = *(source++);
|
||||
@ -888,7 +888,7 @@ static int yy_get_next_buffer()
|
||||
/* just a shorter name for the current buffer */
|
||||
YY_BUFFER_STATE b = yy_current_buffer;
|
||||
|
||||
int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
|
||||
int yy_c_buf_p_offset = (int)(yy_c_buf_p - b->yy_ch_buf);
|
||||
|
||||
b->yy_buf_size *= 2;
|
||||
b->yy_ch_buf = (char *)
|
||||
|
@ -230,13 +230,13 @@ bool MACINFO::GetOneInfo(PGLOBAL g, int flag, void *v, int lv)
|
||||
case 11: // Description
|
||||
if ((p = strstr(Curp->Description, " - Packet Scheduler Miniport"))) {
|
||||
strncpy(buf, Curp->Description, p - Curp->Description);
|
||||
i = p - Curp->Description;
|
||||
i = (int)(p - Curp->Description);
|
||||
strncpy(buf, Curp->Description, i);
|
||||
buf[i] = 0;
|
||||
p = buf;
|
||||
} else if ((p = strstr(Curp->Description,
|
||||
" - Miniport d'ordonnancement de paquets"))) {
|
||||
i = p - Curp->Description;
|
||||
i = (int)(p - Curp->Description);
|
||||
strncpy(buf, Curp->Description, i);
|
||||
buf[i] = 0;
|
||||
p = buf;
|
||||
|
@ -248,7 +248,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
|
||||
|
||||
while (true) {
|
||||
p2 = strchr(p1, '\'');
|
||||
len = MY_MAX(len, p2 - p1);
|
||||
len = MY_MAX(len, (int)(p2 - p1));
|
||||
if (*++p2 != ',') break;
|
||||
p1 = p2 + 2;
|
||||
} // endwhile
|
||||
|
@ -2427,7 +2427,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
|
||||
else if (vlen[n] == SQL_NULL_DATA)
|
||||
pval[n]->SetNull(true);
|
||||
else if (crp->Type == TYPE_STRING/* && vlen[n] != SQL_NULL_DATA*/)
|
||||
pval[n]->SetValue_char(pbuf[n], vlen[n]);
|
||||
pval[n]->SetValue_char(pbuf[n], (int)vlen[n]);
|
||||
else
|
||||
pval[n]->SetNull(false);
|
||||
|
||||
|
@ -540,7 +540,7 @@ bool EvalLikePattern(LPCSTR sp, LPCSTR tp)
|
||||
{
|
||||
LPSTR p;
|
||||
char c;
|
||||
int n;
|
||||
ssize_t n;
|
||||
bool b, t = false;
|
||||
|
||||
if (trace)
|
||||
|
@ -934,7 +934,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
|
||||
|
||||
if (p) {
|
||||
//len = p++ - p2;
|
||||
len = p - p2 - 1;;
|
||||
len = (int)(p - p2 - 1);
|
||||
|
||||
// if (Sep != ' ')
|
||||
// for (; *p == ' '; p++) ; // Skip blanks
|
||||
@ -978,7 +978,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
|
||||
return RC_NF;
|
||||
|
||||
} else if ((p = strchr(p2, Sep)))
|
||||
len = p - p2;
|
||||
len = (int)(p - p2);
|
||||
else if (i == Fields - 1)
|
||||
len = strlen(p2);
|
||||
else if (Accept && Maxerr == 0) {
|
||||
@ -996,7 +996,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
|
||||
} else
|
||||
len = 0;
|
||||
|
||||
Offset[i] = p2 - To_Line;
|
||||
Offset[i] = (int)(p2 - To_Line);
|
||||
|
||||
if (Mode != MODE_UPDATE)
|
||||
Fldlen[i] = len;
|
||||
|
@ -367,13 +367,13 @@ void MACCOL::ReadColumn(PGLOBAL g)
|
||||
case 11: // Description
|
||||
if ((p = strstr(adp->Description, " - Packet Scheduler Miniport"))) {
|
||||
strncpy(buf, adp->Description, p - adp->Description);
|
||||
i = p - adp->Description;
|
||||
i = (int)(p - adp->Description);
|
||||
strncpy(buf, adp->Description, i);
|
||||
buf[i] = 0;
|
||||
p = buf;
|
||||
} else if ((p = strstr(adp->Description,
|
||||
" - Miniport d'ordonnancement de paquets"))) {
|
||||
i = p - adp->Description;
|
||||
i = (int)(p - adp->Description);
|
||||
strncpy(buf, adp->Description, i);
|
||||
buf[i] = 0;
|
||||
p = buf;
|
||||
|
@ -1738,7 +1738,7 @@ DECVAL::DECVAL(PSZ s) : TYPVAL<PSZ>(s)
|
||||
if (s) {
|
||||
char *p = strchr(Strp, '.');
|
||||
|
||||
Prec = (p) ? Len - (p - Strp) : 0;
|
||||
Prec = (p) ? (int)(Len - (p - Strp)) : 0;
|
||||
} // endif s
|
||||
|
||||
Type = TYPE_DECIM;
|
||||
@ -2647,7 +2647,7 @@ bool DTVAL::SetValue_char(const char *p, int n)
|
||||
// Trim trailing blanks
|
||||
for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--);
|
||||
|
||||
if ((rc = (n = p2 - p + 1) > Len))
|
||||
if ((rc = (n = (int)(p2 - p + 1)) > Len))
|
||||
n = Len;
|
||||
|
||||
memcpy(Sdate, p, n);
|
||||
|
@ -204,7 +204,7 @@ STRING::STRING(PGLOBAL g, uint n, PCSZ str)
|
||||
*Strp = 0;
|
||||
|
||||
Next = GetNext();
|
||||
Size = Next - Strp;
|
||||
Size = (int)(Next - Strp);
|
||||
Trc = false;
|
||||
} else {
|
||||
// This should normally never happen
|
||||
@ -239,7 +239,7 @@ char *STRING::Realloc(uint len)
|
||||
p = Strp;
|
||||
|
||||
Next = GetNext();
|
||||
Size = Next - p;
|
||||
Size = (int)(Next - p);
|
||||
return p;
|
||||
} // end of Realloc
|
||||
|
||||
|
@ -77,22 +77,85 @@ btr_corruption_report(
|
||||
/*
|
||||
Latching strategy of the InnoDB B-tree
|
||||
--------------------------------------
|
||||
A tree latch protects all non-leaf nodes of the tree. Each node of a tree
|
||||
also has a latch of its own.
|
||||
|
||||
A B-tree operation normally first acquires an S-latch on the tree. It
|
||||
searches down the tree and releases the tree latch when it has the
|
||||
leaf node latch. To save CPU time we do not acquire any latch on
|
||||
non-leaf nodes of the tree during a search, those pages are only bufferfixed.
|
||||
Node pointer page latches acquisition is protected by index->lock latch.
|
||||
|
||||
If an operation needs to restructure the tree, it acquires an X-latch on
|
||||
the tree before searching to a leaf node. If it needs, for example, to
|
||||
split a leaf,
|
||||
(1) InnoDB decides the split point in the leaf,
|
||||
(2) allocates a new page,
|
||||
(3) inserts the appropriate node pointer to the first non-leaf level,
|
||||
(4) releases the tree X-latch,
|
||||
(5) and then moves records from the leaf to the new allocated page.
|
||||
Before MariaDB 10.2.2, all node pointer pages were protected by index->lock
|
||||
either in S (shared) or X (exclusive) mode and block->lock was not acquired on
|
||||
node pointer pages.
|
||||
|
||||
After MariaDB 10.2.2, block->lock S-latch or X-latch is used to protect
|
||||
node pointer pages and obtaiment of node pointer page latches is protected by
|
||||
index->lock.
|
||||
|
||||
(0) Definition: B-tree level.
|
||||
|
||||
(0.1) The leaf pages of the B-tree are at level 0.
|
||||
|
||||
(0.2) The parent of a page at level L has level L+1. (The level of the
|
||||
root page is equal to the tree height.)
|
||||
|
||||
(0.3) The B-tree lock (index->lock) is the parent of the root page and
|
||||
has a level = tree height + 1.
|
||||
|
||||
Index->lock has 3 possible locking modes:
|
||||
|
||||
(1) S-latch:
|
||||
|
||||
(1.1) All latches for pages must be obtained in descending order of tree level.
|
||||
|
||||
(1.2) Before obtaining the first node pointer page latch at a given B-tree
|
||||
level, parent latch must be held (at level +1 ).
|
||||
|
||||
(1.3) If a node pointer page is already latched at the same level
|
||||
we can only obtain latch to its right sibling page latch at the same level.
|
||||
|
||||
(1.4) Release of the node pointer page latches must be done in
|
||||
child-to-parent order. (Prevents deadlocks when obtained index->lock
|
||||
in SX mode).
|
||||
|
||||
(1.4.1) Level L node pointer page latch can be released only when
|
||||
no latches at children level i.e. level < L are hold.
|
||||
|
||||
(1.4.2) All latches from node pointer pages must be released so
|
||||
that no latches are obtained between.
|
||||
|
||||
(1.5) [implied by (1.1), (1.2)] Root page latch must be first node pointer
|
||||
latch obtained.
|
||||
|
||||
(2) SX-latch:
|
||||
|
||||
In this case rules (1.2) and (1.3) from S-latch case are relaxed and
|
||||
merged into (2.2) and rule (1.4) is removed. Thus, latch acquisition
|
||||
can be skipped at some tree levels and latches can be obtained in
|
||||
a less restricted order.
|
||||
|
||||
(2.1) [identical to (1.1)]: All latches for pages must be obtained in descending
|
||||
order of tree level.
|
||||
|
||||
(2.2) When a node pointer latch at level L is obtained,
|
||||
the left sibling page latch in the same level or some ancestor
|
||||
page latch (at level > L) must be hold.
|
||||
|
||||
(2.3) [implied by (2.1), (2.2)] The first node pointer page latch obtained can
|
||||
be any node pointer page.
|
||||
|
||||
(3) X-latch:
|
||||
|
||||
Node pointer latches can be obtained in any order.
|
||||
|
||||
NOTE: New rules after MariaDB 10.2.2 does not affect the latching rules of leaf pages:
|
||||
|
||||
index->lock S-latch is needed in read for the node pointer traversal. When the leaf
|
||||
level is reached, index-lock can be released (and with the MariaDB 10.2.2 changes, all
|
||||
node pointer latches). Left to right index travelsal in leaf page level can be safely done
|
||||
by obtaining right sibling leaf page latch and then releasing the old page latch.
|
||||
|
||||
Single leaf page modifications (BTR_MODIFY_LEAF) are protected by index->lock
|
||||
S-latch.
|
||||
|
||||
B-tree operations involving page splits or merges (BTR_MODIFY_TREE) and page
|
||||
allocations are protected by index->lock X-latch.
|
||||
|
||||
Node pointers
|
||||
-------------
|
||||
@ -1041,7 +1104,8 @@ btr_free_root(
|
||||
{
|
||||
fseg_header_t* header;
|
||||
|
||||
ut_ad(mtr_memo_contains_flagged(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr_memo_contains_flagged(mtr, block, MTR_MEMO_PAGE_X_FIX
|
||||
| MTR_MEMO_PAGE_SX_FIX));
|
||||
ut_ad(mtr->is_named_space(block->page.id.space()));
|
||||
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
@ -564,8 +564,7 @@ PageBulk::storeExt(
|
||||
page_cur->block = m_block;
|
||||
|
||||
dberr_t err = btr_store_big_rec_extern_fields(
|
||||
&btr_pcur, NULL, offsets, big_rec, m_mtr,
|
||||
BTR_STORE_INSERT_BULK);
|
||||
&btr_pcur, offsets, big_rec, m_mtr, BTR_STORE_INSERT_BULK);
|
||||
|
||||
ut_ad(page_offset(m_cur_rec) == page_offset(page_cur->rec));
|
||||
|
||||
|
@ -6647,7 +6647,6 @@ btr_store_big_rec_extern_fields(
|
||||
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
|
||||
btr_mtr is restarted, then this can
|
||||
be repositioned. */
|
||||
const upd_t* upd, /*!< in: update vector */
|
||||
ulint* offsets, /*!< in/out: rec_get_offsets() on
|
||||
pcur. the "external storage" flags
|
||||
in offsets will correctly correspond
|
||||
|
@ -564,7 +564,7 @@ btr_defragment_merge_pages(
|
||||
page_get_infimum_rec(from_page));
|
||||
node_ptr = dict_index_build_node_ptr(
|
||||
index, rec, page_get_page_no(from_page),
|
||||
heap, level + 1);
|
||||
heap, level);
|
||||
btr_insert_on_non_leaf_level(0, index, level+1,
|
||||
node_ptr, mtr);
|
||||
}
|
||||
@ -797,11 +797,16 @@ DECLARE_THREAD(btr_defragment_thread)(void*)
|
||||
|
||||
now = ut_timer_now();
|
||||
mtr_start(&mtr);
|
||||
btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, &mtr);
|
||||
cursor = btr_pcur_get_btr_cur(pcur);
|
||||
index = btr_cur_get_index(cursor);
|
||||
first_block = btr_cur_get_block(cursor);
|
||||
mtr.set_named_space(index->space);
|
||||
/* To follow the latching order defined in WL#6326, acquire index->lock X-latch.
|
||||
This entitles us to acquire page latches in any order for the index. */
|
||||
mtr_x_lock(&index->lock, &mtr);
|
||||
/* This will acquire index->lock SX-latch, which per WL#6363 is allowed
|
||||
when we are already holding the X-latch. */
|
||||
btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, &mtr);
|
||||
first_block = btr_cur_get_block(cursor);
|
||||
|
||||
last_block = btr_defragment_n_pages(first_block, index,
|
||||
srv_defragment_n_pages,
|
||||
|
@ -824,7 +824,6 @@ buf_flush_update_zip_checksum(
|
||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm));
|
||||
|
||||
mach_write_to_8(page + FIL_PAGE_LSN, lsn);
|
||||
memset(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
|
||||
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum);
|
||||
}
|
||||
|
||||
@ -1077,7 +1076,6 @@ buf_flush_write_block_low(
|
||||
bpage->newest_modification);
|
||||
|
||||
ut_a(page_zip_verify_checksum(frame, bpage->size.physical()));
|
||||
memset(frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8);
|
||||
break;
|
||||
case BUF_BLOCK_FILE_PAGE:
|
||||
frame = bpage->zip.data;
|
||||
|
@ -912,8 +912,7 @@ dict_index_contains_col_or_prefix(
|
||||
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
|
||||
|
||||
if (dict_index_is_clust(index)) {
|
||||
|
||||
return(TRUE);
|
||||
return(!is_virtual);
|
||||
}
|
||||
|
||||
if (is_virtual) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user