Re: Persist injection points across server restarts

From: Rahila Syed <rahilasyed90(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Maksim(dot)Melnikov" <m(dot)melnikov(at)postgrespro(dot)ru>
Subject: Re: Persist injection points across server restarts
Date: 2025-05-26 07:47:46
Message-ID: CAH2L28t4jGQ+iEbg=4ZN-akw6hOtgsjNEPYgzLzypHV-Hkij2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> This is v19 work, so I am adding that to the next commit fest.
>
> Rebased, to fix a conflict I've introduced with a different commit.
>
>
Thank you for the rebased patches. I reviewed the code and have a few
comments for
your consideration.

It appears that Github CI is reporting failures with
injection_points/002_data_persist
failing across all OSes.

Following are comments on
v2-0002-injection_points-Add-function-to-flush-injection-.patch
1.
/*
+ * Rename file into place, so we atomically replace any old one.
+ */
+ (void) durable_rename(INJ_DUMP_FILE_TMP, INJ_DUMP_FILE, LOG);

I wonder if it would be better to include a check for the return value of
`durable_rename` to
manage potential failure scenarios.

2. +
+ file = AllocateFile(INJ_DUMP_FILE ".tmp", PG_BINARY_W);

Could we perhaps add a brief comment clarifying the rationale behind the
use of a
temporary file in this context?

3. + if (fread(buf, 1, len + 1, file) != len + 1)
+ goto error;
+ library = pstrdup(buf);

It seems that `buf` should be null-terminated before being passed to
`pstrdup(buf)`.
Otherwise, `strlen` might not accurately determine the length. This seems
to be
consistent with the handling of `fread` calls in `snapmgr.c`.

Thank you,
Rahila Syed

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-05-26 07:49:34 Add AioUringCompletion in wait_event_names.txt and a safeguard in generate-wait_event_types.pl
Previous Message Zhijie Hou (Fujitsu) 2025-05-26 07:21:38 RE: Conflict detection for update_deleted in logical replication