From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 02E484765E0 for ; Thu, 24 Dec 2020 19:59:38 +0300 (MSK) Date: Thu, 24 Dec 2020 16:59:37 +0000 From: Nikita Pettik Message-ID: <20201224165937.GD14559@tarantool.org> References: <54ef9ccd2a7bee1f5f53a811c7edea1ba034c4ca.1608159414.git.lvasiliev@tarantool.org> <8e66938a-e950-1b80-e664-13af405dfaeb@tarantool.org> <200e5cd6-6c8c-d784-42ae-0a941a7b9e1b@tarantool.org> <9af9fff1-81d7-f7ce-ca7e-171f551dfc72@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9af9fff1-81d7-f7ce-ca7e-171f551dfc72@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org 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; > >          }