Re: Listen / Notify - what to do when the queue is full - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Listen / Notify - what to do when the queue is full
Date
Msg-id 20100208161632.GL4113@alvh.no-ip.org
Whole thread Raw
In response to Re: Listen / Notify - what to do when the queue is full  (Joachim Wieland <joe@mcknight.de>)
Responses Re: Listen / Notify - what to do when the queue is full  (Joachim Wieland <joe@mcknight.de>)
List pgsql-hackers
Joachim Wieland wrote:

> + typedef struct AsyncQueueEntry
> + {
> +     /*
> +      * this record has the maximal length, but usually we limit it to
> +      * AsyncQueueEntryEmptySize + strlen(payload).
> +      */
> +     Size            length;
> +     Oid                dboid;
> +     TransactionId    xid;
> +     int32            srcPid;
> +     char            channel[NAMEDATALEN];
> +     char            payload[NOTIFY_PAYLOAD_MAX_LENGTH];
> + } AsyncQueueEntry;
> + #define AsyncQueueEntryEmptySize \
> +      (sizeof(AsyncQueueEntry) - NOTIFY_PAYLOAD_MAX_LENGTH + 1)

These are the on-disk notifications, right?  It seems to me a bit
wasteful to store channel name always as NAMEDATALEN bytes.  Can we
truncate it at its strlen?  I realize that this would cause the struct
definition to be uglier (you will no longer be able to have both channel
and payload pointers, only a char[1] pointer to a data area to which you
write both).  Typical channel names should be short, so IMHO this is
worthwhile.  Besides, I think the uglification of code this causes
should be fairly contained ...

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Re: [GENERAL] FM format modifier does not remove leading zero from year
Next
From: Tom Lane
Date:
Subject: Re: Re: [GENERAL] FM format modifier does not remove leading zero from year