From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>,
tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 2/2] vinyl: clean-up unprocessed read views in *_build_read_views()
Date: Sun, 19 Apr 2020 17:31:30 +0200 [thread overview]
Message-ID: <4a23b20f-193f-c3d4-fa05-eab17f5e2f60@tarantool.org> (raw)
In-Reply-To: <1bfd4b8d73192086bb351e216386fcd221acff27.1586902245.git.korablev@tarantool.org>
Hi! Thanks for the patch!
See 2 comments below.
> diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c
> index 7a6a20627..910e5a062 100644
> --- a/src/box/vy_write_iterator.c
> +++ b/src/box/vy_write_iterator.c
> @@ -790,8 +790,11 @@ next_lsn:
> * statement around if this is major compaction, because
> * there's no tuple it could overwrite.
> */
> - if (rc == 0 && stream->is_last_level &&
> - stream->deferred_delete_stmt != NULL) {
> + if (rc != 0) {
> + for (int i = 0; i < stream->rv_count; ++i)
> + stream->read_views[i].history = NULL;
1. Why are we sure it is safe to nullify the read view histories in
case of a fail? Looks like they can keep tuples which should be
unreferenced. If it would be enough to nullify them, we could
just do the same in vy_write_iterator_stop(). But it calls
vy_write_history_destroy() before nullification.
Why is not it called here? The same question for vy_read_view_merge().
> + } else if (stream->is_last_level &&
> + stream->deferred_delete_stmt != NULL) {
> vy_stmt_unref_if_possible(stream->deferred_delete_stmt);
> stream->deferred_delete_stmt = NULL;
> }
> @@ -834,6 +837,15 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
> rv->history = NULL;
> return 0;
> }
> +#ifndef NDEBUG
> + struct errinj *inj =
> + errinj(ERRINJ_VY_READ_VIEW_MERGE_FAIL, ERRINJ_BOOL);
> + if (inj != NULL && inj->bparam) {
> + inj->bparam = false;
> + diag_set(OutOfMemory, 666, "malloc", "struct vy_stmt");
> + return -1;
> + }
2. Indentation is too big.
> +#endif
> @@ -983,8 +995,13 @@ vy_write_iterator_build_read_views(struct vy_write_iterator *stream, int *count)
> if (rv->history == NULL)
> continue;
> if (vy_read_view_merge(stream, hint, rv,
> - is_first_insert) != 0)
> + is_first_insert) != 0) {
> + while (rv >= &stream->read_views[0]) {
> + rv->history = NULL;
> + rv--;
> + }
> goto error;
> + }
> assert(rv->history == NULL);
> if (rv->tuple == NULL)
> continue;
next prev parent reply other threads:[~2020-04-19 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 22:22 [Tarantool-patches] [PATCH v2 0/2] vinyl: fix uninitialized memory accesses Nikita Pettik
2020-04-14 22:22 ` [Tarantool-patches] [PATCH v2 1/2] vinyl: init all vars before cleanup in vy_lsm_split_range() Nikita Pettik
2020-04-14 22:22 ` [Tarantool-patches] [PATCH v2 2/2] vinyl: clean-up unprocessed read views in *_build_read_views() Nikita Pettik
2020-04-19 15:31 ` Vladislav Shpilevoy [this message]
2020-04-27 0:53 ` Nikita Pettik
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=4a23b20f-193f-c3d4-fa05-eab17f5e2f60@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 2/2] vinyl: clean-up unprocessed read views in *_build_read_views()' \
/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