Skip to content

Commit

Permalink
Faster value decoding
Browse files Browse the repository at this point in the history
Summary:
Similar to integer key decoding improvement, but for values:
* Remove dependency to field* and cache those information in Rdb_field_encoder
* No more Field::move_field - just write to buffer directly

We were originally planning to use Rdb_protocol_value_decoder for MySQL bypass project to eliminate overhead of decoding to integer then convert to string, but in practice it probably makes little difference and it is not going to be needed when we go with bypass RPC (which is thrift binary protocol). So this changes removes Rdb_protocol_value_decoder completely.

One thing that worth mentioning is I've unified pack_length and pack_length_in_rec because they are essentially identical in our scenarios and in the case they could be different (more packed BITS format that borrows bits from null byte when storage engine supports it) we don't really support it at all, so unifying it to avoid confusion and assert it.

With this MyRocks is now either faster or on par with InnoDB when it comes to SELECT integer columns stored in value.

NOTE:FDO data needs to be updated for this diff in order to take full advantage of this change.

Reviewed By: luqun

Differential Revision: D24527543

fbshipit-source-id: 560bdea8cf3
  • Loading branch information
yizhang82 authored and facebook-github-bot committed Dec 9, 2020
1 parent 9af9aa5 commit f4cefba
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 335 deletions.
3 changes: 2 additions & 1 deletion sql/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,8 @@ class Field_blob :public Field_longstr {
}
inline uint32 get_length(uint row_offset= 0)
{ return get_length(ptr+row_offset, this->packlength, table->s->db_low_byte_first); }
uint32 get_length(const uchar *ptr, uint packlength, bool low_byte_first);
static uint32 get_length(const uchar *ptr, uint packlength,
bool low_byte_first);
uint32 get_length(const uchar *ptr_arg)
{ return get_length(ptr_arg, this->packlength, table->s->db_low_byte_first); }
void put_length(uchar *pos, uint32 length);
Expand Down
Loading

0 comments on commit f4cefba

Please sign in to comment.