[Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c
Nikita Pettik
korablev at tarantool.org
Thu Dec 24 19:59:37 MSK 2020
On 24 Dec 17:00, Vladislav Shpilevoy wrote:
> 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.
Right away I can say that it would be super nice to see corresponding test
(using error injections I gueess). Otherwise we can't say for sure that
all this stubs are working...
> > 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;
> > }
More information about the Tarantool-patches
mailing list