oldsix2
V2EX  ›  PostgreSQL

PostgreSQL 流复制 1 主 1 从集群,从节点多余一个不知道作用的文件 16539.1

By oldsix2 at 2023 年 6 月 13 日 · 2491 次点击

PostgreSQL 流复制 1 主 1 从集群,从节点 database 目录大于 主节点 database 目录

1 、主节点

# du -h base/16525
3.0G    base/16525

# ls -ahlS base/16525 | head -10
total 3.0G
-rw------- 1 postgres postgres 1.0G Jun 13 13:25 16608
-rw------- 1 postgres postgres 1.0G Jun 13 13:25 16608.1
-rw------- 1 postgres postgres 514M Jun 13 13:29 16608.2
-rw------- 1 postgres postgres 429M Jun 13 13:25 16611
-rw------- 1 postgres postgres 6.0M Jun 13 13:23 17111
-rw------- 1 postgres postgres 808K Jun 13 11:29 16680
-rw------- 1 postgres postgres 664K Jun 13 13:45 16608_fsm
-rw------- 1 postgres postgres 568K Jun 13 13:23 16619
-rw------- 1 postgres postgres 528K Jun 12 20:26 16779

2 、从节点

# du -h base/16525/
3.2G    base/16525/

# ls -ahlS base/16525 | head -10
total 3.2G
-rw------- 1 postgres postgres 1.0G Jun 13 13:25 16608
-rw------- 1 postgres postgres 1.0G Jun 13 13:25 16608.1
-rw------- 1 postgres postgres 514M Jun 13 13:34 16608.2
-rw------- 1 postgres postgres 429M Jun 13 13:25 16611
-rw------- 1 postgres postgres 257M Jun  9 14:22 16539.1
-rw------- 1 postgres postgres 6.0M Jun 13 13:16 17111
-rw------- 1 postgres postgres 808K Jun 13 11:29 16680
-rw------- 1 postgres postgres 664K Jun 13 13:34 16608_fsm
-rw------- 1 postgres postgres 568K Jun 13 13:16 16619

肉眼看起来是从节点多了 16539.1 文件,257M ,所以从节点目录大于主节点 0.2G 。 ls | grep 16539 这个 oid ,只存在 16539.1 一个文件

ls -ahlS base/16525 | grep 16539
-rw------- 1 postgres postgres 257M Jun  9 14:22 16539.1

sql 也查不到

test=# SELECT relname
FROM pg_class
WHERE pg_relation_filepath(oid) = 'base/16525/16539';
 relname
---------
(0 rows)

怎么排查呢?哪位大佬知道吗

6 条回复  •  2023-06-15 17:20:36 +08:00
oldsix2
   1
oldsix2  
OP
   2023 年 6 月 13 日
更新,是主节点 vacuum full tablename 之后,主节点回收了磁盘空间。从节点多了这个不明文件
oldsix2
   2
oldsix2  
OP
   2023 年 6 月 13 日   ❤️ 1
结案了,15.0 版本的 bug 。15.1 的 changelog 里修复了。

https://www.postgresql.org/docs/15/release-15-1.html#id-1.11.6.7.5
wingor2015
   3
wingor2015  
   2023 年 6 月 13 日
学习了
dw2693734d
   4
dw2693734d  
   2023 年 6 月 13 日
还在用 14
oldsix2
   5
oldsix2  
OP
   2023 年 6 月 13 日   ❤️ 1
@wingor2015 互相学习

@dw2693734d 刚好给你排个雷,嘿嘿
wingor2015
   6
wingor2015  
   2023 年 6 月 15 日
我们还在用 9.6 。。。
© 2026 V2EX · 46ms · 3.9.8.5