On 08.09.26 17:03, Andres Freund wrote:
+ /*
+ * These are used to hold the record header while constructing a record.
+ * 'hdr_scratch' must be MAXALIGNed and padding bytes zeroed.
+ *
+ * For simplicity, it's allocated large enough to hold the headers for
any
+ * WAL record.
+ */
+ static XLogRecData hdr_rdt;
+ static alignas(MAXIMUM_ALIGNOF) char hdr_scratch[HEADER_SCRATCH_SIZE];
I think we really shouldn't add more function level statics at this point. At
least for file level static variables you can just slap a thread_local on and
it has a chance of working. But it won't with this.
What would prevent us from adding thread_local to a function-scope
static variable? AFAICT, that should work.
(In this particular case, with Heikki's suggestion, it seems we can get
rid of it.)