Closed laurynas-biveinis closed 3 months ago
@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
This way it can dump any MyRocks key (3072 byte maximum).
This sounds incorrect. max_supported_key_part_length is 3072. max_supported_key_length is 16 * 1024 = 16k.
in Rdb_deadlock_info::Rdb_dl_trx_info get_dl_txn_info(), would you prefer calling rdb_hexdump with 0?
This sounds incorrect. max_supported_key_part_length is 3072. max_supported_key_length is 16 * 1024 = 16k.
Right, I missed this. Is it OK to bump the rdb_hexdump
default to
cover 16K keys?
in Rdb_deadlock_info::Rdb_dl_trx_info get_dl_txn_info(), would you prefer calling rdb_hexdump with 0?
Yes, updating
Rebased, addressed both comments (the rdb_hexdump one speculatively by bumping the default to 32K). Let me know if you prefer another default.
@laurynas-biveinis has updated the pull request. You must reimport the pull request before landing.
+// The default limit for rdb_hexdump output length, happens to fit the longest +// possible keys (16K) +constexpr size_t RDB_MAX_HEXDUMP_LEN = 2 16 1024;
The comment mention 16K, but the value is 32K?
hexdump: two output bytes per one input byte
@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
This pull request has been merged in facebook/mysql-5.6@40f4f32475d1ff16f5315dfba44aa31aa53e29ee.
Currently,
rdb_hexdump
has a third argumentmaxsize
with a default value of 0, meaning unlimited output length, and there is also aRDB_MAX_HEXDUMP
constant for the callers to use. However, only a part of the callers use it, the rest use the default or something else altogether (i.e.FN_REFLEN
)Change as follows:
RDB_MAX_HEXDUMP
maxsize
instead of unlimited. This should cover all the reasonable cases, and prevent runaway dumping in the case of corrupteddata_len
values.RDB_MAX_HEXDUMP_LEN
from 1000 to 7000. This way it can dump any MyRocks key (3072 byte maximum). Make itconstexpr
.Minor cleanups:
std::string
is used as an input forrdb_hexdump
, pass its buffer throughdata()
, not throughc_str()
, because it's used as a sized buffer and not as a zero-terminated C stringrdb_hexdump
asnodiscard
, make its constantsconstexpr
, remove redundantconst
from by-value parameters.