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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2fb68244
Commit
2fb68244
authored
Aug 01, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.0 into 10.1
parents
87ec6a04
a7f84f09
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
124 additions
and
40 deletions
+124
-40
mysql-test/suite/innodb_fts/r/fts_kill_query.result
mysql-test/suite/innodb_fts/r/fts_kill_query.result
+6
-0
mysql-test/suite/innodb_fts/t/fts_kill_query.test
mysql-test/suite/innodb_fts/t/fts_kill_query.test
+30
-0
storage/innobase/fts/fts0ast.cc
storage/innobase/fts/fts0ast.cc
+8
-1
storage/innobase/fts/fts0pars.cc
storage/innobase/fts/fts0pars.cc
+8
-8
storage/innobase/fts/fts0pars.y
storage/innobase/fts/fts0pars.y
+8
-8
storage/innobase/fts/fts0que.cc
storage/innobase/fts/fts0que.cc
+16
-1
storage/innobase/include/fts0ast.h
storage/innobase/include/fts0ast.h
+4
-2
storage/xtradb/fts/fts0ast.cc
storage/xtradb/fts/fts0ast.cc
+8
-1
storage/xtradb/fts/fts0pars.cc
storage/xtradb/fts/fts0pars.cc
+8
-8
storage/xtradb/fts/fts0pars.y
storage/xtradb/fts/fts0pars.y
+8
-8
storage/xtradb/fts/fts0que.cc
storage/xtradb/fts/fts0que.cc
+16
-1
storage/xtradb/include/fts0ast.h
storage/xtradb/include/fts0ast.h
+4
-2
No files found.
mysql-test/suite/innodb_fts/r/fts_kill_query.result
0 → 100644
View file @
2fb68244
CREATE TABLE t1 (a VARCHAR(7), b text, FULLTEXT KEY idx (a,b)) ENGINE=InnoDB;
COMMIT;
SELECT COUNT(*) FROM t1
WHERE MATCH (a,b) AGAINST ('foo bar' IN BOOLEAN MODE);
KILL QUERY @id;
DROP TABLE t1;
mysql-test/suite/innodb_fts/t/fts_kill_query.test
0 → 100644
View file @
2fb68244
--
source
include
/
have_innodb
.
inc
CREATE
TABLE
t1
(
a
VARCHAR
(
7
),
b
text
,
FULLTEXT
KEY
idx
(
a
,
b
))
ENGINE
=
InnoDB
;
--
disable_query_log
BEGIN
;
let
$n
=
1000
;
while
(
$n
)
{
INSERT
INTO
t1
VALUES
(
'foo bar'
,
'boo far'
);
dec
$n
;
}
--
enable_query_log
COMMIT
;
let
$id
=
`SELECT CONNECTION_ID()`
;
send
SELECT
COUNT
(
*
)
FROM
t1
WHERE
MATCH
(
a
,
b
)
AGAINST
(
'foo bar'
IN
BOOLEAN
MODE
);
connect
(
con1
,
localhost
,
root
,,);
let
$ignore
=
`SELECT @id := $ID`
;
KILL
QUERY
@
id
;
disconnect
con1
;
connection
default
;
# The following would return a result set if the KILL was not fast enough.
--
disable_result_log
--
error
0
,
ER_QUERY_INTERRUPTED
,
HA_ERR_ABORTED_BY_USER
reap
;
--
enable_result_log
DROP
TABLE
t1
;
storage/innobase/fts/fts0ast.cc
View file @
2fb68244
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
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
the terms of the GNU General Public License as published by the Free Software
...
@@ -27,6 +28,7 @@ Created 2007/3/16 Sunny Bains.
...
@@ -27,6 +28,7 @@ Created 2007/3/16 Sunny Bains.
#include "fts0ast.h"
#include "fts0ast.h"
#include "fts0pars.h"
#include "fts0pars.h"
#include "fts0fts.h"
#include "fts0fts.h"
#include "row0sel.h"
/* The FTS ast visit pass. */
/* The FTS ast visit pass. */
enum
fts_ast_visit_pass_t
{
enum
fts_ast_visit_pass_t
{
...
@@ -498,6 +500,7 @@ fts_ast_visit(
...
@@ -498,6 +500,7 @@ fts_ast_visit(
bool
revisit
=
false
;
bool
revisit
=
false
;
bool
will_be_ignored
=
false
;
bool
will_be_ignored
=
false
;
fts_ast_visit_pass_t
visit_pass
=
FTS_PASS_FIRST
;
fts_ast_visit_pass_t
visit_pass
=
FTS_PASS_FIRST
;
const
trx_t
*
trx
=
node
->
trx
;
start_node
=
node
->
list
.
head
;
start_node
=
node
->
list
.
head
;
...
@@ -596,6 +599,10 @@ fts_ast_visit(
...
@@ -596,6 +599,10 @@ fts_ast_visit(
}
}
}
}
if
(
trx_is_interrupted
(
trx
))
{
return
DB_INTERRUPTED
;
}
if
(
revisit
)
{
if
(
revisit
)
{
/* Exist pass processes the skipped FTS_EXIST operation. */
/* Exist pass processes the skipped FTS_EXIST operation. */
for
(
node
=
start_node
;
for
(
node
=
start_node
;
...
...
storage/innobase/fts/fts0pars.cc
View file @
2fb68244
...
@@ -87,7 +87,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
...
@@ -87,7 +87,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
extern
int
fts_blexer
(
YYSTYPE
*
,
yyscan_t
);
extern
int
fts_blexer
(
YYSTYPE
*
,
yyscan_t
);
extern
int
fts_tlexer
(
YYSTYPE
*
,
yyscan_t
);
extern
int
fts_tlexer
(
YYSTYPE
*
,
yyscan_t
);
typedef
int
(
*
fts_scan
)();
extern
int
ftserror
(
const
char
*
p
);
extern
int
ftserror
(
const
char
*
p
);
...
@@ -102,8 +102,8 @@ extern int ftserror(const char* p);
...
@@ -102,8 +102,8 @@ extern int ftserror(const char* p);
#define YYTOKENFREE(token) fts_ast_string_free((token))
#define YYTOKENFREE(token) fts_ast_string_free((token))
typedef
int
(
*
fts_scanner_alt
)(
YYSTYPE
*
val
,
yyscan_t
yyscanner
);
typedef
int
(
*
fts_scanner
)();
typedef
int
(
*
fts_scanner
)(
YYSTYPE
*
val
,
yyscan_t
yyscanner
);
struct
fts_lexer_t
{
struct
fts_lexer_t
{
fts_scanner
scanner
;
fts_scanner
scanner
;
...
@@ -1950,7 +1950,7 @@ fts_lexer_create(
...
@@ -1950,7 +1950,7 @@ fts_lexer_create(
reinterpret_cast
<
const
char
*>
(
query
),
reinterpret_cast
<
const
char
*>
(
query
),
static_cast
<
int
>
(
query_len
),
static_cast
<
int
>
(
query_len
),
fts_lexer
->
yyscanner
);
fts_lexer
->
yyscanner
);
fts_lexer
->
scanner
=
reinterpret_cast
<
fts_scan
>
(
fts_blexer
)
;
fts_lexer
->
scanner
=
fts_blexer
;
/* FIXME: Debugging */
/* FIXME: Debugging */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
}
else
{
}
else
{
...
@@ -1959,7 +1959,7 @@ fts_lexer_create(
...
@@ -1959,7 +1959,7 @@ fts_lexer_create(
reinterpret_cast
<
const
char
*>
(
query
),
reinterpret_cast
<
const
char
*>
(
query
),
static_cast
<
int
>
(
query_len
),
static_cast
<
int
>
(
query_len
),
fts_lexer
->
yyscanner
);
fts_lexer
->
yyscanner
);
fts_lexer
->
scanner
=
reinterpret_cast
<
fts_scan
>
(
fts_tlexer
)
;
fts_lexer
->
scanner
=
fts_tlexer
;
}
}
return
(
fts_lexer
);
return
(
fts_lexer
);
...
@@ -1973,7 +1973,7 @@ fts_lexer_free(
...
@@ -1973,7 +1973,7 @@ fts_lexer_free(
/*===========*/
/*===========*/
fts_lexer_t
*
fts_lexer
)
fts_lexer_t
*
fts_lexer
)
{
{
if
(
fts_lexer
->
scanner
==
(
fts_scan
)
fts_blexer
)
{
if
(
fts_lexer
->
scanner
==
fts_blexer
)
{
fts0blex_destroy
(
fts_lexer
->
yyscanner
);
fts0blex_destroy
(
fts_lexer
->
yyscanner
);
}
else
{
}
else
{
fts0tlex_destroy
(
fts_lexer
->
yyscanner
);
fts0tlex_destroy
(
fts_lexer
->
yyscanner
);
...
@@ -1991,9 +1991,9 @@ fts_lexer(
...
@@ -1991,9 +1991,9 @@ fts_lexer(
YYSTYPE
*
val
,
YYSTYPE
*
val
,
fts_lexer_t
*
fts_lexer
)
fts_lexer_t
*
fts_lexer
)
{
{
fts_scanner
_alt
func_ptr
;
fts_scanner
func_ptr
;
func_ptr
=
(
fts_scanner_alt
)
fts_lexer
->
scanner
;
func_ptr
=
fts_lexer
->
scanner
;
return
(
func_ptr
(
val
,
fts_lexer
->
yyscanner
));
return
(
func_ptr
(
val
,
fts_lexer
->
yyscanner
));
}
}
...
...
storage/innobase/fts/fts0pars.y
View file @
2fb68244
...
@@ -35,7 +35,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
...
@@ -35,7 +35,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
extern int fts_blexer(YYSTYPE*, yyscan_t);
extern int fts_blexer(YYSTYPE*, yyscan_t);
extern int fts_tlexer(YYSTYPE*, yyscan_t);
extern int fts_tlexer(YYSTYPE*, yyscan_t);
typedef int (*fts_scan)();
extern int ftserror(const char* p);
extern int ftserror(const char* p);
...
@@ -48,8 +48,8 @@ extern int ftserror(const char* p);
...
@@ -48,8 +48,8 @@ extern int ftserror(const char* p);
#define YYPARSE_PARAM state
#define YYPARSE_PARAM state
#define YYLEX_PARAM ((fts_ast_state_t*) state)->lexer
#define YYLEX_PARAM ((fts_ast_state_t*) state)->lexer
typedef int (*fts_scanner_alt)(YYSTYPE* val, yyscan_t yyscanner);
typedef int (*fts_scanner)();
typedef int (*fts_scanner)(
YYSTYPE* val, yyscan_t yyscanner
);
struct fts_lexer_struct {
struct fts_lexer_struct {
fts_scanner scanner;
fts_scanner scanner;
...
@@ -238,13 +238,13 @@ fts_lexer_create(
...
@@ -238,13 +238,13 @@ fts_lexer_create(
if (boolean_mode) {
if (boolean_mode) {
fts0blex_init(&fts_lexer->yyscanner);
fts0blex_init(&fts_lexer->yyscanner);
fts0b_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts0b_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts_lexer->scanner =
(fts_scan)
fts_blexer;
fts_lexer->scanner = fts_blexer;
/* FIXME: Debugging */
/* FIXME: Debugging */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
} else {
} else {
fts0tlex_init(&fts_lexer->yyscanner);
fts0tlex_init(&fts_lexer->yyscanner);
fts0t_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts0t_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts_lexer->scanner =
(fts_scan)
fts_tlexer;
fts_lexer->scanner = fts_tlexer;
}
}
return(fts_lexer);
return(fts_lexer);
...
@@ -258,7 +258,7 @@ fts_lexer_free(
...
@@ -258,7 +258,7 @@ fts_lexer_free(
/*===========*/
/*===========*/
fts_lexer_t* fts_lexer)
fts_lexer_t* fts_lexer)
{
{
if (fts_lexer->scanner ==
(fts_scan)
fts_blexer) {
if (fts_lexer->scanner == fts_blexer) {
fts0blex_destroy(fts_lexer->yyscanner);
fts0blex_destroy(fts_lexer->yyscanner);
} else {
} else {
fts0tlex_destroy(fts_lexer->yyscanner);
fts0tlex_destroy(fts_lexer->yyscanner);
...
@@ -276,9 +276,9 @@ fts_lexer(
...
@@ -276,9 +276,9 @@ fts_lexer(
YYSTYPE* val,
YYSTYPE* val,
fts_lexer_t* fts_lexer)
fts_lexer_t* fts_lexer)
{
{
fts_scanner
_alt
func_ptr;
fts_scanner func_ptr;
func_ptr =
(fts_scanner_alt)
fts_lexer->scanner;
func_ptr = fts_lexer->scanner;
return(func_ptr(val, fts_lexer->yyscanner));
return(func_ptr(val, fts_lexer->yyscanner));
}
}
...
...
storage/innobase/fts/fts0que.cc
View file @
2fb68244
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2007, 201
7
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
This program is free software; you can redistribute it and/or modify it under
...
@@ -3970,6 +3970,7 @@ fts_query(
...
@@ -3970,6 +3970,7 @@ fts_query(
/* Parse the input query string. */
/* Parse the input query string. */
if
(
fts_query_parse
(
&
query
,
lc_query_str
,
result_len
))
{
if
(
fts_query_parse
(
&
query
,
lc_query_str
,
result_len
))
{
fts_ast_node_t
*
ast
=
query
.
root
;
fts_ast_node_t
*
ast
=
query
.
root
;
ast
->
trx
=
trx
;
/* Optimize query to check if it's a single term */
/* Optimize query to check if it's a single term */
fts_query_can_optimize
(
&
query
,
flags
);
fts_query_can_optimize
(
&
query
,
flags
);
...
@@ -3983,6 +3984,11 @@ fts_query(
...
@@ -3983,6 +3984,11 @@ fts_query(
query
.
error
=
fts_ast_visit
(
query
.
error
=
fts_ast_visit
(
FTS_NONE
,
ast
,
fts_query_visitor
,
FTS_NONE
,
ast
,
fts_query_visitor
,
&
query
,
&
will_be_ignored
);
&
query
,
&
will_be_ignored
);
if
(
query
.
error
==
DB_INTERRUPTED
)
{
error
=
DB_INTERRUPTED
;
ut_free
(
lc_query_str
);
goto
func_exit
;
}
/* If query expansion is requested, extend the search
/* If query expansion is requested, extend the search
with first search pass result */
with first search pass result */
...
@@ -4010,6 +4016,15 @@ fts_query(
...
@@ -4010,6 +4016,15 @@ fts_query(
memset
(
*
result
,
0
,
sizeof
(
**
result
));
memset
(
*
result
,
0
,
sizeof
(
**
result
));
}
}
if
(
trx_is_interrupted
(
trx
))
{
error
=
DB_INTERRUPTED
;
ut_free
(
lc_query_str
);
if
(
result
!=
NULL
)
{
fts_query_free_result
(
*
result
);
}
goto
func_exit
;
}
ut_free
(
lc_query_str
);
ut_free
(
lc_query_str
);
if
(
fts_enable_diag_print
&&
(
*
result
))
{
if
(
fts_enable_diag_print
&&
(
*
result
))
{
...
...
storage/innobase/include/fts0ast.h
View file @
2fb68244
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2007, 201
6
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation.
Copyright (c) 2016,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
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
the terms of the GNU General Public License as published by the Free Software
...
@@ -317,6 +317,8 @@ struct fts_ast_node_t {
...
@@ -317,6 +317,8 @@ struct fts_ast_node_t {
fts_ast_node_t
*
next_alloc
;
/*!< For tracking allocations */
fts_ast_node_t
*
next_alloc
;
/*!< For tracking allocations */
bool
visited
;
/*!< whether this node is
bool
visited
;
/*!< whether this node is
already processed */
already processed */
/** current transaction */
const
trx_t
*
trx
;
};
};
/* To track state during parsing */
/* To track state during parsing */
...
...
storage/xtradb/fts/fts0ast.cc
View file @
2fb68244
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
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
the terms of the GNU General Public License as published by the Free Software
...
@@ -27,6 +28,7 @@ Created 2007/3/16 Sunny Bains.
...
@@ -27,6 +28,7 @@ Created 2007/3/16 Sunny Bains.
#include "fts0ast.h"
#include "fts0ast.h"
#include "fts0pars.h"
#include "fts0pars.h"
#include "fts0fts.h"
#include "fts0fts.h"
#include "row0sel.h"
/* The FTS ast visit pass. */
/* The FTS ast visit pass. */
enum
fts_ast_visit_pass_t
{
enum
fts_ast_visit_pass_t
{
...
@@ -498,6 +500,7 @@ fts_ast_visit(
...
@@ -498,6 +500,7 @@ fts_ast_visit(
bool
revisit
=
false
;
bool
revisit
=
false
;
bool
will_be_ignored
=
false
;
bool
will_be_ignored
=
false
;
fts_ast_visit_pass_t
visit_pass
=
FTS_PASS_FIRST
;
fts_ast_visit_pass_t
visit_pass
=
FTS_PASS_FIRST
;
const
trx_t
*
trx
=
node
->
trx
;
start_node
=
node
->
list
.
head
;
start_node
=
node
->
list
.
head
;
...
@@ -596,6 +599,10 @@ fts_ast_visit(
...
@@ -596,6 +599,10 @@ fts_ast_visit(
}
}
}
}
if
(
trx_is_interrupted
(
trx
))
{
return
DB_INTERRUPTED
;
}
if
(
revisit
)
{
if
(
revisit
)
{
/* Exist pass processes the skipped FTS_EXIST operation. */
/* Exist pass processes the skipped FTS_EXIST operation. */
for
(
node
=
start_node
;
for
(
node
=
start_node
;
...
...
storage/xtradb/fts/fts0pars.cc
View file @
2fb68244
...
@@ -87,7 +87,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
...
@@ -87,7 +87,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
extern
int
fts_blexer
(
YYSTYPE
*
,
yyscan_t
);
extern
int
fts_blexer
(
YYSTYPE
*
,
yyscan_t
);
extern
int
fts_tlexer
(
YYSTYPE
*
,
yyscan_t
);
extern
int
fts_tlexer
(
YYSTYPE
*
,
yyscan_t
);
typedef
int
(
*
fts_scan
)();
extern
int
ftserror
(
const
char
*
p
);
extern
int
ftserror
(
const
char
*
p
);
...
@@ -102,8 +102,8 @@ extern int ftserror(const char* p);
...
@@ -102,8 +102,8 @@ extern int ftserror(const char* p);
#define YYTOKENFREE(token) fts_ast_string_free((token))
#define YYTOKENFREE(token) fts_ast_string_free((token))
typedef
int
(
*
fts_scanner_alt
)(
YYSTYPE
*
val
,
yyscan_t
yyscanner
);
typedef
int
(
*
fts_scanner
)();
typedef
int
(
*
fts_scanner
)(
YYSTYPE
*
val
,
yyscan_t
yyscanner
);
struct
fts_lexer_t
{
struct
fts_lexer_t
{
fts_scanner
scanner
;
fts_scanner
scanner
;
...
@@ -1950,7 +1950,7 @@ fts_lexer_create(
...
@@ -1950,7 +1950,7 @@ fts_lexer_create(
reinterpret_cast
<
const
char
*>
(
query
),
reinterpret_cast
<
const
char
*>
(
query
),
static_cast
<
int
>
(
query_len
),
static_cast
<
int
>
(
query_len
),
fts_lexer
->
yyscanner
);
fts_lexer
->
yyscanner
);
fts_lexer
->
scanner
=
reinterpret_cast
<
fts_scan
>
(
fts_blexer
)
;
fts_lexer
->
scanner
=
fts_blexer
;
/* FIXME: Debugging */
/* FIXME: Debugging */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
}
else
{
}
else
{
...
@@ -1959,7 +1959,7 @@ fts_lexer_create(
...
@@ -1959,7 +1959,7 @@ fts_lexer_create(
reinterpret_cast
<
const
char
*>
(
query
),
reinterpret_cast
<
const
char
*>
(
query
),
static_cast
<
int
>
(
query_len
),
static_cast
<
int
>
(
query_len
),
fts_lexer
->
yyscanner
);
fts_lexer
->
yyscanner
);
fts_lexer
->
scanner
=
reinterpret_cast
<
fts_scan
>
(
fts_tlexer
)
;
fts_lexer
->
scanner
=
fts_tlexer
;
}
}
return
(
fts_lexer
);
return
(
fts_lexer
);
...
@@ -1973,7 +1973,7 @@ fts_lexer_free(
...
@@ -1973,7 +1973,7 @@ fts_lexer_free(
/*===========*/
/*===========*/
fts_lexer_t
*
fts_lexer
)
fts_lexer_t
*
fts_lexer
)
{
{
if
(
fts_lexer
->
scanner
==
(
fts_scan
)
fts_blexer
)
{
if
(
fts_lexer
->
scanner
==
fts_blexer
)
{
fts0blex_destroy
(
fts_lexer
->
yyscanner
);
fts0blex_destroy
(
fts_lexer
->
yyscanner
);
}
else
{
}
else
{
fts0tlex_destroy
(
fts_lexer
->
yyscanner
);
fts0tlex_destroy
(
fts_lexer
->
yyscanner
);
...
@@ -1991,9 +1991,9 @@ fts_lexer(
...
@@ -1991,9 +1991,9 @@ fts_lexer(
YYSTYPE
*
val
,
YYSTYPE
*
val
,
fts_lexer_t
*
fts_lexer
)
fts_lexer_t
*
fts_lexer
)
{
{
fts_scanner
_alt
func_ptr
;
fts_scanner
func_ptr
;
func_ptr
=
(
fts_scanner_alt
)
fts_lexer
->
scanner
;
func_ptr
=
fts_lexer
->
scanner
;
return
(
func_ptr
(
val
,
fts_lexer
->
yyscanner
));
return
(
func_ptr
(
val
,
fts_lexer
->
yyscanner
));
}
}
...
...
storage/xtradb/fts/fts0pars.y
View file @
2fb68244
...
@@ -35,7 +35,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
...
@@ -35,7 +35,7 @@ extern int fts_lexer(YYSTYPE*, fts_lexer_t*);
extern int fts_blexer(YYSTYPE*, yyscan_t);
extern int fts_blexer(YYSTYPE*, yyscan_t);
extern int fts_tlexer(YYSTYPE*, yyscan_t);
extern int fts_tlexer(YYSTYPE*, yyscan_t);
typedef int (*fts_scan)();
extern int ftserror(const char* p);
extern int ftserror(const char* p);
...
@@ -48,8 +48,8 @@ extern int ftserror(const char* p);
...
@@ -48,8 +48,8 @@ extern int ftserror(const char* p);
#define YYPARSE_PARAM state
#define YYPARSE_PARAM state
#define YYLEX_PARAM ((fts_ast_state_t*) state)->lexer
#define YYLEX_PARAM ((fts_ast_state_t*) state)->lexer
typedef int (*fts_scanner_alt)(YYSTYPE* val, yyscan_t yyscanner);
typedef int (*fts_scanner)();
typedef int (*fts_scanner)(
YYSTYPE* val, yyscan_t yyscanner
);
struct fts_lexer_struct {
struct fts_lexer_struct {
fts_scanner scanner;
fts_scanner scanner;
...
@@ -238,13 +238,13 @@ fts_lexer_create(
...
@@ -238,13 +238,13 @@ fts_lexer_create(
if (boolean_mode) {
if (boolean_mode) {
fts0blex_init(&fts_lexer->yyscanner);
fts0blex_init(&fts_lexer->yyscanner);
fts0b_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts0b_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts_lexer->scanner =
(fts_scan)
fts_blexer;
fts_lexer->scanner = fts_blexer;
/* FIXME: Debugging */
/* FIXME: Debugging */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
/* fts0bset_debug(1 , fts_lexer->yyscanner); */
} else {
} else {
fts0tlex_init(&fts_lexer->yyscanner);
fts0tlex_init(&fts_lexer->yyscanner);
fts0t_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts0t_scan_bytes((char*) query, query_len, fts_lexer->yyscanner);
fts_lexer->scanner =
(fts_scan)
fts_tlexer;
fts_lexer->scanner = fts_tlexer;
}
}
return(fts_lexer);
return(fts_lexer);
...
@@ -258,7 +258,7 @@ fts_lexer_free(
...
@@ -258,7 +258,7 @@ fts_lexer_free(
/*===========*/
/*===========*/
fts_lexer_t* fts_lexer)
fts_lexer_t* fts_lexer)
{
{
if (fts_lexer->scanner ==
(fts_scan)
fts_blexer) {
if (fts_lexer->scanner == fts_blexer) {
fts0blex_destroy(fts_lexer->yyscanner);
fts0blex_destroy(fts_lexer->yyscanner);
} else {
} else {
fts0tlex_destroy(fts_lexer->yyscanner);
fts0tlex_destroy(fts_lexer->yyscanner);
...
@@ -276,9 +276,9 @@ fts_lexer(
...
@@ -276,9 +276,9 @@ fts_lexer(
YYSTYPE* val,
YYSTYPE* val,
fts_lexer_t* fts_lexer)
fts_lexer_t* fts_lexer)
{
{
fts_scanner
_alt
func_ptr;
fts_scanner func_ptr;
func_ptr =
(fts_scanner_alt)
fts_lexer->scanner;
func_ptr = fts_lexer->scanner;
return(func_ptr(val, fts_lexer->yyscanner));
return(func_ptr(val, fts_lexer->yyscanner));
}
}
...
...
storage/xtradb/fts/fts0que.cc
View file @
2fb68244
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2007, 201
7
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
This program is free software; you can redistribute it and/or modify it under
...
@@ -3989,6 +3989,7 @@ fts_query(
...
@@ -3989,6 +3989,7 @@ fts_query(
/* Parse the input query string. */
/* Parse the input query string. */
if
(
fts_query_parse
(
&
query
,
lc_query_str
,
result_len
))
{
if
(
fts_query_parse
(
&
query
,
lc_query_str
,
result_len
))
{
fts_ast_node_t
*
ast
=
query
.
root
;
fts_ast_node_t
*
ast
=
query
.
root
;
ast
->
trx
=
trx
;
/* Optimize query to check if it's a single term */
/* Optimize query to check if it's a single term */
fts_query_can_optimize
(
&
query
,
flags
);
fts_query_can_optimize
(
&
query
,
flags
);
...
@@ -4002,6 +4003,11 @@ fts_query(
...
@@ -4002,6 +4003,11 @@ fts_query(
query
.
error
=
fts_ast_visit
(
query
.
error
=
fts_ast_visit
(
FTS_NONE
,
ast
,
fts_query_visitor
,
FTS_NONE
,
ast
,
fts_query_visitor
,
&
query
,
&
will_be_ignored
);
&
query
,
&
will_be_ignored
);
if
(
query
.
error
==
DB_INTERRUPTED
)
{
error
=
DB_INTERRUPTED
;
ut_free
(
lc_query_str
);
goto
func_exit
;
}
/* If query expansion is requested, extend the search
/* If query expansion is requested, extend the search
with first search pass result */
with first search pass result */
...
@@ -4029,6 +4035,15 @@ fts_query(
...
@@ -4029,6 +4035,15 @@ fts_query(
memset
(
*
result
,
0
,
sizeof
(
**
result
));
memset
(
*
result
,
0
,
sizeof
(
**
result
));
}
}
if
(
trx_is_interrupted
(
trx
))
{
error
=
DB_INTERRUPTED
;
ut_free
(
lc_query_str
);
if
(
result
!=
NULL
)
{
fts_query_free_result
(
*
result
);
}
goto
func_exit
;
}
ut_free
(
lc_query_str
);
ut_free
(
lc_query_str
);
if
(
fts_enable_diag_print
&&
(
*
result
))
{
if
(
fts_enable_diag_print
&&
(
*
result
))
{
...
...
storage/xtradb/include/fts0ast.h
View file @
2fb68244
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2007, 201
6
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation.
Copyright (c) 2016,
2018,
MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
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
the terms of the GNU General Public License as published by the Free Software
...
@@ -317,6 +317,8 @@ struct fts_ast_node_t {
...
@@ -317,6 +317,8 @@ struct fts_ast_node_t {
fts_ast_node_t
*
next_alloc
;
/*!< For tracking allocations */
fts_ast_node_t
*
next_alloc
;
/*!< For tracking allocations */
bool
visited
;
/*!< whether this node is
bool
visited
;
/*!< whether this node is
already processed */
already processed */
/** current transaction */
const
trx_t
*
trx
;
};
};
/* To track state during parsing */
/* To track state during parsing */
...
...
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