openGauss/MogDB中孤儿文件问题 (ID8257)

原作者:罗海鸥

适用范围

openGauss/MogDB

问题概述

数据库崩溃或者会话异常终止时,未清理的文件会侵蚀存储空间。

问题原因

数据库崩溃或者会话异常终止时,数据库不会清理回滚事务中创建的文件。

db1=# begin ; BEGIN db1=# create table t1(id int); CREATE TABLE db1=# insert into t1 values(1); INSERT 0 1 db1=# select pg_relation_filepath('t1'); pg_relation_filepath ---------------------- base/16775/41449 (1 row) db1=# select * from pg_tables where tablename='t1'; schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers | tablecreator | created | last _ddl_time ------------+-----------+------------+------------+------------+----------+-------------+--------------+-------------------------------+------------- ------------------ public | t1 | omm | | f | f | f | omm | 2024-01-02 11:20:32.627504+08 | 2024-01-02 1 1:20:32.627504+08 (1 row)