From: Nikita Pettik <korablev@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2/2] vinyl: skip invalid upserts during squash
Date: Wed, 27 May 2020 20:05:06 +0000 [thread overview]
Message-ID: <20200527200506.GC17325@tarantool.org> (raw)
In-Reply-To: <30344cf8-3ea1-33c2-2c34-89a2c4c561ec@tarantool.org>
On 26 May 23:33, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
> > diff --git a/src/box/vy_history.c b/src/box/vy_history.c
> > index 0f3b71195..2232348f9 100644
> > --- a/src/box/vy_history.c
> > +++ b/src/box/vy_history.c
> > @@ -102,12 +102,22 @@ vy_history_apply(struct vy_history *history, struct key_def *cmp_def,
> > while (node != NULL) {
> > struct tuple *stmt = vy_apply_upsert(node->stmt, curr_stmt,
> > cmp_def, format, true);
> > - ++*upserts_applied;
> > - if (curr_stmt != NULL)
> > - tuple_unref(curr_stmt);
> > - if (stmt == NULL)
> > - return -1;
> > - curr_stmt = stmt;
> > + if (stmt == NULL) {
> > + /*
> > + * In case statement hasn't been applied,
> > + * simply skip it ignoring errors (otherwise
> > + * error will appear during tuple read).
> > + */
> > + assert(diag_last_error(diag_get()) != NULL);
> > + struct error *e = diag_last_error(diag_get());
> > + if (e->type != &type_ClientError)
> > + return -1;
>
> *. Shouldn't we log here?
No, we shouldn't. vy_history_apply() is called only during reads.
So in order to avoid spam the same error each time on data selection,
we don't log it here.
> > diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c
> > index 04c9926a8..3d630fc01 100644
> > --- a/src/box/vy_lsm.c
> > +++ b/src/box/vy_lsm.c
> > @@ -984,13 +984,20 @@ vy_lsm_commit_upsert(struct vy_lsm *lsm, struct vy_mem *mem,
> > struct tuple *upserted =
> > vy_apply_upsert(stmt, older, lsm->cmp_def,
> > lsm->mem_format, false);
> > - lsm->stat.upsert.applied++;
> > -
> > if (upserted == NULL) {
> > - /* OOM */
> > + /*
> > + * OOM or upserted tuple does not fulfill
> > + * space format. Hence, upsert can't be
> > + * transformed into replace. Log error
> > + * and exit.
> > + */
> > + struct error *e = diag_last_error(diag_get());
> > + assert(e != NULL);
> > + error_log(e);
>
> *. These three lines can be replaced with diag_log();.
Ok, let's use diag_log():
diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c
index 3d630fc01..c768d0229 100644
--- a/src/box/vy_lsm.c
+++ b/src/box/vy_lsm.c
@@ -991,10 +991,7 @@ vy_lsm_commit_upsert(struct vy_lsm *lsm, struct vy_mem *mem,
* transformed into replace. Log error
* and exit.
*/
- struct error *e = diag_last_error(diag_get());
- assert(e != NULL);
- error_log(e);
- diag_clear(diag_get());
+ diag_log();
return;
}
lsm->stat.upsert.applied++;
diff --git a/src/box/vy_tx.c b/src/box/vy_tx.c
index 1a2ea43d9..0a14478fc 100644
--- a/src/box/vy_tx.c
+++ b/src/box/vy_tx.c
@@ -516,9 +516,7 @@ vy_tx_write(struct vy_lsm *lsm, struct vy_mem *mem,
tuple_unref(applied);
return rc;
} else {
- struct error *e = diag_last_error(diag_get());
- assert(e != NULL);
- error_log(e);
+ diag_log();
}
}
} else {
> > diff --git a/src/box/vy_tx.c b/src/box/vy_tx.c
> > index 5029bd8a1..1a2ea43d9 100644
> > --- a/src/box/vy_tx.c
> > +++ b/src/box/vy_tx.c
> > @@ -515,11 +515,11 @@ vy_tx_write(struct vy_lsm *lsm, struct vy_mem *mem,
> > region_stmt);
> > tuple_unref(applied);
> > return rc;
> > + } else {
> > + struct error *e = diag_last_error(diag_get());
> > + assert(e != NULL);
> > + error_log(e);
>
> *. The same here.
See diff above.
> > diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c
> > index 7a6a20627..4d34d96c8 100644
> > --- a/src/box/vy_write_iterator.c
> > +++ b/src/box/vy_write_iterator.c
> > @@ -850,10 +850,23 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
> > vy_stmt_type(hint) != IPROTO_UPSERT);
> > struct tuple *applied = vy_apply_upsert(h->tuple, hint,
> > stream->cmp_def, stream->format, false);
> > - if (applied == NULL)
> > - return -1;
> > - vy_stmt_unref_if_possible(h->tuple);
> > - h->tuple = applied;
> > + if (applied == NULL) {
> > + /*
> > + * Current upsert can't be applied.
> > + * Let's skip it and log error.
> > + */
> > + struct error *e = diag_last_error(diag_get());
> > + assert(e != NULL);
> > + if (e->type != &type_ClientError)
> > + return -1;
> > + say_info("upsert %s is not applied due to the error: %s",
> > + vy_stmt_str(h->tuple), e->errmsg);
> > + vy_stmt_unref_if_possible(h->tuple);
>
> *. Why here we use sometimes say_info() and sometimes error_log()? Why
> not something one?
Indeed, let's use here say_error():
diff --git a/src/box/vy_write_iterator.c b/src/box/vy_write_iterator.c
index 4d34d96c8..ce700f260 100644
--- a/src/box/vy_write_iterator.c
+++ b/src/box/vy_write_iterator.c
@@ -859,8 +859,8 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
assert(e != NULL);
if (e->type != &type_ClientError)
return -1;
- say_info("upsert %s is not applied due to the error: %s",
- vy_stmt_str(h->tuple), e->errmsg);
+ say_error("upsert %s is not applied due to the error: %s",
+ vy_stmt_str(h->tuple), e->errmsg);
vy_stmt_unref_if_possible(h->tuple);
h->tuple = hint;
} else {
@@ -882,8 +882,8 @@ vy_read_view_merge(struct vy_write_iterator *stream, struct tuple *hint,
assert(e != NULL);
if (e->type != &type_ClientError)
return -1;
- say_info("upsert %s is not applied due to the error: %s",
- vy_stmt_str(h->tuple), e->errmsg);
+ say_error("upsert %s is not applied due to the error: %s",
+ vy_stmt_str(h->tuple), e->errmsg);
} else {
vy_stmt_unref_if_possible(result->tuple);
result->tuple = applied;
next prev parent reply other threads:[~2020-05-27 20:05 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 21:55 [Tarantool-patches] [PATCH 0/2] Validate result of upserts squash & skip invalid upserts which can't be applied Nikita Pettik
2020-04-13 21:55 ` [Tarantool-patches] [PATCH 1/2] vinyl: validate resulting tuple after upsert is applied Nikita Pettik
2020-06-22 19:28 ` Aleksandr Lyapunov
2020-04-13 21:55 ` [Tarantool-patches] [PATCH 2/2] vinyl: skip invalid upserts during squash Nikita Pettik
2020-04-13 22:12 ` Konstantin Osipov
2020-05-14 2:11 ` Nikita Pettik
2020-05-14 6:56 ` Konstantin Osipov
2020-05-19 19:10 ` Nikita Pettik
2020-05-19 19:39 ` Konstantin Osipov
2020-05-21 2:51 ` Nikita Pettik
2020-05-21 8:36 ` Konstantin Osipov
2020-05-01 0:31 ` Vladislav Shpilevoy
2020-05-14 2:21 ` Nikita Pettik
2020-05-14 21:32 ` Vladislav Shpilevoy
2020-05-19 18:18 ` Nikita Pettik
2020-05-20 22:13 ` Vladislav Shpilevoy
2020-05-26 21:33 ` Vladislav Shpilevoy
2020-05-27 20:05 ` Nikita Pettik [this message]
2020-05-29 21:47 ` Vladislav Shpilevoy
2020-06-01 19:24 ` Nikita Pettik
2020-05-20 22:13 ` [Tarantool-patches] [PATCH 0/2] Validate result of upserts squash & skip invalid upserts which can't be applied Vladislav Shpilevoy
2020-05-22 2:42 ` Nikita Pettik
2020-05-26 21:33 ` Vladislav Shpilevoy
2020-05-27 20:10 ` Nikita Pettik
2020-06-22 14:13 ` Aleksandr Lyapunov
2020-06-22 20:21 ` Nikita Pettik
2020-06-23 12:32 ` Aleksandr Lyapunov
2020-06-02 21:36 ` Vladislav Shpilevoy
2020-06-02 21:37 ` 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=20200527200506.GC17325@tarantool.org \
--to=korablev@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 2/2] vinyl: skip invalid upserts during squash' \
/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