Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: v.shpilevoy@tarantool.org, tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] replication: stop pushing TimedOut error to the replica
Date: Mon, 12 Jul 2021 13:14:09 +0300	[thread overview]
Message-ID: <21e11a11-c771-e014-3874-3083dbdaf4c7@tarantool.org> (raw)
In-Reply-To: <YOgn7/qxwOh24D4y@grain>



09.07.2021 13:41, Cyrill Gorcunov пишет:
> On Fri, Jul 09, 2021 at 11:30:20AM +0300, Serge Petrenko wrote:
>> Thanks! No problem, will rework.
>> It might be better to not allocate any string at all.
>> I can simply allocate the needed buffer on the region (where the msgpack
>> will be encoded), and encode the string header, and leave the
>> buffer with whatever contents it has (it'll probably be filled
>> with 0x50 bytes, it's the slab poison symbol).
>>
>> Cool, good idea!

I've found an even better solution:

We don't care for the actual contents of the error, so
it's fine to fill the buffer with whatever junk we come up with.
(That's because the error is meant to fill the remaining buffer
space after a partially written row).
'E' is for error injection, since we have 'P' for slab poison.

I've force-pushed the following change:

====================

diff --git a/src/box/xrow.c b/src/box/xrow.c
index fae9861a5..c4647c6cb 100644
--- a/src/box/xrow.c
+++ b/src/box/xrow.c
@@ -552,10 +552,8 @@ iproto_write_error(int fd, const struct error *e, 
uint32_t schema_version,
         mpstream_iproto_encode_error(&stream, e);
         struct errinj *inj = errinj(ERRINJ_IPROTO_WRITE_ERROR_LARGE,
                                     ERRINJ_INT);
-       if (inj != NULL && inj->iparam > 0) {
-               char garbage[inj->iparam];
-               mpstream_encode_strn(&stream, garbage, inj->iparam);
-       }
+       if (inj != NULL && inj->iparam > 0)
+               mpstream_memset(&stream, 'E', inj->iparam);
         mpstream_flush(&stream);
         if (is_error)
                 goto cleanup;

=====================

-- 
Serge Petrenko


  reply	other threads:[~2021-07-12 10:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  7:40 Serge Petrenko via Tarantool-patches
2021-07-09  7:59 ` Cyrill Gorcunov via Tarantool-patches
2021-07-09  8:30   ` Serge Petrenko via Tarantool-patches
2021-07-09 10:41     ` Cyrill Gorcunov via Tarantool-patches
2021-07-12 10:14       ` Serge Petrenko via Tarantool-patches [this message]
2021-07-12 10:38         ` Cyrill Gorcunov via Tarantool-patches
2021-07-13 21:49 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-15 10:20   ` Serge Petrenko via Tarantool-patches
2021-07-15 21:04 ` Vladislav Shpilevoy via Tarantool-patches

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=21e11a11-c771-e014-3874-3083dbdaf4c7@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] replication: stop pushing TimedOut error to the replica' \
    /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