mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 10.1 into 10.2
This commit is contained in:
@ -856,6 +856,27 @@ DROP TABLE dest_db.t1;
|
||||
DROP TABLE source_db.t1;
|
||||
DROP DATABASE source_db;
|
||||
DROP DATABASE dest_db;
|
||||
#
|
||||
# BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
|
||||
# ORPHANED DUE TO RENAME TABLE
|
||||
#
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE TABLE notes (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
body text COLLATE utf8_unicode_ci,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
|
||||
COLLATE=utf8_unicode_ci
|
||||
ROW_FORMAT=COMPRESSED;
|
||||
ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
|
||||
Warnings:
|
||||
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
|
||||
DROP INDEX index_ft_body ON notes;
|
||||
CREATE DATABASE db2;
|
||||
RENAME TABLE db1.notes TO db2.notes;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
USE test;
|
||||
#
|
||||
# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
|
||||
|
@ -477,6 +477,28 @@ 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;
|
||||
|
||||
--echo #
|
||||
--echo # BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
|
||||
--echo # ORPHANED DUE TO RENAME TABLE
|
||||
--echo #
|
||||
CREATE DATABASE db1; USE db1;
|
||||
CREATE TABLE notes (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
body text COLLATE utf8_unicode_ci,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
|
||||
COLLATE=utf8_unicode_ci
|
||||
ROW_FORMAT=COMPRESSED;
|
||||
|
||||
ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
|
||||
DROP INDEX index_ft_body ON notes;
|
||||
|
||||
CREATE DATABASE db2;
|
||||
RENAME TABLE db1.notes TO db2.notes;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
|
||||
USE test;
|
||||
|
||||
#
|
||||
|
@ -257,3 +257,37 @@ WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
drop table articles;
|
||||
#
|
||||
# Bug #22679185 INVALID INNODB FTS DOC ID DURING INSERT
|
||||
#
|
||||
create table t1 (f1 int not null primary key, f2 varchar(100),
|
||||
FTS_DOC_ID bigint(20) unsigned not null,
|
||||
unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
|
||||
fulltext key (f2))engine=innodb;
|
||||
insert into t1 values(1, "This is the first record", 20000);
|
||||
insert into t1 values(2, "This is the second record", 40000);
|
||||
select FTS_DOC_ID from t1;
|
||||
FTS_DOC_ID
|
||||
20000
|
||||
40000
|
||||
drop table t1;
|
||||
create table t1 (f1 int not null primary key, f2 varchar(100),
|
||||
FTS_DOC_ID bigint(20) unsigned not null auto_increment,
|
||||
unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
|
||||
fulltext key (f2))engine=innodb;
|
||||
set auto_increment_increment = 65535;
|
||||
insert into t1(f1, f2) values(1, "This is the first record");
|
||||
insert into t1(f1, f2) values(2, "This is the second record");
|
||||
insert into t1(f1, f2) values(3, "This is the third record");
|
||||
select FTS_DOC_ID from t1;
|
||||
FTS_DOC_ID
|
||||
1
|
||||
65536
|
||||
131071
|
||||
drop table t1;
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: Doc ID 20030101000000 is too big. Its difference with largest used Doc ID 0 cannot exceed or equal to 65535");
|
||||
CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200), FULLTEXT(title)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL, NULL), (20030101000000, 20030102000000);
|
||||
ERROR HY000: Invalid InnoDB FTS Doc ID
|
||||
DROP TABLE t1;
|
@ -2,11 +2,6 @@
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in InnoDB 5.6.10 or earlier
|
||||
}
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
@ -226,3 +221,37 @@ SELECT * FROM articles
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
|
||||
drop table articles;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #22679185 INVALID INNODB FTS DOC ID DURING INSERT
|
||||
--echo #
|
||||
|
||||
create table t1 (f1 int not null primary key, f2 varchar(100),
|
||||
FTS_DOC_ID bigint(20) unsigned not null,
|
||||
unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
|
||||
fulltext key (f2))engine=innodb;
|
||||
|
||||
insert into t1 values(1, "This is the first record", 20000);
|
||||
insert into t1 values(2, "This is the second record", 40000);
|
||||
select FTS_DOC_ID from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
create table t1 (f1 int not null primary key, f2 varchar(100),
|
||||
FTS_DOC_ID bigint(20) unsigned not null auto_increment,
|
||||
unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
|
||||
fulltext key (f2))engine=innodb;
|
||||
|
||||
set auto_increment_increment = 65535;
|
||||
insert into t1(f1, f2) values(1, "This is the first record");
|
||||
insert into t1(f1, f2) values(2, "This is the second record");
|
||||
insert into t1(f1, f2) values(3, "This is the third record");
|
||||
select FTS_DOC_ID from t1;
|
||||
drop table t1;
|
||||
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: Doc ID 20030101000000 is too big. Its difference with largest used Doc ID 0 cannot exceed or equal to 65535");
|
||||
CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200), FULLTEXT(title)) ENGINE=InnoDB;
|
||||
--error 182
|
||||
INSERT INTO t1 VALUES (NULL, NULL), (20030101000000, 20030102000000);
|
||||
DROP TABLE t1;
|
@ -191,6 +191,17 @@ select 2;
|
||||
2
|
||||
2
|
||||
drop table t1;
|
||||
set global server_audit_events='query_dml_no_select';
|
||||
create table t1(id int);
|
||||
insert into t1 values (1), (2);
|
||||
select * from t1;
|
||||
id
|
||||
1
|
||||
2
|
||||
select 2;
|
||||
2
|
||||
2
|
||||
drop table t1;
|
||||
set global server_audit_events='';
|
||||
set global server_audit_query_log_limit= 15;
|
||||
select (1), (2), (3), (4);
|
||||
@ -352,6 +363,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD \n# comment\nFOR u1
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
|
||||
|
@ -121,6 +121,13 @@ select 2;
|
||||
/*! select 2*/;
|
||||
/*comment*/ select 2;
|
||||
drop table t1;
|
||||
set global server_audit_events='query_dml_no_select';
|
||||
create table t1(id int);
|
||||
insert into t1 values (1), (2);
|
||||
select * from t1;
|
||||
select 2;
|
||||
drop table t1;
|
||||
|
||||
set global server_audit_events='';
|
||||
|
||||
set global server_audit_query_log_limit= 15;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#define PLUGIN_VERSION 0x104
|
||||
#define PLUGIN_STR_VERSION "1.4.3"
|
||||
#define PLUGIN_STR_VERSION "1.4.4"
|
||||
|
||||
#define _my_thread_var loc_thread_var
|
||||
|
||||
@ -361,16 +361,17 @@ static MYSQL_SYSVAR_STR(excl_users, excl_users, PLUGIN_VAR_RQCMDARG,
|
||||
/* bits in the event filter. */
|
||||
#define EVENT_CONNECT 1
|
||||
#define EVENT_QUERY_ALL 2
|
||||
#define EVENT_QUERY 58
|
||||
#define EVENT_QUERY 122
|
||||
#define EVENT_TABLE 4
|
||||
#define EVENT_QUERY_DDL 8
|
||||
#define EVENT_QUERY_DML 16
|
||||
#define EVENT_QUERY_DCL 32
|
||||
#define EVENT_QUERY_DML_NO_SELECT 64
|
||||
|
||||
static const char *event_names[]=
|
||||
{
|
||||
"CONNECT", "QUERY", "TABLE", "QUERY_DDL", "QUERY_DML", "QUERY_DCL",
|
||||
NULL
|
||||
"QUERY_DML_NO_SELECT", NULL
|
||||
};
|
||||
static TYPELIB events_typelib=
|
||||
{
|
||||
@ -378,7 +379,7 @@ static TYPELIB events_typelib=
|
||||
};
|
||||
static MYSQL_SYSVAR_SET(events, events, PLUGIN_VAR_RQCMDARG,
|
||||
"Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE,"
|
||||
" QUERY_DDL, QUERY_DML, QUERY_DCL.",
|
||||
" QUERY_DDL, QUERY_DML, QUERY_DML_NO_SELECT, QUERY_DCL.",
|
||||
NULL, NULL, 0, &events_typelib);
|
||||
#define OUTPUT_SYSLOG 0
|
||||
#define OUTPUT_FILE 1
|
||||
@ -852,6 +853,21 @@ struct sa_keyword dml_keywords[]=
|
||||
};
|
||||
|
||||
|
||||
struct sa_keyword dml_no_select_keywords[]=
|
||||
{
|
||||
{2, "DO", 0, SQLCOM_DML},
|
||||
{4, "CALL", 0, SQLCOM_DML},
|
||||
{4, "LOAD", &data_word, SQLCOM_DML},
|
||||
{4, "LOAD", &xml_word, SQLCOM_DML},
|
||||
{6, "DELETE", 0, SQLCOM_DML},
|
||||
{6, "INSERT", 0, SQLCOM_DML},
|
||||
{6, "UPDATE", 0, SQLCOM_DML},
|
||||
{7, "HANDLER", 0, SQLCOM_DML},
|
||||
{7, "REPLACE", 0, SQLCOM_DML},
|
||||
{0, NULL, 0, SQLCOM_DML}
|
||||
};
|
||||
|
||||
|
||||
struct sa_keyword dcl_keywords[]=
|
||||
{
|
||||
{6, "CREATE", &user_word, SQLCOM_DCL},
|
||||
@ -1633,6 +1649,11 @@ static int log_statement_ex(const struct connection_info *cn,
|
||||
if (filter_query_type(query, dml_keywords))
|
||||
goto do_log_query;
|
||||
}
|
||||
if (events & EVENT_QUERY_DML_NO_SELECT)
|
||||
{
|
||||
if (filter_query_type(query, dml_no_select_keywords))
|
||||
goto do_log_query;
|
||||
}
|
||||
if (events & EVENT_QUERY_DCL)
|
||||
{
|
||||
if (filter_query_type(query, dcl_keywords))
|
||||
|
@ -1712,10 +1712,6 @@ PageConverter::update_records(
|
||||
|
||||
m_rec_iter.open(block);
|
||||
|
||||
if (!page_is_leaf(block->frame)) {
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
|
||||
while (!m_rec_iter.end()) {
|
||||
rec_t* rec = m_rec_iter.current();
|
||||
|
||||
@ -1840,11 +1836,7 @@ PageConverter::update_index_page(
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
if (!page_is_leaf(block->frame)) {
|
||||
return (DB_SUCCESS);
|
||||
}
|
||||
|
||||
return(update_records(block));
|
||||
return page_is_leaf(block->frame) ? update_records(block) : DB_SUCCESS;
|
||||
}
|
||||
|
||||
/** Validate the space flags and update tablespace header page.
|
||||
|
@ -1804,10 +1804,6 @@ PageConverter::update_records(
|
||||
|
||||
m_rec_iter.open(block);
|
||||
|
||||
if (!page_is_leaf(block->frame)) {
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
|
||||
while (!m_rec_iter.end()) {
|
||||
rec_t* rec = m_rec_iter.current();
|
||||
ibool deleted = rec_get_deleted_flag(rec, comp);
|
||||
@ -1921,7 +1917,7 @@ PageConverter::update_index_page(
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
return(update_records(block));
|
||||
return page_is_leaf(block->frame) ? update_records(block) : DB_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2018, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
@ -1504,8 +1504,7 @@ error_exit:
|
||||
doc_ids difference should not exceed
|
||||
FTS_DOC_ID_MAX_STEP value. */
|
||||
|
||||
if (next_doc_id > 1
|
||||
&& doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) {
|
||||
if (doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Doc ID " UINT64PF " is too"
|
||||
" big. Its difference with largest"
|
||||
@ -5270,7 +5269,8 @@ row_rename_table_for_mysql(
|
||||
}
|
||||
}
|
||||
|
||||
if (dict_table_has_fts_index(table)
|
||||
if ((dict_table_has_fts_index(table)
|
||||
|| DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
|
||||
&& !dict_tables_have_same_db(old_name, new_name)) {
|
||||
err = fts_rename_aux_tables(table, new_name, trx);
|
||||
if (err != DB_TABLE_NOT_FOUND) {
|
||||
|
Reference in New Issue
Block a user