Re: logical decoding/replication: new functions pg_ls_logicaldir and pg_ls_replslotdir

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: logical decoding/replication: new functions pg_ls_logicaldir and pg_ls_replslotdir
Date: 2021-11-17 18:46:47
Message-ID: D3D7B42F-9675-4B30-BD10-F82D8AE9A02D@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/30/21, 2:36 AM, "Bharath Rupireddy" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> I've added 3 functions pg_ls_logicalsnapdir, pg_ls_logicalmapdir,
> pg_ls_replslotdir, and attached the patch. The sample output looks
> like [1]. Please review it further.

I took a look at the patch.

+ char path[MAXPGPATH + 11];

Why are you adding 11 to MAXPGPATH here? I would think that MAXPGPATH
is sufficient.

+ filename = text_to_cstring(filename_t);
+ snprintf(path, sizeof(path), "%s/%s", "pg_replslot", filename);
+ return pg_ls_dir_files(fcinfo, path, false);

I think we need to do some additional input validation here. It's
pretty easy to use this to see the contents of other directories.

postgres=# SELECT * FROM pg_ls_replslotdir('../');
name | size | modification
----------------------+-------+------------------------
postgresql.conf | 28995 | 2021-11-17 18:40:33+00
pg_hba.conf | 4789 | 2021-11-17 18:40:33+00
postmaster.opts | 39 | 2021-11-17 18:43:07+00
postgresql.auto.conf | 88 | 2021-11-17 18:40:33+00
pg_ident.conf | 1636 | 2021-11-17 18:40:33+00
postmaster.pid | 95 | 2021-11-17 18:43:07+00
PG_VERSION | 3 | 2021-11-17 18:40:33+00
(7 rows)

Nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-11-17 18:47:29 Re: Propose a new hook for mutating the query bounds
Previous Message Melanie Plageman 2021-11-17 18:45:06 Re: Parallel Full Hash Join