On 2017-12-12 14:04:55 -0500, Robert Haas wrote:
> On Tue, Dec 12, 2017 at 1:50 PM, Andres Freund <andres@anarazel.de> wrote:
> > I do wonder if the right thing here wouldn't be to put the result into a
> > dsm segment, and then return that to the UDF on the requesting
> > side. Logging to the server log and then have the requestor dig that out
> > doesn't seem particularly user friendly.
>
> I think that dumping it to the server log will be fine for most
> people, and it's *significantly* safer.
I agree that it's more reliable - I hope there's no meaningful safety
difference. I think you overestimate users a bit however - far from
most of them are going to be able to extract a very long log entry from
a busy log file. There's no generally available easy way to copy a few
pages of text from a logfile that's a few gigabytes large...
I'd suggest adding two functions.
> Creating a DSM segment could fail, and the last thing we want is for
> interrogating a long-running backend to make it crap out.
It'd need to handle memory alloc failures gracefully, I agree. That
doesn't seem impossible. Also don't think that's meaningfully different
in the non-dsm case, it'd be good to handle malloc failures gracefully
in that case as well.
The requesting side should create the dsm segment and preallocate a
reasonable amount of memory, if we go for it.
> +1 for this whole concept, just BTW. As I've said before, I grow
> weary of asking customers to run gdb.
Indeed.
Greetings,
Andres Freund