Skip to content
Snippets Groups Projects
Commit a0753cf2 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

xrow: drop xrow_header_has_key and iproto_dml_body_has_key

xrow_header_has_key() isn't used anywhere.

The purpose of iproto_dml_body_has_key() is unclear - we use it to skip
unknown DML keys, but we would skip them anyway in the switch-case down
the code path, like we do while decoding other requests. The only useful
thing it does is implicitly checks that the key has type MP_UINT, but we
can do that explicitly instead.
parent 59870cce
No related branches found
No related tags found
No related merge requests found
......@@ -176,30 +176,6 @@ enum iproto_ballot_key {
IPROTO_BALLOT_CAN_LEAD = 0x07,
};
#define bit(c) (1ULL<<IPROTO_##c)
#define IPROTO_HEAD_BMAP (bit(REQUEST_TYPE) | bit(SYNC) | bit(REPLICA_ID) |\
bit(LSN) | bit(SCHEMA_VERSION))
#define IPROTO_DML_BODY_BMAP (bit(SPACE_ID) | bit(INDEX_ID) | bit(LIMIT) |\
bit(OFFSET) | bit(ITERATOR) | bit(INDEX_BASE) |\
bit(KEY) | bit(TUPLE) | bit(OPS) | bit(TUPLE_META))
static inline bool
xrow_header_has_key(const char *pos, const char *end)
{
unsigned char key = pos < end ? *pos : (unsigned char) IPROTO_KEY_MAX;
return key < IPROTO_KEY_MAX && IPROTO_HEAD_BMAP & (1ULL<<key);
}
static inline bool
iproto_dml_body_has_key(const char *pos, const char *end)
{
unsigned char key = pos < end ? *pos : (unsigned char) IPROTO_KEY_MAX;
return key < IPROTO_KEY_MAX && IPROTO_DML_BODY_BMAP & (1ULL<<key);
}
#undef bit
static inline uint64_t
iproto_key_bit(unsigned char key)
{
......
......@@ -776,7 +776,7 @@ xrow_decode_dml(struct xrow_header *row, struct request *request,
uint32_t size = mp_decode_map(&data);
for (uint32_t i = 0; i < size; i++) {
if (! iproto_dml_body_has_key(data, end)) {
if (mp_typeof(*data) != MP_UINT) {
mp_next(&data);
mp_next(&data);
continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment