Re: BUG #17382: When vacuum full or vacuumdb - F is executed, a large number of empty files will be generated in the - Mailing list pgsql-bugs

From 两个孩子的爹
Subject Re: BUG #17382: When vacuum full or vacuumdb - F is executed, a large number of empty files will be generated in the
Date
Msg-id tencent_455C88A54F4AFB73D3824A2558585F911209@qq.com
Whole thread Raw
In response to Re: BUG #17382: When vacuum full or vacuumdb - F is executed, a large number of empty files will be generated in the  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #17382: When vacuum full or vacuumdb - F is executed, a large number of empty files will be generated in the
List pgsql-bugs
Sorry, it's my fault. The empty files generated by "vacuumdb - f " is located under the $pgdata / base / 99522 directory

The following is the verification:

[postgres@PG-3 ~]$ psql 
Timing is on.
Border style is 2.
Null display is "NULL".
psql (14.1)
Type "help" for help.

user:postgres@db:postgres[[local]:5432]#\l
                                   List of databases
+-----------+----------+----------+-------------+-------------+-----------------------+
|   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   |
+-----------+----------+----------+-------------+-------------+-----------------------+
| postgres  | postgres | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 |                       |
| template0 | postgres | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres          +|
|           |          |          |             |             | postgres=CTc/postgres |
| template1 | postgres | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres          +|
|           |          |          |             |             | postgres=CTc/postgres |
+-----------+----------+----------+-------------+-------------+-----------------------+
(3 rows)

user:postgres@db:postgres[[local]:5432]#select * from pg_database; 
+-------+-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+------------+---------------+-------------------------------------+
|  oid  |  datname  | datdba | encoding | datcollate  |  datctype   | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | datminmxid | dattablespace |               datacl                |
+-------+-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+------------+---------------+-------------------------------------+
|     1 | template1 |     10 |        6 | zh_CN.UTF-8 | zh_CN.UTF-8 | t             | t            |           -1 |         14407 |          727 |          1 |          1663 | {=c/postgres,postgres=CTc/postgres} |
| 14407 | template0 |     10 |        6 | zh_CN.UTF-8 | zh_CN.UTF-8 | t             | f            |           -1 |         14407 |          727 |          1 |          1663 | {=c/postgres,postgres=CTc/postgres} |
| 99522 | postgres  |     10 |        6 | zh_CN.UTF-8 | zh_CN.UTF-8 | f             | t            |           -1 |         14407 |         1529 |          4 |          1663 | NULL                                |
+-------+-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+------------+---------------+-------------------------------------+
(3 rows)

Time: 0.782 ms
user:postgres@db:postgres[[local]:5432]#\! ls -l $PGDATA/base/99522 | wc -l 
292
user:postgres@db:postgres[[local]:5432]#vacuum full;
VACUUM
Time: 604.148 ms
user:postgres@db:postgres[[local]:5432]#\! ls -l $PGDATA/base/99522 | wc -l
435
user:postgres@db:postgres[[local]:5432]#\q

[postgres@PG-3 ~]$ cd $PGDATA/base/99522
[postgres@PG-3 99522]$ ll | less
总用量 13160
-rw------- 1 postgres postgres      0 1月  28 21:39 101874
-rw------- 1 postgres postgres      0 1月  26 16:37 101877
-rw------- 1 postgres postgres      0 1月  28 21:39 101878
-rw------- 1 postgres postgres      0 1月  28 21:39 101879
-rw------- 1 postgres postgres      0 1月  28 21:39 101880
-rw------- 1 postgres postgres      0 1月  28 21:39 101881
-rw------- 1 postgres postgres      0 1月  28 21:39 101884
-rw------- 1 postgres postgres      0 1月  28 21:39 101885
-rw------- 1 postgres postgres      0 1月  28 21:39 101886
-rw------- 1 postgres postgres      0 1月  28 21:39 101887
-rw------- 1 postgres postgres      0 1月  28 21:39 101888
-rw------- 1 postgres postgres      0 1月  28 21:39 101891
-rw------- 1 postgres postgres      0 1月  28 21:39 101892
-rw------- 1 postgres postgres      0 1月  28 21:39 101893
-rw------- 1 postgres postgres      0 1月  28 21:39 101894
-rw------- 1 postgres postgres      0 1月  26 16:37 101897
-rw------- 1 postgres postgres      0 1月  28 21:39 101898
-rw------- 1 postgres postgres      0 1月  28 21:39 101899
-rw------- 1 postgres postgres      0 1月  28 21:39 101900
-rw------- 1 postgres postgres      0 1月  28 21:39 101901
-rw------- 1 postgres postgres      0 1月  26 16:37 101904
-rw------- 1 postgres postgres      0 1月  28 21:39 101905
-rw------- 1 postgres postgres      0 1月  28 21:39 101906
-rw------- 1 postgres postgres      0 1月  28 21:39 101907
-rw------- 1 postgres postgres      0 1月  28 21:39 101908
-rw------- 1 postgres postgres      0 1月  28 21:39 101909
-rw------- 1 postgres postgres      0 1月  28 21:39 101910
-rw------- 1 postgres postgres      0 1月  28 21:39 101911
-rw------- 1 postgres postgres      0 1月  28 21:39 101914
-rw------- 1 postgres postgres      0 1月  28 21:39 101915
-rw------- 1 postgres postgres      0 1月  28 21:39 101916
-rw------- 1 postgres postgres      0 1月  28 21:39 101919
-rw------- 1 postgres postgres      0 1月  28 21:39 101920
-rw------- 1 postgres postgres      0 1月  28 21:39 101921
-rw------- 1 postgres postgres      0 1月  28 21:39 101924
-rw------- 1 postgres postgres      0 1月  28 21:39 101925
-rw------- 1 postgres postgres      0 1月  28 21:39 101926
-rw------- 1 postgres postgres      0 1月  28 21:39 101929
-rw------- 1 postgres postgres      0 1月  28 21:39 101930
-rw------- 1 postgres postgres      0 1月  28 21:39 101931
-rw------- 1 postgres postgres      0 1月  26 16:37 101934
-rw------- 1 postgres postgres      0 1月  28 21:39 101935
-rw------- 1 postgres postgres      0 1月  28 21:39 101936
-rw------- 1 postgres postgres      0 1月  28 21:39 101937
-rw------- 1 postgres postgres      0 1月  28 21:39 101938
-rw------- 1 postgres postgres      0 1月  26 16:37 101941
-rw------- 1 postgres postgres      0 1月  28 21:39 101942
-rw------- 1 postgres postgres      0 1月  28 21:39 101943
-rw------- 1 postgres postgres      0 1月  28 21:39 101944
-rw------- 1 postgres postgres      0 1月  28 21:39 101947
-rw------- 1 postgres postgres      0 1月  28 21:39 101948
-rw------- 1 postgres postgres      0 1月  28 21:39 101949
-rw------- 1 postgres postgres      0 1月  28 21:39 101952
-rw------- 1 postgres postgres      0 1月  28 21:39 101953
-rw------- 1 postgres postgres      0 1月  28 21:39 101954
-rw------- 1 postgres postgres      0 1月  28 21:39 101985
-rw------- 1 postgres postgres      0 1月  28 21:39 101988
-rw------- 1 postgres postgres      0 1月  28 21:39 101989
-rw------- 1 postgres postgres      0 1月  28 21:39 101990
-rw------- 1 postgres postgres      0 1月  28 21:39 101993
-rw------- 1 postgres postgres      0 1月  28 21:39 101994
-rw------- 1 postgres postgres      0 1月  28 21:39 101997
[postgres@PG-3 99522]$ pg_ctl restart
waiting for server to shut down.... done
server stopped
waiting for server to start....2022-01-28 21:41:49 CST[2289]:[1-1]user = ,db = ,app = ,client = LOG:  redirecting log output to logging collector process
2022-01-28 21:41:49 CST[2289]:[2-1]user = ,db = ,app = ,client = HINT:  Future log output will appear in directory "log".
 done
server started
[postgres@PG-3 99522]$ ll | wc -l
229


------------------ Original ------------------
From: "Tom Lane" <tgl@sss.pgh.pa.us>;
Date: Wed, Jan 26, 2022 11:29 PM
To: "两个孩子的爹"<1726002692@qq.com>;
Cc: "pgsql-bugs"<pgsql-bugs@lists.postgresql.org>;
Subject: Re: BUG #17382: When vacuum full or vacuumdb - F is executed, a large number of empty files will be generated in the

PG Bug reporting form <noreply@postgresql.org> writes:
> When vacuum full or vacuumdb - F is executed, a large number of empty files
> will be generated in the database. These files have never been deleted.
> Each execution of vacuum full or vacuudb - F will produce a large number of
> empty files.These empty files will not be deleted until the database is
> restarted.
> Is this a bug?

It might be if you could tell us how to reproduce it --- I see no
such behavior here.

In general, PG uses numerically-named files for table contents,
but they should always appear in subdirectories of $PGDATA, never
in the directory's top level.  So I have no idea what those are
or what put them there.  Perhaps you are using some unusual
extension or custom C code that creates them?

regards, tom lane

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17386: btree index corruption after reindex concurrently on write heavy table
Next
From: Maxim Boguk
Date:
Subject: Re: BUG #17386: btree index corruption after reindex concurrently on write heavy table