Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Leonid Vasiliev <lvasiliev@tarantool.org>,
	tarantool-patches@dev.tarantool.org, imeevma@tarantool.org,
	korablev@tarantool.org, sergos@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c
Date: Thu, 24 Dec 2020 17:00:31 +0100	[thread overview]
Message-ID: <9af9fff1-81d7-f7ce-ca7e-171f551dfc72@tarantool.org> (raw)
In-Reply-To: <200e5cd6-6c8c-d784-42ae-0a941a7b9e1b@tarantool.org>

Hi! Thanks for the fixes!

See 1 comment below. After that the patchset will LGTM, and
you can send it to Nikita on a second review.

> diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c
> index d64f1bd..07461f5 100644
> --- a/src/box/sql/os_unix.c
> +++ b/src/box/sql/os_unix.c
> @@ -873,6 +908,12 @@ unixWrite(sql_file * id, const void *pBuf, int amt, sql_int64 offset)
>              /* lastErrno set by seekAndWrite */
>              return -1;
>          } else {
> +            /* Wrote to file less than planned. */
> +            const char *err = tt_sprintf("wrote less (%i bytes) "
> +                             "than planned (%i bytes) "
> +                             "to file: %s",
> +                             wrote, amt, pFile->zPath);
> +            diag_set(ClientError, ER_SQL_EXECUTE, err);

Planned wasn't amt, because amt is modified in the loop above. Also
'wrote' will be -1 here, because this branch is taked on ENOSPC and
write() returned -1.

Perpahs it is enough to say that didn't have enough space to write
'amt' bytes (this is how much was left to write).

>              storeLastErrno(pFile, 0);    /* not a system error */
>              return -1;
>          }

  reply	other threads:[~2020-12-24 16:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 23:09 [Tarantool-patches] [PATCH v3 0/2] Fix working with VDBE Leonid Vasiliev
2020-12-16 23:09 ` [Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c Leonid Vasiliev
2020-12-20 16:02   ` Vladislav Shpilevoy
2020-12-23 23:27     ` Leonid Vasiliev
2020-12-24 16:00       ` Vladislav Shpilevoy [this message]
2020-12-24 16:59         ` Nikita Pettik
2020-12-16 23:09 ` [Tarantool-patches] [PATCH v3 2/2] sql: add panic() call in sql_execute() on complete failure Leonid Vasiliev
2020-12-20 16:02   ` Vladislav Shpilevoy
2020-12-23 22:38     ` Leonid Vasiliev

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=9af9fff1-81d7-f7ce-ca7e-171f551dfc72@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=lvasiliev@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c' \
    /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