Commit e63c03db authored by Michael Widenius's avatar Michael Widenius

Merge with 10.0-base

Automatic merge, except for server_audit.cc that had to be modified slightly
Changes to xtradb and innobase where ignored was these made no sence for 10.0
parents 70c08df4 17278496
...@@ -11,6 +11,7 @@ usr/lib/mysql/plugin/query_response_time.so ...@@ -11,6 +11,7 @@ usr/lib/mysql/plugin/query_response_time.so
usr/lib/mysql/plugin/semisync_master.so 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/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
......
...@@ -11,6 +11,7 @@ usr/lib/mysql/plugin/query_response_time.so ...@@ -11,6 +11,7 @@ usr/lib/mysql/plugin/query_response_time.so
usr/lib/mysql/plugin/semisync_master.so 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/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-10.0.py usr/share/apport/package-hooks/source_mariadb-10.0.py
......
...@@ -265,7 +265,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) ...@@ -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) ...@@ -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);
} }
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
An instrumented mutex structure. An instrumented mutex structure.
@sa mysql_mutex_t @sa mysql_mutex_t
*/ */
struct st_mysql_mutex struct st_mysql_mutex
{ {
/** The real mutex. */ /** The real mutex. */
...@@ -96,6 +97,15 @@ struct st_mysql_mutex ...@@ -96,6 +97,15 @@ struct st_mysql_mutex
*/ */
typedef struct st_mysql_mutex mysql_mutex_t; typedef struct st_mysql_mutex mysql_mutex_t;
/* How to access the pthread_mutex in mysql_mutex_t */
#ifdef SAFE_MUTEX
#define mysql_mutex_real_mutex(A) &(A)->m_mutex.mutex
#elif defined(MY_PTHREAD_FASTMUTEX)
#define mysql_mutex_real_mutex(A) &(A)->m_mutex.mutex
#else
#define mysql_mutex_real_mutex(A) &(A)->m_mutex
#endif
/** /**
An instrumented rwlock structure. An instrumented rwlock structure.
@sa mysql_rwlock_t @sa mysql_rwlock_t
......
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,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
--thread_handling='one-thread-per-connection'
--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;
# 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)
This diff is collapsed.
This diff is collapsed.
...@@ -84,7 +84,7 @@ static void general_class_handler(THD *thd, uint event_subtype, va_list ap) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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->get_stmt_da()->current_row_for_warning(); rows= thd->get_stmt_da()->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);
} }
} }
......
...@@ -3248,7 +3248,8 @@ static my_bool write_block_record(MARIA_HA *info, ...@@ -3248,7 +3248,8 @@ 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,
record + tmp_column->offset + length,
sizeof(uchar*)); sizeof(uchar*));
log_array_pos->length= blob_length; log_array_pos->length= blob_length;
log_entry_length+= blob_length; log_entry_length+= blob_length;
...@@ -5344,6 +5345,7 @@ int _ma_scan_restore_block_record(MARIA_HA *info, ...@@ -5344,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
...@@ -5381,7 +5383,7 @@ restart_record_read: ...@@ -5381,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)))
...@@ -5977,12 +5979,12 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec, ...@@ -5977,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;
......
...@@ -1594,9 +1594,8 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info, ...@@ -1594,9 +1594,8 @@ my_bool _ma_cmp_dynamic_record(register MARIA_HA *info,
MARIA_BLOCK_INFO block_info; MARIA_BLOCK_INFO block_info;
my_bool error= 1; my_bool error= 1;
size_t buffer_length; size_t buffer_length;
LINT_INIT(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)
{ {
......
...@@ -135,7 +135,7 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record) ...@@ -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, ...@@ -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)
......
...@@ -1536,7 +1536,7 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, ...@@ -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(&param->read_cache,info->dfile, if (init_io_cache(&param->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) ...@@ -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;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment