Re: [proposal] de-TOAST'ing using a iterator
Binguo Bao <djydewang@gmail.com>
From: Binguo Bao <djydewang@gmail.com>
To: John Naylor <john.naylor@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, Andrey Borodin <x4mmm@yandex-team.ru>, Atri Sharma <atri.jiit@gmail.com>, Stephen Frost <sfrost@snowman.net>, Владимир Лесков <vladimirlesk@yandex-team.ru>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-08-21T17:10:43Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Use single-byte Boyer-Moore-Horspool search even with multibyte encodings.
- 9556aa01c69a 12.0 cited
Attachments
- 0001-de-TOASTing-using-a-iterator-9.patch (text/x-patch) patch 0001
John Naylor <john.naylor@2ndquadrant.com> 于2019年8月19日周一 下午12:55写道: > init_toast_buffer(): > > + * Note the constrain buf->position <= buf->limit may be broken > + * at initialization. Make sure that the constrain is satisfied > + * when consume chars. > > s/constrain/constraint/ (2 times) > s/consume/consuming/ > > Also, this comment might be better at the top the whole function? > The constraint is broken in the if branch, so I think put this comment in the branch is more precise. The check > if (iter->buf != iter->fetch_datum_iterator->buf) > is what we need to do for the compressed case. Could we use this > directly instead of having a separate state variable iter->compressed, > with a macro like this? > #define TOAST_ITER_COMPRESSED(iter) \ > (iter->buf != iter->fetch_datum_iterator->buf) The logic of the macro may be hard to understand, so I think it's ok to just check the compressed state variable. + * If "ctrlc" field in iterator is equal to INVALID_CTRLC, it means that > + * the field is invalid and need to read the control byte from the > + * source buffer in the next iteration, see pglz_decompress_iterate(). > + */ > +#define INVALID_CTRLC 8 > > I think the macro might be better placed in pg_lzcompress.h, and for > consistency used in pglz_decompress(). Then the comment can be shorter > and more general. With my additional comment in > init_detoast_iterator(), hopefully it will be clear to readers. > The main role of this macro is to explain the iterator's "ctrlc" state, IMO it's reasonable to put the macro and definition of de-TOAST iterator together. Thanks for your suggestion, I have updated the patch. -- Best regards, Binguo Bao