In most cases, relfilenode equals to relid. After some SQLs such as truncate or reorganize, relfilenode changed. For reorganize, the table name changed to pg_aoseg_$relfilenode. For truncate, the table name remained as pg_aoseg_$oldrelfilenode
I think the ideal implementation should be pg_aoseg_$relid, but our current design and implementation is pg_aoseg_$relfilenode. So at least we should change it compatible with $relfilenode for truncate. On Mon, Apr 10, 2017 at 4:40 PM, Ruilong Huo <[email protected]> wrote: > It should be pg_aoseg_$table_oid. However, it is pg_aoseg_$relfilenode > with current implementation of truncate. > > Best regards, > Ruilong Huo > > On Mon, Apr 10, 2017 at 10:51 AM, Lirong Jian <[email protected]> > wrote: > >> I am not sure the table name is made up as "pg_aoseg_$relfilenode". There >> is another possibility: the table name is made up as "pg_aoseg_$table_oid". >> For the truncate case, the relfilenode has been updated, but the table oid >> is kept as the same. If the latter one is true, then the behavior you >> mentioned is valid. >> >> Please have a double check. >> >> Lirong >> >> Lirong Jian >> HashData Inc. >> >> 2017-04-10 10:43 GMT+08:00 Lili Ma (JIRA) <[email protected]>: >> >>> Lili Ma created HAWQ-1428: >>> ----------------------------- >>> >>> Summary: Table name pg_aoseg_$relfilenode does not change >>> after running truncate command >>> Key: HAWQ-1428 >>> URL: https://issues.apache.org/jira/browse/HAWQ-1428 >>> Project: Apache HAWQ >>> Issue Type: Bug >>> Components: Core >>> Reporter: Lili Ma >>> Assignee: Ed Espino >>> >>> >>> The table pg_aoseg.pg_aoseg(paqseg)_$relfilenode describes the >>> information of file stored on HDFS for AO table and Parquet table. To make >>> users easily find this catalog table, the suffix should equal the >>> relfilenode for this table. >>> >>> After running truncate command, the relfilenode field for this table >>> changed, but pg_aoseg_$ table name was not changed. >>> >>> Reproduce Steps: >>> {code} >>> postgres=# create table a(a int); >>> CREATE TABLE >>> postgres=# insert into a values(51); >>> INSERT 0 1 >>> postgres=# select oid, * from pg_class where relname='a'; >>> oid | relname | relnamespace | reltype | relowner | relam | >>> relfilenode | reltablespace | relpages | reltuples | reltoastrelid | >>> reltoastidxid | relaosegrelid | relaosegidxid | relhasindex | relisshared | >>> relkind | relstorage | relnatts | relchecks | reltriggers | relukeys | >>> relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass >>> | relfrozenxid | relacl | reloptions >>> -------+---------+--------------+---------+----------+------ >>> -+-------------+---------------+----------+-----------+----- >>> ----------+---------------+---------------+---------------+- >>> ------------+-------------+---------+------------+---------- >>> +-----------+-------------+----------+----------+---------+- >>> -----------+------------+-------------+----------------+---- >>> ----------+--------+------------------- >>> 61269 | a | 2200 | 61270 | 10 | 0 | >>> 61269 | 0 | 1 | 1 | 0 | >>> 0 | 0 | 0 | f | f | r | >>> a | 1 | 0 | 0 | 0 | 0 | >>> 0 | f | f | f | f | >>> 16214 | | {appendonly=true} >>> (1 row) >>> >>> postgres=# select oid, * from pg_class, pg_appendonly where >>> pg_appendonly.relid=61269 and pg_appendonly.segrelid=pg_class.oid; >>> oid | relname | relnamespace | reltype | relowner | relam | >>> relfilenode | reltablespace | relpages | reltuples | reltoastrelid | >>> reltoastidxid | relaosegrelid | relaosegidxid | relhasindex | relisshared | >>> relkind | relstorage | relnatts | relchecks | reltriggers | relukeys | >>> relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass >>> | relfrozenxid | relacl | reloptions | relid | blocksize | safefswritesize >>> | compresslevel | majorversion | minorversion | checksum | compresstype | >>> columnstore | segrelid | segidxid | blkdirrelid | blkdiridxid | version | >>> pagesize | splitsize >>> -------+----------------+--------------+---------+---------- >>> +-------+-------------+---------------+----------+---------- >>> -+---------------+---------------+---------------+---------- >>> -----+-------------+-------------+---------+------------+--- >>> -------+-----------+-------------+----------+----------+---- >>> -----+------------+------------+-------------+-------------- >>> --+--------------+--------+------------+-------+-----------+ >>> -----------------+---------------+--------------+----------- >>> ---+----------+--------------+-------------+----------+----- >>> -----+-------------+-------------+---------+----------+----------- >>> 61271 | pg_aoseg_61269 | 6104 | 61272 | 10 | 0 | >>> 61271 | 0 | 0 | 0 | 0 | >>> 0 | 0 | 0 | t | f | o >>> | h | 5 | 0 | 0 | 0 | 0 | >>> 0 | f | t | f | f | >>> 16214 | | | 61269 | 32768 | 0 | >>> 0 | 2 | 0 | f | | f >>> | 61271 | 61273 | 0 | 0 | 2 | 0 | >>> 67108864 >>> (1 row) >>> >>> postgres=# truncate a; >>> TRUNCATE TABLE >>> postgres=# select oid, * from pg_class where relname='a'; >>> oid | relname | relnamespace | reltype | relowner >>> | relam | relfilenode | reltablespace | relpages | reltuples | >>> reltoastrelid | reltoastidxid | relaosegrelid | relaosegidxid | relhasindex >>> | relisshared | relkind | relstorage | relnatts | relchecks | reltriggers | >>> relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | >>> relhassubclass | relfrozenxid | relacl | reloptions >>> -------+---------+--------------+---------+----------+------ >>> -+-------------+---------------+----------+-----------+----- >>> ----------+---------------+---------------+---------------+- >>> ------------+-------------+---------+------------+---------- >>> +-----------+-------------+----------+----------+---------+- >>> -----------+------------+-------------+----------------+---- >>> ----------+--------+------------------- >>> 61269 | a | 2200 | 61270 | 10 | 0 | >>> 61274 | 0 | 0 | 0 | 0 | >>> 0 | 0 | 0 | f | f | r | >>> a | 1 | 0 | 0 | 0 | 0 | >>> 0 | f | f | f | f | >>> 16214 | | {appendonly=true} >>> (1 row) >>> >>> postgres=# select oid, * from pg_class, pg_appendonly where >>> pg_appendonly.relid=61269 and pg_appendonly.segrelid=pg_class.oid; >>> oid | relname | relnamespace | reltype | relowner | relam | >>> relfilenode | reltablespace | relpages | reltuples | reltoastrelid | >>> reltoastidxid | relaosegrelid | relaosegidxid | relhasindex | relisshared | >>> relkind | relstorage | relnatts | relchecks | reltriggers | relukeys | >>> relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass >>> | relfrozenxid | relacl | reloptions | relid | blocksize | safefswritesize >>> | compresslevel | majorversion | minorversion | checksum | compresstype | >>> columnstore | segrelid | segidxid | blkdirrelid | blkdiridxid | version | >>> pagesize | splitsize >>> -------+----------------+--------------+---------+---------- >>> +-------+-------------+---------------+----------+---------- >>> -+---------------+---------------+---------------+---------- >>> -----+-------------+-------------+---------+------------+--- >>> -------+-----------+-------------+----------+----------+---- >>> -----+------------+------------+-------------+-------------- >>> --+--------------+--------+------------+-------+-----------+ >>> -----------------+---------------+--------------+----------- >>> ---+----------+--------------+-------------+----------+----- >>> -----+-------------+-------------+---------+----------+----------- >>> 61271 | pg_aoseg_61269 | 6104 | 61272 | 10 | 0 | >>> 61275 | 0 | 0 | 0 | 0 | >>> 0 | 0 | 0 | t | f | o >>> | h | 5 | 0 | 0 | 0 | 0 | >>> 0 | f | t | f | f | >>> 16214 | | | 61269 | 32768 | 0 | >>> 0 | 2 | 0 | f | | f >>> | 61271 | 61273 | 0 | 0 | 2 | 0 | >>> 67108864 >>> (1 row) >>> {code} >>> >>> Since relfilenode has changed to 61274, we should change the table name >>> to "pg_aoseg_61274" instead of keeping it as "pg_aoseg_61269" >>> >>> >>> >>> -- >>> This message was sent by Atlassian JIRA >>> (v6.3.15#6346) >>> >> >> >
