Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7c8ce0a6
Commit
7c8ce0a6
authored
Jun 03, 2011
by
Anitha Gopi
Browse files
Options
Browse Files
Download
Plain Diff
Merged with tree
parents
2293d284
4ba1e549
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
38 deletions
+67
-38
include/mysql/plugin_audit.h
include/mysql/plugin_audit.h
+5
-16
include/mysql/plugin_audit.h.pp
include/mysql/plugin_audit.h.pp
+2
-8
mysql-test/r/archive_debug.result
mysql-test/r/archive_debug.result
+12
-0
mysql-test/t/archive_debug.test
mysql-test/t/archive_debug.test
+13
-0
plugin/audit_null/audit_null.c
plugin/audit_null/audit_null.c
+3
-2
sql/sql_audit.cc
sql/sql_audit.cc
+21
-11
storage/archive/azio.c
storage/archive/azio.c
+9
-0
storage/archive/ha_archive.cc
storage/archive/ha_archive.cc
+2
-1
No files found.
include/mysql/plugin_audit.h
View file @
7c8ce0a6
...
...
@@ -24,16 +24,7 @@
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
#define MYSQL_AUDIT_INTERFACE_VERSION 0x0200
/*
The first word in every event class struct indicates the specific
class of the event.
*/
struct
mysql_event
{
unsigned
int
event_class
;
};
#define MYSQL_AUDIT_INTERFACE_VERSION 0x0300
/*************************************************************************
...
...
@@ -55,7 +46,6 @@ struct mysql_event
struct
mysql_event_general
{
unsigned
int
event_class
;
unsigned
int
event_subclass
;
int
general_error_code
;
unsigned
long
general_thread_id
;
...
...
@@ -87,7 +77,6 @@ struct mysql_event_general
struct
mysql_event_connection
{
unsigned
int
event_class
;
unsigned
int
event_subclass
;
int
status
;
unsigned
long
thread_id
;
...
...
@@ -118,9 +107,9 @@ struct mysql_event_connection
waiting for the next query from the client.
event_notify() is invoked whenever an event occurs which is of any
class for which the plugin has interest. The
first word of the
mysql_event argument indicates the specific event class and the
remainder of the structure is
as required for that class.
class for which the plugin has interest. The
second argument
indicates the specific event class and the third argument is data
as required for that class.
class_mask is an array of bits used to indicate what event classes
that this plugin wants to receive.
...
...
@@ -130,7 +119,7 @@ struct st_mysql_audit
{
int
interface_version
;
void
(
*
release_thd
)(
MYSQL_THD
);
void
(
*
event_notify
)(
MYSQL_THD
,
const
struct
mysql_event
*
);
void
(
*
event_notify
)(
MYSQL_THD
,
unsigned
int
,
const
void
*
);
unsigned
long
class_mask
[
MYSQL_AUDIT_CLASS_MASK_SIZE
];
};
...
...
include/mysql/plugin_audit.h.pp
View file @
7c8ce0a6
...
...
@@ -43,7 +43,7 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG
=
8
,
THD_WAIT_GROUP_COMMIT
=
9
,
THD_WAIT_SYNC
=
10
,
THD_WAIT_LAST
=
11
THD_WAIT_LAST
=
11
}
thd_wait_type
;
extern
struct
thd_wait_service_st
{
void
(
*
thd_wait_begin_func
)(
void
*
,
int
);
...
...
@@ -195,13 +195,8 @@ void mysql_query_cache_invalidate4(void* thd,
void
*
thd_get_ha_data
(
const
void
*
thd
,
const
struct
handlerton
*
hton
);
void
thd_set_ha_data
(
void
*
thd
,
const
struct
handlerton
*
hton
,
const
void
*
ha_data
);
struct
mysql_event
{
unsigned
int
event_class
;
};
struct
mysql_event_general
{
unsigned
int
event_class
;
unsigned
int
event_subclass
;
int
general_error_code
;
unsigned
long
general_thread_id
;
...
...
@@ -217,7 +212,6 @@ struct mysql_event_general
};
struct
mysql_event_connection
{
unsigned
int
event_class
;
unsigned
int
event_subclass
;
int
status
;
unsigned
long
thread_id
;
...
...
@@ -240,6 +234,6 @@ struct st_mysql_audit
{
int
interface_version
;
void
(
*
release_thd
)(
void
*
);
void
(
*
event_notify
)(
void
*
,
const
struct
mysql_event
*
);
void
(
*
event_notify
)(
void
*
,
unsigned
int
,
const
void
*
);
unsigned
long
class
_mask
[
1
];
};
mysql-test/r/archive_debug.result
0 → 100644
View file @
7c8ce0a6
#
# BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
# WITH PARTITIONED ARCHIVE TABLES
#
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
INSERT INTO t1 VALUES(1);
SET SESSION debug='d,simulate_archive_open_failure';
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check error Corrupt
SET SESSION debug=DEFAULT;
DROP TABLE t1;
mysql-test/t/archive_debug.test
0 → 100644
View file @
7c8ce0a6
--
source
include
/
have_archive
.
inc
--
source
include
/
have_debug
.
inc
--
echo
#
--
echo
# BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
--
echo
# WITH PARTITIONED ARCHIVE TABLES
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
ARCHIVE
;
INSERT
INTO
t1
VALUES
(
1
);
SET
SESSION
debug
=
'd,simulate_archive_open_failure'
;
CHECK
TABLE
t1
;
SET
SESSION
debug
=
DEFAULT
;
DROP
TABLE
t1
;
plugin/audit_null/audit_null.c
View file @
7c8ce0a6
...
...
@@ -81,11 +81,12 @@ static int audit_null_plugin_deinit(void *arg __attribute__((unused)))
*/
static
void
audit_null_notify
(
MYSQL_THD
thd
__attribute__
((
unused
)),
const
struct
mysql_event
*
event
)
unsigned
int
event_class
,
const
void
*
event
)
{
/* prone to races, oh well */
number_of_calls
++
;
if
(
event
->
event
_class
==
MYSQL_AUDIT_GENERAL_CLASS
)
if
(
event_class
==
MYSQL_AUDIT_GENERAL_CLASS
)
{
const
struct
mysql_event_general
*
event_general
=
(
const
struct
mysql_event_general
*
)
event
;
...
...
sql/sql_audit.cc
View file @
7c8ce0a6
...
...
@@ -21,11 +21,18 @@ extern int finalize_audit_plugin(st_plugin_int *plugin);
#ifndef EMBEDDED_LIBRARY
struct
st_mysql_event_generic
{
unsigned
int
event_class
;
const
void
*
event
;
};
unsigned
long
mysql_global_audit_mask
[
MYSQL_AUDIT_CLASS_MASK_SIZE
];
static
mysql_mutex_t
LOCK_audit_mask
;
static
void
event_class_dispatch
(
THD
*
thd
,
const
struct
mysql_event
*
event
);
static
void
event_class_dispatch
(
THD
*
thd
,
unsigned
int
event_class
,
const
void
*
event
);
static
inline
...
...
@@ -64,7 +71,6 @@ typedef void (*audit_handler_t)(THD *thd, uint event_subtype, va_list ap);
static
void
general_class_handler
(
THD
*
thd
,
uint
event_subtype
,
va_list
ap
)
{
mysql_event_general
event
;
event
.
event_class
=
MYSQL_AUDIT_GENERAL_CLASS
;
event
.
event_subclass
=
event_subtype
;
event
.
general_error_code
=
va_arg
(
ap
,
int
);
event
.
general_thread_id
=
thd
?
thd
->
thread_id
:
0
;
...
...
@@ -77,14 +83,13 @@ static void general_class_handler(THD *thd, uint event_subtype, va_list ap)
event
.
general_query_length
=
va_arg
(
ap
,
unsigned
int
);
event
.
general_charset
=
va_arg
(
ap
,
struct
charset_info_st
*
);
event
.
general_rows
=
(
unsigned
long
long
)
va_arg
(
ap
,
ha_rows
);
event_class_dispatch
(
thd
,
(
const
mysql_event
*
)
&
event
);
event_class_dispatch
(
thd
,
MYSQL_AUDIT_GENERAL_CLASS
,
&
event
);
}
static
void
connection_class_handler
(
THD
*
thd
,
uint
event_subclass
,
va_list
ap
)
{
mysql_event_connection
event
;
event
.
event_class
=
MYSQL_AUDIT_CONNECTION_CLASS
;
event
.
event_subclass
=
event_subclass
;
event
.
status
=
va_arg
(
ap
,
int
);
event
.
thread_id
=
va_arg
(
ap
,
unsigned
long
);
...
...
@@ -102,7 +107,7 @@ static void connection_class_handler(THD *thd, uint event_subclass, va_list ap)
event
.
ip_length
=
va_arg
(
ap
,
unsigned
int
);
event
.
database
=
va_arg
(
ap
,
const
char
*
);
event
.
database_length
=
va_arg
(
ap
,
unsigned
int
);
event_class_dispatch
(
thd
,
(
const
mysql_event
*
)
&
event
);
event_class_dispatch
(
thd
,
MYSQL_AUDIT_CONNECTION_CLASS
,
&
event
);
}
...
...
@@ -433,18 +438,19 @@ int finalize_audit_plugin(st_plugin_int *plugin)
static
my_bool
plugins_dispatch
(
THD
*
thd
,
plugin_ref
plugin
,
void
*
arg
)
{
const
struct
mysql_event
*
event
=
(
const
struct
mysql_event
*
)
arg
;
const
struct
st_mysql_event_generic
*
event_generic
=
(
const
struct
st_mysql_event_generic
*
)
arg
;
unsigned
long
event_class_mask
[
MYSQL_AUDIT_CLASS_MASK_SIZE
];
st_mysql_audit
*
data
=
plugin_data
(
plugin
,
struct
st_mysql_audit
*
);
set_audit_mask
(
event_class_mask
,
event
->
event_class
);
set_audit_mask
(
event_class_mask
,
event
_generic
->
event_class
);
/* Check to see if the plugin is interested in this event */
if
(
check_audit_mask
(
data
->
class_mask
,
event_class_mask
))
return
0
;
/* Actually notify the plugin */
data
->
event_notify
(
thd
,
event
);
data
->
event_notify
(
thd
,
event
_generic
->
event_class
,
event_generic
->
event
);
return
0
;
}
...
...
@@ -457,15 +463,19 @@ static my_bool plugins_dispatch(THD *thd, plugin_ref plugin, void *arg)
@param[in] event
*/
static
void
event_class_dispatch
(
THD
*
thd
,
const
struct
mysql_event
*
event
)
static
void
event_class_dispatch
(
THD
*
thd
,
unsigned
int
event_class
,
const
void
*
event
)
{
struct
st_mysql_event_generic
event_generic
;
event_generic
.
event_class
=
event_class
;
event_generic
.
event
=
event
;
/*
Check if we are doing a slow global dispatch. This event occurs when
thd == NULL as it is not associated with any particular thread.
*/
if
(
unlikely
(
!
thd
))
{
plugin_foreach
(
thd
,
plugins_dispatch
,
MYSQL_AUDIT_PLUGIN
,
(
void
*
)
event
);
plugin_foreach
(
thd
,
plugins_dispatch
,
MYSQL_AUDIT_PLUGIN
,
&
event_generic
);
}
else
{
...
...
@@ -476,7 +486,7 @@ static void event_class_dispatch(THD *thd, const struct mysql_event *event)
plugins_last
=
plugins
+
thd
->
audit_class_plugins
.
elements
;
for
(;
plugins
<
plugins_last
;
plugins
++
)
plugins_dispatch
(
thd
,
*
plugins
,
(
void
*
)
event
);
plugins_dispatch
(
thd
,
*
plugins
,
&
event_generic
);
}
}
...
...
storage/archive/azio.c
View file @
7c8ce0a6
...
...
@@ -114,6 +114,15 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
errno
=
0
;
s
->
file
=
fd
<
0
?
my_open
(
path
,
Flags
,
MYF
(
0
))
:
fd
;
DBUG_EXECUTE_IF
(
"simulate_archive_open_failure"
,
{
if
(
s
->
file
>=
0
)
{
my_close
(
s
->
file
,
MYF
(
0
));
s
->
file
=
-
1
;
my_errno
=
EMFILE
;
}
});
if
(
s
->
file
<
0
)
{
...
...
storage/archive/ha_archive.cc
View file @
7c8ce0a6
...
...
@@ -1685,11 +1685,12 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
azflush
(
&
(
share
->
archive_write
),
Z_SYNC_FLUSH
);
mysql_mutex_unlock
(
&
share
->
mutex
);
if
(
init_archive_reader
())
DBUG_RETURN
(
HA_ADMIN_CORRUPT
);
/*
Now we will rewind the archive file so that we are positioned at the
start of the file.
*/
init_archive_reader
();
read_data_header
(
&
archive
);
while
(
!
(
rc
=
get_row
(
&
archive
,
table
->
record
[
0
])))
count
--
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment