pgsql: Allow TestLib::slurp_file to skip contents, and use as needed

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow TestLib::slurp_file to skip contents, and use as needed
Date: 2021-04-16 21:42:14
Message-ID: E1lXWEA-0003PQ-44@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow TestLib::slurp_file to skip contents, and use as needed

In order to avoid getting old logfile contents certain functions in
PostgresNode were doing one of two things. On Windows it rotated the
logfile and restarted the server, while elsewhere it truncated the log
file. Both of these are unnecessary. We borrow from the buildfarm which
does this instead: note the size of the logfile before we start, and
then when fetching the logfile skip to that position before accumulating
contents. This is spelled differently on Windows but the effect is the
same. This is largely centralized in TestLib's slurp_file function,
which has a new optional parameter, the offset to skip to before
starting to reading the file. Code in the client becomes much neater.

Backpatch to all live branches.

Michael Paquier, slightly modified by me.

Discussion: https://postgr.es/m/YHajnhcMAI3++pJL@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c5b0685b921533f37622345beb0f8dd49200c01

Modified Files
--------------
src/test/perl/PostgresNode.pm | 46 +++++++++----------------------------------
src/test/perl/TestLib.pm | 21 +++++++++++++++-----
2 files changed, 25 insertions(+), 42 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-04-16 22:37:15 pgsql: Split function definitions out of system_views.sql into a new fi
Previous Message Tom Lane 2021-04-16 20:49:21 Re: pgsql: Use SIGURG rather than SIGUSR1 for latches.