On Tue, Jul 26, 2022 at 06:58:02PM +0200, Matthias van de Meent wrote:
> - Retained the check in XLogRegisterData, so that we check against
> integer overflows in the registerdata code instead of only an assert
> in XLogRecordAssemble where it might be too late.
Why? The record has not been inserted yet. I would tend to keep only
the check at the bottom of XLogRecordAssemble(), for simplicity, and
call it a day.
> - Kept the inline static elog-ing function (as per Andres' suggestion
> on 2022-03-14; this decreases binary sizes)
I am not really convinced that this one is worth doing.
+#define MaxXLogRecordSize (1020 * 1024 * 1024)
+
+#define XLogRecordLengthIsValid(len) ((len) >= 0 && (len) < MaxXLogRecordSize)
These are used only in xloginsert.c, so we could keep them isolated.
+ * To accommodate some overhead, hhis MaxXLogRecordSize value allows for
s/hhis/this/.
For now, I have extracted from the patch the two API changes and the
checks for the block information for uint16, and applied this part.
That's one less thing to worry about.
--
Michael