| 1 |
## Preamble |
| 2 |
--source include/xplugin_preamble.inc |
| 3 |
--source include/xplugin_create_user.inc |
| 4 |
|
| 5 |
## TEST STARTS HERE |
| 6 |
--write_file $MYSQL_TMP_DIR/mysqlx-update_itemremove.xpl |
| 7 |
-->import wait_until_disconnect.macro |
| 8 |
-->stmtadmin ensure_collection {"schema":"test", "name":"coll"} |
| 9 |
-->recvresult |
| 10 |
|
| 11 |
## It tests the limits of protobuf, we do not need any data in the collection |
| 12 |
|
| 13 |
# |
| 14 |
# Number of protobuf object should be calculated from following equation |
| 15 |
# NUMBER_OF_OBJECTS = 2 * NUMBER_OF_OBJECTS_TO_NEST |
| 16 |
# |
| 17 |
-->macro Send_crud_find_with_repeated_nested_objects %OBJECTS_TO_NEST% |
| 18 |
-->varlet %NESTED_OBJECTS% |
| 19 |
|
| 20 |
-->varlet %OBJECTS_TO_REPEAT% %OBJECTS_TO_NEST% |
| 21 |
-->varinc %OBJECTS_TO_REPEAT% -3 |
| 22 |
|
| 23 |
-->repeat %OBJECTS_TO_REPEAT% %ITERATION% |
| 24 |
-->varlet %OBJECT_NUMBER% %ITERATION% |
| 25 |
-->varinc %OBJECT_NUMBER% 4 |
| 26 |
-->varlet %NESTED_OBJECTS% %NESTED_OBJECTS% value { type: ARRAY array { value { type: LITERAL literal { type: V_SINT v_signed_int: %OBJECT_NUMBER% } } |
| 27 |
-->endrepeat |
| 28 |
|
| 29 |
-->repeat %OBJECTS_TO_REPEAT% |
| 30 |
-->varlet %NESTED_OBJECTS% %NESTED_OBJECTS% } } |
| 31 |
-->endrepeat |
| 32 |
|
| 33 |
-->quiet |
| 34 |
Mysqlx.Crud.Find { |
| 35 |
collection { |
| 36 |
name: "coll" |
| 37 |
schema: "test" |
| 38 |
} |
| 39 |
data_model: DOCUMENT |
| 40 |
criteria { |
| 41 |
type: OPERATOR |
| 42 |
operator { |
| 43 |
name: "==" |
| 44 |
param { |
| 45 |
type: IDENT |
| 46 |
identifier { |
| 47 |
document_path { |
| 48 |
type: MEMBER |
| 49 |
value: "ARR0" |
| 50 |
} |
| 51 |
} |
| 52 |
} |
| 53 |
param { |
| 54 |
type: ARRAY |
| 55 |
array { |
| 56 |
value { |
| 57 |
type: LITERAL |
| 58 |
literal { |
| 59 |
type: V_SINT |
| 60 |
v_signed_int: 3 |
| 61 |
} |
| 62 |
} |
| 63 |
%NESTED_OBJECTS% |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
-->noquiet |
| 70 |
-->endmacro |
| 71 |
|
| 72 |
## Current recursion limit is set to 100 |
| 73 |
## each repeated message in bellow macro contains two messages |
| 74 |
## (it increases the current depth by 2) |
| 75 |
-->newsession test_different_messages1 x_root |
| 76 |
-->echo Try to send number of objects less then X Protocol limit, 50 (2 * 25) |
| 77 |
-->callmacro Send_crud_find_with_repeated_nested_objects 25 |
| 78 |
-->recvresult |
| 79 |
|
| 80 |
-->echo Try to send number of objects equal to the X Protocol limit, 100 (2 * 50) |
| 81 |
-->callmacro Send_crud_find_with_repeated_nested_objects 50 |
| 82 |
-->recvresult |
| 83 |
|
| 84 |
-->echo Try to send number of object more than the X Protocol limit 101 (2 * 51) |
| 85 |
-->callmacro Send_crud_find_with_repeated_nested_objects 51 |
| 86 |
## Following commands in this context can't be used |
| 87 |
## -->expecterror ER_X_BAD_MESSAGE |
| 88 |
## -->recvresult |
| 89 |
## It's because, error is always printed with message. |
| 90 |
## X Plugin error message depends on Protobuf version, thus |
| 91 |
## this test must not check it. |
| 92 |
noquery_result; |
| 93 |
recvmessage Mysqlx.Error { |
| 94 |
code: 5000 |
| 95 |
}; |
| 96 |
query_result; |
| 97 |
echo Received error message with code: ER_X_BAD_MESSAGE; |
| 98 |
# |
| 99 |
# After error 5000, connection is disconnected by the X Plugin, abort the client connection |
| 100 |
# it is in invalid state |
| 101 |
-->callmacro Wait_until_disconnect |
| 102 |
|
| 103 |
EOF |
| 104 |
|
| 105 |
|
| 106 |
--write_file $MYSQL_TMP_DIR/capabilities_set_with_repeated_nested_objects.xpl |
| 107 |
-->import wait_until_disconnect.macro |
| 108 |
-->stmtadmin ensure_collection {"schema":"test", "name":"coll"} |
| 109 |
-->recvresult |
| 110 |
|
| 111 |
## It tests the limits of protobuf, we do not need any data in the collection |
| 112 |
|
| 113 |
# |
| 114 |
# Number of protobuf object should be calculated from following equation |
| 115 |
# NUMBER_OF_OBJECTS = 2 * NUMBER_OF_OBJECTS_TO_NEST |
| 116 |
# |
| 117 |
|
| 118 |
-->macro Send_capabilities_set_with_repeated_nested_objects %OBJECTS_TO_NEST% |
| 119 |
-->varlet %NESTED_OBJECTS% |
| 120 |
-->varlet %OBJECTS_TO_REPEAT% %OBJECTS_TO_NEST% |
| 121 |
-->varinc %OBJECTS_TO_REPEAT% -3 |
| 122 |
|
| 123 |
-->repeat %OBJECTS_TO_REPEAT% %ITERATION% |
| 124 |
-->varlet %OBJECT_NUMBER% %ITERATION% |
| 125 |
-->varinc %OBJECT_NUMBER% 4 |
| 126 |
-->varlet %NESTED_OBJECTS% %NESTED_OBJECTS% value { type: ARRAY array { value { type: SCALAR scalar { type: V_SINT v_signed_int: %OBJECT_NUMBER% } } |
| 127 |
-->endrepeat |
| 128 |
|
| 129 |
-->repeat %OBJECTS_TO_REPEAT% |
| 130 |
-->varlet %NESTED_OBJECTS% %NESTED_OBJECTS% } } |
| 131 |
-->endrepeat |
| 132 |
|
| 133 |
-->quiet |
| 134 |
Mysqlx.Connection.CapabilitiesSet { |
| 135 |
capabilities { |
| 136 |
capabilities { |
| 137 |
name: "tls" |
| 138 |
value { |
| 139 |
type: ARRAY |
| 140 |
array { |
| 141 |
%NESTED_OBJECTS% |
| 142 |
} |
| 143 |
} |
| 144 |
} |
| 145 |
} |
| 146 |
} |
| 147 |
-->noquiet |
| 148 |
-->endmacro |
| 149 |
|
| 150 |
## Current recursion limit is set to 100 |
| 151 |
## each repeated message in bellow macro contains two messages |
| 152 |
|
| 153 |
-->echo Try to send number of object more than the X Protocol limit 101 (2 * 51) |
| 154 |
-->callmacro Send_capabilities_set_with_repeated_nested_objects 51 |
| 155 |
|
| 156 |
## Following commands in this context can't be used |
| 157 |
## -->expecterror ER_X_BAD_MESSAGE |
| 158 |
## -->recvresult |
| 159 |
## It's because, error is always printed with message. |
| 160 |
## X Plugin error message depends on Protobuf version, thus |
| 161 |
## this test must not check it. |
| 162 |
noquery_result; |
| 163 |
recvmessage Mysqlx.Error { |
| 164 |
code: 5000 |
| 165 |
}; |
| 166 |
query_result; |
| 167 |
echo Received error message with code: ER_X_BAD_MESSAGE; |
| 168 |
|
| 169 |
# |
| 170 |
# After error 5000, connection is disconnected by the X Plugin, abort the client connection |
| 171 |
# it is in invalid state |
| 172 |
-->callmacro Wait_until_disconnect |
| 173 |
|
| 174 |
EOF |
| 175 |
|
| 176 |
# Set the timeout for connection to 300 seconds |
| 177 |
# which is must be greater than the peerdisc/timeout |
| 178 |
SET GLOBAL mysqlx_connect_timeout = 300; |
| 179 |
SET GLOBAL mysqlx_wait_timeout = 300; |
| 180 |
|
| 181 |
--exec $MYSQLXTEST -u x_root --file=$MYSQL_TMP_DIR/mysqlx-update_itemremove.xpl 2>&1 |
| 182 |
|
| 183 |
--exec $MYSQLXTEST -u x_root --file=$MYSQL_TMP_DIR/capabilities_set_with_repeated_nested_objects.xpl 2>&1 |
| 184 |
|
| 185 |
## Cleanup |
| 186 |
SET GLOBAL mysqlx_connect_timeout= DEFAULT; |
| 187 |
SET GLOBAL mysqlx_wait_timeout = DEFAULT; |
| 188 |
DROP TABLE IF EXISTS coll; |
| 189 |
--source ../include/xplugin_cleanup.inc |