lua/xlog: don't ignore unknown header fields
The xlog reader Lua module uses the xlog_cursor_next_row, which decodes the row header with xrow_header_decode. The latter silently ignores any unknown fields, which complicates catching bugs when garbage is written to a row header by mistake, for example, see #8783. Let's parse a row header without using xrow_header_decode in the xlog reader module, like we parse a row body, and output all unknown/invalid keys as is. To do that, we have to extend the xlog cursor API with the new method xlog_cursor_next_row_raw that returns a pointer to the position in the tx buffer where the next xrow is stored without advancing it. To avoid a memory leak in case the caller fails to parse an xrow returned by this function, we also have to move the call to xlog_tx_cursor_destroy from xlog_tx_cursor_next_row to xlog_cursor_next_tx. While we are at it, - Don't raise an error if a key type encountered in a row body is invalid (not an integer). Instead, silently ignore such keys. - Remove the useless body MsgPack validness check because we already check it after decoding the header. - Add error injection based tests to check all the corner cases. NO_DOC=bug fix
Showing
- changelogs/unreleased/xlog-reader-show-unknown-header-fields.md 4 additions, 0 deletions...logs/unreleased/xlog-reader-show-unknown-header-fields.md
- src/box/lua/xlog.c 143 additions, 98 deletionssrc/box/lua/xlog.c
- src/box/xlog.c 26 additions, 7 deletionssrc/box/xlog.c
- src/box/xlog.h 37 additions, 0 deletionssrc/box/xlog.h
- src/box/xrow.c 49 additions, 1 deletionsrc/box/xrow.c
- src/lib/core/errinj.h 8 additions, 0 deletionssrc/lib/core/errinj.h
- test/box-luatest/xlog_reader_test.lua 152 additions, 0 deletionstest/box-luatest/xlog_reader_test.lua
- test/box/errinj.result 8 additions, 0 deletionstest/box/errinj.result
Loading