Skip to content

Commit 0b9accf

Browse files
author
Marc Alff
committed
Merge mysql-next-mr (revno 2965) --> mysql-next-mr-marc
2 parents 48614b5 + 9ba4d00 commit 0b9accf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4433
-776
lines changed

include/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h
1919
HEADERS_GEN_CONFIGURE = mysql_version.h
2020
HEADERS_GEN_MAKE = my_config.h
2121
HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
22-
my_list.h my_alloc.h typelib.h mysql/plugin.h
22+
my_list.h my_alloc.h typelib.h mysql/plugin.h \
23+
mysql/plugin_audit.h mysql/plugin_ftparser.h
2324
pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
2425
my_xml.h mysql_embed.h mysql/services.h \
2526
mysql/service_my_snprintf.h mysql/service_thd_alloc.h \

include/mysql/plugin.h

Lines changed: 20 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ typedef struct st_mysql_xid MYSQL_XID;
6666
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
6767
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
6868
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
69-
#define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */
70-
#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */
69+
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
70+
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
71+
#define MYSQL_MAX_PLUGIN_TYPE_NUM 7 /* The number of plugin types */
7172

7273
/* We use the following strings to define licenses for plugins */
7374
#define PLUGIN_LICENSE_PROPRIETARY 0
@@ -403,205 +404,43 @@ struct st_mysql_plugin
403404
/*************************************************************************
404405
API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
405406
*/
407+
#include "plugin_ftparser.h"
406408

407-
#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100
408-
409-
/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */
410-
enum enum_ftparser_mode
411-
{
412-
/*
413-
Fast and simple mode. This mode is used for indexing, and natural
414-
language queries.
415-
416-
The parser is expected to return only those words that go into the
417-
index. Stopwords or too short/long words should not be returned. The
418-
'boolean_info' argument of mysql_add_word() does not have to be set.
419-
*/
420-
MYSQL_FTPARSER_SIMPLE_MODE= 0,
421-
422-
/*
423-
Parse with stopwords mode. This mode is used in boolean searches for
424-
"phrase matching."
425-
426-
The parser is not allowed to ignore words in this mode. Every word
427-
should be returned, including stopwords and words that are too short
428-
or long. The 'boolean_info' argument of mysql_add_word() does not
429-
have to be set.
409+
/*************************************************************************
410+
API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
430411
*/
431-
MYSQL_FTPARSER_WITH_STOPWORDS= 1,
432412

433-
/*
434-
Parse in boolean mode. This mode is used to parse a boolean query string.
435-
436-
The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO
437-
structure in the 'boolean_info' argument to mysql_add_word().
438-
Usually that means that the parser should recognize boolean operators
439-
in the parsing stream and set appropriate fields in
440-
MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for
441-
MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored.
442-
Instead, use FT_TOKEN_STOPWORD for the token type of such a word.
443-
*/
444-
MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
445-
};
413+
/* handlertons of different MySQL releases are incompatible */
414+
#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
446415

447416
/*
448-
Token types for boolean mode searching (used for the type member of
449-
MYSQL_FTPARSER_BOOLEAN_INFO struct)
450-
451-
FT_TOKEN_EOF: End of data.
452-
FT_TOKEN_WORD: Regular word.
453-
FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression).
454-
FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression).
455-
FT_TOKEN_STOPWORD: Stopword.
417+
Here we define only the descriptor structure, that is referred from
418+
st_mysql_plugin.
456419
*/
457420

458-
enum enum_ft_token_type
421+
struct st_mysql_daemon
459422
{
460-
FT_TOKEN_EOF= 0,
461-
FT_TOKEN_WORD= 1,
462-
FT_TOKEN_LEFT_PAREN= 2,
463-
FT_TOKEN_RIGHT_PAREN= 3,
464-
FT_TOKEN_STOPWORD= 4
423+
int interface_version;
465424
};
466425

