Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations?
От
torikoshia
Тема
Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations?
Дата
Msg-id
d55f973ba36a24635c2e96680b3d9e33@oss.nttdata.com
Ответ на
Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? (Kyotaro Horiguchi)
Список
Дерево обсуждения
Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? torikoshia <torikoshia@oss.nttdata.com>
Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? Yugo Nagata <nagata@sraoss.co.jp>
Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? torikoshia <torikoshia@oss.nttdata.com>
Nagata-san, Horiguchi-san, Thank you for confirming! My understanding is as follows: - It is not clear why only logical messages return endptr. - According to the documentation, the value should be startptr rather than endptr. - PostgreSQL itself does not have mechanism that uses this LSN, so either value does not cause a problem within PostgreSQL. Regarding the third point, I believe this distinction is important for consumers of logical decoding. Typically, a consumer records the LSN up to which the decoded result has been successfully processed and uses that LSN as the restart point after a crash or other failure. From that perspective, whether startptr or endptr is returned matters. With the current behavior, consumers need to be aware that only logical messages return endptr (and this does not appear to be documented, so one would have to discover it through testing). Then they need special handling to translate the completion LSN for logical messages back to the previous processing position. On this point, I have started discussing with the Debezium community, where I originally encountered this issue. The main question is whether a change in PostgreSQL's behavior would be welcomed, or whether Debezium instead treats logical messages differently from other decoded records. If they reach some consensus, I would be happy to share the outcome here. It is also possible that someone from the Debezium community will comment on this thread directly. I think it's valuable to hear from anyone familiar with products or applications that decode pg_logical_emit_message(). For example, I wonder whether Fujitsu's 'Userlog Operation' might also be affected: https://www.postgresql.fastware.com/hubfs/_Global/Manuals/FEP-v17forx86-UserlogOperationGuide.pdf Thanks, -- Atsushi Torikoshi
В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата: