Skip to content

Commit 71d81e3

Browse files
committed
Bug#35318781 parameter_count_available has the wrong value
Decoding StmtExecute with the parameter-count-available flag set fails. This is only noticed if the tracer is enabled at build-time as the StmtExecute message isn't decoded by default. The routertest_integration_routing_direct fails due to this if the tracer is enabled. Change ------ - fixed values of the StmtExecute flags which were off-by-one Change-Id: Ib31d01150ef3e925218af7834dddb720be43c2fa
1 parent 0dce1bb commit 71d81e3

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

router/src/mysql_protocol/include/mysqlrouter/classic_protocol_constants.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,16 @@ constexpr value_type session_state_changed{1 << pos::session_state_changed};
209209
namespace cursor {
210210
namespace pos {
211211
using value_type = uint8_t;
212-
constexpr value_type no_cursor{0};
213-
constexpr value_type read_only{1};
214-
constexpr value_type for_update{2};
215-
constexpr value_type scrollable{3};
216-
constexpr value_type param_count_available{4};
212+
constexpr value_type read_only{0};
213+
constexpr value_type for_update{1};
214+
constexpr value_type scrollable{2};
215+
constexpr value_type param_count_available{3};
217216

218217
constexpr value_type _bitset_size{param_count_available + 1};
219218
} // namespace pos
220219
using value_type = std::bitset<pos::_bitset_size>;
221220

222-
constexpr value_type no_cursor{1 << pos::no_cursor};
221+
constexpr value_type no_cursor{0};
223222
constexpr value_type read_only{1 << pos::read_only};
224223
constexpr value_type for_update{1 << pos::for_update};
225224
constexpr value_type scrollable{1 << pos::scrollable};

router/src/mysql_protocol/tests/test_classic_protocol_message.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
12891289
{"cap_query_attributes_one_param",
12901290
{
12911291
1, // stmt-id
1292-
0x10, // flags
1292+
0x08, // flags
12931293
1, // iteration_count
12941294
true, // new-params bound
12951295
{{classic_protocol::field_type::String, "abc"}}, // types
@@ -1300,7 +1300,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
13001300
// serialized
13011301
0x17, // cmd
13021302
0x01, 0x00, 0x00, 0x00, // stmt-id
1303-
0x10, // flags: param-count-available
1303+
0x08, // flags: param-count-available
13041304
0x01, 0x00, 0x00, 0x00, // iteration-count
13051305
0x01, // param-count
13061306
0x00, // null-bitmap
@@ -1312,7 +1312,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
13121312
{"cap_query_attributes_null_param",
13131313
{
13141314
1, // stmt-id
1315-
0x10, // flags
1315+
0x08, // flags
13161316
1, // iteration_count
13171317
true, // new-params bound
13181318
{{classic_protocol::field_type::String, "abc"}}, // types
@@ -1323,7 +1323,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
13231323
// serialized
13241324
0x17, // cmd
13251325
0x01, 0x00, 0x00, 0x00, // stmt-id
1326-
0x10, // flags: param-count-available
1326+
0x08, // flags: param-count-available
13271327
0x01, 0x00, 0x00, 0x00, // iteration-count
13281328
0x01, // param-count
13291329
0x01, // null-bitmap: data[0]: NULL
@@ -1334,7 +1334,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
13341334
{"cap_query_attributes_8_params",
13351335
{
13361336
1, // stmt-id
1337-
0x10, // flags
1337+
0x08, // flags
13381338
1, // iteration_count
13391339
true, // new-params bound
13401340
{
@@ -1361,7 +1361,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
13611361
// serialized
13621362
0x17, // cmd
13631363
0x01, 0x00, 0x00, 0x00, // stmt-id
1364-
0x10, // flags: param-count-available
1364+
0x08, // flags: param-count-available
13651365
0x01, 0x00, 0x00, 0x00, // iteration-count
13661366
0x08, // param-count
13671367
0x00, // null-bitmap
@@ -1396,7 +1396,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
13961396
{"cap_query_attributes_9_params",
13971397
{
13981398
1, // stmt-id
1399-
0x10, // flags
1399+
0x08, // flags
14001400
1, // iteration_count
14011401
true, // new-params bound
14021402
{
@@ -1425,7 +1425,7 @@ const CodecParam<classic_protocol::message::client::StmtExecute>
14251425
// serialized
14261426
0x17, // cmd
14271427
0x01, 0x00, 0x00, 0x00, // stmt-id
1428-
0x10, // flags: param-count-available
1428+
0x08, // flags: param-count-available
14291429
0x01, 0x00, 0x00, 0x00, // iteration-count
14301430
0x09, // param-count
14311431
0x40, 0x00, // null-bitmap: data[6]: NULL

0 commit comments

Comments
 (0)