From: Nikita Pettik <korablev@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH 4/7] box: introduce stacked diagnostic area Date: Wed, 25 Mar 2020 01:34:02 +0000 [thread overview] Message-ID: <20200325013402.GB30598@tarantool.org> (raw) In-Reply-To: <b70729ae-6d8a-76cb-fbf7-8e7ffbd6a615@tarantool.org> On 23 Feb 18:43, Vladislav Shpilevoy wrote: > Hi! Thanks for the patch, welcome to the first review iteration! > > Finally something good, not related to SQL/replication/application server > modules. > > > +/** > > + * Add a new error to the diagnostics area. It is added to the > > + * tail, so that list forms stack. > > + * @param diag Diagnostics area. > > + * @param e Error to be added. > > + */ > > +static inline void > > +diag_add_error(struct diag *diag, struct error *e) > > +{ > > + assert(e != NULL); > > + error_ref(e); > > + error_unlink_tail(e); > > + e->next = diag->last; > > 15. I thought, that 'next' member is responsible for keeping a > reference, but since you don't ref 'diag->last' here, I am not > sure now. Could you please clarify? Yes, but since diag->last is not longer the head of diag list, it also should be unrefed. One ref and one unref - as a result no ref actions. > > + if (diag->last != NULL) > > + diag->last->prev = e; > > diag->last = e; > > } > > > > 21. It is not really necessary to use assertion here. It will fail > without assertion too in case of a problem. Assertion is needed, > when you want an exception. For example, when you call a function, > inside which you do tests. IMHO assertions underline the fact of testing result of particular action (since we don't have explicit test case borders, it may turn out to be vital while attempting at exploring test). We can discuss it in server chat with other members, I do not mind both approaches. > Instead of an assertion it is better to write something like that: > > e3.prev == e2 or {e3, e3.prev, e2} > > In that case, if the == is false, you will see not only a false in > .reject file, but also actual values of e3, e3.prev, and e2. This > is especially helpful, when error is not stable, and in Travis/Gitlab, > because you see values right in the web console. These tests are quite easy to reproduce copying them to Tarantool's console.
next prev parent reply other threads:[~2020-03-25 1:34 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-19 14:16 [Tarantool-patches] [PATCH 0/7] Stacked diagnostics area Nikita Pettik 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 1/7] box: rename diag_add_error to diag_set_error Nikita Pettik 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 2/7] box/error: introduce box.error.set() method Nikita Pettik 2020-02-19 14:26 ` Cyrill Gorcunov 2020-02-19 14:30 ` Nikita Pettik 2020-02-19 14:53 ` Cyrill Gorcunov 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 3/7] box/error: don't set error created via box.error.new to diag Nikita Pettik 2020-02-22 17:18 ` Vladislav Shpilevoy 2020-03-25 1:02 ` Nikita Pettik 2020-03-26 0:22 ` Vladislav Shpilevoy 2020-03-26 1:03 ` Nikita Pettik 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 4/7] box: introduce stacked diagnostic area Nikita Pettik 2020-02-19 21:10 ` Vladislav Shpilevoy 2020-02-20 11:53 ` Nikita Pettik 2020-02-20 18:29 ` Nikita Pettik 2020-02-23 17:43 ` Vladislav Shpilevoy 2020-03-25 1:34 ` Nikita Pettik [this message] 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 5/7] box/error: clarify purpose of reference counting in struct error Nikita Pettik 2020-02-23 17:43 ` Vladislav Shpilevoy 2020-03-25 1:40 ` Nikita Pettik 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 6/7] iproto: refactor error encoding with mpstream Nikita Pettik 2020-02-23 17:44 ` Vladislav Shpilevoy 2020-03-25 1:42 ` Nikita Pettik 2020-02-19 14:16 ` [Tarantool-patches] [PATCH 7/7] iproto: support error stacked diagnostic area Nikita Pettik 2020-02-23 17:43 ` Vladislav Shpilevoy 2020-03-25 1:38 ` Nikita Pettik 2020-02-22 17:18 ` [Tarantool-patches] [PATCH 0/7] Stacked diagnostics area Vladislav Shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200325013402.GB30598@tarantool.org \ --to=korablev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 4/7] box: introduce stacked diagnostic area' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox