Re: Improving connection scalability: GetSnapshotData() - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Improving connection scalability: GetSnapshotData()
Date
Msg-id 20201001202201.bjff3mghwasihbzj@alap3.anarazel.de
Whole thread Raw
In response to Re: Improving connection scalability: GetSnapshotData()  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Responses Re: Improving connection scalability: GetSnapshotData()
Re: Improving connection scalability: GetSnapshotData()
List pgsql-hackers
Hi,

On 2020-10-01 16:00:20 -0400, Andrew Dunstan wrote:
> My strong suspicion is that we're getting unwanted CRs. Note the
> presence of numerous instances of this in PostgresNode.pm:


>     $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
> 
> So you probably want something along those lines at the top of the loop
> in send_query_and_wait:
> 
>     $$psql{stdout} =~ s/\r\n/\n/g if $Config{osname} eq 'msys';

Yikes, that's ugly :(.


I assume it's not, as the comments says
    # Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
    # if we're using native Perl, but not if we're using MSys Perl.  So do it
    # by hand in the latter case, here and elsewhere.
that IPC::Run converts things, but that native windows perl uses
https://perldoc.perl.org/perlrun#PERLIO
a PERLIO that includes :crlf, whereas msys probably doesn't?

Any chance you could run something like
perl -mPerlIO -e 'print(PerlIO::get_layers(STDIN), "\n");'
on both native and msys perl?


> possibly also for stderr, just to make it more futureproof, and at the
> top of the file:
> 
>     use Config;
> 
> 

> Do you want me to test that first?

That'd be awesome.


> The difference between the canonical way perl states the regex is due to
> perl version differences. It shouldn't matter.

Thanks!

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Improving connection scalability: GetSnapshotData()
Next
From: Andrew Dunstan
Date:
Subject: Re: Improving connection scalability: GetSnapshotData()