[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] com =?UTF-8?Q?pecl/database/mysql=5Fxdevapi=3A=20WL=23=31=33=30=30=31=20D?= =?UTF-8?Q?evA
From: hery ramilison <mysqlre () php ! net>
Date: 2019-08-19 12:22:28
Message-ID: php-mail-39c46c1b0c3c0bd06b763afd5ac626731241536017 () git ! php ! net
[Download RAW message or body]
Commit: 3036f3a076e13be2c84fee32ba220849560dbca3
Author: Darek Slusarczyk <dariusz.slusarczyk@oracle.com> Mon, 19 Aug 2019 \
10:15:23 +0200
Parents: 4bb4759ecf4d49cfe20c153d8b11d783079d657b
Branches: master
Link: http://git.php.net/?p=pecl/database/mysql_xdevapi.git;a=commitdiff;h=3036f3a076e13be2c84fee32ba220849560dbca3
Log:
WL#13001 DevAPI: Connection compression
- tweak wire protocol code
- add session_data::create_message_factory wrapper on get_message_factory function
Bugs:
https://bugs.php.net/13001
Changed paths:
M xmysqlnd/xmysqlnd_collection.cc
M xmysqlnd/xmysqlnd_compression.cc
M xmysqlnd/xmysqlnd_session.cc
M xmysqlnd/xmysqlnd_session.h
M xmysqlnd/xmysqlnd_stmt.cc
M xmysqlnd/xmysqlnd_table.cc
M xmysqlnd/xmysqlnd_wireprotocol.cc
M xmysqlnd/xmysqlnd_wireprotocol.h
["diff_3036f3a076e13be2c84fee32ba220849560dbca3.txt" (text/plain)]
diff --git a/xmysqlnd/xmysqlnd_collection.cc b/xmysqlnd/xmysqlnd_collection.cc
index 14b483d..94ee25d 100644
--- a/xmysqlnd/xmysqlnd_collection.cc
+++ b/xmysqlnd/xmysqlnd_collection.cc
@@ -263,11 +263,8 @@ xmysqlnd_collection::add(XMYSQLND_CRUD_COLLECTION_OP__ADD * \
crud_op) DBG_ENTER("xmysqlnd_collection::add");
xmysqlnd_stmt* ret{nullptr};
XMYSQLND_SESSION session{ get_schema()->get_session() };
- struct st_xmysqlnd_message_factory msg_factory;
if( xmysqlnd_crud_collection_add__finalize_bind(crud_op) == PASS ) {
- msg_factory = xmysqlnd_get_message_factory(&session->data->io,
- session->data->stats,
- session->data->error_info);
+ st_xmysqlnd_message_factory msg_factory{ session->data->create_message_factory() \
}; st_xmysqlnd_msg__collection_add collection_add = \
msg_factory.get__collection_add(&msg_factory); enum_func_status request_ret = \
collection_add.send_request(&collection_add, \
xmysqlnd_crud_collection_add__get_protobuf_message(crud_op)); @@ -302,8 +299,7 @@ \
xmysqlnd_collection::remove(XMYSQLND_CRUD_COLLECTION_OP__REMOVE * op) \
DBG_RETURN(stmt); }
if (xmysqlnd_crud_collection_remove__is_initialized(op)) {
- st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io,
- session->data->stats, session->data->error_info);
+ st_xmysqlnd_message_factory msg_factory{ session->data->create_message_factory() \
}; struct st_xmysqlnd_msg__collection_ud collection_ud = \
msg_factory.get__collection_ud(&msg_factory); if (PASS == \
collection_ud.send_delete_request(&collection_ud, \
xmysqlnd_crud_collection_remove__get_protobuf_message(op))) { stmt = \
session->create_statement_object(session); @@ -362,7 +358,7 @@ \
xmysqlnd_collection::modify(XMYSQLND_CRUD_COLLECTION_OP__MODIFY * op) \
DBG_RETURN(stmt); }
if (xmysqlnd_crud_collection_modify__is_initialized(op)) {
- st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io, session->data->stats, \
session->data->error_info); + st_xmysqlnd_message_factory msg_factory{ \
session->data->create_message_factory() }; struct st_xmysqlnd_msg__collection_ud \
collection_ud = msg_factory.get__collection_ud(&msg_factory); if (PASS == \
collection_ud.send_update_request(&collection_ud, \
xmysqlnd_crud_collection_modify__get_protobuf_message(op))) { stmt = \
session->create_statement_object(session);
diff --git a/xmysqlnd/xmysqlnd_compression.cc b/xmysqlnd/xmysqlnd_compression.cc
index 75aa7e5..7343c69 100644
--- a/xmysqlnd/xmysqlnd_compression.cc
+++ b/xmysqlnd/xmysqlnd_compression.cc
@@ -346,9 +346,9 @@ bool Setup::negotiate()
// algorithms, server styles and client styles in the order how they should be \
negotiated const Algorithms algorithms{
Algorithm::lz4,
- Algorithm::zlib_deflate
+ Algorithm::zlib_deflate
};
-
+
const Server_styles server_styles{
Server_style::group,
Server_style::multiple,
@@ -435,7 +435,7 @@ Configuration::Configuration(
bool Configuration::enabled() const
{
- return (algorithm != Algorithm::none)
+ return (algorithm != Algorithm::none)
&& ((server_style != Server_style::none) || (client_style != Client_style::none));
}
diff --git a/xmysqlnd/xmysqlnd_session.cc b/xmysqlnd/xmysqlnd_session.cc
index 7d3b823..65dabfe 100644
--- a/xmysqlnd/xmysqlnd_session.cc
+++ b/xmysqlnd/xmysqlnd_session.cc
@@ -156,6 +156,18 @@ Session_auth_data::Session_auth_data() :
ssl_no_defaults{ true } {
}
+st_xmysqlnd_message_factory xmysqlnd_session_data::create_message_factory()
+{
+ Message_context msg_ctx{
+ io.vio,
+ io.pfc,
+ stats,
+ error_info,
+ compression_cfg
+ };
+ return get_message_factory(msg_ctx);
+}
+
/* {{{ xmysqlnd_session_data::get_scheme */
std::string
xmysqlnd_session_data::get_scheme(
@@ -250,7 +262,7 @@ xmysqlnd_session_data::send_client_attributes()
enum_func_status ret{ PASS };
if( capa_count > 0 ) {
ret = FAIL;
- st_xmysqlnd_message_factory msg_factory = xmysqlnd_get_message_factory(&io, stats, \
error_info); + st_xmysqlnd_message_factory msg_factory{ create_message_factory() };
st_xmysqlnd_msg__capabilities_set caps_set{ \
msg_factory.get__capabilities_set(&msg_factory) }; st_xmysqlnd_msg__capabilities_get \
caps_get{ msg_factory.get__capabilities_get(&msg_factory) }; @@ -619,7 +631,7 @@ \
xmysqlnd_session_data::send_reset(bool keep_open) case SESSION_NON_AUTHENTICATED:
case SESSION_READY:
case SESSION_CLOSE_SENT: {
- st_xmysqlnd_message_factory msg_factory{ xmysqlnd_get_message_factory(&io, stats, \
error_info) }; + st_xmysqlnd_message_factory msg_factory{ create_message_factory() \
}; st_xmysqlnd_msg__session_reset conn_reset_msg{ \
msg_factory.get__session_reset(&msg_factory) }; if (keep_open) {
conn_reset_msg.keep_open.reset(keep_open);
@@ -665,7 +677,7 @@ xmysqlnd_session_data::send_close()
switch (state_val) {
case SESSION_NON_AUTHENTICATED:
case SESSION_READY: {
- st_xmysqlnd_message_factory msg_factory = xmysqlnd_get_message_factory(&io, stats, \
error_info); + st_xmysqlnd_message_factory msg_factory{ create_message_factory() };
if ((state_val == SESSION_READY) && is_session_properly_supported()) {
DBG_INF("Session clean, sending SESS_CLOSE");
st_xmysqlnd_msg__session_close session_close_msg = \
msg_factory.get__session_close(&msg_factory); @@ -720,11 +732,11 @@ \
xmysqlnd_session_data::negotiate_client_api_capabilities(const size_t flags)
/* {{{ xmysqlnd_session_data::is_session_properly_supported */
-bool xmysqlnd_session_data::is_session_properly_supported() const
+bool xmysqlnd_session_data::is_session_properly_supported()
{
if (session_properly_supported) return *session_properly_supported;
- st_xmysqlnd_message_factory msg_factory{ xmysqlnd_get_message_factory(&io, stats, \
error_info) }; + st_xmysqlnd_message_factory msg_factory{ create_message_factory() };
st_xmysqlnd_msg__expectations_open conn_expectations_open{ \
msg_factory.get__expectations_open(&msg_factory) }; \
conn_expectations_open.condition_key = \
Mysqlx::Expect::Open_Condition::EXPECT_FIELD_EXIST; const char* \
field_keep_session_open{ "6.1" }; @@ -1701,7 +1713,7 @@ Authenticate::Authenticate(
: session(session)
, scheme(scheme)
, default_schema(def_schema)
- , msg_factory(xmysqlnd_get_message_factory(&session->io, session->stats, \
session->error_info)) + , msg_factory(session->create_message_factory())
, auth(session->auth.get())
{
ZVAL_NULL(&capabilities);
@@ -4312,7 +4324,7 @@ Session_auth_data* extract_auth_information(const util::Url& \
node_url) }
/*
- * Connection attributes
+ * Connection attributes
* are handled separately, in this function we're
* focusing on authentication stuff.
*/
diff --git a/xmysqlnd/xmysqlnd_session.h b/xmysqlnd/xmysqlnd_session.h
index e784bc0..3b9656a 100644
--- a/xmysqlnd/xmysqlnd_session.h
+++ b/xmysqlnd/xmysqlnd_session.h
@@ -434,6 +434,7 @@ public:
const MYSQLND_CLASS_METHODS_TYPE(xmysqlnd_object_factory) * object_factory;
+ st_xmysqlnd_message_factory create_message_factory();
std::string get_scheme(const std::string& hostname, unsigned int port);
enum_func_status connect_handshake(
const MYSQLND_CSTRING scheme,
@@ -462,7 +463,7 @@ public:
bool is_closed() const { return state.get() == SESSION_CLOSED; }
size_t negotiate_client_api_capabilities(const size_t flags);
- bool is_session_properly_supported() const;
+ bool is_session_properly_supported();
size_t get_client_id();
void cleanup();
public:
diff --git a/xmysqlnd/xmysqlnd_stmt.cc b/xmysqlnd/xmysqlnd_stmt.cc
index 0c690d0..8e7a305 100644
--- a/xmysqlnd/xmysqlnd_stmt.cc
+++ b/xmysqlnd/xmysqlnd_stmt.cc
@@ -56,11 +56,8 @@ xmysqlnd_stmt::send_raw_message(xmysqlnd_stmt * const stmt,
MYSQLND_STATS * const stats,
MYSQLND_ERROR_INFO * const error_info)
{
- MYSQLND_VIO * vio = stmt->session->data->io.vio;
- XMYSQLND_PFC * pfc = stmt->session->data->io.pfc;
- const XMYSQLND_L3_IO io = {vio, pfc};
/* pass stmt->session->data->io directly ?*/
- st_xmysqlnd_message_factory msg_factory = xmysqlnd_get_message_factory(&io, stats, \
error_info); + st_xmysqlnd_message_factory msg_factory{ \
stmt->session->data->create_message_factory() }; enum_func_status ret{FAIL};
DBG_ENTER("xmysqlnd_stmt::send_raw_message");
@@ -942,9 +939,7 @@ Prepare_stmt_data::assign_session( XMYSQLND_SESSION session_obj )
bool
Prepare_stmt_data::send_prepare_msg( uint32_t message_id )
{
- struct st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io,
- session->data->stats,
- session->data->error_info);
+ st_xmysqlnd_message_factory msg_factory{ session->data->create_message_factory() };
Mysqlx::Prepare::Prepare prep_msg;
size_t db_idx = get_ps_entry(message_id);
bool res{ true };
@@ -988,9 +983,7 @@ Prepare_stmt_data::set_ps_server_error( const uint32_t \
message_code ) bool
Prepare_stmt_data::get_prepare_resp( drv::xmysqlnd_stmt * stmt )
{
- st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io,
- session->data->stats,
- session->data->error_info);
+ st_xmysqlnd_message_factory msg_factory{ session->data->create_message_factory() };
st_xmysqlnd_msg__prepare_prepare prepare_prepare = \
msg_factory.get__prepare_prepare(&msg_factory); st_xmysqlnd_on_error_bind on_error = \
{ prepare_st_on_error_handler,
@@ -1063,9 +1056,7 @@ Prepare_stmt_data::send_execute_msg(
add_limit_expr_mutable_arg( execute_msg, static_cast<int32_t>(ps_entry.offset) );
}
- struct st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io,
- session->data->stats,
- session->data->error_info);
+ st_xmysqlnd_message_factory msg_factory{ session->data->create_message_factory() };
st_xmysqlnd_msg__prepare_execute prepare_execute = \
msg_factory.get__prepare_execute(&msg_factory); enum_func_status request_ret = \
prepare_execute.send_execute_request(&prepare_execute, \
get_protobuf_msg(&execute_msg,COM_PREPARE_EXECUTE));
diff --git a/xmysqlnd/xmysqlnd_table.cc b/xmysqlnd/xmysqlnd_table.cc
index 5cf54e4..7df1298 100644
--- a/xmysqlnd/xmysqlnd_table.cc
+++ b/xmysqlnd/xmysqlnd_table.cc
@@ -344,9 +344,7 @@ xmysqlnd_table::insert(XMYSQLND_CRUD_TABLE_OP__INSERT * op)
DBG_RETURN(stmt);
}
if (xmysqlnd_crud_table_insert__is_initialized(op)) {
- st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io,
- session->data->stats,
- session->data->error_info);
+ st_xmysqlnd_message_factory msg_factory{ session->data->create_message_factory() \
}; struct st_xmysqlnd_msg__table_insert table_insert = \
msg_factory.get__table_insert(&msg_factory); if (PASS == \
table_insert.send_insert_request(&table_insert, \
xmysqlnd_crud_table_insert__get_protobuf_message(op))) {
@@ -381,7 +379,7 @@ xmysqlnd_table::opdelete(XMYSQLND_CRUD_TABLE_OP__DELETE * op)
}
if (xmysqlnd_crud_table_delete__is_initialized(op))
{
- st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io, session->data->stats, \
session->data->error_info); + st_xmysqlnd_message_factory msg_factory{ \
session->data->create_message_factory() }; struct st_xmysqlnd_msg__collection_ud \
table_ud = msg_factory.get__collection_ud(&msg_factory); if (PASS == \
table_ud.send_delete_request(&table_ud, \
xmysqlnd_crud_table_delete__get_protobuf_message(op))) {
@@ -444,7 +442,7 @@ xmysqlnd_table::update(XMYSQLND_CRUD_TABLE_OP__UPDATE * op)
}
if (xmysqlnd_crud_table_update__is_initialized(op))
{
- st_xmysqlnd_message_factory msg_factory = \
xmysqlnd_get_message_factory(&session->data->io, session->data->stats, \
session->data->error_info); + st_xmysqlnd_message_factory msg_factory{ \
session->data->create_message_factory() }; struct st_xmysqlnd_msg__collection_ud \
table_ud = msg_factory.get__collection_ud(&msg_factory); if (PASS == \
table_ud.send_update_request(&table_ud, \
xmysqlnd_crud_table_update__get_protobuf_message(op))) {
diff --git a/xmysqlnd/xmysqlnd_wireprotocol.cc b/xmysqlnd/xmysqlnd_wireprotocol.cc
index e940c17..b2839f7 100644
--- a/xmysqlnd/xmysqlnd_wireprotocol.cc
+++ b/xmysqlnd/xmysqlnd_wireprotocol.cc
@@ -391,10 +391,10 @@ xmysqlnd_send_message(
msg_ctx.pfc,
msg_ctx.vio,
static_cast<zend_uchar>(packet_type),
- static_cast<zend_uchar*>(payload),
- payload_size,
- bytes_sent,
- msg_ctx.stats,
+ static_cast<zend_uchar*>(payload),
+ payload_size,
+ bytes_sent,
+ msg_ctx.stats,
msg_ctx.error_info);
if (payload != stack_buffer) {
mnd_efree(payload);
@@ -443,14 +443,14 @@ xmysqlnd_receive_message(
do {
ret = msg_ctx.pfc->data->m.receive(
- msg_ctx.pfc,
- msg_ctx.vio,
- stack_buffer,
- sizeof(stack_buffer),
- &type,
- &payload,
- &rcv_payload_size,
- msg_ctx.stats,
+ msg_ctx.pfc,
+ msg_ctx.vio,
+ stack_buffer,
+ sizeof(stack_buffer),
+ &type,
+ &payload,
+ &rcv_payload_size,
+ msg_ctx.stats,
msg_ctx.error_info);
if (FAIL == ret) {
DBG_RETURN(FAIL);
@@ -3411,18 +3411,13 @@ \
xmysqlnd_msg_factory_get__prepare_execute(st_xmysqlnd_message_factory* factory) /* \
}}} */
-/* {{{ xmysqlnd_get_message_factory */
+/* {{{ get_message_factory */
st_xmysqlnd_message_factory
-xmysqlnd_get_message_factory(const XMYSQLND_L3_IO * const io, MYSQLND_STATS * stats, \
MYSQLND_ERROR_INFO * error_info) +get_message_factory(Message_context msg_ctx)
{
st_xmysqlnd_message_factory factory
{
- {
- io->vio,
- io->pfc,
- stats,
- error_info
- },
+ msg_ctx,
xmysqlnd_msg_factory_get__capabilities_get,
xmysqlnd_msg_factory_get__capabilities_set,
xmysqlnd_msg_factory_get__auth_start,
diff --git a/xmysqlnd/xmysqlnd_wireprotocol.h b/xmysqlnd/xmysqlnd_wireprotocol.h
index 69922ca..1dfe052 100644
--- a/xmysqlnd/xmysqlnd_wireprotocol.h
+++ b/xmysqlnd/xmysqlnd_wireprotocol.h
@@ -587,7 +587,7 @@ struct st_xmysqlnd_message_factory
st_xmysqlnd_msg__prepare_execute \
(*get__prepare_execute)(st_xmysqlnd_message_factory* factory); };
-st_xmysqlnd_message_factory xmysqlnd_get_message_factory(const \
st_xmysqlnd_level3_io* const io, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * \
error_info); +st_xmysqlnd_message_factory get_message_factory(Message_context \
msg_ctx);
void xmysqlnd_shutdown_protobuf_library();
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic