Re: [PATCH v1] pg_ls_tmpdir to show directories

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH v1] pg_ls_tmpdir to show directories
Date: 2019-12-28 06:52:55
Message-ID: alpine.DEB.2.21.1912280747370.27864@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Justin,

>> Why not simply showing the files underneath their directories?
>>
>> /path/to/tmp/file1
>> /path/to/tmp/subdir1/file2
>>
>> In which case probably showing the directory itself is not useful,
>> and the is_dir column could be dropped?
>
> The names are expected to look like this:
>
> $ sudo find /var/lib/pgsql/12/data/base/pgsql_tmp -ls
> 142977 4 drwxr-x--- 3 postgres postgres 4096 Dec 27 13:51 /var/lib/pgsql/12/data/base/pgsql_tmp
> 169868 4 drwxr-x--- 2 postgres postgres 4096 Dec 7 01:35 /var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset
> 169347 5492 -rw-r----- 1 postgres postgres 5619712 Dec 7 01:35 /var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/0.0
> 169346 5380 -rw-r----- 1 postgres postgres 5505024 Dec 7 01:35 /var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/1.0
>
> I think we'd have to show sudbdir/file1, subdir/file2, not just file1, file2.
> It doesn't seem useful or nice to show a bunch of files called 0.0 or 1.0.
> Actually the results should be unique, either on filename or (dir,file).

Ok, so this suggests recursing into subdirs, which requires to make a
separate function of the inner loop.

> It's worth thinking if subdir should be a separate column.

My 0.02 €: I would rather simply keep the full path and just add subdir
contents, so that the function output does not change at all.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2019-12-28 10:16:50 Re: [PATCH v1] pg_ls_tmpdir to show directories
Previous Message Abdul Yadi AH-2 2019-12-28 04:33:43 PostgreSQL 12.1 patch for "private_modify" table creation option for data validation reinforcement