Re: Cluster::restart dumping logs when stop fails

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Cluster::restart dumping logs when stop fails
Дата
Msg-id 332deaa1-5a92-4105-aa25-7ed2c00839ad@dunslane.net
обсуждение исходный текст
Ответ на Re: Cluster::restart dumping logs when stop fails  (Andres Freund <andres@anarazel.de>)
Ответы Re: Cluster::restart dumping logs when stop fails  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers


On 2024-04-06 Sa 20:49, Andres Freund wrote:

That's probably unnecessary optimization, but it seems a tad silly to read an
entire, potentially sizable, file to just use the last 1k. Not sure if the way
slurp_file() uses seek supports negative ofsets, the docs read to me like that
may only be supported with SEEK_END.


We should enhance slurp_file() so it uses SEEK_END if the offset is negative. It would be a trivial patch:


diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 42d5a50dc8..8256573957 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -524,7 +524,7 @@ sub slurp_file
 
    if (defined($offset))
    {
-       seek($fh, $offset, SEEK_SET)
+       seek($fh, $offset, ($offset < 0 ? SEEK_END : SEEK_SET))
          or croak "could not seek \"$filename\": $!";
    }

cheers


andrew


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: Flushing large data immediately in pqcomm
Следующее
От: "Andrey M. Borodin"
Дата:
Сообщение: Re: MultiXact\SLRU buffers configuration