robertmu opened a new issue, #1260:
URL: https://github.com/apache/cloudberry/issues/1260
### Issue Description
The system configuration `gp_default_storage_options` defines several
defaults, including `blocksize`, `compresstype`, and `checksum`. However, when
an AO table is created with only the `WITH (appendonly=true)` clause, **none**
of these default values are persisted to the table's metadata in the
`pg_class.reloptions` column. The column remains `NULL`.
This behavior differs from Greenplum, which correctly persists all
applicable defaults from `gp_default_storage_options` to `pg_class.reloptions`.
Since `gp_default_storage_options` is a GUC that can be changed at any time, it
is critical that the effective storage options at creation time are explicitly
recorded in the metadata. The current behavior in Cloudberry leads to a loss of
critical metadata, making it impossible to know the table's original storage
properties if the GUC is changed later.
### Reproduction and Evidence
The following raw `psql` session logs demonstrate the issue. The session on
Cloudberry shows that the default options are not persisted to
`pg_class.reloptions`. The session on Greenplum shows the expected, consistent
behavior.
```text
cbdb@robertmu-VirtualBox:~/Projects/cloudberry$ psql
psql (14.4, server 14.4)
Type "help" for help.
cbdb=# select version();
version
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 14.4 (Apache Cloudberry 2.1.0-devel+dev.2019.g1cc76495e18 build
dev) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2)
9.4.0, 64-bit compiled on Jul 18 2025 11:29:40
(1 row)
cbdb=#
cbdb=# create table tab_ao(i int) with(appendonly=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named
'i' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make
sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
cbdb=#
cbdb=# select oid, relname, reloptions from pg_class where relname =
'tab_ao';
oid | relname | reloptions
-------+---------+------------
21682 | tab_ao |
(1 row)
cbdb=#
cbdb=# show gp_default_storage_options;
gp_default_storage_options
-------------------------------------------------
blocksize=32768,compresstype=none,checksum=true
(1 row)
cbdb=#
gpdb7@robertmu-VirtualBox:~/Projects/gpdb-archive$ psql
psql (12.12)
Type "help" for help.
gpdb7=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 12.12 (Greenplum Database 7.0.0-beta.0+482967c1b4 build dev) on
x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0,
64-bit compiled on Nov 8 2024 23:43:47 Bhuvnesh C.
(1 row)
gpdb7=#
gpdb7=# create table tab_ao(i int) with(appendonly=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named
'i' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make
sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
gpdb7=#
gpdb7=# select oid, relname, reloptions from pg_class where relname =
'tab_ao';
oid | relname | reloptions
-------+---------+-------------------------------------------------------------------
18326 | tab_ao |
{blocksize=32768,compresslevel=0,compresstype=none,checksum=true}
(1 row)
gpdb7=#
gpdb7=# show gp_default_storage_options;
gp_default_storage_options
-------------------------------------------------
blocksize=32768,compresstype=none,checksum=true
(1 row)
gpdb7=#
```
### Expected Behavior
The `reloptions` column in `pg_class` for the `tab_ao` table should contain
all the default storage options (`blocksize=32768`, `compresslevel=0`,
`compresstype=none`, `checksum=true`), as these are the effective defaults set
by `gp_default_storage_options` at the time of creation.
### Actual Behavior
The `reloptions` column in `pg_class` for the `tab_ao` table is `NULL`,
indicating that no default storage options were persisted.
### Environment
- **Cloudberry Version:** `PostgreSQL 14.4 (Apache Cloudberry
2.1.0-devel+dev.2019.g1cc76495e18 build dev)`
- **Greenplum Version:** `PostgreSQL 12.12 (Greenplum Database
7.0.0-beta.0+482967c1b4 build dev)`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]