467-
/*
468-
This structure is used in boolean search mode only. It conveys
469-
boolean-mode metadata to the MySQL search engine for every word in
470-
the search query. A valid instance of this structure must be filled
471-
in by the plugin parser and passed as an argument in the call to
472-
mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM
473-
structure) when a query is parsed in boolean mode.
474-
475-
type: The token type. Should be one of the enum_ft_token_type values.
476-
477-
yesno: Whether the word must be present for a match to occur:
478-
>0 Must be present
479-
<0 Must not be present
480-
0 Neither; the word is optional but its presence increases the relevance
481-
With the default settings of the ft_boolean_syntax system variable,
482-
>0 corresponds to the '+' operator, <0 corrresponds to the '-' operator,
483-
and 0 means neither operator was used.
484-
485-
weight_adjust: A weighting factor that determines how much a match
486-
for the word counts. Positive values increase, negative - decrease the
487-
relative word's importance in the query.
488-
489-
wasign: The sign of the word's weight in the query. If it's non-negative
490-
the match for the word will increase document relevance, if it's
491-
negative - decrease (the word becomes a "noise word", the less of it the
492-
better).
493-
494-
trunc: Corresponds to the '*' operator in the default setting of the
495-
ft_boolean_syntax system variable.
496-
*/
497-
498-
typedef struct st_mysql_ftparser_boolean_info
499-
{
500-
enum enum_ft_token_type type;
501-
int yesno;
502-
int weight_adjust;
503-
char wasign;
504-
char trunc;
505-
/* These are parser state and must be removed. */
506-
char prev;
507-
char *quot;
508-
} MYSQL_FTPARSER_BOOLEAN_INFO;
509-
510-
/*
511-
The following flag means that buffer with a string (document, word)
512-
may be overwritten by the caller before the end of the parsing (that is
513-
before st_mysql_ftparser::deinit() call). If one needs the string
514-
to survive between two successive calls of the parsing function, she
515-
needs to save a copy of it. The flag may be set by MySQL before calling
516-
st_mysql_ftparser::parse(), or it may be set by a plugin before calling
517-
st_mysql_ftparser_param::mysql_parse() or
518-
st_mysql_ftparser_param::mysql_add_word().
519-
*/
520-
#define MYSQL_FTFLAGS_NEED_COPY 1
521-
522-
/*
523-
An argument of the full-text parser plugin. This structure is
524-
filled in by MySQL server and passed to the parsing function of the
525-
plugin as an in/out parameter.
526-
527-
mysql_parse: A pointer to the built-in parser implementation of the
528-
server. It's set by the server and can be used by the parser plugin
529-
to invoke the MySQL default parser. If plugin's role is to extract
530-
textual data from .doc, .pdf or .xml content, it might extract
531-
plaintext from the content, and then pass the text to the default
532-
MySQL parser to be parsed.
533-
534-
mysql_add_word: A server callback to add a new word. When parsing
535-
a document, the server sets this to point at a function that adds
536-
the word to MySQL full-text index. When parsing a search query,
537-
this function will add the new word to the list of words to search
538-
for. The boolean_info argument can be NULL for all cases except
539-
when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
540426

541-
ftparser_state: A generic pointer. The plugin can set it to point
542-
to information to be used internally for its own purposes.
543-
544-
mysql_ftparam: This is set by the server. It is used by MySQL functions
545-
called via mysql_parse() and mysql_add_word() callback. The plugin
546-
should not modify it.
547-
548-
cs: Information about the character set of the document or query string.
549-
550-
doc: A pointer to the document or query string to be parsed.
551-
552-
length: Length of the document or query string, in bytes.
553-
554-
flags: See MYSQL_FTFLAGS_* constants above.
555-
556-
mode: The parsing mode. With boolean operators, with stopwords, or
557-
nothing. See enum_ftparser_mode above.
427+
/*************************************************************************
428+
API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
558429
*/
559430

560-
typedef struct st_mysql_ftparser_param
561-
{
562-
int (*mysql_parse)(struct st_mysql_ftparser_param *,
563-
char *doc, int doc_len);
564-
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
565-
char *word, int word_len,
566-
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
567-
void *ftparser_state;
568-
void *mysql_ftparam;
569-
struct charset_info_st *cs;
570-
char *doc;
571-
int length;
572-
int flags;
573-
enum enum_ftparser_mode mode;
574-
} MYSQL_FTPARSER_PARAM;
431+
/* handlertons of different MySQL releases are incompatible */
432+
#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
575433

576434
/*
577-
Full-text parser descriptor.
578-
579-
interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION.
580-
The parsing, initialization, and deinitialization functions are
581-
invoked per SQL statement for which the parser is used.
435+
Here we define only the descriptor structure, that is referred from
436+
st_mysql_plugin.
582437
*/
583438

584-
struct st_mysql_ftparser
439+
struct st_mysql_information_schema
585440
{
586441
int interface_version;
587-
int (*parse)(MYSQL_FTPARSER_PARAM *param);
588-
int (*init)(MYSQL_FTPARSER_PARAM *param);
589-
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
590442
};
591443

592-
/*************************************************************************
593-
API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
594-
*/
595-
596-
/* handlertons of different MySQL releases are incompatible */
597-
#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
598-
599-
/*************************************************************************
600-
API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
601-
*/
602-
603-
/* handlertons of different MySQL releases are incompatible */
604-
#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
605444

606445
/*************************************************************************
607446
API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
@@ -623,25 +462,6 @@ struct st_mysql_storage_engine
623462

624463
struct handlerton;
625464

626-
/*
627-
Here we define only the descriptor structure, that is referred from
628-
st_mysql_plugin.
629-
*/
630-
631-
struct st_mysql_daemon
632-
{
633-
int interface_version;
634-
};
635-
636-
/*
637-
Here we define only the descriptor structure, that is referred from
638-
st_mysql_plugin.
639-
*/
640-
641-
struct st_mysql_information_schema
642-
{
643-
int interface_version;
644-
};
645465

646466
/*
647467
API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
@@ -655,7 +475,7 @@ struct st_mysql_information_schema
655475
int interface_version;
656476
};
657477

658-
/*
478+
/*************************************************************************
659479
st_mysql_value struct for reading values from mysqld.
660480
Used by server variables framework to parse user-provided values.
661481
Will be used for arguments when implementing UDFs.

include/mysql/plugin.h.pp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
struct st_mysql_sys_var **system_vars;
7777
void * __reserved1;
7878
};
79+
#include "plugin_ftparser.h"
80+
#include "plugin.h"
7981
enum enum_ftparser_mode
8082
{
8183
MYSQL_FTPARSER_SIMPLE_MODE= 0,
@@ -122,19 +124,19 @@
122124
int (*init)(MYSQL_FTPARSER_PARAM *param);
123125
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
124126
};
125-
struct st_mysql_storage_engine
127+
struct st_mysql_daemon
126128
{
127129
int interface_version;
128130
};
129-
struct handlerton;
130-
struct st_mysql_daemon
131+
struct st_mysql_information_schema
131132
{
132133
int interface_version;
133134
};
134-
struct st_mysql_information_schema
135+
struct st_mysql_storage_engine
135136
{
136137
int interface_version;
137138
};
139+
struct handlerton;
138140
struct Mysql_replication {
139141
int interface_version;
140142
};

0 commit comments

Comments
 (0)