From c740c8fa5eec600cd244f2a396c051e8a7a5ccd3 Mon Sep 17 00:00:00 2001 From: Grzegorz Szwarc Date: Fri, 1 Jul 2016 16:20:06 +0200 Subject: [PATCH] Revert "Bug#23707238 - PROTOBUF LIMITS THE NUMBER OF NESTED OBJECTS TO 100 RECURSIONS" This reverts commit 145efe432458cabb3fca519e720ece91e5434d08. --- rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc | 11 +-- rapid/plugin/x/ngs/src/protocol_decoder.cc | 6 -- .../plugin/x/protocol/mysqlx_datatypes.proto | 16 +-- .../x/tests/mtr/include/connection_ssl.inc | 3 - .../have_performance_schema_threads.inc | 5 - .../x/tests/mtr/r/protobuf_nested.result | 23 ----- .../x/tests/mtr/t/connection_nonssl.test | 2 - .../x/tests/mtr/t/performance_schema.test | 2 +- .../x/tests/mtr/t/protobuf_nested-master.opt | 1 - .../plugin/x/tests/mtr/t/protobuf_nested.test | 98 ------------------- 10 files changed, 13 insertions(+), 154 deletions(-) delete mode 100644 rapid/plugin/x/tests/mtr/include/have_performance_schema_threads.inc delete mode 100644 rapid/plugin/x/tests/mtr/r/protobuf_nested.result delete mode 100644 rapid/plugin/x/tests/mtr/t/protobuf_nested-master.opt delete mode 100644 rapid/plugin/x/tests/mtr/t/protobuf_nested.test diff --git a/rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc b/rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc index 3898688f0705..518328dbe332 100644 --- a/rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc +++ b/rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc @@ -822,8 +822,8 @@ class Command m_commands["enablessl"] = &Command::cmd_enablessl; m_commands["sleep "] = &Command::cmd_sleep; m_commands["login "] = &Command::cmd_login; - m_commands["stmtadmin "] = &Command::cmd_stmtadmin; - m_commands["stmtsql "] = &Command::cmd_stmtsql; + m_commands["stmtadmin "] = &Command::cmd_stmt_admin; + m_commands["stmtsql "] = &Command::cmd_stmt_sql; m_commands["loginerror "] = &Command::cmd_loginerror; m_commands["repeat "] = &Command::cmd_repeat; m_commands["endrepeat"] = &Command::cmd_endrepeat; @@ -1149,7 +1149,7 @@ class Command return Continue; } - Result cmd_stmtsql(Execution_context &context, const std::string &args) + Result cmd_stmt_sql(Execution_context &context, const std::string &args) { Mysqlx::Sql::StmtExecute stmt; @@ -1165,7 +1165,7 @@ class Command } - Result cmd_stmtadmin(Execution_context &context, const std::string &args) + Result cmd_stmt_admin(Execution_context &context, const std::string &args) { std::string tmp = args; replace_variables(tmp); @@ -1296,9 +1296,6 @@ class Command variable_name = argl[1]; } - // Allow use of variables as a source of number of iterations - replace_variables(argl[0]); - Loop_do loop = {context.m_stream.tellg(), atoi(argl[0].c_str()), 0, variable_name}; m_loop_stack.push_back(loop); diff --git a/rapid/plugin/x/ngs/src/protocol_decoder.cc b/rapid/plugin/x/ngs/src/protocol_decoder.cc index c19d07f0406b..de2648033c3e 100644 --- a/rapid/plugin/x/ngs/src/protocol_decoder.cc +++ b/rapid/plugin/x/ngs/src/protocol_decoder.cc @@ -109,12 +109,6 @@ Error_code Message_decoder::parse(Request &request) static_cast(buffer.length())); // variable 'mysqlx_max_allowed_packet' has been checked when buffer was filling by data stream.SetTotalBytesLimit(static_cast(buffer.length()), -1 /*no warnings*/); - // Protobuf limits the number of nested objects in decoded message - // 400 nested objects should be enough to write complicated queries. - // Protobuf doesn't print a readable error after reaching the limit - // thus we would like to ensure that user doesn't hit the error - stream.SetRecursionLimit(400); - message->ParseFromCodedStream(&stream); if (!message->IsInitialized()) diff --git a/rapid/plugin/x/protocol/mysqlx_datatypes.proto b/rapid/plugin/x/protocol/mysqlx_datatypes.proto index f4f5ba1f8ef2..04a948c8964c 100644 --- a/rapid/plugin/x/protocol/mysqlx_datatypes.proto +++ b/rapid/plugin/x/protocol/mysqlx_datatypes.proto @@ -31,14 +31,14 @@ message Scalar { required bytes value = 1; optional uint64 collation = 2; }; - - // an opaque octet sequence, with an optional content_type - // See ``Mysqlx.Resultset.ColumnMetadata`` for list of known values. - message Octets { - required bytes value = 1; - optional uint32 content_type = 2; - }; - + +// an opaque octet sequence, with an optional content_type +// See ``Mysqlx.Resultset.ColumnMetadata`` for list of known values. +message Octets { + required bytes value = 1; + optional uint32 content_type = 2; +}; + enum Type { V_SINT = 1; V_UINT = 2; diff --git a/rapid/plugin/x/tests/mtr/include/connection_ssl.inc b/rapid/plugin/x/tests/mtr/include/connection_ssl.inc index b925ab62c0d6..a0fbaa268847 100644 --- a/rapid/plugin/x/tests/mtr/include/connection_ssl.inc +++ b/rapid/plugin/x/tests/mtr/include/connection_ssl.inc @@ -3,10 +3,7 @@ # Modified : 19-08-2015 Lalit Choudhary --echo Preamble ---source ../include/have_performance_schema_threads.inc - --source ../include/xplugin_preamble.inc - SET GLOBAL mysqlx_connect_timeout = 300; call mtr.add_suppression("Unsuccessful login attempt"); diff --git a/rapid/plugin/x/tests/mtr/include/have_performance_schema_threads.inc b/rapid/plugin/x/tests/mtr/include/have_performance_schema_threads.inc deleted file mode 100644 index a9024294db9f..000000000000 --- a/rapid/plugin/x/tests/mtr/include/have_performance_schema_threads.inc +++ /dev/null @@ -1,5 +0,0 @@ -# Do not run the test when PFS thread monitoring is disabled -if (`SELECT COUNT(*)=0 as `running_threads` from performance_schema.threads ;`) -{ - skip Needs DISABLE_PSI_THREAD (cmake options) to be set to zero; -} diff --git a/rapid/plugin/x/tests/mtr/r/protobuf_nested.result b/rapid/plugin/x/tests/mtr/r/protobuf_nested.result deleted file mode 100644 index 2af61e0e5eb2..000000000000 --- a/rapid/plugin/x/tests/mtr/r/protobuf_nested.result +++ /dev/null @@ -1,23 +0,0 @@ -install plugin mysqlx soname "mysqlx.so"; -call mtr.add_suppression("Plugin mysqlx reported: .Failed at SSL configuration: .SSL context is not usable without certificate and private key.."); -call mtr.add_suppression("Plugin mysqlx reported: .SSL_CTX_load_verify_locations failed."); - -command ok -connecting... -active session is now 'test_different_messages' -Try to use value greater than the default limit 100 /2 => 50 -doc -command ok -Try to use value equal than the X Protocol limit 400 /2 => 200 -doc -command ok -Try to use value greater than the X Protocol limit 400 /2 => 200 -Got expected error: Parse error unserializing protobuf message (code 5000) -aborting session test_different_messages -switched to session default -Mysqlx.Ok { - msg: "bye!" -} -ok -uninstall plugin mysqlx; -DROP TABLE IF EXISTS coll; diff --git a/rapid/plugin/x/tests/mtr/t/connection_nonssl.test b/rapid/plugin/x/tests/mtr/t/connection_nonssl.test index d16d49f52b39..e89b99b52e98 100644 --- a/rapid/plugin/x/tests/mtr/t/connection_nonssl.test +++ b/rapid/plugin/x/tests/mtr/t/connection_nonssl.test @@ -2,8 +2,6 @@ # Created : 21-08-2015 Lalit Choudhary --echo Preamble ---source ../include/have_performance_schema_threads.inc - --source ../include/xplugin_preamble.inc SET GLOBAL mysqlx_connect_timeout = 300; diff --git a/rapid/plugin/x/tests/mtr/t/performance_schema.test b/rapid/plugin/x/tests/mtr/t/performance_schema.test index a8024da02b9b..6c0b4e127d6a 100644 --- a/rapid/plugin/x/tests/mtr/t/performance_schema.test +++ b/rapid/plugin/x/tests/mtr/t/performance_schema.test @@ -2,7 +2,7 @@ ## Preamble --source include/not_embedded.inc ---source ../include/have_performance_schema_threads.inc +--source include/have_perfschema.inc --source ../include/xplugin_preamble.inc diff --git a/rapid/plugin/x/tests/mtr/t/protobuf_nested-master.opt b/rapid/plugin/x/tests/mtr/t/protobuf_nested-master.opt deleted file mode 100644 index bb4e4931a1f5..000000000000 --- a/rapid/plugin/x/tests/mtr/t/protobuf_nested-master.opt +++ /dev/null @@ -1 +0,0 @@ ---plugin_dir=$MYSQLXPLUGIN_DIR diff --git a/rapid/plugin/x/tests/mtr/t/protobuf_nested.test b/rapid/plugin/x/tests/mtr/t/protobuf_nested.test deleted file mode 100644 index 7987b65e1f8a..000000000000 --- a/rapid/plugin/x/tests/mtr/t/protobuf_nested.test +++ /dev/null @@ -1,98 +0,0 @@ - ## Preamble ---source ../include/xplugin_preamble.inc - -## TEST STARTS HERE ---write_file $MYSQL_TMP_DIR/mysqlx-update_itemremove.tmp --->stmtadmin create_collection {"schema":"test", "name":"coll"} --->recvresult - -## It tests the limits of protobuf, we do not need any data in the collection - - --->macro Send_message_with_repeated_nested_objects %OBJECTS_TO_NEST% --->varlet %NESTED_OBJECTS% - --->varlet %OBJECTS_TO_REPEAT% %OBJECTS_TO_NEST% --->varinc %OBJECTS_TO_REPEAT% -3 - --->repeat %OBJECTS_TO_REPEAT% %ITERATION% --->varlet %OBJECT_NUMBER% %ITERATION% --->varinc %OBJECT_NUMBER% 4 --->varlet %NESTED_OBJECTS% %NESTED_OBJECTS% value { type: ARRAY array { value { type: LITERAL literal { type: V_SINT v_signed_int: %OBJECT_NUMBER% } } --->endrepeat - --->repeat %OBJECTS_TO_REPEAT% --->varlet %NESTED_OBJECTS% %NESTED_OBJECTS% } } --->endrepeat - --->quiet -Mysqlx.Crud.Find { - collection { - name: "coll" - schema: "test" - } - data_model: DOCUMENT - criteria { - type: OPERATOR - operator { - name: "==" - param { - type: IDENT - identifier { - document_path { - type: MEMBER - value: "ARR0" - } - } - } - param { - type: ARRAY - array { - value { - type: LITERAL - literal { - type: V_SINT - v_signed_int: 3 - } - } - - %NESTED_OBJECTS% - - - } - - } - } - } -} --->noquiet --->endmacro - -## Current recursion limit is set to 400 -## each repeated message in bellow macro contains two messages -## (it increases the current depth by 2) --->newsession test_different_messages root --->echo Try to use value greater than the default limit 100 /2 => 50 --->callmacro Send_message_with_repeated_nested_objects 51 --->recvresult - --->echo Try to use value equal than the X Protocol limit 400 /2 => 200 --->callmacro Send_message_with_repeated_nested_objects 200 --->recvresult - --->echo Try to use value greater than the X Protocol limit 400 /2 => 200 --->callmacro Send_message_with_repeated_nested_objects 201 --->expecterror 5000 --->recvresult --->closesession abort - -EOF - ---exec $MYSQLXTEST -u root --file=$MYSQL_TMP_DIR/mysqlx-update_itemremove.tmp 2>&1 - -## Postamble ---remove_file $MYSQL_TMP_DIR/mysqlx-update_itemremove.tmp - -uninstall plugin mysqlx; - -DROP TABLE IF EXISTS coll;