Uploaded image for project: 'Apache HAWQ'
  1. Apache HAWQ
  2. HAWQ-1428

Table name pg_aoseg_$relfilenode does not change after running truncate command

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      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:

      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)
      

      Since relfilenode has changed to 61274, we should change the table name to "pg_aoseg_61274" instead of keeping it as "pg_aoseg_61269"

        Attachments

          Activity

            People

            • Assignee:
              rlei Radar Lei
              Reporter:
              lilima Lili Ma
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: