From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 8834B4696C3 for ; Mon, 6 Apr 2020 17:17:18 +0300 (MSK) From: Nikita Pettik Date: Mon, 6 Apr 2020 17:17:09 +0300 Message-Id: Subject: [Tarantool-patches] [PATCH v3 0/6] Stacked diagnostics List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: v.shpilevoy@tarantool.org Branch: https://github.com/tarantool/tarantool/commits/np/gh-1148-stacked-diag Issue: https://github.com/tarantool/tarantool/issues/1148 https://github.com/tarantool/tarantool/issues/4829 Implementation of stacked diagnostics in Tarantool according to RFC: https://github.com/tarantool/tarantool/commit/1acd32d98f628431429b427df19caa9d269bb9c8). Error structure is extended with double linked list; Lua and C interfaces are provided to interact with it; stacked diagnostics is supported in IProto protocol and net.box modules. Note that patch-set also contains fix of #4829 since some tests rely on the fact that box.error(err_obj) promotes error to diagnotic area. Changes in v2: - renamed 'prev' and 'next' links in struct error to 'cause' and 'effect'; - moved all tests related to box.error module to a separate file (box/error.test.lua); - removed recursion from error_unref(); - removed box_error_construct() and box_error_add() from public API; - removed error_prev() getter which was used to access error.prev member in Lua (now it is accessed directly via error._prev); - moved diag_add() usages to a separate commit; - several ref/unref usages corrections in the code; - added mp_check_* auxiliary checks to iproto_decode_error_stack(); - other minor refactoring (removing unused headers and redundant testing facilities, fixing comments etc); - rebased to fresh master branch. Changes in v3: - refactored iproto_decode_error_stack(): removed mp_check_*() calls, added checks on broken map keys values including overflowed values; - added unit tests to cover iproto_decode_error_stack() function (which can be called by replication applier); - integration tests were simplified: instead of using complicated schema involving persistent functions and functional indexes, simple function which raises stack of errors is used; - optimized error_set_prev() function: cycle detection is avoided in most cases; - other refactoring: code, tests and commit message clean-ups; added a few comments and assertion checks. - rebased to fresh master branch. @ChangeLog * Always promote error created via box.error() to diagnostic area (gh-4829). * Introduced stacked diagnostick area: now each Lua table representing error object features .prev member and :set_prev() method. So that errors can be organized into lists. IProto protocol is extended with new command keys to support this feature as well (gh-1148). Kirill Shcherbatov (1): iproto: refactor error encoding with mpstream Nikita Pettik (5): box: introduce stacked diagnostic area box: use stacked diagnostic area for functional indexes box/error: clarify purpose of reference counting in struct error box: always promote error created via box.error() to diag iproto: support error stacked diagnostic area extra/exports | 1 + src/box/error.cc | 21 +++ src/box/error.h | 16 ++ src/box/iproto_constants.h | 6 + src/box/key_list.c | 12 +- src/box/lua/call.c | 6 +- src/box/lua/error.cc | 13 +- src/box/lua/net_box.lua | 30 ++- src/box/xrow.c | 150 ++++++++++++--- src/lib/core/diag.c | 47 +++++ src/lib/core/diag.h | 111 ++++++++++- src/lib/core/exception.cc | 1 + src/lua/error.lua | 32 ++++ test/box-py/iproto.result | 6 +- test/box-py/iproto.test.py | 6 +- test/box/error.result | 325 ++++++++++++++++++++++++++++++++ test/box/error.test.lua | 120 ++++++++++++ test/box/iproto.result | 142 ++++++++++++++ test/box/iproto.test.lua | 66 +++++++ test/box/net.box.result | 71 +++++++ test/box/net.box.test.lua | 31 +++ test/engine/func_index.result | 54 +++++- test/engine/func_index.test.lua | 8 + test/unit/xrow.cc | 184 +++++++++++++++++- test/unit/xrow.result | 27 ++- 25 files changed, 1424 insertions(+), 62 deletions(-) create mode 100644 test/box/iproto.result create mode 100644 test/box/iproto.test.lua -- 2.17.1