mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge with 5.5
This commit is contained in:
@ -7,6 +7,7 @@ usr/lib/mysql/plugin/semisync_master.so
|
|||||||
usr/lib/mysql/plugin/semisync_slave.so
|
usr/lib/mysql/plugin/semisync_slave.so
|
||||||
usr/lib/mysql/plugin/handlersocket.so
|
usr/lib/mysql/plugin/handlersocket.so
|
||||||
usr/lib/mysql/plugin/sql_errlog.so
|
usr/lib/mysql/plugin/sql_errlog.so
|
||||||
|
usr/lib/mysql/plugin/server_audit.so
|
||||||
usr/lib/libhsclient.so.*
|
usr/lib/libhsclient.so.*
|
||||||
etc/mysql/debian-start
|
etc/mysql/debian-start
|
||||||
etc/mysql/conf.d/mysqld_safe_syslog.cnf
|
etc/mysql/conf.d/mysqld_safe_syslog.cnf
|
||||||
|
@ -7,6 +7,7 @@ usr/lib/mysql/plugin/semisync_master.so
|
|||||||
usr/lib/mysql/plugin/semisync_slave.so
|
usr/lib/mysql/plugin/semisync_slave.so
|
||||||
usr/lib/mysql/plugin/handlersocket.so
|
usr/lib/mysql/plugin/handlersocket.so
|
||||||
usr/lib/mysql/plugin/sql_errlog.so
|
usr/lib/mysql/plugin/sql_errlog.so
|
||||||
|
usr/lib/mysql/plugin/server_audit.so
|
||||||
usr/lib/libhsclient.so.*
|
usr/lib/libhsclient.so.*
|
||||||
etc/apparmor.d/usr.sbin.mysqld
|
etc/apparmor.d/usr.sbin.mysqld
|
||||||
usr/share/apport/package-hooks/source_mariadb-5.5.py
|
usr/share/apport/package-hooks/source_mariadb-5.5.py
|
||||||
|
@ -265,7 +265,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
|||||||
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
|
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
my_free((char*) pa->typelib.type_names);
|
my_free((void*) pa->typelib.type_names);
|
||||||
DBUG_RETURN (-1);
|
DBUG_RETURN (-1);
|
||||||
}
|
}
|
||||||
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
|
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
|
||||||
@ -327,7 +327,7 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa)
|
|||||||
if (pa->typelib.count)
|
if (pa->typelib.count)
|
||||||
{
|
{
|
||||||
pa->typelib.count=0;
|
pa->typelib.count=0;
|
||||||
my_free((char*) pa->typelib.type_names);
|
my_free((void*) pa->typelib.type_names);
|
||||||
pa->typelib.type_names=0;
|
pa->typelib.type_names=0;
|
||||||
my_free(pa->str);
|
my_free(pa->str);
|
||||||
}
|
}
|
||||||
|
93
mysql-test/r/stack-crash.result
Normal file
93
mysql-test/r/stack-crash.result
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
drop table if exists t1,t2;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't1'
|
||||||
|
Note 1051 Unknown table 't2'
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
`sspo_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`sspo_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`sspo_type` varchar(1) NOT NULL DEFAULT 'P',
|
||||||
|
`sspo_text` longtext NOT NULL,
|
||||||
|
`sspo_image` varchar(255) NOT NULL,
|
||||||
|
`sspo_source` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`sspo_event_name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`sspo_event_location` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`sspo_event_date` datetime DEFAULT NULL,
|
||||||
|
`sspo_remote_title` varchar(255) NOT NULL,
|
||||||
|
`sspo_remote_url` varchar(255) NOT NULL,
|
||||||
|
`sspo_remote_desc` text NOT NULL,
|
||||||
|
`sspo_remote_image` varchar(255) NOT NULL,
|
||||||
|
`sspo_obj_status` varchar(1) NOT NULL DEFAULT 'A',
|
||||||
|
`sspo_cr_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`sspo_cr_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`sspo_lu_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`sspo_lu_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`sspo_id`),
|
||||||
|
KEY `post_uid` (`sspo_uid`,`sspo_cr_date`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
|
||||||
|
Warnings:
|
||||||
|
Warning 1286 Unknown storage engine 'InnoDB'
|
||||||
|
Warning 1266 Using storage engine MyISAM for table 't1'
|
||||||
|
INSERT INTO t1 VALUES (1,2,'P','test1','',0,'','',NULL,'','','','','A','2013-09-30 00:19:32',2,'2013-09-30 00:19:32',2),(2,2,'P','bbb','',0,'','',NULL,'','','','','A','2013-10-02 15:06:35',2,'2013-10-02 15:06:35',2);
|
||||||
|
CREATE TABLE `t2` (
|
||||||
|
`spoo_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`spoo_user_type_id` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_option_id` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_value` varchar(10000) NOT NULL,
|
||||||
|
`spoo_obj_status` varchar(1) NOT NULL DEFAULT 'A',
|
||||||
|
`spoo_cr_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`spoo_cr_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_lu_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`spoo_lu_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`spoo_id`),
|
||||||
|
KEY `object_option_main_idx` (`spoo_user_type_id`,`spoo_uid`,`spoo_option_id`,`spoo_value`(255))
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
|
||||||
|
Warnings:
|
||||||
|
Warning 1286 Unknown storage engine 'InnoDB'
|
||||||
|
Warning 1266 Using storage engine MyISAM for table 't2'
|
||||||
|
INSERT INTO `t2` VALUES (19,1,2,6,'Dortmund','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2),(20,1,2,8,'49','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2);
|
||||||
|
SELECT Count(*)
|
||||||
|
FROM t1 AS tbl
|
||||||
|
LEFT JOIN t2 a
|
||||||
|
ON a.spoo_uid = sspo_uid
|
||||||
|
AND a.spoo_option_id = 1
|
||||||
|
LEFT JOIN t2 b
|
||||||
|
ON b.spoo_uid = sspo_uid
|
||||||
|
AND b.spoo_option_id = 2
|
||||||
|
LEFT JOIN t2 c
|
||||||
|
ON c.spoo_uid = sspo_uid
|
||||||
|
AND c.spoo_option_id = 3
|
||||||
|
LEFT JOIN t2 d
|
||||||
|
ON d.spoo_uid = sspo_uid
|
||||||
|
AND d.spoo_option_id = 5
|
||||||
|
LEFT JOIN t2 e
|
||||||
|
ON e.spoo_uid = sspo_uid
|
||||||
|
AND e.spoo_option_id = 4
|
||||||
|
LEFT JOIN t2 f
|
||||||
|
ON f.spoo_uid = sspo_uid
|
||||||
|
AND f.spoo_option_id = 11
|
||||||
|
LEFT JOIN t2 g
|
||||||
|
ON g.spoo_uid = sspo_uid
|
||||||
|
AND g.spoo_option_id = 7
|
||||||
|
LEFT JOIN t2 h
|
||||||
|
ON h.spoo_uid = sspo_uid
|
||||||
|
AND h.spoo_option_id = 10
|
||||||
|
LEFT JOIN t2 i
|
||||||
|
ON i.spoo_uid = sspo_uid
|
||||||
|
AND i.spoo_option_id = 18
|
||||||
|
LEFT JOIN t2 j
|
||||||
|
ON j.spoo_uid = sspo_uid
|
||||||
|
AND j.spoo_option_id = 6
|
||||||
|
GROUP BY a.spoo_value,
|
||||||
|
b.spoo_value,
|
||||||
|
c.spoo_value,
|
||||||
|
d.spoo_value,
|
||||||
|
e.spoo_value,
|
||||||
|
f.spoo_value,
|
||||||
|
g.spoo_value,
|
||||||
|
h.spoo_value,
|
||||||
|
i.spoo_value,
|
||||||
|
j.spoo_value;
|
||||||
|
Count(*)
|
||||||
|
2
|
||||||
|
drop table t1,t2;
|
203
mysql-test/suite/plugins/r/server_audit.result
Normal file
203
mysql-test/suite/plugins/r/server_audit.result
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
install plugin server_audit soname 'server_audit';
|
||||||
|
show variables like 'server_audit%';
|
||||||
|
Variable_name Value
|
||||||
|
server_audit_events
|
||||||
|
server_audit_excl_users
|
||||||
|
server_audit_file_path server_audit.log
|
||||||
|
server_audit_file_rotate_now OFF
|
||||||
|
server_audit_file_rotate_size 1000000
|
||||||
|
server_audit_file_rotations 9
|
||||||
|
server_audit_incl_users
|
||||||
|
server_audit_logging OFF
|
||||||
|
server_audit_mode 0
|
||||||
|
server_audit_output_type file
|
||||||
|
server_audit_syslog_facility LOG_USER
|
||||||
|
server_audit_syslog_ident mysql-server_auditing
|
||||||
|
server_audit_syslog_info
|
||||||
|
server_audit_syslog_priority LOG_INFO
|
||||||
|
set global server_audit_file_path='server_audit.log';
|
||||||
|
set global server_audit_output_type=file;
|
||||||
|
set global server_audit_logging=on;
|
||||||
|
connect(localhost,no_such_user,,mysql,MASTER_PORT,MASTER_SOCKET);
|
||||||
|
ERROR 28000: Access denied for user 'no_such_user'@'localhost' (using password: NO)
|
||||||
|
set global server_audit_incl_users='odin, dva, tri';
|
||||||
|
create table t1 (id int);
|
||||||
|
set global server_audit_incl_users='odin, root, dva, tri';
|
||||||
|
create table t2 (id int);
|
||||||
|
set global server_audit_excl_users='odin, dva, tri';
|
||||||
|
Warnings:
|
||||||
|
Warning 1 User 'odin' is in the server_audit_incl_users, so wasn't added.
|
||||||
|
Warning 1 User 'dva' is in the server_audit_incl_users, so wasn't added.
|
||||||
|
Warning 1 User 'tri' is in the server_audit_incl_users, so wasn't added.
|
||||||
|
insert into t1 values (1), (2);
|
||||||
|
select * from t1;
|
||||||
|
id
|
||||||
|
1
|
||||||
|
2
|
||||||
|
set global server_audit_incl_users='odin, root, dva, tri';
|
||||||
|
insert into t2 values (1), (2);
|
||||||
|
select * from t2;
|
||||||
|
id
|
||||||
|
1
|
||||||
|
2
|
||||||
|
alter table t1 rename renamed_t1;
|
||||||
|
set global server_audit_events='connect,query';
|
||||||
|
insert into t2 values (1), (2);
|
||||||
|
select * from t2;
|
||||||
|
id
|
||||||
|
1
|
||||||
|
2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
select * from t_doesnt_exist;
|
||||||
|
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
|
||||||
|
syntax_error_query;
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'syntax_error_query' at line 1
|
||||||
|
drop table renamed_t1, t2;
|
||||||
|
show variables like 'server_audit%';
|
||||||
|
Variable_name Value
|
||||||
|
server_audit_events CONNECT,QUERY
|
||||||
|
server_audit_excl_users
|
||||||
|
server_audit_file_path server_audit.log
|
||||||
|
server_audit_file_rotate_now OFF
|
||||||
|
server_audit_file_rotate_size 1000000
|
||||||
|
server_audit_file_rotations 9
|
||||||
|
server_audit_incl_users odin, root, dva, tri
|
||||||
|
server_audit_logging ON
|
||||||
|
server_audit_mode 0
|
||||||
|
server_audit_output_type file
|
||||||
|
server_audit_syslog_facility LOG_USER
|
||||||
|
server_audit_syslog_ident mysql-server_auditing
|
||||||
|
server_audit_syslog_info
|
||||||
|
server_audit_syslog_priority LOG_INFO
|
||||||
|
set global server_audit_mode=1;
|
||||||
|
set global server_audit_events='';
|
||||||
|
create database sa_db;
|
||||||
|
create table t1 (id2 int);
|
||||||
|
insert into t1 values (1), (2);
|
||||||
|
select * from t1;
|
||||||
|
id2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
drop table t1;
|
||||||
|
use sa_db;
|
||||||
|
create table sa_t1(id int);
|
||||||
|
insert into sa_t1 values (1), (2);
|
||||||
|
drop table sa_t1;
|
||||||
|
drop database sa_db;
|
||||||
|
set global server_audit_file_path='.';
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
Variable_name Value
|
||||||
|
Server_audit_current_log HOME_DIR/server_audit.log
|
||||||
|
set global server_audit_file_path='';
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
Variable_name Value
|
||||||
|
Server_audit_current_log server_audit.log
|
||||||
|
set global server_audit_file_path=' ';
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
Variable_name Value
|
||||||
|
Server_audit_current_log server_audit.log
|
||||||
|
set global server_audit_file_path='nonexisting_dir/';
|
||||||
|
Warnings:
|
||||||
|
Warning 1 SERVER AUDIT plugin can't create file 'nonexisting_dir/'.
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
Variable_name Value
|
||||||
|
Server_audit_current_log server_audit.log
|
||||||
|
show variables like 'server_audit%';
|
||||||
|
Variable_name Value
|
||||||
|
server_audit_events
|
||||||
|
server_audit_excl_users
|
||||||
|
server_audit_file_path
|
||||||
|
server_audit_file_rotate_now OFF
|
||||||
|
server_audit_file_rotate_size 1000000
|
||||||
|
server_audit_file_rotations 9
|
||||||
|
server_audit_incl_users odin, root, dva, tri
|
||||||
|
server_audit_logging ON
|
||||||
|
server_audit_mode 1
|
||||||
|
server_audit_output_type file
|
||||||
|
server_audit_syslog_facility LOG_USER
|
||||||
|
server_audit_syslog_ident mysql-server_auditing
|
||||||
|
server_audit_syslog_info
|
||||||
|
server_audit_syslog_priority LOG_INFO
|
||||||
|
uninstall plugin server_audit;
|
||||||
|
Warnings:
|
||||||
|
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
|
||||||
|
TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
|
||||||
|
TIME,HOSTNAME,no_such_user,localhost,ID,0,DISCONNECT,,,0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t2,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users=\'odin, dva, tri\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t2,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,ALTER,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'syntax_error_query',ID
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table renamed_t1, t2',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_mode=1',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,0,CONNECT,test,,0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t1 (id2 int)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t1 values (1), (2)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t1',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,DROP,test,t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table t1',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,sa_db,sa_t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table sa_t1(id int)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,sa_db,sa_t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into sa_t1 values (1), (2)',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,table_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,column_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,DROP,sa_db,sa_t1,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table sa_t1',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,sa_db,,0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'.\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'.\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\' \'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\' \'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'nonexisting_dir/\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'nonexisting_dir/\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin,
|
||||||
|
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'uninstall plugin server_audit',0
|
2
mysql-test/suite/plugins/t/server_audit.opt
Normal file
2
mysql-test/suite/plugins/t/server_audit.opt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
--thread_handling='one-thread-per-connection'
|
||||||
|
|
77
mysql-test/suite/plugins/t/server_audit.test
Normal file
77
mysql-test/suite/plugins/t/server_audit.test
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
|
||||||
|
if (!$SERVER_AUDIT_SO) {
|
||||||
|
skip No SERVER_AUDIT plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
install plugin server_audit soname 'server_audit';
|
||||||
|
|
||||||
|
show variables like 'server_audit%';
|
||||||
|
set global server_audit_file_path='server_audit.log';
|
||||||
|
set global server_audit_output_type=file;
|
||||||
|
set global server_audit_logging=on;
|
||||||
|
connect (con1,localhost,root,,mysql);
|
||||||
|
connection default;
|
||||||
|
disconnect con1;
|
||||||
|
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
|
||||||
|
--error ER_ACCESS_DENIED_ERROR
|
||||||
|
connect (con1,localhost,no_such_user,,mysql);
|
||||||
|
connection default;
|
||||||
|
--sleep 2
|
||||||
|
set global server_audit_incl_users='odin, dva, tri';
|
||||||
|
create table t1 (id int);
|
||||||
|
set global server_audit_incl_users='odin, root, dva, tri';
|
||||||
|
create table t2 (id int);
|
||||||
|
set global server_audit_excl_users='odin, dva, tri';
|
||||||
|
insert into t1 values (1), (2);
|
||||||
|
select * from t1;
|
||||||
|
set global server_audit_incl_users='odin, root, dva, tri';
|
||||||
|
insert into t2 values (1), (2);
|
||||||
|
select * from t2;
|
||||||
|
alter table t1 rename renamed_t1;
|
||||||
|
set global server_audit_events='connect,query';
|
||||||
|
insert into t2 values (1), (2);
|
||||||
|
select * from t2;
|
||||||
|
--error ER_NO_SUCH_TABLE
|
||||||
|
select * from t_doesnt_exist;
|
||||||
|
--error 1064
|
||||||
|
syntax_error_query;
|
||||||
|
drop table renamed_t1, t2;
|
||||||
|
show variables like 'server_audit%';
|
||||||
|
set global server_audit_mode=1;
|
||||||
|
set global server_audit_events='';
|
||||||
|
create database sa_db;
|
||||||
|
connect (con1,localhost,root,,test);
|
||||||
|
connection con1;
|
||||||
|
create table t1 (id2 int);
|
||||||
|
insert into t1 values (1), (2);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
use sa_db;
|
||||||
|
create table sa_t1(id int);
|
||||||
|
insert into sa_t1 values (1), (2);
|
||||||
|
drop table sa_t1;
|
||||||
|
drop database sa_db;
|
||||||
|
connection default;
|
||||||
|
disconnect con1;
|
||||||
|
|
||||||
|
--sleep 2
|
||||||
|
set global server_audit_file_path='.';
|
||||||
|
--replace_regex /\.[\\\/]/HOME_DIR\//
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
set global server_audit_file_path='';
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
set global server_audit_file_path=' ';
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
set global server_audit_file_path='nonexisting_dir/';
|
||||||
|
show status like 'server_audit_current_log';
|
||||||
|
show variables like 'server_audit%';
|
||||||
|
uninstall plugin server_audit;
|
||||||
|
|
||||||
|
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||||
|
# replace the timestamp and the hostname with constant values
|
||||||
|
--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/
|
||||||
|
cat_file $MYSQLD_DATADIR/server_audit.log;
|
||||||
|
remove_file $MYSQLD_DATADIR/server_audit.log;
|
||||||
|
|
96
mysql-test/t/stack-crash.test
Normal file
96
mysql-test/t/stack-crash.test
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#
|
||||||
|
# Test to ensure that we don't get stack overflows
|
||||||
|
#
|
||||||
|
|
||||||
|
drop table if exists t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-5724
|
||||||
|
# Server crashes on SQL select containing more group by and left join
|
||||||
|
# statements
|
||||||
|
# This was because record_buffer was 300,000 bytes and caused stack overflow
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
`sspo_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`sspo_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`sspo_type` varchar(1) NOT NULL DEFAULT 'P',
|
||||||
|
`sspo_text` longtext NOT NULL,
|
||||||
|
`sspo_image` varchar(255) NOT NULL,
|
||||||
|
`sspo_source` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`sspo_event_name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`sspo_event_location` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`sspo_event_date` datetime DEFAULT NULL,
|
||||||
|
`sspo_remote_title` varchar(255) NOT NULL,
|
||||||
|
`sspo_remote_url` varchar(255) NOT NULL,
|
||||||
|
`sspo_remote_desc` text NOT NULL,
|
||||||
|
`sspo_remote_image` varchar(255) NOT NULL,
|
||||||
|
`sspo_obj_status` varchar(1) NOT NULL DEFAULT 'A',
|
||||||
|
`sspo_cr_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`sspo_cr_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`sspo_lu_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`sspo_lu_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`sspo_id`),
|
||||||
|
KEY `post_uid` (`sspo_uid`,`sspo_cr_date`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
|
||||||
|
INSERT INTO t1 VALUES (1,2,'P','test1','',0,'','',NULL,'','','','','A','2013-09-30 00:19:32',2,'2013-09-30 00:19:32',2),(2,2,'P','bbb','',0,'','',NULL,'','','','','A','2013-10-02 15:06:35',2,'2013-10-02 15:06:35',2);
|
||||||
|
|
||||||
|
CREATE TABLE `t2` (
|
||||||
|
`spoo_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`spoo_user_type_id` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_option_id` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_value` varchar(10000) NOT NULL,
|
||||||
|
`spoo_obj_status` varchar(1) NOT NULL DEFAULT 'A',
|
||||||
|
`spoo_cr_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`spoo_cr_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`spoo_lu_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
|
||||||
|
`spoo_lu_uid` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`spoo_id`),
|
||||||
|
KEY `object_option_main_idx` (`spoo_user_type_id`,`spoo_uid`,`spoo_option_id`,`spoo_value`(255))
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
|
||||||
|
INSERT INTO `t2` VALUES (19,1,2,6,'Dortmund','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2),(20,1,2,8,'49','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2);
|
||||||
|
|
||||||
|
SELECT Count(*)
|
||||||
|
FROM t1 AS tbl
|
||||||
|
LEFT JOIN t2 a
|
||||||
|
ON a.spoo_uid = sspo_uid
|
||||||
|
AND a.spoo_option_id = 1
|
||||||
|
LEFT JOIN t2 b
|
||||||
|
ON b.spoo_uid = sspo_uid
|
||||||
|
AND b.spoo_option_id = 2
|
||||||
|
LEFT JOIN t2 c
|
||||||
|
ON c.spoo_uid = sspo_uid
|
||||||
|
AND c.spoo_option_id = 3
|
||||||
|
LEFT JOIN t2 d
|
||||||
|
ON d.spoo_uid = sspo_uid
|
||||||
|
AND d.spoo_option_id = 5
|
||||||
|
LEFT JOIN t2 e
|
||||||
|
ON e.spoo_uid = sspo_uid
|
||||||
|
AND e.spoo_option_id = 4
|
||||||
|
LEFT JOIN t2 f
|
||||||
|
ON f.spoo_uid = sspo_uid
|
||||||
|
AND f.spoo_option_id = 11
|
||||||
|
LEFT JOIN t2 g
|
||||||
|
ON g.spoo_uid = sspo_uid
|
||||||
|
AND g.spoo_option_id = 7
|
||||||
|
LEFT JOIN t2 h
|
||||||
|
ON h.spoo_uid = sspo_uid
|
||||||
|
AND h.spoo_option_id = 10
|
||||||
|
LEFT JOIN t2 i
|
||||||
|
ON i.spoo_uid = sspo_uid
|
||||||
|
AND i.spoo_option_id = 18
|
||||||
|
LEFT JOIN t2 j
|
||||||
|
ON j.spoo_uid = sspo_uid
|
||||||
|
AND j.spoo_option_id = 6
|
||||||
|
GROUP BY a.spoo_value,
|
||||||
|
b.spoo_value,
|
||||||
|
c.spoo_value,
|
||||||
|
d.spoo_value,
|
||||||
|
e.spoo_value,
|
||||||
|
f.spoo_value,
|
||||||
|
g.spoo_value,
|
||||||
|
h.spoo_value,
|
||||||
|
i.spoo_value,
|
||||||
|
j.spoo_value;
|
||||||
|
drop table t1,t2;
|
16
plugin/server_audit/CMakeLists.txt
Normal file
16
plugin/server_audit/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Copyright (C) 2013 Alexey Botchkov and SkySQL Ab
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; version 2 of the License.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
MYSQL_ADD_PLUGIN(server_audit server_audit.c MODULE_ONLY)
|
339
plugin/server_audit/COPYING
Normal file
339
plugin/server_audit/COPYING
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
1836
plugin/server_audit/server_audit.c
Normal file
1836
plugin/server_audit/server_audit.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -84,7 +84,7 @@ static void general_class_handler(THD *thd, uint event_subtype, va_list ap)
|
|||||||
event.general_rows= (unsigned long long) va_arg(ap, ha_rows);
|
event.general_rows= (unsigned long long) va_arg(ap, ha_rows);
|
||||||
event.database= va_arg(ap, const char *);
|
event.database= va_arg(ap, const char *);
|
||||||
event.database_length= va_arg(ap, unsigned int);
|
event.database_length= va_arg(ap, unsigned int);
|
||||||
event.query_id= (unsigned long long) thd->query_id;
|
event.query_id= (unsigned long long) (thd ? thd->query_id : 0);
|
||||||
event_class_dispatch(thd, MYSQL_AUDIT_GENERAL_CLASS, &event);
|
event_class_dispatch(thd, MYSQL_AUDIT_GENERAL_CLASS, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ static void table_class_handler(THD *thd, uint event_subclass, va_list ap)
|
|||||||
event.new_database_length= va_arg(ap, unsigned int);
|
event.new_database_length= va_arg(ap, unsigned int);
|
||||||
event.new_table= va_arg(ap, const char *);
|
event.new_table= va_arg(ap, const char *);
|
||||||
event.new_table_length= va_arg(ap, unsigned int);
|
event.new_table_length= va_arg(ap, unsigned int);
|
||||||
event.query_id= (unsigned long long) thd->query_id;
|
event.query_id= (unsigned long long) (thd ? thd->query_id : 0);
|
||||||
event_class_dispatch(thd, MYSQL_AUDIT_TABLE_CLASS, &event);
|
event_class_dispatch(thd, MYSQL_AUDIT_TABLE_CLASS, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +96,13 @@ void mysql_audit_general_log(THD *thd, time_t time,
|
|||||||
{
|
{
|
||||||
CHARSET_INFO *clientcs= thd ? thd->variables.character_set_client
|
CHARSET_INFO *clientcs= thd ? thd->variables.character_set_client
|
||||||
: global_system_variables.character_set_client;
|
: global_system_variables.character_set_client;
|
||||||
|
const char *db= thd ? thd->db : "";
|
||||||
|
size_t db_length= thd ? thd->db_length : 0;
|
||||||
|
|
||||||
mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, MYSQL_AUDIT_GENERAL_LOG,
|
mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, MYSQL_AUDIT_GENERAL_LOG,
|
||||||
0, time, user, userlen, cmd, cmdlen,
|
0, time, user, userlen, cmd, cmdlen,
|
||||||
query, querylen, clientcs, (ha_rows) 0,
|
query, querylen, clientcs, (ha_rows) 0,
|
||||||
thd->db, thd->db_length);
|
db, db_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +131,8 @@ void mysql_audit_general(THD *thd, uint event_subtype,
|
|||||||
char user_buff[MAX_USER_HOST_SIZE];
|
char user_buff[MAX_USER_HOST_SIZE];
|
||||||
CSET_STRING query;
|
CSET_STRING query;
|
||||||
ha_rows rows;
|
ha_rows rows;
|
||||||
|
const char *db;
|
||||||
|
size_t db_length;
|
||||||
|
|
||||||
if (thd)
|
if (thd)
|
||||||
{
|
{
|
||||||
@ -136,18 +140,22 @@ void mysql_audit_general(THD *thd, uint event_subtype,
|
|||||||
user= user_buff;
|
user= user_buff;
|
||||||
userlen= make_user_name(thd, user_buff);
|
userlen= make_user_name(thd, user_buff);
|
||||||
rows= thd->warning_info->current_row_for_warning();
|
rows= thd->warning_info->current_row_for_warning();
|
||||||
|
db= thd->db;
|
||||||
|
db_length= thd->db_length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user= 0;
|
user= 0;
|
||||||
userlen= 0;
|
userlen= 0;
|
||||||
rows= 0;
|
rows= 0;
|
||||||
|
db= "";
|
||||||
|
db_length= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, event_subtype,
|
mysql_audit_notify(thd, MYSQL_AUDIT_GENERAL_CLASS, event_subtype,
|
||||||
error_code, time, user, userlen, msg, msglen,
|
error_code, time, user, userlen, msg, msglen,
|
||||||
query.str(), query.length(), query.charset(), rows,
|
query.str(), query.length(), query.charset(), rows,
|
||||||
thd->db, thd->db_length);
|
db, db_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4110,18 +4110,31 @@ fil_extend_space_to_desired_size(
|
|||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
#ifdef HAVE_POSIX_FALLOCATE
|
||||||
if (srv_use_posix_fallocate) {
|
if (srv_use_posix_fallocate) {
|
||||||
offset_high = size_after_extend * page_size / (4ULL*1024*1024*1024);
|
ib_int64_t start_offset = start_page_no * page_size;
|
||||||
offset_low = size_after_extend * page_size % (4ULL*1024*1024*1024);
|
ib_int64_t end_offset = (size_after_extend - start_page_no) * page_size;
|
||||||
|
ib_int64_t desired_size = size_after_extend*page_size;
|
||||||
|
|
||||||
mutex_exit(&fil_system->mutex);
|
mutex_exit(&fil_system->mutex);
|
||||||
success = os_file_set_size(node->name, node->handle,
|
|
||||||
offset_low, offset_high);
|
if (posix_fallocate(node->handle, start_offset, end_offset) == -1) {
|
||||||
|
fprintf(stderr, "InnoDB: Error: preallocating file "
|
||||||
|
"space for file \'%s\' failed. Current size "
|
||||||
|
" %lld, len %lld, desired size %lld\n",
|
||||||
|
node->name, start_offset, end_offset, desired_size);
|
||||||
|
success = FALSE;
|
||||||
|
} else {
|
||||||
|
success = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_enter(&fil_system->mutex);
|
mutex_enter(&fil_system->mutex);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
node->size += (size_after_extend - start_page_no);
|
node->size += (size_after_extend - start_page_no);
|
||||||
space->size += (size_after_extend - start_page_no);
|
space->size += (size_after_extend - start_page_no);
|
||||||
os_has_said_disk_full = FALSE;
|
os_has_said_disk_full = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fil_node_complete_io(node, fil_system, OS_FILE_READ);
|
||||||
goto complete_io;
|
goto complete_io;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4178,12 +4191,10 @@ fil_extend_space_to_desired_size(
|
|||||||
|
|
||||||
mem_free(buf2);
|
mem_free(buf2);
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
|
||||||
complete_io:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
|
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
|
||||||
|
|
||||||
|
complete_io:
|
||||||
|
|
||||||
*actual_size = space->size;
|
*actual_size = space->size;
|
||||||
|
|
||||||
#ifndef UNIV_HOTBACKUP
|
#ifndef UNIV_HOTBACKUP
|
||||||
|
@ -3248,8 +3248,9 @@ static my_bool write_block_record(MARIA_HA *info,
|
|||||||
blob_length-= (blob_length % FULL_PAGE_SIZE(block_size));
|
blob_length-= (blob_length % FULL_PAGE_SIZE(block_size));
|
||||||
if (blob_length)
|
if (blob_length)
|
||||||
{
|
{
|
||||||
memcpy(&log_array_pos->str, record + tmp_column->offset + length,
|
memcpy((void*) &log_array_pos->str,
|
||||||
sizeof(uchar*));
|
record + tmp_column->offset + length,
|
||||||
|
sizeof(uchar*));
|
||||||
log_array_pos->length= blob_length;
|
log_array_pos->length= blob_length;
|
||||||
log_entry_length+= blob_length;
|
log_entry_length+= blob_length;
|
||||||
log_array_pos++;
|
log_array_pos++;
|
||||||
@ -5144,7 +5145,12 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
|
|||||||
int error;
|
int error;
|
||||||
DBUG_ENTER("_ma_cmp_block_unique");
|
DBUG_ENTER("_ma_cmp_block_unique");
|
||||||
|
|
||||||
if (!(old_record= my_alloca(info->s->base.reclength)))
|
/*
|
||||||
|
Don't allocate more than 16K on the stack to ensure we don't get
|
||||||
|
stack overflow.
|
||||||
|
*/
|
||||||
|
if (!(old_record= my_safe_alloca(info->s->base.reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
/* Don't let the compare destroy blobs that may be in use */
|
/* Don't let the compare destroy blobs that may be in use */
|
||||||
@ -5166,7 +5172,8 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
|
|||||||
info->rec_buff_size= org_rec_buff_size;
|
info->rec_buff_size= org_rec_buff_size;
|
||||||
}
|
}
|
||||||
DBUG_PRINT("exit", ("result: %d", error));
|
DBUG_PRINT("exit", ("result: %d", error));
|
||||||
my_afree(old_record);
|
my_safe_afree(old_record, info->s->base.reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK);
|
||||||
DBUG_RETURN(error != 0);
|
DBUG_RETURN(error != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5338,6 +5345,7 @@ int _ma_scan_restore_block_record(MARIA_HA *info,
|
|||||||
info Maria handler
|
info Maria handler
|
||||||
record Store found here
|
record Store found here
|
||||||
record_pos Value stored in info->cur_row.next_pos after last call
|
record_pos Value stored in info->cur_row.next_pos after last call
|
||||||
|
This is offset inside the current pagebuff
|
||||||
skip_deleted
|
skip_deleted
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
@ -5375,7 +5383,7 @@ restart_record_read:
|
|||||||
/* Ensure that scan.dir and record_pos are in sync */
|
/* Ensure that scan.dir and record_pos are in sync */
|
||||||
DBUG_ASSERT(info->scan.dir == dir_entry_pos(info->scan.page_buff,
|
DBUG_ASSERT(info->scan.dir == dir_entry_pos(info->scan.page_buff,
|
||||||
share->block_size,
|
share->block_size,
|
||||||
record_pos));
|
(uint) record_pos));
|
||||||
|
|
||||||
/* Search for a valid directory entry (not 0) */
|
/* Search for a valid directory entry (not 0) */
|
||||||
while (!(offset= uint2korr(info->scan.dir)))
|
while (!(offset= uint2korr(info->scan.dir)))
|
||||||
@ -5971,12 +5979,12 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
|
|||||||
{
|
{
|
||||||
uint size_length= column->length - portable_sizeof_char_ptr;
|
uint size_length= column->length - portable_sizeof_char_ptr;
|
||||||
old_column_length= _ma_calc_blob_length(size_length, old_column_pos);
|
old_column_length= _ma_calc_blob_length(size_length, old_column_pos);
|
||||||
memcpy(&old_column_pos, oldrec + column->offset + size_length,
|
memcpy((void*) &old_column_pos, oldrec + column->offset + size_length,
|
||||||
sizeof(old_column_pos));
|
sizeof(old_column_pos));
|
||||||
if (!new_column_is_empty)
|
if (!new_column_is_empty)
|
||||||
{
|
{
|
||||||
new_column_length= _ma_calc_blob_length(size_length, new_column_pos);
|
new_column_length= _ma_calc_blob_length(size_length, new_column_pos);
|
||||||
memcpy(&new_column_pos, newrec + column->offset + size_length,
|
memcpy((void*) &new_column_pos, newrec + column->offset + size_length,
|
||||||
sizeof(old_column_pos));
|
sizeof(old_column_pos));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -36,12 +36,6 @@ static my_bool delete_dynamic_record(MARIA_HA *info,MARIA_RECORD_POS filepos,
|
|||||||
static my_bool _ma_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
|
static my_bool _ma_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
|
||||||
uint length);
|
uint length);
|
||||||
|
|
||||||
/* Play it safe; We have a small stack when using threads */
|
|
||||||
#undef my_alloca
|
|
||||||
#undef my_afree
|
|
||||||
#define my_alloca(A) my_malloc((A),MYF(0))
|
|
||||||
#define my_afree(A) my_free((A))
|
|
||||||
|
|
||||||
/* Interface function from MARIA_HA */
|
/* Interface function from MARIA_HA */
|
||||||
|
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
@ -256,7 +250,8 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
|
|||||||
MARIA_DYN_DELETE_BLOCK_HEADER+1);
|
MARIA_DYN_DELETE_BLOCK_HEADER+1);
|
||||||
reclength= (info->s->base.pack_reclength +
|
reclength= (info->s->base.pack_reclength +
|
||||||
_ma_calc_total_blob_length(info,record)+ extra);
|
_ma_calc_total_blob_length(info,record)+ extra);
|
||||||
if (!(rec_buff=(uchar*) my_alloca(reclength)))
|
if (!(rec_buff=(uchar*) my_safe_alloca(reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK)))
|
||||||
{
|
{
|
||||||
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
|
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
|
||||||
return(1);
|
return(1);
|
||||||
@ -270,7 +265,7 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const uchar *record)
|
|||||||
error= write_dynamic_record(info,
|
error= write_dynamic_record(info,
|
||||||
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
|
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
|
||||||
reclength2);
|
reclength2);
|
||||||
my_afree(rec_buff);
|
my_safe_afree(rec_buff, reclength, MARIA_MAX_RECORD_ON_STACK);
|
||||||
return(error != 0);
|
return(error != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +289,8 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!(rec_buff=(uchar*) my_alloca(reclength)))
|
if (!(rec_buff=(uchar*) my_safe_alloca(reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK)))
|
||||||
{
|
{
|
||||||
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
|
my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
|
||||||
return(1);
|
return(1);
|
||||||
@ -304,7 +300,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos,
|
|||||||
error=update_dynamic_record(info,pos,
|
error=update_dynamic_record(info,pos,
|
||||||
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
|
rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER),
|
||||||
reclength);
|
reclength);
|
||||||
my_afree(rec_buff);
|
my_safe_afree(rec_buff, reclength, MARIA_MAX_RECORD_ON_STACK);
|
||||||
return(error != 0);
|
return(error != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1559,7 +1555,8 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
|
|||||||
my_bool error;
|
my_bool error;
|
||||||
DBUG_ENTER("_ma_cmp_dynamic_unique");
|
DBUG_ENTER("_ma_cmp_dynamic_unique");
|
||||||
|
|
||||||
if (!(old_record=my_alloca(info->s->base.reclength)))
|
if (!(old_record= my_safe_alloca(info->s->base.reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
/* Don't let the compare destroy blobs that may be in use */
|
/* Don't let the compare destroy blobs that may be in use */
|
||||||
@ -1580,7 +1577,8 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
|
|||||||
info->rec_buff= old_rec_buff;
|
info->rec_buff= old_rec_buff;
|
||||||
info->rec_buff_size= old_rec_buff_size;
|
info->rec_buff_size= old_rec_buff_size;
|
||||||
}
|
}
|
||||||
my_afree(old_record);
|
my_safe_afree(old_record, info->s->base.reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1595,7 +1593,9 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
|
|||||||
uchar *buffer;
|
uchar *buffer;
|
||||||
MARIA_BLOCK_INFO block_info;
|
MARIA_BLOCK_INFO block_info;
|
||||||
my_bool error= 1;
|
my_bool error= 1;
|
||||||
|
size_t buffer_length;
|
||||||
DBUG_ENTER("_ma_cmp_dynamic_record");
|
DBUG_ENTER("_ma_cmp_dynamic_record");
|
||||||
|
LINT_INIT(buffer_length);
|
||||||
|
|
||||||
if (info->opt_flag & WRITE_CACHE_USED)
|
if (info->opt_flag & WRITE_CACHE_USED)
|
||||||
{
|
{
|
||||||
@ -1612,8 +1612,10 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
|
|||||||
{ /* If check isn't disabled */
|
{ /* If check isn't disabled */
|
||||||
if (info->s->base.blobs)
|
if (info->s->base.blobs)
|
||||||
{
|
{
|
||||||
if (!(buffer=(uchar*) my_alloca(info->s->base.pack_reclength+
|
buffer_length= (info->s->base.pack_reclength +
|
||||||
_ma_calc_total_blob_length(info,record))))
|
_ma_calc_total_blob_length(info,record));
|
||||||
|
if (!(buffer=(uchar*) my_safe_alloca(buffer_length,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
reclength= _ma_rec_pack(info,buffer,record);
|
reclength= _ma_rec_pack(info,buffer,record);
|
||||||
@ -1665,7 +1667,7 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
|
|||||||
error= 0;
|
error= 0;
|
||||||
err:
|
err:
|
||||||
if (buffer != info->rec_buff)
|
if (buffer != info->rec_buff)
|
||||||
my_afree(buffer);
|
my_safe_afree(buffer, buffer_length, MARIA_MAX_RECORD_ON_STACK);
|
||||||
DBUG_PRINT("exit", ("result: %d", error));
|
DBUG_PRINT("exit", ("result: %d", error));
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
|
|||||||
else if (keyseg->flag & HA_BLOB_PART)
|
else if (keyseg->flag & HA_BLOB_PART)
|
||||||
{
|
{
|
||||||
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
|
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
|
||||||
memcpy(&pos,pos+keyseg->bit_start,sizeof(char*));
|
memcpy((void*) &pos,pos+keyseg->bit_start,sizeof(char*));
|
||||||
if (!length || length > tmp_length)
|
if (!length || length > tmp_length)
|
||||||
length=tmp_length; /* The whole blob */
|
length=tmp_length; /* The whole blob */
|
||||||
}
|
}
|
||||||
@ -231,8 +231,8 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
|
|||||||
set_if_smaller(a_length, keyseg->length);
|
set_if_smaller(a_length, keyseg->length);
|
||||||
set_if_smaller(b_length, keyseg->length);
|
set_if_smaller(b_length, keyseg->length);
|
||||||
}
|
}
|
||||||
memcpy(&pos_a, pos_a+keyseg->bit_start, sizeof(char*));
|
memcpy((void*) &pos_a, pos_a+keyseg->bit_start, sizeof(char*));
|
||||||
memcpy(&pos_b, pos_b+keyseg->bit_start, sizeof(char*));
|
memcpy((void*) &pos_b, pos_b+keyseg->bit_start, sizeof(char*));
|
||||||
}
|
}
|
||||||
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
|
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
|
||||||
type == HA_KEYTYPE_VARTEXT2)
|
type == HA_KEYTYPE_VARTEXT2)
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#define MAX_NONMAPPED_INSERTS 1000
|
#define MAX_NONMAPPED_INSERTS 1000
|
||||||
#define MARIA_MAX_TREE_LEVELS 32
|
#define MARIA_MAX_TREE_LEVELS 32
|
||||||
|
#define MARIA_MAX_RECORD_ON_STACK 16384
|
||||||
|
|
||||||
/* maria_open() flag, specific for maria_pack */
|
/* maria_open() flag, specific for maria_pack */
|
||||||
#define HA_OPEN_IGNORE_MOVED_STATE (1U << 30)
|
#define HA_OPEN_IGNORE_MOVED_STATE (1U << 30)
|
||||||
|
@ -861,7 +861,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
|
|||||||
|
|
||||||
reclength= mrg->file[0]->s->base.reclength;
|
reclength= mrg->file[0]->s->base.reclength;
|
||||||
null_bytes= mrg->file[0]->s->base.null_bytes;
|
null_bytes= mrg->file[0]->s->base.null_bytes;
|
||||||
record=(uchar*) my_alloca(reclength);
|
record=(uchar*) my_safe_alloca(reclength, MARIA_MAX_RECORD_ON_STACK);
|
||||||
end_count=huff_counts+mrg->file[0]->s->base.fields;
|
end_count=huff_counts+mrg->file[0]->s->base.fields;
|
||||||
record_count=0; glob_crc=0;
|
record_count=0; glob_crc=0;
|
||||||
max_blob_length=0;
|
max_blob_length=0;
|
||||||
@ -1145,7 +1145,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
|
|||||||
|
|
||||||
mrg->records=record_count;
|
mrg->records=record_count;
|
||||||
mrg->max_blob_length=max_blob_length;
|
mrg->max_blob_length=max_blob_length;
|
||||||
my_afree(record);
|
my_safe_afree(record, reclength, MARIA_MAX_RECORD_ON_STACK);
|
||||||
DBUG_RETURN(error != HA_ERR_END_OF_FILE);
|
DBUG_RETURN(error != HA_ERR_END_OF_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2415,7 +2415,8 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||||||
DBUG_ENTER("compress_maria_file");
|
DBUG_ENTER("compress_maria_file");
|
||||||
|
|
||||||
/* Allocate a buffer for the records (excluding blobs). */
|
/* Allocate a buffer for the records (excluding blobs). */
|
||||||
if (!(record=(uchar*) my_alloca(isam_file->s->base.reclength)))
|
if (!(record=(uchar*) my_safe_alloca(isam_file->s->base.reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
end_count=huff_counts+isam_file->s->base.fields;
|
end_count=huff_counts+isam_file->s->base.fields;
|
||||||
@ -2778,7 +2779,8 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||||||
if (verbose >= 2)
|
if (verbose >= 2)
|
||||||
printf("wrote %s records.\n", llstr((longlong) record_count, llbuf));
|
printf("wrote %s records.\n", llstr((longlong) record_count, llbuf));
|
||||||
|
|
||||||
my_afree(record);
|
my_safe_afree(record, isam_file->s->base.reclength,
|
||||||
|
MARIA_MAX_RECORD_ON_STACK);
|
||||||
mrg->ref_length=max_pack_length;
|
mrg->ref_length=max_pack_length;
|
||||||
mrg->min_pack_length=max_record_length ? min_record_length : 0;
|
mrg->min_pack_length=max_record_length ? min_record_length : 0;
|
||||||
mrg->max_pack_length=max_record_length;
|
mrg->max_pack_length=max_record_length;
|
||||||
|
@ -1536,7 +1536,7 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info,
|
|||||||
|
|
||||||
if (!param->using_global_keycache)
|
if (!param->using_global_keycache)
|
||||||
(void) init_key_cache(dflt_key_cache, param->key_cache_block_size,
|
(void) init_key_cache(dflt_key_cache, param->key_cache_block_size,
|
||||||
param->use_buffers, 0, 0, 0);
|
(size_t) param->use_buffers, 0, 0, 0);
|
||||||
|
|
||||||
if (init_io_cache(¶m->read_cache,info->dfile,
|
if (init_io_cache(¶m->read_cache,info->dfile,
|
||||||
(uint) param->read_buffer_length,
|
(uint) param->read_buffer_length,
|
||||||
|
@ -40,7 +40,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
|
|||||||
length=_mi_calc_blob_length(column->length-
|
length=_mi_calc_blob_length(column->length-
|
||||||
portable_sizeof_char_ptr,
|
portable_sizeof_char_ptr,
|
||||||
buf);
|
buf);
|
||||||
memcpy(&pos, buf+column->length - portable_sizeof_char_ptr,
|
memcpy((void*) &pos, buf+column->length - portable_sizeof_char_ptr,
|
||||||
sizeof(char*));
|
sizeof(char*));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4953,20 +4953,30 @@ fil_extend_space_to_desired_size(
|
|||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
#ifdef HAVE_POSIX_FALLOCATE
|
||||||
if (srv_use_posix_fallocate) {
|
if (srv_use_posix_fallocate) {
|
||||||
offset_high = (size_after_extend - file_start_page_no)
|
ib_int64_t start_offset = start_page_no * page_size;
|
||||||
* page_size / (4ULL * 1024 * 1024 * 1024);
|
ib_int64_t end_offset = (size_after_extend - start_page_no) * page_size;
|
||||||
offset_low = (size_after_extend - file_start_page_no)
|
ib_int64_t desired_size = size_after_extend*page_size;
|
||||||
* page_size % (4ULL * 1024 * 1024 * 1024);
|
|
||||||
|
|
||||||
mutex_exit(&fil_system->mutex);
|
mutex_exit(&fil_system->mutex);
|
||||||
success = os_file_set_size(node->name, node->handle,
|
|
||||||
offset_low, offset_high);
|
if (posix_fallocate(node->handle, start_offset, end_offset) == -1) {
|
||||||
|
fprintf(stderr, "InnoDB: Error: preallocating file "
|
||||||
|
"space for file \'%s\' failed. Current size "
|
||||||
|
" %lld, len %lld, desired size %lld\n",
|
||||||
|
node->name, start_offset, end_offset, desired_size);
|
||||||
|
success = FALSE;
|
||||||
|
} else {
|
||||||
|
success = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_enter(&fil_system->mutex);
|
mutex_enter(&fil_system->mutex);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
node->size += (size_after_extend - start_page_no);
|
node->size += (size_after_extend - start_page_no);
|
||||||
space->size += (size_after_extend - start_page_no);
|
space->size += (size_after_extend - start_page_no);
|
||||||
os_has_said_disk_full = FALSE;
|
os_has_said_disk_full = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fil_node_complete_io(node, fil_system, OS_FILE_READ);
|
fil_node_complete_io(node, fil_system, OS_FILE_READ);
|
||||||
goto complete_io;
|
goto complete_io;
|
||||||
}
|
}
|
||||||
@ -5028,21 +5038,9 @@ fil_extend_space_to_desired_size(
|
|||||||
|
|
||||||
mem_free(buf2);
|
mem_free(buf2);
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
|
||||||
complete_io:
|
|
||||||
/* If posix_fallocate was used to extent the file space
|
|
||||||
we need to complete the io. Because no actual writes were
|
|
||||||
dispatched read operation is enough here. Without this
|
|
||||||
there will be assertion at shutdown indicating that
|
|
||||||
all IO is not completed. */
|
|
||||||
if (srv_use_posix_fallocate) {
|
|
||||||
fil_node_complete_io(node, fil_system, OS_FILE_READ);
|
|
||||||
} else {
|
|
||||||
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
|
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
|
||||||
#endif
|
|
||||||
|
complete_io:
|
||||||
|
|
||||||
*actual_size = space->size;
|
*actual_size = space->size;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user