Re: [proposal] de-TOAST'ing using a iterator

Поиск
Список
Период
Сортировка
От Binguo Bao
Тема Re: [proposal] de-TOAST'ing using a iterator
Дата
Msg-id CAL-OGkvGePwfAaPbfv2Ec-0ubPUE-==0PygpLxyEjNsw-ZSGUw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [proposal] de-TOAST'ing using a iterator  (John Naylor <john.naylor@2ndquadrant.com>)
Ответы Re: [proposal] de-TOAST'ing using a iterator  (John Naylor <john.naylor@2ndquadrant.com>)
Re: [proposal] de-TOAST'ing using a iterator  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
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
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Konstantin Knizhnik
Дата:
Сообщение: Why overhead of SPI is so large?
Следующее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index.