Skip to content

Commit 54f16ed

Browse files
committed
WL#9264 - XPlugin sockets and memory monitoring in performance schema
Approved by Tarique Saleem<[email protected]>
1 parent 36024b4 commit 54f16ed

File tree

81 files changed

+3799
-418
lines changed

Some content is hidden

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

81 files changed

+3799
-418
lines changed

mysql-test/collections/mysql-5.7-wl9306.push

Lines changed: 0 additions & 3 deletions
This file was deleted.

mysql-test/collections/mysql-5.7-xplugin.push

Lines changed: 0 additions & 3 deletions
This file was deleted.

mysql-test/collections/mysql-5.7-xplugin.push-valgrind

Lines changed: 0 additions & 1 deletion
This file was deleted.

rapid/plugin/x/mysqlxtest_src/common/expr_parser.cc

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void Expr_parser::paren_expr_list(::google::protobuf::RepeatedPtrField< ::Mysqlx
131131
_tokenizer.consume_token(Token::LPAREN);
132132
if (!_tokenizer.cur_token_type_is(Token::RPAREN))
133133
{
134-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr ptr(my_expr());
134+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr ptr(my_expr());
135135
expr_list->AddAllocated(ptr.get());
136136
ptr.release();
137137
while (_tokenizer.cur_token_type_is(Token::COMMA))
@@ -151,7 +151,7 @@ void Expr_parser::paren_expr_list(::google::protobuf::RepeatedPtrField< ::Mysqlx
151151
Mysqlx::Expr::Identifier* Expr_parser::identifier()
152152
{
153153
_tokenizer.assert_cur_token(Token::IDENT);
154-
Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(new Mysqlx::Expr::Identifier());
154+
ngs::Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(new Mysqlx::Expr::Identifier());
155155
if (_tokenizer.next_token_type(Token::DOT))
156156
{
157157
const std::string& schema_name = _tokenizer.consume_token(Token::IDENT);
@@ -168,10 +168,10 @@ Mysqlx::Expr::Identifier* Expr_parser::identifier()
168168
*/
169169
Mysqlx::Expr::Expr* Expr_parser::function_call()
170170
{
171-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
171+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
172172
e->set_type(Mysqlx::Expr::Expr::FUNC_CALL);
173173
Mysqlx::Expr::FunctionCall* func = e->mutable_function_call();
174-
Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(identifier());
174+
ngs::Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(identifier());
175175
func->set_allocated_name(id.get());
176176
id.release();
177177

@@ -288,7 +288,7 @@ const std::string& Expr_parser::id()
288288
*/
289289
Mysqlx::Expr::Expr* Expr_parser::column_field()
290290
{
291-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
291+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
292292
std::vector<std::string> parts;
293293
const std::string& part = id();
294294

@@ -342,7 +342,7 @@ Mysqlx::Expr::Expr* Expr_parser::column_field()
342342
*/
343343
Mysqlx::Expr::Expr* Expr_parser::document_field()
344344
{
345-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
345+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
346346

347347
if (_tokenizer.cur_token_type_is(Token::DOLLAR))
348348
_tokenizer.consume_token(Token::DOLLAR);
@@ -378,7 +378,7 @@ Mysqlx::Expr::Expr* Expr_parser::atomic_expr()
378378
}
379379
else if (type == Token::LPAREN)
380380
{
381-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(my_expr());
381+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(my_expr());
382382
_tokenizer.consume_token(Token::RPAREN);
383383
return e.release();
384384
}
@@ -398,8 +398,8 @@ Mysqlx::Expr::Expr* Expr_parser::atomic_expr()
398398
}
399399
else if (type == Token::PLUS || type == Token::MINUS || type == Token::NOT || type == Token::NEG)
400400
{
401-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(atomic_expr());
402-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(Expr_builder::build_unary_op(t.get_text(), tmp.get()));
401+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(atomic_expr());
402+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(Expr_builder::build_unary_op(t.get_text(), tmp.get()));
403403
tmp.release();
404404
return result.release();
405405
}
@@ -429,8 +429,8 @@ Mysqlx::Expr::Expr* Expr_parser::atomic_expr()
429429
}
430430
else if (type == Token::INTERVAL)
431431
{
432-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
433-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr operand(NULL);
432+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
433+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr operand(NULL);
434434
e->set_type(Mysqlx::Expr::Expr::OPERATOR);
435435
operand.reset(my_expr());
436436

@@ -449,7 +449,7 @@ Mysqlx::Expr::Expr* Expr_parser::atomic_expr()
449449
throw Parser_error((boost::format("Expected interval units at %d (%s)") % tok.get_pos() % tok.get_text()).str());
450450
}
451451
const Token& val = _tokenizer.consume_any_token();
452-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr param(Expr_builder::build_literal_expr(Expr_builder::build_string_scalar(val.get_text())));
452+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr param(Expr_builder::build_literal_expr(Expr_builder::build_string_scalar(val.get_text())));
453453
e->mutable_operator_()->mutable_param()->AddAllocated(param.get());
454454
param.release();
455455
return e.release();
@@ -517,7 +517,7 @@ Mysqlx::Expr::Expr* Expr_parser::atomic_expr()
517517
*/
518518
Mysqlx::Expr::Expr* Expr_parser::array_()
519519
{
520-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
520+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
521521

522522
result->set_type(Mysqlx::Expr::Expr_Type_ARRAY);
523523
Mysqlx::Expr::Array* a = result->mutable_array();
@@ -526,7 +526,7 @@ Mysqlx::Expr::Expr* Expr_parser::array_()
526526

527527
if (!_tokenizer.cur_token_type_is(Token::RSQBRACKET))
528528
{
529-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(my_expr());
529+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(my_expr());
530530
Mysqlx::Expr::Expr *item = a->add_value();
531531
item->CopyFrom(*e);
532532
e.reset();
@@ -562,7 +562,7 @@ void Expr_parser::json_key_value(Mysqlx::Expr::Object* obj)
562562
*/
563563
Mysqlx::Expr::Expr* Expr_parser::json_doc()
564564
{
565-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
565+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
566566
Mysqlx::Expr::Object* obj = result->mutable_object();
567567
result->set_type(Mysqlx::Expr::Expr_Type_OBJECT);
568568
_tokenizer.consume_token(Token::LCURLY);
@@ -584,7 +584,7 @@ Mysqlx::Expr::Expr* Expr_parser::json_doc()
584584
*/
585585
Mysqlx::Expr::Expr* Expr_parser::placeholder()
586586
{
587-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
587+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
588588
result->set_type(Mysqlx::Expr::Expr_Type_PLACEHOLDER);
589589

590590
std::string placeholder_name;
@@ -625,12 +625,12 @@ Mysqlx::Expr::Expr* Expr_parser::cast()
625625
{
626626
_tokenizer.consume_token(Token::CAST);
627627
_tokenizer.consume_token(Token::LPAREN);
628-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(my_expr());
629-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
628+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(my_expr());
629+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(new Mysqlx::Expr::Expr());
630630
// function
631631
result->set_type(Mysqlx::Expr::Expr::FUNC_CALL);
632632
Mysqlx::Expr::FunctionCall* func = result->mutable_function_call();
633-
Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(new Mysqlx::Expr::Identifier());
633+
ngs::Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(new Mysqlx::Expr::Identifier());
634634
id->set_name(std::string("cast"));
635635
func->set_allocated_name(id.release());
636636
// params
@@ -640,7 +640,7 @@ Mysqlx::Expr::Expr* Expr_parser::cast()
640640
params->AddAllocated(e.release());
641641
// 2nd arg, cast_data_type
642642
const std::string& type_to_cast = cast_data_type();
643-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr type_expr(new Mysqlx::Expr::Expr());
643+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr type_expr(new Mysqlx::Expr::Expr());
644644
type_expr->set_type(Mysqlx::Expr::Expr::LITERAL);
645645
Mysqlx::Datatypes::Scalar* sc(type_expr->mutable_literal());
646646
sc->set_type(Mysqlx::Datatypes::Scalar_Type_V_OCTETS);
@@ -826,10 +826,10 @@ Mysqlx::Expr::Expr *Expr_parser::binary()
826826
// binary
827827
_tokenizer.consume_token(Token::BINARY);
828828

829-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
829+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
830830
e->set_type(Mysqlx::Expr::Expr::FUNC_CALL);
831831
Mysqlx::Expr::FunctionCall* func = e->mutable_function_call();
832-
Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(new Mysqlx::Expr::Identifier());
832+
ngs::Memory_new<Mysqlx::Expr::Identifier>::Unique_ptr id(new Mysqlx::Expr::Identifier());
833833
id->set_name(std::string("binary"));
834834
func->set_allocated_name(id.release());
835835
::google::protobuf::RepeatedPtrField< ::Mysqlx::Expr::Expr >* params = func->mutable_param();
@@ -842,10 +842,10 @@ Mysqlx::Expr::Expr *Expr_parser::binary()
842842
Mysqlx::Expr::Expr* Expr_parser::parse_left_assoc_binary_op_expr(std::set<Token::TokenType>& types, inner_parser_t inner_parser)
843843
{
844844
// Given a `set' of types and an Expr-returning inner parser function, parse a left associate binary operator expression
845-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr lhs(inner_parser(this));
845+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr lhs(inner_parser(this));
846846
while (_tokenizer.tokens_available() && _tokenizer.is_type_within_set(types))
847847
{
848-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
848+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
849849
e->set_type(Mysqlx::Expr::Expr::OPERATOR);
850850
const Token &t = _tokenizer.consume_any_token();
851851
const std::string& op_val = t.get_text();
@@ -855,7 +855,7 @@ Mysqlx::Expr::Expr* Expr_parser::parse_left_assoc_binary_op_expr(std::set<Token:
855855
op->mutable_param()->AddAllocated(lhs.get());
856856
lhs.release();
857857

858-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(inner_parser(this));
858+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(inner_parser(this));
859859
op->mutable_param()->AddAllocated(tmp.get());
860860
tmp.release();
861861
lhs.release();
@@ -910,8 +910,8 @@ Mysqlx::Expr::Expr* Expr_parser::comp_expr()
910910
*/
911911
Mysqlx::Expr::Expr* Expr_parser::ilri_expr()
912912
{
913-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
914-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr lhs(comp_expr());
913+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr e(new Mysqlx::Expr::Expr());
914+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr lhs(comp_expr());
915915
bool is_not = false;
916916
if (_tokenizer.cur_token_type_is(Token::NOT))
917917
{
@@ -934,7 +934,7 @@ Mysqlx::Expr::Expr* Expr_parser::ilri_expr()
934934
is_not = true;
935935
_tokenizer.consume_token(Token::NOT);
936936
}
937-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
937+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
938938
params->AddAllocated(lhs.get());
939939
params->AddAllocated(tmp.get());
940940
tmp.release();
@@ -946,7 +946,7 @@ Mysqlx::Expr::Expr* Expr_parser::ilri_expr()
946946
if (_tokenizer.cur_token_type_is(Token::LSQBRACKET))
947947
{
948948
_tokenizer.consume_token(Token::LSQBRACKET);
949-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr ptr(my_expr());
949+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr ptr(my_expr());
950950
params->AddAllocated(ptr.get());
951951
ptr.release();
952952
while (_tokenizer.cur_token_type_is(Token::COMMA))
@@ -966,7 +966,7 @@ Mysqlx::Expr::Expr* Expr_parser::ilri_expr()
966966
else if (_tokenizer.cur_token_type_is(Token::LIKE))
967967
{
968968
_tokenizer.consume_token(Token::LIKE);
969-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
969+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
970970
params->AddAllocated(lhs.get());
971971
params->AddAllocated(tmp.get());
972972
tmp.release();
@@ -982,7 +982,7 @@ Mysqlx::Expr::Expr* Expr_parser::ilri_expr()
982982
{
983983
_tokenizer.consume_token(Token::BETWEEN);
984984
params->AddAllocated(lhs.get());
985-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
985+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
986986
params->AddAllocated(tmp.get());
987987
tmp.release();
988988
_tokenizer.consume_token(Token::AND);
@@ -993,7 +993,7 @@ Mysqlx::Expr::Expr* Expr_parser::ilri_expr()
993993
else if (_tokenizer.cur_token_type_is(Token::REGEXP))
994994
{
995995
_tokenizer.consume_token(Token::REGEXP);
996-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
996+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr tmp(comp_expr());
997997
params->AddAllocated(lhs.get());
998998
params->AddAllocated(tmp.get());
999999
tmp.release();
@@ -1057,7 +1057,7 @@ Mysqlx::Expr::Expr* Expr_parser::my_expr()
10571057
*/
10581058
Mysqlx::Expr::Expr* Expr_parser::expr()
10591059
{
1060-
Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(or_expr());
1060+
ngs::Memory_new<Mysqlx::Expr::Expr>::Unique_ptr result(or_expr());
10611061
if (_tokenizer.tokens_available())
10621062
{
10631063
const Token& tok = _tokenizer.peek_token();
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* This program is free software; you can redistribute it and/or
5+
* modify it under the terms of the GNU General Public License as
6+
* published by the Free Software Foundation; version 2 of the
7+
* License.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17+
* 02110-1301 USA
18+
*/
19+
20+
// MySQL DB access module, for use by plugins and others
21+
// For the module that implements interactive DB functionality see mod_db
22+
23+
#ifndef _DUMMY_STREAM_H_
24+
#define _DUMMY_STREAM_H_
25+
26+
#include <iostream>
27+
28+
class Dummy_stream: public std::ostream
29+
{
30+
public:
31+
Dummy_stream()
32+
: std::ostream(&m_streambuf)
33+
{
34+
}
35+
36+
private:
37+
class Dummy_streambuf : public std::streambuf
38+
{
39+
public:
40+
std::streamsize xsputn (const char * s, std::streamsize n)
41+
{
42+
return n;
43+
}
44+
45+
int overflow (int c)
46+
{
47+
return 1;
48+
}
49+
};
50+
51+
Dummy_streambuf m_streambuf;
52+
};
53+
54+
#endif

rapid/plugin/x/mysqlxtest_src/mysqlx_connection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <sys/un.h>
2828
#endif // HAVE_SYS_UN_H
2929

30-
#ifdef WIN32
30+
#ifdef WIN32
3131
# define snprintf _snprintf
3232
#endif // WIN32
3333

rapid/plugin/x/mysqlxtest_src/mysqlx_protocol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ namespace mysqlx
205205
ca(NULL),
206206
ca_path(NULL),
207207
cert(NULL),
208-
cipher(NULL)
208+
cipher(NULL),
209+
tls_version(NULL)
209210
{
210-
tls_version = NULL;
211211
}
212212

213213
const char *key;

0 commit comments

Comments
 (0)