You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/01/08 03:33:05 UTC
(cloudberry) branch main updated (d5767f0211 -> 563b7ca024)
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
from d5767f0211 Update Orca explain pipeline for rhel8 changes (#14585)
new 438a6a6a69 Fix ic_proxy compilation for when HOST_NAME_MAX is unavailable
new 4c15d6b333 add permission check to file /sys/fs/cgroup/cgroup.procs (#15133)
new cfa6d829ce AO/CO: reword misleading comment
new 15a9683ee3 remove resGroupId check in runaway detector
new ed99c71940 Avoid syncscan for vacuum full and cluster for catalog tables
new 9a52f7e478 Fix format error of the lib name on Mac m1 (#15140)
new f9dbcda775 Allow GRANT on pg_log_backend_memory_contexts().
new c56911bd19 Prevent function execution which access distributed table on entrydb query executor.
new 957d715869 Add filenum field to pg_attribute_encoding
new eb442939e9 Fix index DDL operations are recorded in QEs' pg_last_stat_operation (#14822)
new f30f66ba5f Fix pullup error when the target list contains RelabelType node (#15173)
new 48865dbc01 gpexpand: Fix tables not copied to new segments
new 3e832f1c06 Fix obsolete references to SnapshotNow in comment. (#15189)
new 1e2d348e93 change IC_PROXY_INVALID_CONTENT to int16 (#15219)
new 2a77533e73 gpcheckcat: Replace expensive pg_attribute query
new 563b7ca024 gpcheckcat: Avoid false positives in vpinfo check
The 16 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
contrib/interconnect/proxy/ic_proxy.h | 2 +-
contrib/interconnect/proxy/ic_proxy_addr.h | 7 +
gpMgmt/bin/Makefile | 2 +-
gpMgmt/bin/gpcheckcat | 22 +-
gpMgmt/bin/gpcheckresgroupv2impl | 6 +-
gpMgmt/bin/gppylib/gpcatalog.py | 3 -
gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature | 11 +-
gpMgmt/test/behave/mgmt_utils/gpexpand.feature | 63 +-
gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py | 31 +
src/backend/access/aocs/aocs_compaction.c | 9 +-
src/backend/access/aocs/aocsam.c | 32 +-
src/backend/access/aocs/aocsam_handler.c | 6 +-
src/backend/access/aocs/aocssegfiles.c | 20 -
src/backend/access/appendonly/README.md | 8 +-
src/backend/access/appendonly/aomd.c | 36 +-
.../access/appendonly/appendonly_compaction.c | 5 +-
src/backend/access/appendonly/appendonlyam.c | 6 +-
.../access/appendonly/appendonlyam_handler.c | 6 +-
src/backend/access/heap/heapam_handler.c | 13 +-
src/backend/access/transam/xact.c | 5 -
src/backend/catalog/index.c | 7 +-
src/backend/catalog/pg_attribute_encoding.c | 111 +++-
src/backend/catalog/system_functions.sql | 1 +
src/backend/cdb/cdbpullup.c | 2 +-
src/backend/executor/functions.c | 3 +-
src/backend/utils/adt/mcxtfuncs.c | 14 +-
src/backend/utils/mmgr/redzone_handler.c | 31 -
src/include/access/aomd.h | 4 +-
src/include/catalog/pg_attribute_encoding.h | 20 +-
src/include/cdb/cdbaocsam.h | 1 +
src/test/isolation/specs/ao-insert-eof.spec | 3 -
src/test/regress/expected/AOCO_Compression.out | 12 +-
src/test/regress/expected/column_compression.out | 700 ++++++++++-----------
src/test/regress/expected/create_table_like_gp.out | 13 +-
src/test/regress/expected/dsp.out | 142 ++---
src/test/regress/expected/gp_pullup_expr.out | 10 +
src/test/regress/expected/misc_functions.out | 33 +-
.../regress/expected/misc_functions_optimizer.out | 34 +-
src/test/regress/expected/partition.out | 52 +-
src/test/regress/expected/partition_optimizer.out | 52 +-
.../regress/expected/pg_stat_last_operation.out | 22 +-
src/test/regress/expected/qp_functions.out | 22 +
src/test/regress/expected/rle_delta.out | 278 ++++----
src/test/regress/greenplum_schedule | 2 +-
src/test/regress/input/aocs.source | 6 +-
src/test/regress/output/aocs.source | 44 +-
src/test/regress/sql/AOCO_Compression.sql | 2 +-
src/test/regress/sql/column_compression.sql | 8 +-
src/test/regress/sql/create_table_like_gp.sql | 1 +
src/test/regress/sql/dsp.sql | 14 +-
src/test/regress/sql/gp_pullup_expr.sql | 7 +
src/test/regress/sql/misc_functions.sql | 26 +-
src/test/regress/sql/partition.sql | 8 +-
src/test/regress/sql/pg_stat_last_operation.sql | 7 +
src/test/regress/sql/qp_functions.sql | 25 +
src/test/regress/sql/rle_delta.sql | 28 +-
.../singlenode_regress/expected/bfv_catalog.out | 9 +-
57 files changed, 1208 insertions(+), 839 deletions(-)
create mode 100644 src/test/regress/expected/gp_pullup_expr.out
create mode 100644 src/test/regress/sql/gp_pullup_expr.sql
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 06/16: Fix format error of the lib name on Mac m1 (#15140)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 9a52f7e478a33804772a6fbefd41b5cadba536a6
Author: Jermy Li <ja...@gmail.com>
AuthorDate: Thu Mar 9 12:57:26 2023 +0800
Fix format error of the lib name on Mac m1 (#15140)
An error occurred when `make install` on Mac m1:
"PyYAML-5.3.1/build/lib*-3.*/*: No such file or directory"
Since the lib name format on Mac m1 is different from x86,
it is 'xx-cpython-3.8.so' on x86 and 'xx-cpython-38.so' on Mac m1.
This patch we removed the unnecessary '.', so both x86 and arm will be fine.
---
gpMgmt/bin/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gpMgmt/bin/Makefile b/gpMgmt/bin/Makefile
index e01b0dee2f..3d9ab50ad7 100644
--- a/gpMgmt/bin/Makefile
+++ b/gpMgmt/bin/Makefile
@@ -116,7 +116,7 @@ pyyaml:
@echo "--- pyyaml"
cd $(PYLIB_SRC_EXT)/ && $(TAR) xzf $(PYYAML_DIR).tar.gz
cd $(PYLIB_SRC_EXT)/$(PYYAML_DIR)/ && env -u CC python3 setup.py build
- cp -r $(PYLIB_SRC_EXT)/$(PYYAML_DIR)/build/lib*-3.*/* $(PYLIB_DIR)
+ cp -r $(PYLIB_SRC_EXT)/$(PYYAML_DIR)/build/lib*-3*/* $(PYLIB_DIR)/
#
# PYLINT
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 14/16: change IC_PROXY_INVALID_CONTENT to int16 (#15219)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 1e2d348e9374ba78855a33ac55e62cb60c0b84c7
Author: Hongxu Ma <in...@outlook.com>
AuthorDate: Mon Mar 20 14:49:56 2023 +0800
change IC_PROXY_INVALID_CONTENT to int16 (#15219)
PR #15139 introduced a compilation warning:
```
ic_proxy_peer.c:159:17: warning: result of comparison of constant 65534 with expression of type 'int16' (aka 'short') is always false [-Wtautological-constant-out-of-range-compare]
peer->content == IC_PROXY_INVALID_CONTENT)
~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
```
This PR fix it: change IC_PROXY_INVALID_CONTENT to int16 (align its type to ICProxyPeer.content field).
---
contrib/interconnect/proxy/ic_proxy.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/interconnect/proxy/ic_proxy.h b/contrib/interconnect/proxy/ic_proxy.h
index 4935bee1a0..7cd54508d2 100644
--- a/contrib/interconnect/proxy/ic_proxy.h
+++ b/contrib/interconnect/proxy/ic_proxy.h
@@ -20,7 +20,7 @@
#include "postmaster/postmaster.h"
#define IC_PROXY_BACKLOG 1024
-#define IC_PROXY_INVALID_CONTENT ((uint16) -2)
+#define IC_PROXY_INVALID_CONTENT ((int16) -2)
#define IC_PROXY_INVALID_DBID ((int16) 0)
/* pause the sender when the unack packet increase to this threshold */
#define IC_PROXY_TRESHOLD_UNACK_PACKET_PAUSE 100
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 09/16: Add filenum field to pg_attribute_encoding
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 957d7158693d02daa6063c2b0318585b9c2dc59b
Author: Divyesh Vanjare <va...@vmware.com>
AuthorDate: Wed Feb 22 22:36:31 2023 -0500
Add filenum field to pg_attribute_encoding
For CO tables, today, each column is tied to an implicit "filenum",
which is a shorthand for the file range that the column is assigned.
This means segfiles for columns are of the form:
(rfnode = relfilenode)
attnum 1: rfnode, rfnode.1 .. rfnode.127 (implicit filenum = 1)
attnum 2: rfnode.128, rfnode.129 .. rfnode.255 (implicit filenum = 2)
attnum 3: rfnode.256, rfnode.257 .. rfnode.383 (implicit filenum = 3)
...
The range of relfiles for a column depends on this implicit "filenum",
which is always equal to the attnum.
We want to decouple the implicit filenum from the attnum. To illustrate,
segfiles can now be of the form:
attnum 1: rfnode.256, rfnode.257 .. rfnode.383 (explicit filenum = 3)
attnum 2: rfnode, rfnode.1 .. rfnode.127 (explicit filenum = 1)
attnum 3: rfnode.128, rfnode.129 .. rfnode.255 (explicit filenum = 2)
...
This commit does exactly that by introducing
pg_attribute_encoding.filenum, so we can have a mapping
between attnum and filenum.
We will leverage this decoupling in future commits.
For instance, to support column-only rewrites,
we would need a way to create a "rewritten" relfile
for an existing column i and then swap them in the catalog,
while supporting MVCC semantics etc.
It is also now worth observing that the filenum no longer needs to
range from 1..1600 (MaxHeapAttributeNumber).
It can now go beyond 1600, with more alter operations.
Also, we have edited the tests to include the new filenum field.
Some tests don't need to check filenum,
but keeping the field to check if further commits/changes affect it
---
src/backend/access/aocs/aocs_compaction.c | 9 +-
src/backend/access/aocs/aocsam.c | 32 +-
src/backend/access/appendonly/README.md | 8 +-
src/backend/access/appendonly/aomd.c | 36 +-
.../access/appendonly/appendonly_compaction.c | 5 +-
src/backend/access/appendonly/appendonlyam.c | 6 +-
src/backend/catalog/pg_attribute_encoding.c | 111 +++-
src/include/access/aomd.h | 4 +-
src/include/catalog/pg_attribute_encoding.h | 20 +-
src/include/cdb/cdbaocsam.h | 1 +
src/test/regress/expected/AOCO_Compression.out | 12 +-
src/test/regress/expected/column_compression.out | 700 ++++++++++-----------
src/test/regress/expected/create_table_like_gp.out | 13 +-
src/test/regress/expected/dsp.out | 142 ++---
src/test/regress/expected/partition.out | 52 +-
src/test/regress/expected/partition_optimizer.out | 52 +-
src/test/regress/expected/rle_delta.out | 278 ++++----
src/test/regress/input/aocs.source | 6 +-
src/test/regress/output/aocs.source | 44 +-
src/test/regress/sql/AOCO_Compression.sql | 2 +-
src/test/regress/sql/column_compression.sql | 8 +-
src/test/regress/sql/create_table_like_gp.sql | 1 +
src/test/regress/sql/dsp.sql | 14 +-
src/test/regress/sql/partition.sql | 8 +-
src/test/regress/sql/rle_delta.sql | 28 +-
25 files changed, 863 insertions(+), 729 deletions(-)
diff --git a/src/backend/access/aocs/aocs_compaction.c b/src/backend/access/aocs/aocs_compaction.c
index 2dec50319f..d688b98ed1 100644
--- a/src/backend/access/aocs/aocs_compaction.c
+++ b/src/backend/access/aocs/aocs_compaction.c
@@ -27,6 +27,7 @@
#include "catalog/catalog.h"
#include "catalog/indexing.h"
#include "catalog/pg_appendonly.h"
+#include "catalog/pg_attribute_encoding.h"
#include "cdb/cdbaocsam.h"
#include "cdb/cdbvars.h"
#include "commands/vacuum.h"
@@ -73,9 +74,11 @@ AOCSCompaction_DropSegmentFile(Relation aorel, int segno, AOVacuumRelStats *vacr
char filenamepath[MAXPGPATH];
int pseudoSegNo;
File fd;
+ /* Filenum for the col */
+ FileNumber filenum = GetFilenumForAttribute(RelationGetRelid(aorel), col + 1);
/* Open and truncate the relation segfile */
- MakeAOSegmentFileName(aorel, segno, col, &pseudoSegNo, filenamepath);
+ MakeAOSegmentFileName(aorel, segno, filenum, &pseudoSegNo, filenamepath);
elogif(Debug_appendonly_print_compaction, LOG,
"Drop segment file: "
@@ -125,12 +128,14 @@ AOCSSegmentFileTruncateToEOF(Relation aorel, int segno, AOCSVPInfo *vpinfo, AOVa
AOCSVPInfoEntry *entry;
File fd;
int32 fileSegNo;
+ /* Filenum for the column */
+ FileNumber filenum = GetFilenumForAttribute(RelationGetRelid(aorel), j + 1);
entry = &vpinfo->entry[j];
segeof = entry->eof;
/* Open and truncate the relation segfile to its eof */
- MakeAOSegmentFileName(aorel, segno, j, &fileSegNo, filenamepath);
+ MakeAOSegmentFileName(aorel, segno, filenum, &fileSegNo, filenamepath);
elogif(Debug_appendonly_print_compaction, LOG,
"Opening AO COL relation \"%s.%s\", relation id %u, relfilenode %lu column #%d, logical segment #%d (physical segment file #%d, logical EOF " INT64_FORMAT ")",
diff --git a/src/backend/access/aocs/aocsam.c b/src/backend/access/aocs/aocsam.c
index 4b9741bf51..0c77204a85 100644
--- a/src/backend/access/aocs/aocsam.c
+++ b/src/backend/access/aocs/aocsam.c
@@ -75,9 +75,7 @@ aocs_delete_hook_type aocs_delete_hook = NULL;
*/
static void
open_datumstreamread_segfile(
- char *basepath,
- const struct f_smgr_ao *smgrAO,
- RelFileNode node,
+ char *basepath, Relation rel,
AOCSFileSegInfo *segInfo,
DatumStreamRead *ds,
int colNo)
@@ -85,10 +83,15 @@ open_datumstreamread_segfile(
int segNo = segInfo->segno;
char fn[MAXPGPATH];
int32 fileSegNo;
+ RelFileNode node = rel->rd_node;
+ Oid relid = RelationGetRelid(rel);
+
+ /* Filenum for the column */
+ FileNumber filenum = GetFilenumForAttribute(relid, colNo + 1);
AOCSVPInfoEntry *e = getAOCSVPEntry(segInfo, colNo);
- FormatAOSegmentFileName(basepath, segNo, colNo, &fileSegNo, fn);
+ FormatAOSegmentFileName(basepath, segNo, filenum, &fileSegNo, fn);
Assert(strlen(fn) + 1 <= MAXPGPATH);
Assert(ds);
@@ -121,7 +124,7 @@ open_all_datumstreamread_segfiles(AOCSScanDesc scan, AOCSFileSegInfo *segInfo)
AttrNumber attno = proj_atts[i];
RelationOpenSmgr(rel);
- open_datumstreamread_segfile(basepath, rel->rd_smgr->smgr_ao, rel->rd_node, segInfo, ds[attno], attno);
+ open_datumstreamread_segfile(basepath, rel, segInfo, ds[attno], attno);
datumstreamread_block(ds[attno], blockDirectory, attno);
AOCSScanDesc_UpdateTotalBytesRead(scan, attno);
@@ -959,7 +962,10 @@ OpenAOCSDatumStreams(AOCSInsertDesc desc)
{
AOCSVPInfoEntry *e = getAOCSVPEntry(seginfo, i);
- FormatAOSegmentFileName(basepath, seginfo->segno, i, &fileSegNo, fn);
+ /* Filenum for the column */
+ FileNumber filenum = GetFilenumForAttribute(RelationGetRelid(desc->aoi_rel), i + 1);
+
+ FormatAOSegmentFileName(basepath, seginfo->segno, filenum, &fileSegNo, fn);
Assert(strlen(fn) + 1 <= MAXPGPATH);
datumstreamwrite_open_file(desc->ds[i], fn, e->eof, e->eof_uncompressed,
@@ -1421,7 +1427,7 @@ openFetchSegmentFile(AOCSFetchDesc aocsFetchDesc,
return false;
RelationOpenSmgr(aocsFetchDesc->relation);
- open_datumstreamread_segfile(aocsFetchDesc->basepath, aocsFetchDesc->relation->rd_smgr->smgr_ao, aocsFetchDesc->relation->rd_node,
+ open_datumstreamread_segfile(aocsFetchDesc->basepath, aocsFetchDesc->relation,
fsInfo,
datumStreamFetchDesc->datumStream,
colNo);
@@ -1968,6 +1974,8 @@ aocs_begin_headerscan(Relation rel, int colno)
&ao_attr,
&rel->rd_node, rel->rd_smgr->smgr_ao);
hdesc->colno = colno;
+ hdesc->relid = RelationGetRelid(rel);
+
return hdesc;
}
@@ -1983,10 +1991,13 @@ aocs_headerscan_opensegfile(AOCSHeaderScanDesc hdesc,
char fn[MAXPGPATH];
int32 fileSegNo;
+ /* Filenum for the column */
+ FileNumber filenum = GetFilenumForAttribute(hdesc->relid, hdesc->colno + 1);
+
/* Close currently open segfile, if any. */
AppendOnlyStorageRead_CloseFile(&hdesc->ao_read);
FormatAOSegmentFileName(basepath, seginfo->segno,
- hdesc->colno, &fileSegNo, fn);
+ filenum, &fileSegNo, fn);
Assert(strlen(fn) + 1 <= MAXPGPATH);
vpe = getAOCSVPEntry(seginfo, hdesc->colno);
AppendOnlyStorageRead_OpenFile(&hdesc->ao_read, fn, seginfo->formatversion,
@@ -2108,10 +2119,13 @@ aocs_addcol_newsegfile(AOCSAddColumnDesc desc,
{
int version;
+ /* New filenum for the column */
+ FileNumber filenum = GetFilenumForAttribute(RelationGetRelid(desc->rel), colno + 1);
+
/* Always write in the latest format */
version = AOSegfileFormatVersion_GetLatest();
- FormatAOSegmentFileName(basepath, seginfo->segno, colno,
+ FormatAOSegmentFileName(basepath, seginfo->segno, filenum,
&fileSegNo, fn);
Assert(strlen(fn) + 1 <= MAXPGPATH);
datumstreamwrite_open_file(desc->dsw[i], fn,
diff --git a/src/backend/access/appendonly/README.md b/src/backend/access/appendonly/README.md
index 31fb78f1a7..9ab4ad272b 100644
--- a/src/backend/access/appendonly/README.md
+++ b/src/backend/access/appendonly/README.md
@@ -25,7 +25,13 @@ also be larger than 1 GB, and are not expanded in BLCKSZ-sized blocks,
like heap segments are. Segment zero is empty unless data has been
inserted during utility mode, in which case it's inserted into segment
zero. Extending the table by adding attributes via ALTER TABLE will also
-push data to segment zero. Each table can have at most 127 segment files.
+push data to segment zero. Each table can have at most 128 segment files.
+
+AOCS tables can similarly have at most 128 segment files for each column.
+The range of segno is dependent on the filenum value in pg_attribute_encoding.
+`segno 0,1-127 (filenum = 1), segno 128,129-255 (filenum = 2),...`
+To find the file range for an AOCS table column, find the attnum of that column
+and then find the corresponding filenum for that attnum from pg_attribute_encoding.
An append-only segfile consists of a number of variable-sized blocks
("varblocks"), one after another. The varblocks are aligned to 4 bytes.
diff --git a/src/backend/access/appendonly/aomd.c b/src/backend/access/appendonly/aomd.c
index a2e6a48f6b..92e54a6bf8 100644
--- a/src/backend/access/appendonly/aomd.c
+++ b/src/backend/access/appendonly/aomd.c
@@ -35,6 +35,7 @@
#include "access/table.h"
#include "catalog/catalog.h"
#include "catalog/pg_appendonly.h"
+#include "catalog/pg_attribute_encoding.h"
#include "cdb/cdbappendonlystorage.h"
#include "cdb/cdbappendonlyxlog.h"
#include "crypto/bufenc.h"
@@ -52,7 +53,7 @@ static void mdunlink_ao_base_relfile(void *ctx);
static bool mdunlink_ao_perFile(const int segno, void *ctx);
static bool copy_append_only_data_perFile(const int segno, void *ctx);
static bool truncate_ao_perFile(const int segno, void *ctx);
-static uint64 ao_segfile_get_physical_size(Relation aorel, int segno, int col);
+static uint64 ao_segfile_get_physical_size(Relation aorel, int segno, FileNumber filenum);
int
AOSegmentFilePathNameLen(Relation rel)
@@ -82,7 +83,7 @@ AOSegmentFilePathNameLen(Relation rel)
void
FormatAOSegmentFileName(char *basepath,
int segno,
- int col,
+ int filenum,
int32 *fileSegNo,
char *filepathname)
{
@@ -91,7 +92,7 @@ FormatAOSegmentFileName(char *basepath,
Assert(segno >= 0);
Assert(segno <= AOTupleId_MaxSegmentFileNum);
- if (col < 0)
+ if (filenum == InvalidFileNumber)
{
/*
* Row oriented Append-Only.
@@ -103,7 +104,7 @@ FormatAOSegmentFileName(char *basepath,
/*
* Column oriented Append-only.
*/
- pseudoSegNo = (col*AOTupleId_MultiplierSegmentFileNum) + segno;
+ pseudoSegNo = ((filenum - 1) * AOTupleId_MultiplierSegmentFileNum) + segno;
}
*fileSegNo = pseudoSegNo;
@@ -124,17 +125,17 @@ FormatAOSegmentFileName(char *basepath,
void
MakeAOSegmentFileName(Relation rel,
int segno,
- int col,
+ int filenum,
int32 *fileSegNo,
char *filepathname)
{
char *basepath;
int32 fileSegNoLocal;
-
+
/* Get base path for this relation file */
basepath = relpathbackend(rel->rd_node, rel->rd_backend, MAIN_FORKNUM);
- FormatAOSegmentFileName(basepath, segno, col, &fileSegNoLocal, filepathname);
+ FormatAOSegmentFileName(basepath, segno, filenum, &fileSegNoLocal, filepathname);
*fileSegNo = fileSegNoLocal;
@@ -658,7 +659,7 @@ ao_rel_get_physical_size(Relation aorel)
segno = DatumGetInt32(fastgetattr(tuple,
Anum_pg_aoseg_segno,
pg_aoseg_dsc, &isNull));
- total_physical_size += ao_segfile_get_physical_size(aorel, segno, -1);
+ total_physical_size += ao_segfile_get_physical_size(aorel, segno, InvalidFileNumber);
}
else
{
@@ -677,7 +678,10 @@ ao_rel_get_physical_size(Relation aorel)
vpinfo = (AOCSVPInfo *) PG_DETOAST_DATUM(d);
for (col = 0; col < vpinfo->nEntry; ++col)
- total_physical_size += ao_segfile_get_physical_size(aorel, segno, col);
+ {
+ FileNumber filenum = GetFilenumForAttribute(RelationGetRelid(aorel), col + 1);
+ total_physical_size += ao_segfile_get_physical_size(aorel, segno, filenum);
+ }
if (DatumGetPointer(d) != (Pointer) vpinfo)
pfree(vpinfo);
@@ -691,7 +695,7 @@ ao_rel_get_physical_size(Relation aorel)
}
static uint64
-ao_segfile_get_physical_size(Relation aorel, int segno, int col)
+ao_segfile_get_physical_size(Relation aorel, int segno, FileNumber filenum)
{
const char *relname;
File fd;
@@ -701,13 +705,13 @@ ao_segfile_get_physical_size(Relation aorel, int segno, int col)
relname = RelationGetRelationName(aorel);
- MakeAOSegmentFileName(aorel, segno, col, &fileSegNo, filenamepath);
+ MakeAOSegmentFileName(aorel, segno, filenum, &fileSegNo, filenamepath);
elogif(Debug_appendonly_print_compaction, LOG,
- "Opening append-optimized relation \"%s\", relation id %u, relfilenode %lu column #%d, logical segment #%d (physical segment file #%d)",
- RelationGetRelationName(aorel),
+ "Opening append-optimized relation \"%s\", relation id %u, relfilenode %lu filenum #%d, logical segment #%d (physical segment file #%d)",
+ relname,
aorel->rd_id,
aorel->rd_node.relNode,
- col,
+ filenum,
segno,
fileSegNo);
fd = PathNameOpenFile(filenamepath, O_RDONLY | PG_BINARY);
@@ -715,11 +719,11 @@ ao_segfile_get_physical_size(Relation aorel, int segno, int col)
physical_size = FileDiskSize(fd);
else
elogif(Debug_appendonly_print_compaction, LOG,
- "No gp_relation_node entry for append-optimized relation \"%s\", relation id %u, relfilenode %lu column #%d, logical segment #%d (physical segment file #%d)",
+ "No gp_relation_node entry for append-optimized relation \"%s\", relation id %u, relfilenode %lu filenum #%d, logical segment #%d (physical segment file #%d)",
relname,
aorel->rd_id,
aorel->rd_node.relNode,
- col,
+ filenum,
segno,
fileSegNo);
return physical_size;
diff --git a/src/backend/access/appendonly/appendonly_compaction.c b/src/backend/access/appendonly/appendonly_compaction.c
index 261d823247..3e152db942 100644
--- a/src/backend/access/appendonly/appendonly_compaction.c
+++ b/src/backend/access/appendonly/appendonly_compaction.c
@@ -39,6 +39,7 @@
#include "catalog/indexing.h"
#include "catalog/pg_am.h"
#include "catalog/pg_appendonly.h"
+#include "catalog/pg_attribute_encoding.h"
#include "cdb/cdbappendonlyam.h"
#include "cdb/cdbvars.h"
#include "commands/progress.h"
@@ -88,7 +89,7 @@ AppendOnlyCompaction_DropSegmentFile(Relation aorel, int segno, AOVacuumRelStats
elog(LOG, "Drop segment file: segno %d", segno);
/* Open and truncate the relation segfile */
- MakeAOSegmentFileName(aorel, segno, -1, &fileSegNo, filenamepath);
+ MakeAOSegmentFileName(aorel, segno, InvalidFileNumber, &fileSegNo, filenamepath);
fd = OpenAOSegmentFile(aorel, filenamepath, 0);
if (fd >= 0)
@@ -244,7 +245,7 @@ AppendOnlySegmentFileTruncateToEOF(Relation aorel, int segno, int64 segeof, AOVa
relname = RelationGetRelationName(aorel);
/* Open and truncate the relation segfile to its eof */
- MakeAOSegmentFileName(aorel, segno, -1, &fileSegNo, filenamepath);
+ MakeAOSegmentFileName(aorel, segno, InvalidFileNumber, &fileSegNo, filenamepath);
elogif(Debug_appendonly_print_compaction, LOG,
"Opening AO relation \"%s.%s\", relation id %u, relfilenode %lu (physical segment file #%d, logical EOF " INT64_FORMAT ")",
diff --git a/src/backend/access/appendonly/appendonlyam.c b/src/backend/access/appendonly/appendonlyam.c
index 9787d4e266..ce404aa45f 100755
--- a/src/backend/access/appendonly/appendonlyam.c
+++ b/src/backend/access/appendonly/appendonlyam.c
@@ -283,7 +283,7 @@ SetNextFileSegForRead(AppendOnlyScanDesc scan)
return false;
}
- MakeAOSegmentFileName(reln, segno, -1, &fileSegNo, scan->aos_filenamepath);
+ MakeAOSegmentFileName(reln, segno, InvalidFileNumber, &fileSegNo, scan->aos_filenamepath);
Assert(strlen(scan->aos_filenamepath) + 1 <= scan->aos_filenamepath_maxlen);
Assert(scan->initedStorageRoutines);
@@ -358,7 +358,7 @@ SetCurrentFileSegForWrite(AppendOnlyInsertDesc aoInsertDesc)
/* Make the 'segment' file name */
MakeAOSegmentFileName(aoInsertDesc->aoi_rel,
- aoInsertDesc->cur_segno, -1,
+ aoInsertDesc->cur_segno, InvalidFileNumber,
&fileSegNo,
aoInsertDesc->appendFilePathName);
Assert(strlen(aoInsertDesc->appendFilePathName) + 1 <= aoInsertDesc->appendFilePathNameMaxLen);
@@ -1866,7 +1866,7 @@ openFetchSegmentFile(AppendOnlyFetchDesc aoFetchDesc,
MakeAOSegmentFileName(
aoFetchDesc->relation,
- openSegmentFileNum, -1,
+ openSegmentFileNum, InvalidFileNumber,
&fileSegNo,
aoFetchDesc->segmentFileName);
Assert(strlen(aoFetchDesc->segmentFileName) + 1 <=
diff --git a/src/backend/catalog/pg_attribute_encoding.c b/src/backend/catalog/pg_attribute_encoding.c
index 9dc1b33bbe..b73e5bd44d 100644
--- a/src/backend/catalog/pg_attribute_encoding.c
+++ b/src/backend/catalog/pg_attribute_encoding.c
@@ -42,20 +42,22 @@
* Add a single attribute encoding entry.
*/
static void
-add_attribute_encoding_entry(Oid relid, AttrNumber attnum, Datum attoptions)
+add_attribute_encoding_entry(Oid relid, AttrNumber attnum, FileNumber filenum, Datum attoptions)
{
Relation rel;
Datum values[Natts_pg_attribute_encoding];
bool nulls[Natts_pg_attribute_encoding];
HeapTuple tuple;
-
+
Assert(attnum != InvalidAttrNumber);
+ Assert(filenum != InvalidFileNumber);
rel = heap_open(AttributeEncodingRelationId, RowExclusiveLock);
MemSet(nulls, 0, sizeof(nulls));
values[Anum_pg_attribute_encoding_attrelid - 1] = ObjectIdGetDatum(relid);
values[Anum_pg_attribute_encoding_attnum - 1] = Int16GetDatum(attnum);
+ values[Anum_pg_attribute_encoding_filenum - 1] = Int16GetDatum(filenum);
values[Anum_pg_attribute_encoding_attoptions - 1] = attoptions;
tuple = heap_form_tuple(RelationGetDescr(rel), values, nulls);
@@ -192,6 +194,7 @@ cloneAttributeEncoding(Oid oldrelid, Oid newrelid, AttrNumber max_attno)
{
if (DatumGetPointer(attoptions[n]) != NULL)
add_attribute_encoding_entry(newrelid,
+ n + 1,
n + 1,
attoptions[n]);
}
@@ -260,8 +263,16 @@ AddRelationAttributeEncodings(Relation rel, List *attr_encodings)
{
Oid relid = RelationGetRelid(rel);
ListCell *lc;
+ ListCell *lc_filenum;
+ List *filenums = GetNextNAvailableFilenums(relid, attr_encodings->length);
- foreach(lc, attr_encodings)
+ if (filenums->length != attr_encodings->length)
+ ereport(ERROR,
+ (errcode(ERRCODE_INTERNAL_ERROR),
+ errmsg("filenums exhausted for relid %u", relid),
+ errhint("recreate the table")));
+
+ forboth(lc, attr_encodings, lc_filenum, filenums)
{
Datum attoptions;
ColumnReferenceStorageDirective *c = lfirst(lc);
@@ -290,8 +301,9 @@ AddRelationAttributeEncodings(Relation rel, List *attr_encodings)
true,
false);
- add_attribute_encoding_entry(relid, attnum, attoptions);
+ add_attribute_encoding_entry(relid, attnum, lfirst_int(lc_filenum), attoptions);
}
+ list_free(filenums);
}
void
@@ -319,3 +331,94 @@ RemoveAttributeEncodingsByRelid(Oid relid)
heap_close(rel, RowExclusiveLock);
}
+
+/*
+ * Returns the filenum value for a relation/attnum entry in pg_attribute_encoding
+ */
+FileNumber
+GetFilenumForAttribute(Oid relid, AttrNumber attnum)
+{
+ Relation rel;
+ SysScanDesc scan;
+ ScanKeyData skey[2];
+ HeapTuple tup;
+ FileNumber filenum;
+ bool isnull;
+
+ Assert(OidIsValid(relid));
+ Assert(AttributeNumberIsValid(attnum));
+
+ rel = heap_open(AttributeEncodingRelationId, AccessShareLock);
+
+ ScanKeyInit(&skey[0],
+ Anum_pg_attribute_encoding_attrelid,
+ BTEqualStrategyNumber, F_OIDEQ,
+ ObjectIdGetDatum(relid));
+ ScanKeyInit(&skey[1],
+ Anum_pg_attribute_encoding_attnum,
+ BTEqualStrategyNumber, F_INT2EQ,
+ Int16GetDatum(attnum));
+ scan = systable_beginscan(rel, AttributeEncodingAttrelidAttnumIndexId, true,
+ NULL, 2, skey);
+
+ tup = systable_getnext(scan);
+ Assert(HeapTupleIsValid(tup));
+ filenum = heap_getattr(tup, Anum_pg_attribute_encoding_filenum,
+ RelationGetDescr(rel), &isnull);
+ Assert(!isnull);
+ systable_endscan(scan);
+ heap_close(rel, AccessShareLock);
+ return filenum;
+}
+
+/*
+ * Returns a sorted list of first n unused filenums in pg_attribute_encoding
+ * for the relation
+ * In the outside chance that filenums have been exhausted,
+ * the list may contain < n unused filenums
+ */
+List *
+GetNextNAvailableFilenums(Oid relid, int n)
+{
+ Relation rel;
+ SysScanDesc scan;
+ ScanKeyData skey[1];
+ HeapTuple tup;
+ bool isnull;
+ bool used[MaxFileNumber];
+ List *newfilenums = NIL;
+
+ Assert(OidIsValid(relid));
+
+ MemSet(used, false, sizeof(used));
+ rel = heap_open(AttributeEncodingRelationId, AccessShareLock);
+
+ ScanKeyInit(&skey[0],
+ Anum_pg_attribute_encoding_attrelid,
+ BTEqualStrategyNumber, F_OIDEQ,
+ ObjectIdGetDatum(relid));
+ scan = systable_beginscan(rel, AttributeEncodingAttrelidIndexId, true,
+ NULL, 1, skey);
+
+ while (HeapTupleIsValid(tup = systable_getnext(scan)))
+ {
+ FileNumber usedfilenum = heap_getattr(tup, Anum_pg_attribute_encoding_filenum,
+ RelationGetDescr(rel), &isnull);
+ Assert(!isnull);
+ used[usedfilenum-1] = true;
+ }
+
+ systable_endscan(scan);
+ heap_close(rel, AccessShareLock);
+
+ for (int i = 0; i < MaxFileNumber; ++i)
+ {
+ if(!used[i])
+ {
+ newfilenums = lappend_int(newfilenums, i + 1);
+ if (newfilenums->length == n)
+ break;
+ }
+ }
+ return newfilenums;
+}
diff --git a/src/include/access/aomd.h b/src/include/access/aomd.h
index 9666ad3974..0283df12d3 100644
--- a/src/include/access/aomd.h
+++ b/src/include/access/aomd.h
@@ -26,14 +26,14 @@ extern int AOSegmentFilePathNameLen(Relation rel);
extern void FormatAOSegmentFileName(
char *basepath,
int segno,
- int col,
+ int filenum,
int32 *fileSegNo,
char *filepathname);
extern void MakeAOSegmentFileName(
Relation rel,
int segno,
- int col,
+ int filenum,
int32 *fileSegNo,
char *filepathname);
diff --git a/src/include/catalog/pg_attribute_encoding.h b/src/include/catalog/pg_attribute_encoding.h
index 6aab63fea2..867dd0221c 100644
--- a/src/include/catalog/pg_attribute_encoding.h
+++ b/src/include/catalog/pg_attribute_encoding.h
@@ -24,6 +24,16 @@
#include "catalog/pg_attribute_encoding_d.h"
#include "utils/rel.h"
+/*
+ * Shorthand for range of segfiles for a specific attnum.
+ * For eg: filenum = 1 denotes a range of segfiles relfilenode.1 - relfilenode.128.
+ * FileNumbers start at 1
+ */
+typedef int16 FileNumber;
+
+#define InvalidFileNumber 0
+#define MaxFileNumber 2 * MaxHeapAttributeNumber
+
/* ----------------
* pg_attribute_encoding definition. cpp turns this into
* typedef struct FormData_pg_attribute_encoding
@@ -31,8 +41,9 @@
*/
CATALOG(pg_attribute_encoding,6231,AttributeEncodingRelationId)
{
- Oid attrelid;
- int16 attnum;
+ Oid attrelid;
+ int16 attnum;
+ int16 filenum;
#ifdef CATALOG_VARLEN /* variable-length fields start here */
text attoptions[1];
#endif
@@ -49,6 +60,8 @@ FOREIGN_KEY(attrelid REFERENCES pg_attribute(attrelid));
typedef FormData_pg_attribute_encoding *Form_pg_attribute_encoding;
DECLARE_TOAST(pg_attribute_encoding, 6233, 6234);
+DECLARE_UNIQUE_INDEX(pg_attribute_encoding_attrelid_filenum_index, 6238, on pg_attribute_encoding using btree(attrelid oid_ops, filenum int2_ops));
+#define AttributeEncodingAttrelidFilenumIndexId 6238
extern PGFunction *get_funcs_for_compression(char *compresstype);
extern StdRdOptions **RelationGetAttributeOptions(Relation rel);
@@ -57,6 +70,9 @@ extern List **RelationGetUntransformedAttributeOptions(Relation rel);
extern void AddRelationAttributeEncodings(Relation rel, List *attr_encodings);
extern void RemoveAttributeEncodingsByRelid(Oid relid);
extern void cloneAttributeEncoding(Oid oldrelid, Oid newrelid, AttrNumber max_attno);
+extern void UpdateAttributeEncodings(Oid relid, List *new_attr_encodings);
+extern FileNumber GetFilenumForAttribute(Oid relid, AttrNumber attnum);
+extern List *GetNextNAvailableFilenums(Oid relid, int n);
extern Datum *get_rel_attoptions(Oid relid, AttrNumber max_attno);
extern List * rel_get_column_encodings(Relation rel);
diff --git a/src/include/cdb/cdbaocsam.h b/src/include/cdb/cdbaocsam.h
index 34597ab258..9d7da02dd5 100644
--- a/src/include/cdb/cdbaocsam.h
+++ b/src/include/cdb/cdbaocsam.h
@@ -326,6 +326,7 @@ typedef struct IndexFetchAOCOData
typedef struct AOCSHeaderScanDescData
{
+ Oid relid; /* relid of the relation */
int32 colno; /* chosen column number to read headers from */
AppendOnlyStorageRead ao_read;
diff --git a/src/test/regress/expected/AOCO_Compression.out b/src/test/regress/expected/AOCO_Compression.out
index efd937b9f7..bd93a8fc9b 100644
--- a/src/test/regress/expected/AOCO_Compression.out
+++ b/src/test/regress/expected/AOCO_Compression.out
@@ -346,12 +346,12 @@ Distributed randomly
Access method: ao_column
--Select from pg_attribute_encoding to see the table entry
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'co_crtb_with_strg_dir_and_col_ref_1' and c.oid=e.attrelid order by relname, attnum limit 3;
- relname | attnum | attoptions
--------------------------------------+--------+-------------------------------------------------------
- co_crtb_with_strg_dir_and_col_ref_1 | 1 | {compresstype=zlib,blocksize=8192,compresslevel=1}
- co_crtb_with_strg_dir_and_col_ref_1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=1048576}
- co_crtb_with_strg_dir_and_col_ref_1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'co_crtb_with_strg_dir_and_col_ref_1' and c.oid=e.attrelid order by relname, attnum limit 3;
+ relname | attnum | filenum | attoptions
+-------------------------------------+--------+---------+-------------------------------------------------------
+ co_crtb_with_strg_dir_and_col_ref_1 | 1 | 1 | {compresstype=zlib,blocksize=8192,compresslevel=1}
+ co_crtb_with_strg_dir_and_col_ref_1 | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=1048576}
+ co_crtb_with_strg_dir_and_col_ref_1 | 3 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(3 rows)
--
diff --git a/src/test/regress/expected/column_compression.out b/src/test/regress/expected/column_compression.out
index d0efcaae91..d9fd0aad53 100644
--- a/src/test/regress/expected/column_compression.out
+++ b/src/test/regress/expected/column_compression.out
@@ -7,10 +7,10 @@
create database column_compression;
\c column_compression
prepare ccddlcheck as
-select attrelid::regclass as relname,
-attnum, attoptions from pg_class c, pg_attribute_encoding e
-where c.relname like 'ccddl%' and c.oid=e.attrelid
-order by relname, attnum;
+select e.attrelid::regclass as relname,
+a.attname, e.filenum, e.attoptions from pg_class c, pg_attribute_encoding e, pg_attribute a
+where c.relname like 'ccddl%' and c.oid=e.attrelid and e.attrelid=a.attrelid and e.attnum = a.attnum
+order by relname, e.attnum;
-- default encoding clause
create table ccddl (
i int,
@@ -20,10 +20,10 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
-- This is enough to force compression, specially since we'll hash
@@ -144,10 +144,10 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=5,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=5,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=5,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,compresslevel=5,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -159,10 +159,10 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
-- This is enough to force compression, specially since we'll hash
@@ -278,8 +278,8 @@ drop table ccddl;
-- We exclude the other tables leftover from other tests.
select * from pg_attribute_encoding where
attrelid not in (select oid from pg_class where relname <> 'ccddl');
- attrelid | attnum | attoptions
-----------+--------+------------
+ attrelid | attnum | filenum | attoptions
+----------+--------+---------+------------
(0 rows)
-- mix inline and default
@@ -291,10 +291,10 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -308,10 +308,10 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -324,33 +324,33 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,blocksize=65536,compresslevel=1}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,blocksize=65536,compresslevel=1}
(2 rows)
-- Should see the encoding information for the new column
alter table ccddl add column k timestamp default now()
encoding (compresstype=zlib);
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,blocksize=65536,compresslevel=1}
- ccddl | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,blocksize=65536,compresslevel=1}
+ ccddl | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(3 rows)
-- no encoding information for this one though
alter table ccddl add column l numeric
default 3.141;
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,blocksize=65536,compresslevel=1}
- ccddl | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,blocksize=65536,compresslevel=1}
+ ccddl | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
(4 rows)
drop table ccddl;
@@ -361,10 +361,10 @@ create table ccddl (i int, j int encoding(compresstype=zlib), column i encoding
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -374,10 +374,10 @@ compresstype=zlib);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -387,10 +387,10 @@ create table ccddl (i int, j int encoding (COMPRESSTYPE="ZlIb"))
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=ZlIb,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=ZlIb,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -402,9 +402,9 @@ create table ccddl_co(LIKE ccddl)
with (appendonly = true, orientation=column);
NOTICE: table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution columns from LIKE table
execute ccddlcheck;
- relname | attnum | attoptions
-----------+--------+-----------------------------------------------------
- ccddl_co | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------+---------+---------+-----------------------------------------------------
+ ccddl_co | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
(1 row)
drop table ccddl_co;
@@ -412,9 +412,9 @@ create table ccddl_co(LIKE ccddl)
with (appendonly = true, orientation=column, compresstype=zlib);
NOTICE: table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution columns from LIKE table
execute ccddlcheck;
- relname | attnum | attoptions
-----------+--------+-----------------------------------------------------
- ccddl_co | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------+---------+---------+-----------------------------------------------------
+ ccddl_co | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(1 row)
drop table ccddl_co, ccddl;
@@ -462,9 +462,9 @@ appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(1 row)
drop table ccddl;
@@ -506,13 +506,13 @@ NOTICE: table has parent, setting distribution columns to match parent table
NOTICE: moving and merging column "parentcol" with inherited definition
DETAIL: User-specified column moved to the position of the inherited column.
execute ccddlcheck;
- relname | attnum | attoptions
--------------+--------+-----------------------------------------------------
- ccddlparent | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddlchild | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddlchild | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddlchild2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddlchild2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ relname | attname | filenum | attoptions
+-------------+-----------+---------+-----------------------------------------------------
+ ccddlparent | parentcol | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddlchild | parentcol | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddlchild | childcol | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddlchild2 | parentcol | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddlchild2 | childcol | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
(5 rows)
drop table ccddlparent cascade;
@@ -538,15 +538,15 @@ NOTICE: table has parent, setting distribution columns to match parent table
NOTICE: merging multiple inherited definitions of column "parentcol1"
NOTICE: merging multiple inherited definitions of column "parentcol2"
execute ccddlcheck;
- relname | attnum | attoptions
---------------+--------+-----------------------------------------------------
- ccddlparent1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddlparent1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddlparent2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddlparent2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddlchild | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddlchild | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddlchild | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------+------------+---------+-----------------------------------------------------
+ ccddlparent1 | parentcol1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddlparent1 | parentcol2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddlparent2 | parentcol1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddlparent2 | parentcol2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddlchild | parentcol1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddlchild | parentcol2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddlchild | childcol | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
(7 rows)
drop table ccddlparent1 cascade;
@@ -566,10 +566,10 @@ create table ccddl (a, b)
with (appendonly=true, orientation=column, compresstype=zlib) as
select 1, 1;
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | a | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | b | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -582,10 +582,10 @@ create table ccddl_co (like ccddl, column i encoding(compresstype=RLE_TYPE))
with (appendonly=true, orientation=column, compresstype=zlib);
NOTICE: table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution columns from LIKE table
execute ccddlcheck;
- relname | attnum | attoptions
-----------+--------+---------------------------------------------------------
- ccddl_co | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_co | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------+---------+---------+---------------------------------------------------------
+ ccddl_co | i | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_co | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -606,14 +606,14 @@ partition by range(j)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
-----------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(6 rows)
insert into ccddl select 1,2 from generate_series(1, 100);
@@ -741,28 +741,28 @@ partition by range(j)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
---------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(20 rows)
insert into ccddl select 1, (i % 19) + 1, ((i+3) % 5) + 1, i+3 from generate_series(1, 100) i;
@@ -1098,62 +1098,62 @@ partition p2 start(10) end(20)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
---------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(20 rows)
alter table ccddl add partition p3 start(20) end(30);
execute ccddlcheck;
- relname | attnum | attoptions
---------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p3 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p3 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p3 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p3_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3_2_prt_sp1 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p3 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p3 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p3 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p3_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3_2_prt_sp1 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3_2_prt_sp1 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(28 rows)
drop table ccddl;
@@ -1171,14 +1171,14 @@ partition p2 start(10) end(20)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
alter table ccddl add partition p3 start(20) end(30);
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
@@ -1190,19 +1190,19 @@ partition by range(i)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
-----------------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
alter table ccddl split partition p1 at (5) into (partition p2, partition p3);
execute ccddlcheck;
- relname | attnum | attoptions
-----------------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(3 rows)
drop table ccddl;
@@ -1217,44 +1217,44 @@ subpartition template (subpartition sp1 start(1) end(20),
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
---------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(6 rows)
alter table ccddl alter partition p1 split partition sp1 at (10) into (partition sp2, partition sp3);
execute ccddlcheck;
- relname | attnum | attoptions
---------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp2 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp3 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp3 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp2 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp2 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp3 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp3 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(8 rows)
alter table ccddl alter partition p1 split partition sp2 at (5) into (partition sp2, partition sp2_5);
execute ccddlcheck;
- relname | attnum | attoptions
-----------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp3 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp3 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp2 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp2_5 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp2_5 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp3 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp3 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp2 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp2 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp2_5 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp2_5 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(10 rows)
drop table ccddl;
@@ -1280,28 +1280,28 @@ CREATE TABLE ccddl (id int, year int, month int, day int, region text)
)
( START (2008) END (2010) );
execute ccddlcheck;
- relname | attnum | attoptions
----------------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1_2_prt_1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1 | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1_3_prt_usa | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1_3_prt_usa | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1_3_prt_usa | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1_2_prt_1_3_prt_usa | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_1_3_prt_usa | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------------------------------+---------+---------+---------------------------------------------------------
+ ccddl | id | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | year | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | month | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | day | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | region | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | id | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | year | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | month | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | day | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | region | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1 | id | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1 | year | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1 | month | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1 | day | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1 | region | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1_3_prt_usa | id | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1_3_prt_usa | year | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1_3_prt_usa | month | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1_3_prt_usa | day | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_1_3_prt_usa | region | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(20 rows)
-- Ensure we can read and write
@@ -1435,24 +1435,24 @@ create table ccddl (
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
-----------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {blocksize=65536,compresstype=none,compresslevel=0}
- ccddl_1_prt_p2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2 | 3 | {blocksize=8192,compresstype=none,compresslevel=0}
- ccddl_1_prt_p2 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3 | 2 | {blocksize=8192,compresstype=none,compresslevel=0}
- ccddl_1_prt_p3 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p3 | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1 | k | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1 | l | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {blocksize=65536,compresstype=none,compresslevel=0}
+ ccddl_1_prt_p2 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2 | k | 3 | {blocksize=8192,compresstype=none,compresslevel=0}
+ ccddl_1_prt_p2 | l | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3 | i | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3 | j | 2 | {blocksize=8192,compresstype=none,compresslevel=0}
+ ccddl_1_prt_p3 | k | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p3 | l | 4 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(16 rows)
drop table ccddl;
@@ -1476,28 +1476,28 @@ partition by range(i) subpartition by range(j)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
---------------------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p2 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p1_2_prt_sp1 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 1 | {blocksize=65536,compresstype=none,compresslevel=0}
- ccddl_1_prt_p2_2_prt_sp1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_p2_2_prt_sp1 | 3 | {blocksize=8192,compresstype=none,compresslevel=0}
- ccddl_1_prt_p2_2_prt_sp1 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+--------------------------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | j | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | k | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p2 | l | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | k | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p1_2_prt_sp1 | l | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | i | 1 | {blocksize=65536,compresstype=none,compresslevel=0}
+ ccddl_1_prt_p2_2_prt_sp1 | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_p2_2_prt_sp1 | k | 3 | {blocksize=8192,compresstype=none,compresslevel=0}
+ ccddl_1_prt_p2_2_prt_sp1 | l | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(20 rows)
drop table ccddl;
@@ -1515,14 +1515,14 @@ WITH (appendonly=true, orientation=column)
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' as the Cloudberry 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.
execute ccddlcheck;
- relname | attnum | attoptions
----------------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=rle_type,blocksize=65536,compresslevel=1}
- ccddl | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------------+---------+---------+---------------------------------------------------------
+ ccddl | c1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | c2 | 2 | {compresstype=rle_type,blocksize=65536,compresslevel=1}
+ ccddl | c3 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1 | c1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1 | c2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1 | c3 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(6 rows)
drop table ccddl;
@@ -1542,8 +1542,8 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
ERROR: ENCODING clause only supported with column oriented tables
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
@@ -1562,14 +1562,14 @@ alter table ccddl add partition "s_xyz" values ('xyz')
WITH (appendonly=true, orientation=column,
compresstype=zlib, compresslevel=1);
execute ccddlcheck;
- relname | attnum | attoptions
--------------------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+-------------------+---------+---------+-----------------------------------------------------
+ ccddl | a | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl | b | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_s_abc | a | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_s_abc | b | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_s_xyz | a | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_s_xyz | b | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(6 rows)
drop table ccddl;
@@ -1587,41 +1587,41 @@ alter table ccddl add partition newp
start('2010-01-06') end('2010-01-07')
with (appendonly=true, orientation=column);
execute ccddlcheck;
- relname | attnum | attoptions
-----------------------------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_2 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_3 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_3 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_3 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_4 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_4 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_4 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_1_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1_2_prt_sp1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_1_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_2_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_2_2_prt_sp1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_2_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_3_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_3_2_prt_sp1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_3_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_4_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_4_2_prt_sp1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_4_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_newp | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_newp | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_newp | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl_1_prt_newp_2_prt_sp1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_newp_2_prt_sp1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- ccddl_1_prt_newp_2_prt_sp1 | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+----------------------------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | d | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | d | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1 | j | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_2 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_2 | d | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_2 | j | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_3 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_3 | d | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_3 | j | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_4 | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_4 | d | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_4 | j | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_1_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1_2_prt_sp1 | d | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_1_2_prt_sp1 | j | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_2_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_2_2_prt_sp1 | d | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_2_2_prt_sp1 | j | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_3_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_3_2_prt_sp1 | d | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_3_2_prt_sp1 | j | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_4_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_4_2_prt_sp1 | d | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_4_2_prt_sp1 | j | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_newp | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_newp | d | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_newp | j | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl_1_prt_newp_2_prt_sp1 | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_newp_2_prt_sp1 | d | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ ccddl_1_prt_newp_2_prt_sp1 | j | 3 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(33 rows)
drop table ccddl;
@@ -1667,8 +1667,8 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' a
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
ERROR: ENCODING clause only supported with column oriented tables
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
@@ -1711,27 +1711,27 @@ select typoptions from pg_type_encoding where typid='public.int42'::regtype;
create table ccddl (i int42) with(appendonly = true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,blocksize=65536,compresslevel=1}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,blocksize=65536,compresslevel=1}
(1 row)
alter type int42 set default encoding (compresstype=zlib);
alter table ccddl add column j int42 default '1'::int42;
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,blocksize=65536,compresslevel=1}
- ccddl | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,blocksize=65536,compresslevel=1}
+ ccddl | j | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
create table ccddl (i int42) with(appendonly = true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+-----------------------------------------------------
- ccddl | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+-----------------------------------------------------
+ ccddl | i | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(1 row)
drop table ccddl;
@@ -1739,16 +1739,16 @@ drop table ccddl;
create table ccddl (i int42);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
create table ccddl (i int42) with (appendonly = true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suitable for a distribution key. Creating a NULL policy entry.
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
@@ -1758,10 +1758,10 @@ NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, and no column type is suita
alter type int42 set default encoding (compresstype=RLE_TYPE);
alter table ccddl add column j int42 default '1'::int42;
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+---------------------------------------------------------
- ccddl | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- ccddl | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ relname | attname | filenum | attoptions
+---------+---------+---------+---------------------------------------------------------
+ ccddl | i | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ ccddl | j | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(2 rows)
drop table ccddl;
@@ -1771,8 +1771,8 @@ alter type int42 set default encoding (compresstype=RLE_TYPE);
alter table ccddl add column j int42 default '1'::int42;
-- No results are returned from the attribute encoding check, as compression with rle is not supported for row tables
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
@@ -1782,8 +1782,8 @@ alter type int42 set default encoding (compresstype=RLE_TYPE);
alter table ccddl add column j int42 default '1'::int42;
-- No results are returned from the attribute encoding check, as compression with rle is not supported for heap tables
execute ccddlcheck;
- relname | attnum | attoptions
----------+--------+------------
+ relname | attname | filenum | attoptions
+---------+---------+---------+------------
(0 rows)
drop table ccddl;
diff --git a/src/test/regress/expected/create_table_like_gp.out b/src/test/regress/expected/create_table_like_gp.out
index 0990a65d23..aca88dde67 100644
--- a/src/test/regress/expected/create_table_like_gp.out
+++ b/src/test/regress/expected/create_table_like_gp.out
@@ -44,18 +44,19 @@ WHERE
SELECT
c.relname,
a.attnum,
+ a.filenum,
a.attoptions
FROM
pg_catalog.pg_class c
JOIN pg_catalog.pg_attribute_encoding a ON (a.attrelid = c.oid)
WHERE
c.relname like 't_ao_enc%';
- relname | attnum | attoptions
-------------+--------+-----------------------------------------------------
- t_ao_enc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- t_ao_enc | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- t_ao_enc_a | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- t_ao_enc_a | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ relname | attnum | filenum | attoptions
+------------+--------+---------+-----------------------------------------------------
+ t_ao_enc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ t_ao_enc | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ t_ao_enc_a | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ t_ao_enc_a | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
(4 rows)
-- EXTERNAL TABLE
diff --git a/src/test/regress/expected/dsp.out b/src/test/regress/expected/dsp.out
index 2a5997b7f8..8ad8748f8e 100644
--- a/src/test/regress/expected/dsp.out
+++ b/src/test/regress/expected/dsp.out
@@ -241,14 +241,14 @@ select * from t2 order by 1;
5 | 14 | 10 | abc10
(5 rows)
-select attrelid::regclass, attnum, attoptions
+select attrelid::regclass, attnum, filenum, attoptions
from pg_attribute_encoding order by 1,2;
- attrelid | attnum | attoptions
-----------+--------+---------------------------------------------------------
- t2 | 1 | {blocksize=65536,compresstype=zlib,compresslevel=2}
- t2 | 2 | {compresstype=zlib,compresslevel=2,blocksize=32768}
- t2 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- t2 | 4 | {compresstype=zlib,compresslevel=2,blocksize=32768}
+ attrelid | attnum | filenum | attoptions
+----------+--------+---------+---------------------------------------------------------
+ t2 | 1 | 1 | {blocksize=65536,compresstype=zlib,compresslevel=2}
+ t2 | 2 | 2 | {compresstype=zlib,compresslevel=2,blocksize=32768}
+ t2 | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ t2 | 4 | 4 | {compresstype=zlib,compresslevel=2,blocksize=32768}
(4 rows)
-- SET operation in a session has higher precedence. Also test if
@@ -383,50 +383,34 @@ create table co7(
b varchar encoding(compresstype=zlib,compresslevel=6),
c char encoding(compresstype=rle_type))
with (checksum=false) distributed by (a);
-select relid::regclass,compresslevel,compresstype,blocksize,checksum,columnstore
- from pg_appendonly order by 1;
- relid | compresslevel | compresstype | blocksize | checksum | columnstore
--------+---------------+--------------+-----------+----------+-------------
- t1 | 2 | zlib | 32768 | t | f
- t2 | 2 | zlib | 32768 | t | t
- t3 | 4 | zlib | 32768 | f | f
- co1 | 1 | zlib | 32768 | t | t
- co2 | 1 | zlib | 8192 | t | t
- co3 | 1 | zlib | 32768 | t | t
- co4 | 1 | zlib | 32768 | t | t
- co5 | 1 | zlib | 32768 | t | t
- co6 | 1 | zlib | 32768 | t | t
- co7 | 1 | zlib | 32768 | f | t
-(10 rows)
-
-select attrelid::regclass,attnum,attoptions
+select attrelid::regclass,attnum,filenum,attoptions
from pg_attribute_encoding order by 1,2;
- attrelid | attnum | attoptions
-----------+--------+---------------------------------------------------------
- t2 | 1 | {blocksize=65536,compresstype=zlib,compresslevel=2}
- t2 | 2 | {compresstype=zlib,compresslevel=2,blocksize=32768}
- t2 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- t2 | 4 | {compresstype=zlib,compresslevel=2,blocksize=32768}
- co1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- co1 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- co2 | 1 | {blocksize=8192,compresstype=zlib,compresslevel=1}
- co2 | 2 | {blocksize=8192,compresstype=zlib,compresslevel=1}
- co3 | 1 | {blocksize=65536,compresstype=zlib,compresslevel=1}
- co3 | 2 | {compresstype=zlib,compresslevel=6,blocksize=32768}
- co3 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- co4 | 1 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co4 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co4 | 3 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co5 | 1 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co5 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co5 | 3 | {compresslevel=0,compresstype=none,blocksize=32768}
- co6 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- co6 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- co6 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- co6 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- co7 | 1 | {blocksize=8192,compresstype=none,compresslevel=0}
- co7 | 2 | {compresstype=zlib,compresslevel=6,blocksize=32768}
- co7 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ attrelid | attnum | filenum | attoptions
+----------+--------+---------+---------------------------------------------------------
+ t2 | 1 | 1 | {blocksize=65536,compresstype=zlib,compresslevel=2}
+ t2 | 2 | 2 | {compresstype=zlib,compresslevel=2,blocksize=32768}
+ t2 | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ t2 | 4 | 4 | {compresstype=zlib,compresslevel=2,blocksize=32768}
+ co1 | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ co1 | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ co2 | 1 | 1 | {blocksize=8192,compresstype=zlib,compresslevel=1}
+ co2 | 2 | 2 | {blocksize=8192,compresstype=zlib,compresslevel=1}
+ co3 | 1 | 1 | {blocksize=65536,compresstype=zlib,compresslevel=1}
+ co3 | 2 | 2 | {compresstype=zlib,compresslevel=6,blocksize=32768}
+ co3 | 3 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ co4 | 1 | 1 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co4 | 2 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co4 | 3 | 3 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co5 | 1 | 1 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co5 | 2 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co5 | 3 | 3 | {compresslevel=0,compresstype=none,blocksize=32768}
+ co6 | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ co6 | 2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ co6 | 3 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ co6 | 4 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ co7 | 1 | 1 | {blocksize=8192,compresstype=none,compresslevel=0}
+ co7 | 2 | 2 | {compresstype=zlib,compresslevel=6,blocksize=32768}
+ co7 | 3 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(24 rows)
drop database if exists dsp3;
@@ -487,32 +471,32 @@ set default_table_access_method = ao_row;
set gp_default_storage_options = "blocksize=32768,compresstype=none,checksum=true";
create table co5 (a int encoding (blocksize=8192), b float)
with (appendonly=true,orientation=column, checksum=false) distributed by (a);
-select relid::regclass,compresslevel,compresstype,blocksize,checksum,columnstore
- from pg_appendonly order by 1;
- relid | compresslevel | compresstype | blocksize | checksum | columnstore
--------+---------------+--------------+-----------+----------+-------------
- co1 | 0 | | 32768 | t | t
- co2 | 3 | zlib | 32768 | t | t
- co3 | 0 | | 32768 | t | t
- co5 | 0 | | 32768 | f | t
+select c.relname, am.amname, c.relkind, c.reloptions from pg_class c left join pg_am am on (c.relam=am.oid)
+where relname in ('co1', 'co2', 'co3', 'co5') order by 1;
+ relname | amname | relkind | reloptions
+---------+-----------+---------+-------------------
+ co1 | ao_column | r |
+ co2 | ao_column | r | {compresslevel=3}
+ co3 | ao_column | r |
+ co5 | ao_column | r | {checksum=false}
(4 rows)
-select attrelid::regclass,attnum,attoptions
+select attrelid::regclass,attnum,filenum,attoptions
from pg_attribute_encoding order by 1,2;
- attrelid | attnum | attoptions
-----------+--------+---------------------------------------------------------
- co1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- co1 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co1 | 3 | {compresslevel=0,blocksize=65536,compresstype=none}
- co1 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- co2 | 1 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- co2 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
- co2 | 3 | {compresslevel=0,blocksize=65536,compresstype=none}
- co2 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
- co3 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- co3 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- co5 | 1 | {blocksize=8192,compresstype=none,compresslevel=0}
- co5 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ attrelid | attnum | filenum | attoptions
+----------+--------+---------+---------------------------------------------------------
+ co1 | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ co1 | 2 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co1 | 3 | 3 | {compresslevel=0,blocksize=65536,compresstype=none}
+ co1 | 4 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ co2 | 1 | 1 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ co2 | 2 | 2 | {compresslevel=5,compresstype=zlib,blocksize=32768}
+ co2 | 3 | 3 | {compresslevel=0,blocksize=65536,compresstype=none}
+ co2 | 4 | 4 | {compresstype=none,compresslevel=0,blocksize=32768}
+ co3 | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ co3 | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ co5 | 1 | 1 | {blocksize=8192,compresstype=none,compresslevel=0}
+ co5 | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
(12 rows)
-- misc tests
@@ -799,13 +783,13 @@ set default_table_access_method = ao_row;
set gp_default_storage_options = "compresstype=NONE";
create table co10 (a int, b int, c int) with (appendonly=true,orientation=column)
distributed by (a);
-select attnum,attoptions from pg_attribute_encoding
+select attnum,filenum,attoptions from pg_attribute_encoding
where attrelid = 'co10'::regclass order by attnum;
- attnum | attoptions
---------+-----------------------------------------------------
- 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+ attnum | filenum | attoptions
+--------+---------+-----------------------------------------------------
+ 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ 3 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
(3 rows)
select compresstype from pg_appendonly where relid = 'co10'::regclass;
diff --git a/src/test/regress/expected/partition.out b/src/test/regress/expected/partition.out
index bd703cbfd1..ce016eff88 100755
--- a/src/test/regress/expected/partition.out
+++ b/src/test/regress/expected/partition.out
@@ -5802,38 +5802,38 @@ select relname, pg_get_expr(relpartbound, oid) from pg_class where relname like
pt_tab_encode_1_prt_s_xyz | FOR VALUES IN ('xyz')
(3 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- -1 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- -1 | pt_tab_encode_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ -1 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ -1 | pt_tab_encode_1_prt_s_abc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass order by 1,3 limit 5;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- 0 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 0 | pt_tab_encode_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 2 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass order by 1,3 limit 5;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ 0 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 0 | pt_tab_encode_1_prt_s_abc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_abc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 2 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(5 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- -1 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- -1 | pt_tab_encode_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ -1 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ -1 | pt_tab_encode_1_prt_s_xyz | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass order by 1,3 limit 5;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- 0 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 0 | pt_tab_encode_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 2 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass order by 1,3 limit 5;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ 0 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 0 | pt_tab_encode_1_prt_s_xyz | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_xyz | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 2 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(5 rows)
select c.oid::regclass, relkind, amname, reloptions from pg_class c left join pg_am am on am.oid = relam where c.oid = 'pt_tab_encode_1_prt_s_abc'::regclass;
diff --git a/src/test/regress/expected/partition_optimizer.out b/src/test/regress/expected/partition_optimizer.out
index 3631bab4c1..ad07522606 100755
--- a/src/test/regress/expected/partition_optimizer.out
+++ b/src/test/regress/expected/partition_optimizer.out
@@ -5792,38 +5792,38 @@ select relname, pg_get_expr(relpartbound, oid) from pg_class where relname like
pt_tab_encode_1_prt_s_xyz | FOR VALUES IN ('xyz')
(3 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- -1 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- -1 | pt_tab_encode_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ -1 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ -1 | pt_tab_encode_1_prt_s_abc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass order by 1,3 limit 5;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- 0 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 0 | pt_tab_encode_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_abc | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 2 | pt_tab_encode_1_prt_s_abc | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass order by 1,3 limit 5;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ 0 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 0 | pt_tab_encode_1_prt_s_abc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_abc | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 2 | pt_tab_encode_1_prt_s_abc | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(5 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- -1 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- -1 | pt_tab_encode_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ -1 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ -1 | pt_tab_encode_1_prt_s_xyz | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(2 rows)
-select gp_segment_id, attrelid::regclass, attnum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass order by 1,3 limit 5;
- gp_segment_id | attrelid | attnum | attoptions
----------------+---------------------------+--------+-----------------------------------------------------
- 0 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 0 | pt_tab_encode_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 1 | pt_tab_encode_1_prt_s_xyz | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- 2 | pt_tab_encode_1_prt_s_xyz | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass order by 1,3 limit 5;
+ gp_segment_id | attrelid | attnum | filenum | attoptions
+---------------+---------------------------+--------+---------+-----------------------------------------------------
+ 0 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 0 | pt_tab_encode_1_prt_s_xyz | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 1 | pt_tab_encode_1_prt_s_xyz | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ 2 | pt_tab_encode_1_prt_s_xyz | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
(5 rows)
select c.oid::regclass, relkind, amname, reloptions from pg_class c left join pg_am am on am.oid = relam where c.oid = 'pt_tab_encode_1_prt_s_abc'::regclass;
diff --git a/src/test/regress/expected/rle_delta.out b/src/test/regress/expected/rle_delta.out
index 30400e653d..b910b1e362 100644
--- a/src/test/regress/expected/rle_delta.out
+++ b/src/test/regress/expected/rle_delta.out
@@ -23,16 +23,16 @@ Create table delta_all(
) with(appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_all' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------+--------+---------------------------------------------------------
- delta_all | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_all | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_all | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_all | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_all | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_all | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_all | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_all' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------+--------+---------+---------------------------------------------------------
+ delta_all | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_all | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_all | 3 | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_all | 4 | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_all | 5 | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_all | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_all | 7 | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(7 rows)
\d+ delta_all
@@ -128,17 +128,17 @@ Create table delta_alter(
) with(appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_alter' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
--------------+--------+---------------------------------------------------------
- delta_alter | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- delta_alter | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_alter | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_alter | 4 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_alter | 5 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_alter | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_alter | 7 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_alter | 8 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_alter' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-------------+--------+---------+---------------------------------------------------------
+ delta_alter | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ delta_alter | 2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_alter | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_alter | 4 | 4 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_alter | 5 | 5 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_alter | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_alter | 7 | 7 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_alter | 8 | 8 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(8 rows)
\d+ delta_alter
@@ -285,16 +285,16 @@ Create table delta_bitmap_ins(
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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 index dl_ix_bt on delta_bitmap_ins using bitmap(a1);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_bitmap_ins' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
-------------------+--------+---------------------------------------------------------
- delta_bitmap_ins | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_bitmap_ins | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_bitmap_ins | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_bitmap_ins | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_bitmap_ins | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_bitmap_ins | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_bitmap_ins | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_bitmap_ins' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+------------------+--------+---------+---------------------------------------------------------
+ delta_bitmap_ins | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_bitmap_ins | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_bitmap_ins | 3 | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_bitmap_ins | 4 | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_bitmap_ins | 5 | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_bitmap_ins | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_bitmap_ins | 7 | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(7 rows)
\d+ delta_bitmap_ins
@@ -366,16 +366,16 @@ Create table delta_btree_ins(
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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 index dl_ix_br on delta_btree_ins(a1);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_btree_ins' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------+--------+---------------------------------------------------------
- delta_btree_ins | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_btree_ins | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_btree_ins | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_btree_ins | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_btree_ins | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_btree_ins | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_btree_ins | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_btree_ins' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------+--------+---------+---------------------------------------------------------
+ delta_btree_ins | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_btree_ins | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_btree_ins | 3 | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_btree_ins | 4 | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_btree_ins | 5 | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_btree_ins | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_btree_ins | 7 | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(7 rows)
\d+ delta_btree_ins
@@ -446,16 +446,16 @@ Create table delta_ins_bitmap(
) with(appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_bitmap' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
-------------------+--------+---------------------------------------------------------
- delta_ins_bitmap | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_ins_bitmap | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_ins_bitmap | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_ins_bitmap | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_ins_bitmap | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_ins_bitmap | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_ins_bitmap | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_bitmap' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+------------------+--------+---------+---------------------------------------------------------
+ delta_ins_bitmap | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_ins_bitmap | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_ins_bitmap | 3 | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_ins_bitmap | 4 | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_ins_bitmap | 5 | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_ins_bitmap | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_ins_bitmap | 7 | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(7 rows)
\d+ delta_ins_bitmap
@@ -543,16 +543,16 @@ Create table delta_ins_btree(
) with(appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_btree' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------+--------+---------------------------------------------------------
- delta_ins_btree | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_ins_btree | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_ins_btree | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_ins_btree | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_ins_btree | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_ins_btree | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_ins_btree | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_btree' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------+--------+---------+---------------------------------------------------------
+ delta_ins_btree | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_ins_btree | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_ins_btree | 3 | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_ins_btree | 4 | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_ins_btree | 5 | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_ins_btree | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_ins_btree | 7 | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(7 rows)
\d+ delta_ins_btree
@@ -714,18 +714,18 @@ Create table delta_none(
) with(appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_none' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
-------------+--------+---------------------------------------------------------
- delta_none | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_none | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- delta_none | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- delta_none | 4 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- delta_none | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
- delta_none | 6 | {compresstype=none,compresslevel=0,blocksize=32768}
- delta_none | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- delta_none | 8 | {compresstype=none,compresslevel=0,blocksize=32768}
- delta_none | 9 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_none' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+------------+--------+---------+---------------------------------------------------------
+ delta_none | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_none | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ delta_none | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ delta_none | 4 | 4 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ delta_none | 5 | 5 | {compresstype=none,compresslevel=0,blocksize=32768}
+ delta_none | 6 | 6 | {compresstype=none,compresslevel=0,blocksize=32768}
+ delta_none | 7 | 7 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ delta_none | 8 | 8 | {compresstype=none,compresslevel=0,blocksize=32768}
+ delta_none | 9 | 9 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
(9 rows)
\d+ delta_none
@@ -1079,18 +1079,18 @@ Create table delta_zlib(
) with(appendonly=true, orientation=column);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_zlib' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
-------------+--------+---------------------------------------------------------
- delta_zlib | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- delta_zlib | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- delta_zlib | 3 | {compresstype=zlib,compresslevel=2,blocksize=32768}
- delta_zlib | 4 | {compresstype=zlib,compresslevel=3,blocksize=32768}
- delta_zlib | 5 | {compresstype=zlib,compresslevel=4,blocksize=32768}
- delta_zlib | 6 | {compresstype=zlib,compresslevel=5,blocksize=32768}
- delta_zlib | 7 | {compresstype=zlib,compresslevel=6,blocksize=32768}
- delta_zlib | 8 | {compresstype=zlib,compresslevel=7,blocksize=32768}
- delta_zlib | 9 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_zlib' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+------------+--------+---------+---------------------------------------------------------
+ delta_zlib | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ delta_zlib | 2 | 2 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ delta_zlib | 3 | 3 | {compresstype=zlib,compresslevel=2,blocksize=32768}
+ delta_zlib | 4 | 4 | {compresstype=zlib,compresslevel=3,blocksize=32768}
+ delta_zlib | 5 | 5 | {compresstype=zlib,compresslevel=4,blocksize=32768}
+ delta_zlib | 6 | 6 | {compresstype=zlib,compresslevel=5,blocksize=32768}
+ delta_zlib | 7 | 7 | {compresstype=zlib,compresslevel=6,blocksize=32768}
+ delta_zlib | 8 | 8 | {compresstype=zlib,compresslevel=7,blocksize=32768}
+ delta_zlib | 9 | 9 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
(9 rows)
\d+ delta_zlib
@@ -1183,15 +1183,15 @@ Create table rle_type_1_delta_null(
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=1);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_1_delta_null' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------------+--------+---------------------------------------------------------
- rle_type_1_delta_null | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- rle_type_1_delta_null | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- rle_type_1_delta_null | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- rle_type_1_delta_null | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- rle_type_1_delta_null | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
- rle_type_1_delta_null | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_1_delta_null' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------------+--------+---------+---------------------------------------------------------
+ rle_type_1_delta_null | 1 | 1 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ rle_type_1_delta_null | 2 | 2 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ rle_type_1_delta_null | 3 | 3 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ rle_type_1_delta_null | 4 | 4 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ rle_type_1_delta_null | 5 | 5 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
+ rle_type_1_delta_null | 6 | 6 | {compresstype=rle_type,compresslevel=1,blocksize=32768}
(6 rows)
\d+ rle_type_1_delta_null
@@ -1282,15 +1282,15 @@ Create table rle_type_2_delta_chkt(
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=2, checksum=true);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkt' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------------+--------+---------------------------------------------------------
- rle_type_2_delta_chkt | 1 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkt | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkt | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkt | 4 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkt | 5 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkt | 6 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkt' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------------+--------+---------+---------------------------------------------------------
+ rle_type_2_delta_chkt | 1 | 1 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkt | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkt | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkt | 4 | 4 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkt | 5 | 5 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkt | 6 | 6 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
(6 rows)
\d+ rle_type_2_delta_chkt
@@ -1348,15 +1348,15 @@ Create table rle_type_2_delta_chkf(
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=2, checksum=false);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkf' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------------+--------+---------------------------------------------------------
- rle_type_2_delta_chkf | 1 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkf | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkf | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkf | 4 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkf | 5 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_chkf | 6 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkf' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------------+--------+---------+---------------------------------------------------------
+ rle_type_2_delta_chkf | 1 | 1 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkf | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkf | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkf | 4 | 4 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkf | 5 | 5 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_chkf | 6 | 6 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
(6 rows)
\d+ rle_type_2_delta_chkf
@@ -1417,15 +1417,15 @@ Create table rle_type_2_delta_null(
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=2);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_null' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------------+--------+---------------------------------------------------------
- rle_type_2_delta_null | 1 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_null | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_null | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_null | 4 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_null | 5 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
- rle_type_2_delta_null | 6 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_null' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------------+--------+---------+---------------------------------------------------------
+ rle_type_2_delta_null | 1 | 1 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_null | 2 | 2 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_null | 3 | 3 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_null | 4 | 4 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_null | 5 | 5 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
+ rle_type_2_delta_null | 6 | 6 | {compresstype=rle_type,compresslevel=2,blocksize=32768}
(6 rows)
\d+ rle_type_2_delta_null
@@ -1540,15 +1540,15 @@ Create table rle_type_3_delta_null(
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=3);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_3_delta_null' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------------+--------+---------------------------------------------------------
- rle_type_3_delta_null | 1 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- rle_type_3_delta_null | 2 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- rle_type_3_delta_null | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- rle_type_3_delta_null | 4 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- rle_type_3_delta_null | 5 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
- rle_type_3_delta_null | 6 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_3_delta_null' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------------+--------+---------+---------------------------------------------------------
+ rle_type_3_delta_null | 1 | 1 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ rle_type_3_delta_null | 2 | 2 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ rle_type_3_delta_null | 3 | 3 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ rle_type_3_delta_null | 4 | 4 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ rle_type_3_delta_null | 5 | 5 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
+ rle_type_3_delta_null | 6 | 6 | {compresstype=rle_type,compresslevel=3,blocksize=32768}
(6 rows)
\d+ rle_type_3_delta_null
@@ -1639,15 +1639,15 @@ Create table rle_type_4_delta_null(
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=4);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a1' as the Cloudberry 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.
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_4_delta_null' and c.oid=e.attrelid order by relname, attnum;
- relname | attnum | attoptions
------------------------+--------+---------------------------------------------------------
- rle_type_4_delta_null | 1 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- rle_type_4_delta_null | 2 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- rle_type_4_delta_null | 3 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- rle_type_4_delta_null | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- rle_type_4_delta_null | 5 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
- rle_type_4_delta_null | 6 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_4_delta_null' and c.oid=e.attrelid order by relname, attnum;
+ relname | attnum | filenum | attoptions
+-----------------------+--------+---------+---------------------------------------------------------
+ rle_type_4_delta_null | 1 | 1 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ rle_type_4_delta_null | 2 | 2 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ rle_type_4_delta_null | 3 | 3 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ rle_type_4_delta_null | 4 | 4 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ rle_type_4_delta_null | 5 | 5 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
+ rle_type_4_delta_null | 6 | 6 | {compresstype=rle_type,compresslevel=4,blocksize=32768}
(6 rows)
\d+ rle_type_4_delta_null
diff --git a/src/test/regress/input/aocs.source b/src/test/regress/input/aocs.source
index c75ec6999e..7f8f4c8574 100644
--- a/src/test/regress/input/aocs.source
+++ b/src/test/regress/input/aocs.source
@@ -245,7 +245,7 @@ CREATE TABLE aocs_inh_child3 (COLUMN parent_t ENCODING (compresstype=zlib))
INHERITS (aocs_inh_parent)
WITH (appendonly=true, orientation=column);
-SELECT c.relname, ae.attnum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh%' AND c.oid=ae.attrelid ORDER BY 1,2;
+SELECT c.relname, ae.attnum, ae.filenum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh%' AND c.oid=ae.attrelid ORDER BY 1,2;
-- Multiple inheritance
-- The ENCODING of parent_t_8k column doesn't match that of the other parent table.
@@ -258,7 +258,7 @@ CREATE TABLE aocs_inh_multichild ()
INHERITS (aocs_inh_parent, aocs_inh_parent2)
WITH (appendonly=true, orientation=column);
-SELECT c.relname, ae.attnum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh_multi%' AND c.oid=ae.attrelid ORDER BY 1,2;
+SELECT c.relname, ae.attnum, ae.filenum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh_multi%' AND c.oid=ae.attrelid ORDER BY 1,2;
-- AOCO table inherits a heap table.
CREATE TABLE aocs_inh2_parent_heap (parent_t text, parent_t2 text);
@@ -267,7 +267,7 @@ WITH (appendonly=true, orientation=column);
CREATE TABLE aocs_inh2_child2 (COLUMN parent_t ENCODING (compresstype=zlib)) INHERITS (aocs_inh2_parent_heap)
WITH (appendonly=true, orientation=column);
-SELECT c.relname, ae.attnum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh2_%' AND c.oid=ae.attrelid ORDER BY 1,2;
+SELECT c.relname, ae.attnum, ae.filenum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh2_%' AND c.oid=ae.attrelid ORDER BY 1,2;
-- don't drop the tables, to also test pg_dump & restore of them.
diff --git a/src/test/regress/output/aocs.source b/src/test/regress/output/aocs.source
index 72b3793d01..5a85c452da 100644
--- a/src/test/regress/output/aocs.source
+++ b/src/test/regress/output/aocs.source
@@ -454,15 +454,15 @@ WITH (appendonly=true, orientation=column);
CREATE TABLE aocs_inh_child3 (COLUMN parent_t ENCODING (compresstype=zlib))
INHERITS (aocs_inh_parent)
WITH (appendonly=true, orientation=column);
-SELECT c.relname, ae.attnum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh%' AND c.oid=ae.attrelid ORDER BY 1,2;
- relname | attnum | attoptions
------------------+--------+-----------------------------------------------------
- aocs_inh_child2 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh_child2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh_child3 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- aocs_inh_child3 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh_parent | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh_parent | 2 | {blocksize=8192,compresstype=none,compresslevel=0}
+SELECT c.relname, ae.attnum, ae.filenum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh%' AND c.oid=ae.attrelid ORDER BY 1,2;
+ relname | attnum | filenum | attoptions
+-----------------+--------+---------+-----------------------------------------------------
+ aocs_inh_child2 | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh_child2 | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh_child3 | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ aocs_inh_child3 | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh_parent | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh_parent | 2 | 2 | {blocksize=8192,compresstype=none,compresslevel=0}
(6 rows)
-- Multiple inheritance
@@ -475,12 +475,12 @@ WITH (appendonly=true, orientation=column);
CREATE TABLE aocs_inh_multichild ()
INHERITS (aocs_inh_parent, aocs_inh_parent2)
WITH (appendonly=true, orientation=column);
-SELECT c.relname, ae.attnum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh_multi%' AND c.oid=ae.attrelid ORDER BY 1,2;
- relname | attnum | attoptions
----------------------+--------+-----------------------------------------------------
- aocs_inh_multichild | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh_multichild | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh_multichild | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
+SELECT c.relname, ae.attnum, ae.filenum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh_multi%' AND c.oid=ae.attrelid ORDER BY 1,2;
+ relname | attnum | filenum | attoptions
+---------------------+--------+---------+-----------------------------------------------------
+ aocs_inh_multichild | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh_multichild | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh_multichild | 3 | 3 | {compresstype=none,compresslevel=0,blocksize=32768}
(3 rows)
-- AOCO table inherits a heap table.
@@ -489,13 +489,13 @@ CREATE TABLE aocs_inh2_child1 () INHERITS (aocs_inh2_parent_heap)
WITH (appendonly=true, orientation=column);
CREATE TABLE aocs_inh2_child2 (COLUMN parent_t ENCODING (compresstype=zlib)) INHERITS (aocs_inh2_parent_heap)
WITH (appendonly=true, orientation=column);
-SELECT c.relname, ae.attnum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh2_%' AND c.oid=ae.attrelid ORDER BY 1,2;
- relname | attnum | attoptions
-------------------+--------+-----------------------------------------------------
- aocs_inh2_child1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh2_child1 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
- aocs_inh2_child2 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
- aocs_inh2_child2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+SELECT c.relname, ae.attnum, ae.filenum, ae.attoptions FROM pg_class c, pg_attribute_encoding ae WHERE c.relname LIKE 'aocs_inh2_%' AND c.oid=ae.attrelid ORDER BY 1,2;
+ relname | attnum | filenum | attoptions
+------------------+--------+---------+-----------------------------------------------------
+ aocs_inh2_child1 | 1 | 1 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh2_child1 | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
+ aocs_inh2_child2 | 1 | 1 | {compresstype=zlib,compresslevel=1,blocksize=32768}
+ aocs_inh2_child2 | 2 | 2 | {compresstype=none,compresslevel=0,blocksize=32768}
(4 rows)
-- don't drop the tables, to also test pg_dump & restore of them.
diff --git a/src/test/regress/sql/AOCO_Compression.sql b/src/test/regress/sql/AOCO_Compression.sql
index 6ce42e9eab..524ffc9420 100644
--- a/src/test/regress/sql/AOCO_Compression.sql
+++ b/src/test/regress/sql/AOCO_Compression.sql
@@ -311,7 +311,7 @@ INSERT INTO co_crtb_with_strg_dir_and_col_ref_1_uncompr select * from co_crtb_wi
\d+ co_crtb_with_strg_dir_and_col_ref_1
--Select from pg_attribute_encoding to see the table entry
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'co_crtb_with_strg_dir_and_col_ref_1' and c.oid=e.attrelid order by relname, attnum limit 3;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'co_crtb_with_strg_dir_and_col_ref_1' and c.oid=e.attrelid order by relname, attnum limit 3;
--
-- Compare data with uncompressed table
--
diff --git a/src/test/regress/sql/column_compression.sql b/src/test/regress/sql/column_compression.sql
index 584f3a6789..5849a935d3 100644
--- a/src/test/regress/sql/column_compression.sql
+++ b/src/test/regress/sql/column_compression.sql
@@ -9,10 +9,10 @@ create database column_compression;
\c column_compression
prepare ccddlcheck as
-select attrelid::regclass as relname,
-attnum, attoptions from pg_class c, pg_attribute_encoding e
-where c.relname like 'ccddl%' and c.oid=e.attrelid
-order by relname, attnum;
+select e.attrelid::regclass as relname,
+a.attname, e.filenum, e.attoptions from pg_class c, pg_attribute_encoding e, pg_attribute a
+where c.relname like 'ccddl%' and c.oid=e.attrelid and e.attrelid=a.attrelid and e.attnum = a.attnum
+order by relname, e.attnum;
-- default encoding clause
create table ccddl (
diff --git a/src/test/regress/sql/create_table_like_gp.sql b/src/test/regress/sql/create_table_like_gp.sql
index e6d0f44fd6..3570ee1db2 100644
--- a/src/test/regress/sql/create_table_like_gp.sql
+++ b/src/test/regress/sql/create_table_like_gp.sql
@@ -30,6 +30,7 @@ WHERE
SELECT
c.relname,
a.attnum,
+ a.filenum,
a.attoptions
FROM
pg_catalog.pg_class c
diff --git a/src/test/regress/sql/dsp.sql b/src/test/regress/sql/dsp.sql
index 23c9c5bfb2..da32900afd 100644
--- a/src/test/regress/sql/dsp.sql
+++ b/src/test/regress/sql/dsp.sql
@@ -99,7 +99,7 @@ create table t2 (
SELECT am.amname FROM pg_class c LEFT JOIN pg_am am ON (c.relam = am.oid) WHERE c.relname = 't2';
insert into t2 select i, 71/i, 2*i, 'abc'||2*i from generate_series(1,5)i;
select * from t2 order by 1;
-select attrelid::regclass, attnum, attoptions
+select attrelid::regclass, attnum, filenum, attoptions
from pg_attribute_encoding order by 1,2;
-- SET operation in a session has higher precedence. Also test if
-- compresstype is correctly inferred based on compress level.
@@ -177,9 +177,7 @@ create table co7(
b varchar encoding(compresstype=zlib,compresslevel=6),
c char encoding(compresstype=rle_type))
with (checksum=false) distributed by (a);
-select relid::regclass,compresslevel,compresstype,blocksize,checksum,columnstore
- from pg_appendonly order by 1;
-select attrelid::regclass,attnum,attoptions
+select attrelid::regclass,attnum,filenum,attoptions
from pg_attribute_encoding order by 1,2;
drop database if exists dsp3;
create database dsp3;
@@ -213,9 +211,9 @@ set default_table_access_method = ao_row;
set gp_default_storage_options = "blocksize=32768,compresstype=none,checksum=true";
create table co5 (a int encoding (blocksize=8192), b float)
with (appendonly=true,orientation=column, checksum=false) distributed by (a);
-select relid::regclass,compresslevel,compresstype,blocksize,checksum,columnstore
- from pg_appendonly order by 1;
-select attrelid::regclass,attnum,attoptions
+select c.relname, am.amname, c.relkind, c.reloptions from pg_class c left join pg_am am on (c.relam=am.oid)
+where relname in ('co1', 'co2', 'co3', 'co5') order by 1;
+select attrelid::regclass,attnum,filenum,attoptions
from pg_attribute_encoding order by 1,2;
-- misc tests
@@ -321,7 +319,7 @@ set default_table_access_method = ao_row;
set gp_default_storage_options = "compresstype=NONE";
create table co10 (a int, b int, c int) with (appendonly=true,orientation=column)
distributed by (a);
-select attnum,attoptions from pg_attribute_encoding
+select attnum,filenum,attoptions from pg_attribute_encoding
where attrelid = 'co10'::regclass order by attnum;
select compresstype from pg_appendonly where relid = 'co10'::regclass;
diff --git a/src/test/regress/sql/partition.sql b/src/test/regress/sql/partition.sql
index 8c6c8b6a42..cc1d519cb8 100644
--- a/src/test/regress/sql/partition.sql
+++ b/src/test/regress/sql/partition.sql
@@ -3725,11 +3725,11 @@ alter table pt_tab_encode add partition "s_xyz" values ('xyz') WITH (appendonly=
select relname, pg_get_expr(relpartbound, oid) from pg_class where relname like 'pt_tab_encode%';
-select gp_segment_id, attrelid::regclass, attnum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass;
-select gp_segment_id, attrelid::regclass, attnum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass order by 1,3 limit 5;
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass;
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_abc'::regclass order by 1,3 limit 5;
-select gp_segment_id, attrelid::regclass, attnum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
-select gp_segment_id, attrelid::regclass, attnum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass order by 1,3 limit 5;
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from pg_attribute_encoding where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
+select gp_segment_id, attrelid::regclass, attnum, filenum, attoptions from gp_dist_random('pg_attribute_encoding') where attrelid = 'pt_tab_encode_1_prt_s_xyz'::regclass order by 1,3 limit 5;
select c.oid::regclass, relkind, amname, reloptions from pg_class c left join pg_am am on am.oid = relam where c.oid = 'pt_tab_encode_1_prt_s_abc'::regclass;
select c.oid::regclass, relkind, amname, reloptions from pg_class c left join pg_am am on am.oid = relam where c.oid = 'pt_tab_encode_1_prt_s_xyz'::regclass;
diff --git a/src/test/regress/sql/rle_delta.sql b/src/test/regress/sql/rle_delta.sql
index 7105a4973b..c9f5e4dbf5 100644
--- a/src/test/regress/sql/rle_delta.sql
+++ b/src/test/regress/sql/rle_delta.sql
@@ -26,7 +26,7 @@ Create table delta_all(
a7 text ENCODING (compresstype=rle_type,compresslevel=4)
) with(appendonly=true, orientation=column);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_all' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_all' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_all
@@ -70,7 +70,7 @@ Create table delta_alter(
a7 text ENCODING (compresstype=rle_type,compresslevel=4)
) with(appendonly=true, orientation=column);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_alter' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_alter' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_alter
@@ -127,7 +127,7 @@ Create table delta_bitmap_ins(
Create index dl_ix_bt on delta_bitmap_ins using bitmap(a1);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_bitmap_ins' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_bitmap_ins' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_bitmap_ins
@@ -175,7 +175,7 @@ Create table delta_btree_ins(
Create index dl_ix_br on delta_btree_ins(a1);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_btree_ins' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_btree_ins' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_btree_ins
@@ -220,7 +220,7 @@ Create table delta_ins_bitmap(
a7 text ENCODING (compresstype=rle_type,compresslevel=4)
) with(appendonly=true, orientation=column);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_bitmap' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_bitmap' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_ins_bitmap
@@ -270,7 +270,7 @@ Create table delta_ins_btree(
) with(appendonly=true, orientation=column);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_btree' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_ins_btree' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_ins_btree
@@ -373,7 +373,7 @@ Create table delta_none(
a9 text ENCODING (compresstype=rle_type,compresslevel=2)
) with(appendonly=true, orientation=column);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_none' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_none' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_none
@@ -566,7 +566,7 @@ Create table delta_zlib(
a9 text ENCODING (compresstype=rle_type,compresslevel=2)
) with(appendonly=true, orientation=column);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_zlib' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'delta_zlib' and c.oid=e.attrelid order by relname, attnum;
\d+ delta_zlib
@@ -602,7 +602,7 @@ Create table rle_type_1_delta_null(
a6 timestamp with time zone
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=1);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_1_delta_null' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_1_delta_null' and c.oid=e.attrelid order by relname, attnum;
\d+ rle_type_1_delta_null
@@ -648,7 +648,7 @@ Create table rle_type_2_delta_chkt(
a6 timestamp with time zone
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=2, checksum=true);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkt' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkt' and c.oid=e.attrelid order by relname, attnum;
\d+ rle_type_2_delta_chkt
@@ -677,7 +677,7 @@ Create table rle_type_2_delta_chkf(
a6 timestamp with time zone
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=2, checksum=false);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkf' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_chkf' and c.oid=e.attrelid order by relname, attnum;
\d+ rle_type_2_delta_chkf
@@ -709,7 +709,7 @@ Create table rle_type_2_delta_null(
a6 timestamp with time zone
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=2);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_null' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_2_delta_null' and c.oid=e.attrelid order by relname, attnum;
\d+ rle_type_2_delta_null
@@ -757,7 +757,7 @@ Create table rle_type_3_delta_null(
a6 timestamp with time zone
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=3);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_3_delta_null' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_3_delta_null' and c.oid=e.attrelid order by relname, attnum;
\d+ rle_type_3_delta_null
@@ -803,7 +803,7 @@ Create table rle_type_4_delta_null(
a6 timestamp with time zone
) with(appendonly=true, orientation=column, compresstype=rle_type, compresslevel=4);
-select attrelid::regclass as relname, attnum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_4_delta_null' and c.oid=e.attrelid order by relname, attnum;
+select attrelid::regclass as relname, attnum, filenum, attoptions from pg_class c, pg_attribute_encoding e where c.relname = 'rle_type_4_delta_null' and c.oid=e.attrelid order by relname, attnum;
\d+ rle_type_4_delta_null
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 16/16: gpcheckcat: Avoid false positives in vpinfo check
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 563b7ca024fbbecec2b531595312ce20541cf2f8
Author: Soumyadeep Chakraborty <so...@gmail.com>
AuthorDate: Fri Mar 17 17:01:47 2023 -0700
gpcheckcat: Avoid false positives in vpinfo check
If a workload such as the following were to run:
BEGIN;
ALTER TABLE co ADD COLUMN j int;
INSERT INTO co VALUES(...); -- uses RESERVED_SEGNO
ABORT;
the RESERVED_SEGNO (0) would contain a vpinfo having more attributes (1
more in this example) than pg_class.relnatts.
This would fail the existing check.
So, we avoid doing this check for segno=0.
Co-authored-by: Divyesh Vanjare <va...@vmware.com>
---
gpMgmt/bin/gpcheckcat | 10 +++++++++-
gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature | 9 +++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/gpMgmt/bin/gpcheckcat b/gpMgmt/bin/gpcheckcat
index 9a0535e905..70dfc84722 100755
--- a/gpMgmt/bin/gpcheckcat
+++ b/gpMgmt/bin/gpcheckcat
@@ -1444,7 +1444,15 @@ class checkAOSegVpinfoThread(execThread):
curs = self.db.query(aoseg_query)
for relname, relid, segrelid, segrelname, attr_count in curs.getresult():
- qry = "SELECT distinct(length(vpinfo)) FROM pg_aoseg.%s where state = 1;" % (segrelname)
+ # We check vpinfo consistency only for segs that are in state
+ # AOSEG_STATE_DEFAULT and which are not RESERVED_SEGNO.
+ # RESERVED_SEGNO can have a different number of attributes than
+ # the other segments. For eg. if we ALTER TABLE ADD COLUMN in a
+ # transaction, and then insert rows in the same transaction, and
+ # then abort, the RESERVED_SEGNO will hold the inserted rows.
+ # The vpinfo for RESERVED_SEGNO will have more columns than
+ # relnatts in that case.
+ qry = "SELECT distinct(length(vpinfo)) FROM pg_aoseg.%s where state = 1 and segno <> 0;" % (segrelname)
vpinfo_curs = self.db.query(qry)
nrows = vpinfo_curs.ntuples()
if nrows == 0:
diff --git a/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature b/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature
index acfe9ab329..d16951a2b6 100644
--- a/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature
+++ b/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature
@@ -585,6 +585,15 @@ Feature: gpcheckcat tests
Then gpcheckcat should print "Failed test\(s\) that are not reported here: aoseg_table" to stdout
And the user runs "dropdb vpinfo_inconsistent_db"
+ Scenario: gpcheckcat should not print error when vpinfo for RESERVED_SEGNO is of different length than relnatts
+ Given database "vpinfo_reserved_segno" is dropped and recreated
+ And the user runs "psql vpinfo_reserved_segno -c "CREATE TABLE co_table(a int, b int) using ao_column; INSERT INTO co_table values (1,1);""
+ And the user runs "psql vpinfo_reserved_segno -c "BEGIN; ALTER TABLE co_table ADD COLUMN newcol int; INSERT INTO co_table VALUES (1,1,1); ABORT;""
+ Then psql should return a return code of 0
+ When the user runs "gpcheckcat vpinfo_reserved_segno"
+ And gpcheckcat should return a return code of 0
+ Then gpcheckcat should not print "[FAIL] inconsistent vpinfo" to stdout
+
Scenario: skip one check in gpcheckcat
Given database "all_good" is dropped and recreated
Then the user runs "gpcheckcat -s owner"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 04/16: remove resGroupId check in runaway detector
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 15a9683ee320c4ccc64d785d7ebebb28529552ed
Author: wenru yan <yw...@vmware.com>
AuthorDate: Mon Mar 6 06:05:36 2023 +0000
remove resGroupId check in runaway detector
In previous version, we disable red-zone check for resource group,
the resgroup use cgroup to clean the process which consumes memory
exceeds the rg's configuration.
For the new version for resgroup, we use redZoneChunks to determine
whether the current process is in red-zone or not, so remove the
resGroupId check.
---
src/backend/utils/mmgr/redzone_handler.c | 31 -------------------------------
1 file changed, 31 deletions(-)
diff --git a/src/backend/utils/mmgr/redzone_handler.c b/src/backend/utils/mmgr/redzone_handler.c
index 03ab4fbfc6..a9d127c6c2 100644
--- a/src/backend/utils/mmgr/redzone_handler.c
+++ b/src/backend/utils/mmgr/redzone_handler.c
@@ -108,10 +108,6 @@ RedZoneHandler_ShmemInit()
* Also, during gpinitsystem we may start a QD without initializing the
* gp_vmem_protect_limit. This may result in 0 vmem protect limit. In such case,
* we ensure that the redZoneChunks is set to a large value.
- *
- * When we enable resource group, we will not use redZoneChunks to determine
- * whether the current process is in red-zone or not, so we can calculate the
- * redZoneChunks, but it'll never be used.
*/
if (runaway_detector_activation_percent != 0 &&
runaway_detector_activation_percent != 100 &&
@@ -163,7 +159,6 @@ RedZoneHandler_FlagTopConsumer()
Assert(NULL != MySessionState);
- Oid resGroupId = InvalidOid;
uint32 expected = 0;
bool success = pg_atomic_compare_exchange_u32((pg_atomic_uint32 *) isRunawayDetector, &expected, 1);
@@ -179,19 +174,6 @@ RedZoneHandler_FlagTopConsumer()
return;
}
- /*
- * In resource group mode, we should acquire ResGroupLock to avoid
- * resource group slot being changed during flag top consumer in redzone.
- * Note that flag top consumer is a low frequency action, so the
- * additional overhead is acceptable.
- *
- * Note that we also need to acquire SessionStateLock as well, so the lock
- * order is important to avoid deadlock. Make sure always acquire
- * ResGroupLock ahead.
- */
- if (IsResGroupEnabled())
- LWLockAcquire(ResGroupLock, LW_SHARED);
-
/*
* Grabbing a shared lock prevents others to modify the SessionState
* data structure, therefore ensuring that we don't flag someone
@@ -213,16 +195,6 @@ RedZoneHandler_FlagTopConsumer()
{
Assert(INVALID_SESSION_ID != curSessionState->sessionId);
- /*
- * in resgroup mode, we should only flag top consumer in group which uses
- * the most of the global shared memory
- */
- if (IsResGroupEnabled() && SessionGetResGroupId(curSessionState) != resGroupId)
- {
- curSessionState = curSessionState->next;
- continue;
- }
-
int32 curVmem = curSessionState->sessionVmem;
Assert(maxActiveVmem <= maxVmem);
@@ -322,9 +294,6 @@ RedZoneHandler_FlagTopConsumer()
}
LWLockRelease(SessionStateLock);
-
- if (IsResGroupEnabled())
- LWLockRelease(ResGroupLock);
}
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 02/16: add permission check to file /sys/fs/cgroup/cgroup.procs (#15133)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 4c15d6b333a6ec3bcd70ab5e6d5111e5d0931eaa
Author: Zhenglong Li <lz...@vmware.com>
AuthorDate: Wed Mar 8 08:46:24 2023 +0800
add permission check to file /sys/fs/cgroup/cgroup.procs (#15133)
Add permission check to file /sys/fs/cgroup/cgroup.procs.
Make sure gpstart -rai will definitely succeed if the customer uses gpconfig to set the
gp_resource_manager to group-v2.
---
gpMgmt/bin/gpcheckresgroupv2impl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gpMgmt/bin/gpcheckresgroupv2impl b/gpMgmt/bin/gpcheckresgroupv2impl
index 4a0fbe42a0..e08798c34b 100755
--- a/gpMgmt/bin/gpcheckresgroupv2impl
+++ b/gpMgmt/bin/gpcheckresgroupv2impl
@@ -25,7 +25,7 @@ class CgroupValidation(object):
return ""
-class CgroupValidationVersionBeta(CgroupValidation):
+class CgroupValidationVersionTwo(CgroupValidation):
def __init__(self):
self.mount_point = self.detect_cgroup_mount_point()
self.tab = {"r": os.R_OK, "w": os.W_OK, "x": os.X_OK, "f": os.F_OK}
@@ -41,6 +41,8 @@ class CgroupValidationVersionBeta(CgroupValidation):
if not self.mount_point:
self.die("failed to detect cgroup v2 mount point.")
+ self.validate_permission("cgroup.procs", "rw")
+
self.validate_permission("gpdb/", "rwx")
self.validate_permission("gpdb/cgroup.procs", "rw")
@@ -85,6 +87,6 @@ class CgroupValidationVersionBeta(CgroupValidation):
if __name__ == '__main__':
try:
- CgroupValidationVersionBeta().validate_all()
+ CgroupValidationVersionTwo().validate_all()
except ValidationException as e:
exit(e.message)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 08/16: Prevent function execution which access distributed table on entrydb query executor.
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit c56911bd19bb3a1e7ee9f7a8b88cefc8f3464d1d
Author: m7onov <m7...@gmail.com>
AuthorDate: Mon Mar 13 09:21:43 2023 +0300
Prevent function execution which access distributed table on entrydb query executor.
I came across a bug related to function execution in entrydb QE. Details provided below.
``` sql
create table invalid_name (name text) distributed replicated;
create table candidate (name text, parent_name text) distributed by (name);
create or replace function is_invalid_name (aname text)
returns boolean
language sql
as $$
select aname in (select name from invalid_name)
$$;
create table tst_valid_name (a text) distributed randomly;
create table tst_invalid_name (a text) distributed randomly;
insert into invalid_name (name) values ('tst_invalid_name');
insert into candidate(name, parent_name) values ('tst_valid_name', 'tst_invalid_name');
```
Table "candidate" contains 1 row.
``` sql
select * from candidate;
name | parent_name
----------------+------------------
tst_valid_name | tst_invalid_name
(1 row)
```
Subquery returns 1 row.
``` sql
select c.relname as name,
'tst_invalid_name' as parent_name
from pg_class c
where c.relname like 'tst%' and
not is_invalid_name(c.relname);
name | parent_name
----------------+------------------
tst_valid_name | tst_invalid_name
(1 row)
```
But when we full join we get 2 rows.
``` sql
select a.name as a_name,
a.parent_name as a_parent_name,
b.name as b_name,
b.parent_name as b_parent_name
from candidate a
full join (select c.relname as name,
'tst_invalid_name' as parent_name
from pg_class c
where c.relname like 'tst%' and
not is_invalid_name(c.relname)) b
on a.name = b.name and
a.parent_name = b.parent_name
order by 1,2,3,4;
a_name | a_parent_name | b_name | b_parent_name
----------------+------------------+------------------+------------------
tst_valid_name | tst_invalid_name | tst_valid_name | tst_invalid_name
| | tst_invalid_name | tst_invalid_name
(2 rows)
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice2; segments: 3) (cost=102.58..102.59 rows=4 width=128) (actual time=1.697..1.698 rows=2 loops=1)
Merge Key: a.name, a.parent_name, c.relname, ('tst_invalid_name'::text)
-> Sort (cost=102.58..102.59 rows=2 width=128) (actual time=0.958..0.959 rows=1 loops=1)
Sort Key: a.name, a.parent_name, c.relname, ('tst_invalid_name'::text)
Sort Method: quicksort Memory: 99kB
-> Hash Full Join (cost=1.29..102.55 rows=2 width=128) (actual time=0.370..0.937 rows=1 loops=1)
Hash Cond: ((c.relname)::text = a.name)
Join Filter: (a.parent_name = 'tst_invalid_name'::text)
Extra Text: (seg0) Hash chain length 0.0 avg, 0 max, using 0 of 131072 buckets.
-> Redistribute Motion 1:3 (slice1) (cost=0.27..101.49 rows=1 width=96) (actual time=0.262..0.262 rows=1 loops=1)
Hash Key: (c.relname)::text
-> Index Only Scan using pg_class_relname_nsp_index on pg_class c (cost=0.27..101.47 rows=1 width=96) (actual time=0.214..0.251 rows=2 loops=1)
Index Cond: ((relname >= 'tst'::name) AND (relname < 'tsu'::name))
Filter: ((relname ~~ 'tst%'::text) AND (NOT is_invalid_name((relname)::text)))
Heap Fetches: 0
-> Hash (cost=1.01..1.01 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=1)
-> Seq Scan on candidate a (cost=0.00..1.01 rows=1 width=32) (actual time=0.005..0.005 rows=1 loops=1)
Planning time: 3.277 ms
(slice0) Executor memory: 224K bytes.
(slice1) Executor memory: 260K bytes (entry db).
(slice2) Executor memory: 1141K bytes avg x 3 workers, 1144K bytes max (seg0). Work_mem: 33K bytes max.
Memory used: 128000kB
Optimizer: Postgres query optimizer
Execution time: 2.866 ms
(24 rows)
```
The problem is that `is_invalid_name` function runs in slice1 in entry DB QE which surely does not contain data for `invalid_name` table. This PR adds additional condition to `src/backend/executor/functions.c`, `querytree_safe_for_qe_walker()` which prevents functions execution on entrydb QE. Also PR contains regression test for this bug.
---
src/backend/executor/functions.c | 3 ++-
src/test/regress/expected/qp_functions.out | 22 ++++++++++++++++++++++
src/test/regress/sql/qp_functions.sql | 25 +++++++++++++++++++++++++
3 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 0b2848e528..9cc613c5b6 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -222,7 +222,8 @@ querytree_safe_for_qe_walker(Node *expr, void *context)
if (!(IsCatalogNamespace(namespaceId) ||
IsToastNamespace(namespaceId) ||
IsAoSegmentNamespace(namespaceId) ||
- IsReplicatedTable(rte->relid)))
+ (IsReplicatedTable(rte->relid) &&
+ !IS_QUERY_DISPATCHER())))
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
diff --git a/src/test/regress/expected/qp_functions.out b/src/test/regress/expected/qp_functions.out
index 9e84f4b630..bc50bd4265 100644
--- a/src/test/regress/expected/qp_functions.out
+++ b/src/test/regress/expected/qp_functions.out
@@ -1132,3 +1132,25 @@ $$;
NOTICE: n: 9.12
NOTICE: t: 9.1
NOTICE: n: 9.12
+create table invalid_name (name text) distributed replicated;
+create table candidate (name text, parent_name text) distributed by (name);
+create or replace function is_invalid_name (aname text) returns boolean language sql as $$ select aname in (select name from invalid_name)$$;
+create table tst_valid_name (a text) distributed randomly;
+create table tst_invalid_name (a text) distributed randomly;
+insert into invalid_name (name) values ('tst_invalid_name');
+insert into candidate(name, parent_name) values ('tst_valid_name', 'tst_invalid_name');
+select a.name as a_name,
+ a.parent_name as a_parent_name,
+ b.name as b_name,
+ b.parent_name as b_parent_name
+ from candidate a
+ full join (select c.relname as name,
+ 'tst_invalid_name' as parent_name
+ from pg_class c
+ where c.relname like 'tst%' and
+ not is_invalid_name(c.relname)) b
+ on a.name = b.name and
+ a.parent_name = b.parent_name
+ order by 1,2,3,4;
+ERROR: function cannot execute on a QE slice because it accesses relation "public.invalid_name"
+CONTEXT: SQL function "is_invalid_name" during startup
diff --git a/src/test/regress/sql/qp_functions.sql b/src/test/regress/sql/qp_functions.sql
index 8b9f65510c..d9eb2bf8fe 100644
--- a/src/test/regress/sql/qp_functions.sql
+++ b/src/test/regress/sql/qp_functions.sql
@@ -510,3 +510,28 @@ begin
raise notice 'n: %', n;
end;
$$;
+
+
+create table invalid_name (name text) distributed replicated;
+create table candidate (name text, parent_name text) distributed by (name);
+create or replace function is_invalid_name (aname text) returns boolean language sql as $$ select aname in (select name from invalid_name)$$;
+
+create table tst_valid_name (a text) distributed randomly;
+create table tst_invalid_name (a text) distributed randomly;
+
+insert into invalid_name (name) values ('tst_invalid_name');
+insert into candidate(name, parent_name) values ('tst_valid_name', 'tst_invalid_name');
+
+select a.name as a_name,
+ a.parent_name as a_parent_name,
+ b.name as b_name,
+ b.parent_name as b_parent_name
+ from candidate a
+ full join (select c.relname as name,
+ 'tst_invalid_name' as parent_name
+ from pg_class c
+ where c.relname like 'tst%' and
+ not is_invalid_name(c.relname)) b
+ on a.name = b.name and
+ a.parent_name = b.parent_name
+ order by 1,2,3,4;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 10/16: Fix index DDL operations are recorded in QEs' pg_last_stat_operation (#14822)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit eb442939e95a234bf457a2ceb02d7c841bfd1599
Author: dreamedcheng <dr...@gmail.com>
AuthorDate: Wed Mar 15 12:33:27 2023 +0800
Fix index DDL operations are recorded in QEs' pg_last_stat_operation (#14822)
Note that, most system catalog tables should be consistent between
coordinator and segments. However, for now, meta tracking stuffs are
done by coordinator only, so the changes to 'pg_last_stat_operation'
should only be made by coordinator. But for index DDL, changes are
also made on QEs. This commit fix that.
Co-authored-by: wuchengwen <wc...@alibaba-inc.com>
fix bfv_catalog.out
---
src/backend/catalog/index.c | 7 +++++--
.../regress/expected/pg_stat_last_operation.out | 22 +++++++++++++++++++---
src/test/regress/sql/pg_stat_last_operation.sql | 7 +++++++
.../singlenode_regress/expected/bfv_catalog.out | 9 ++++-----
4 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index af5d24cc13..1a2abbc53e 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1087,6 +1087,7 @@ index_create_internal(Relation heapRelation,
/* done with pg_class */
table_close(pg_class, RowExclusiveLock);
+ if (Gp_role == GP_ROLE_DISPATCH)
{ /* MPP-7575: track index creation */
bool doIt = true;
char *subtyp = "INDEX";
@@ -2531,8 +2532,9 @@ index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode)
DeleteInheritsTuple(indexId, InvalidOid, false, NULL);
/* MPP-6929: metadata tracking */
- MetaTrackDropObject(RelationRelationId,
- indexId);
+ if (Gp_role == GP_ROLE_DISPATCH)
+ MetaTrackDropObject(RelationRelationId,
+ indexId);
/*
* We are presently too lazy to attempt to compute the new correct value
@@ -3995,6 +3997,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
table_close(pg_index, RowExclusiveLock);
}
+ if (Gp_role == GP_ROLE_DISPATCH)
{
bool doIt = true;
char *subtyp = "REINDEX";
diff --git a/src/test/regress/expected/pg_stat_last_operation.out b/src/test/regress/expected/pg_stat_last_operation.out
index 59ac81c3fb..1d92fcb44a 100644
--- a/src/test/regress/expected/pg_stat_last_operation.out
+++ b/src/test/regress/expected/pg_stat_last_operation.out
@@ -85,8 +85,8 @@ SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'CREATE';
pg_stat_last_operation_test | CREATE | TABLE
mdt_test_part1 | CREATE | TABLE
mdt_test_part1_1_prt_1 | CREATE | TABLE
- mdt_test_part1_1_prt_1_2_prt_1 | CREATE | TABLE
mdt_test_part1_1_prt_2 | CREATE | TABLE
+ mdt_test_part1_1_prt_1_2_prt_1 | CREATE | TABLE
mdt_test_part1_1_prt_2_2_prt_1 | CREATE | TABLE
mdt_test_part1_1_prt_default_part | CREATE | TABLE
mdt_test_part1_1_prt_default_part_2_prt_1 | CREATE | TABLE
@@ -156,6 +156,22 @@ SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'TRUNCATE';
pg_stat_last_operation_test | TRUNCATE |
(1 row)
+-- CREATE INDEX
+CREATE INDEX idx_mt ON mdt_all_types (a);
+REINDEX INDEX idx_mt;
+SELECT * FROM pg_stat_last_operation_testview WHERE objname = 'idx_mt';
+ objname | actionname | subtype
+---------+------------+---------
+ idx_mt | CREATE | INDEX
+ idx_mt | VACUUM | REINDEX
+(2 rows)
+
+-- QEs shouldn't do meta tracking stuff
+SELECT gp_execution_dbid(), * FROM gp_dist_random('pg_stat_last_operation_testview') WHERE objname = 'idx_mt';
+ gp_execution_dbid | objname | actionname | subtype
+-------------------+---------+------------+---------
+(0 rows)
+
-- DROP TABLE
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'DROP';
objname | actionname | subtype
@@ -166,7 +182,6 @@ SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
objname | actionname | subtype
-------------------------------------------+------------+----------
mdt_test_part1 | CREATE | TABLE
- mdt_test_part1 | PARTITION | DROP
mdt_test_part1_1_prt_1 | CREATE | TABLE
mdt_test_part1_1_prt_1 | PARTITION | ATTACH
mdt_test_part1_1_prt_2 | CREATE | TABLE
@@ -188,6 +203,7 @@ SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
mdt_test_newpart | PARTITION | ATTACH
mdt_test_detach | CREATE | TABLE
mdt_test_detach | PARTITION | DETACH
+ mdt_test_part1 | PARTITION | DROP
mdt_all_types | PRIVILEGE | GRANT
mdt_all_types | VACUUM |
mdt_all_types | ANALYZE |
@@ -198,7 +214,6 @@ SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
objname | actionname | subtype
-------------------------------------------+------------+---------
mdt_test_part1 | CREATE | TABLE
- mdt_test_part1 | PARTITION | DROP
mdt_test_part1_1_prt_1 | CREATE | TABLE
mdt_test_part1_1_prt_1 | PARTITION | ATTACH
mdt_test_part1_1_prt_2 | CREATE | TABLE
@@ -215,6 +230,7 @@ SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
mdt_test_newpart | PARTITION | ATTACH
mdt_test_detach | CREATE | TABLE
mdt_test_detach | PARTITION | DETACH
+ mdt_test_part1 | PARTITION | DROP
(18 rows)
DROP TABLE mdt_test_part1;
diff --git a/src/test/regress/sql/pg_stat_last_operation.sql b/src/test/regress/sql/pg_stat_last_operation.sql
index f3e5290ed4..c84e45fe44 100644
--- a/src/test/regress/sql/pg_stat_last_operation.sql
+++ b/src/test/regress/sql/pg_stat_last_operation.sql
@@ -112,6 +112,13 @@ INSERT INTO pg_stat_last_operation_test SELECT generate_series(1, 5);
TRUNCATE pg_stat_last_operation_test;
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'TRUNCATE';
+-- CREATE INDEX
+CREATE INDEX idx_mt ON mdt_all_types (a);
+REINDEX INDEX idx_mt;
+SELECT * FROM pg_stat_last_operation_testview WHERE objname = 'idx_mt';
+-- QEs shouldn't do meta tracking stuff
+SELECT gp_execution_dbid(), * FROM gp_dist_random('pg_stat_last_operation_testview') WHERE objname = 'idx_mt';
+
-- DROP TABLE
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'DROP';
SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
diff --git a/src/test/singlenode_regress/expected/bfv_catalog.out b/src/test/singlenode_regress/expected/bfv_catalog.out
index 4ba9dea31f..aa9d46a0e4 100644
--- a/src/test/singlenode_regress/expected/bfv_catalog.out
+++ b/src/test/singlenode_regress/expected/bfv_catalog.out
@@ -614,9 +614,8 @@ set allow_system_table_mods=off;
vacuum full pg_stat_last_operation;
select classid::regclass, objid::regclass, staactionname, stasubtype from pg_stat_last_operation
where classid='pg_class'::regclass and objid::regclass::text like 'pg_stat%last%' and stasubtype != 'AUTO';
- classid | objid | staactionname | stasubtype
-----------+-------------------------------------------------+---------------+------------
- pg_class | pg_stat_last_operation | VACUUM | FULL
- pg_class | pg_statlastop_classid_objid_staactionname_index | VACUUM | REINDEX
-(2 rows)
+ classid | objid | staactionname | stasubtype
+----------+------------------------+---------------+------------
+ pg_class | pg_stat_last_operation | VACUUM | FULL
+(1 row)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 13/16: Fix obsolete references to SnapshotNow in comment. (#15189)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 3e832f1c06e1ee61ce846f97ebf0be534d1f7604
Author: Xiaoran Wang <wx...@vmware.com>
AuthorDate: Fri Mar 17 10:49:55 2023 +0800
Fix obsolete references to SnapshotNow in comment. (#15189)
SnapshotNow has been deleted on 9.4
---
src/backend/access/aocs/aocssegfiles.c | 20 --------------------
src/backend/access/transam/xact.c | 5 -----
src/test/isolation/specs/ao-insert-eof.spec | 3 ---
3 files changed, 28 deletions(-)
diff --git a/src/backend/access/aocs/aocssegfiles.c b/src/backend/access/aocs/aocssegfiles.c
index b0ca80b114..0ab1a4ea94 100644
--- a/src/backend/access/aocs/aocssegfiles.c
+++ b/src/backend/access/aocs/aocssegfiles.c
@@ -593,10 +593,6 @@ MarkAOCSFileSegInfoAwaitingDrop(Relation prel, int segno)
segrel = heap_open(segrelid, RowExclusiveLock);
tupdesc = RelationGetDescr(segrel);
- /*
- * Since we have the segment-file entry under lock (with
- * LockRelationAppendOnlySegmentFile) we can use SnapshotNow.
- */
scan = table_beginscan_catalog(segrel, 0, NULL);
while (segno != tuple_segno && (oldtup = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
@@ -685,10 +681,6 @@ ClearAOCSFileSegInfo(Relation prel, int segno)
segrel = heap_open(segrelid, RowExclusiveLock);
tupdesc = RelationGetDescr(segrel);
- /*
- * Since we have the segment-file entry under lock (with
- * LockRelationAppendOnlySegmentFile) we can use SnapshotNow.
- */
scan = table_beginscan_catalog(segrel, 0, NULL);
while (segno != tuple_segno && (oldtup = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
@@ -776,10 +768,6 @@ UpdateAOCSFileSegInfo(AOCSInsertDesc idesc)
segrel = heap_open(idesc->segrelid, RowExclusiveLock);
tupdesc = RelationGetDescr(segrel);
- /*
- * Since we have the segment-file entry under lock (with
- * LockRelationAppendOnlySegmentFile) we can use SnapshotNow.
- */
scan = systable_beginscan(segrel, InvalidOid, false, idesc->appendOnlyMetaDataSnapshot, 0, NULL);
while (idesc->cur_segno != tuple_segno && (oldtup = systable_getnext(scan)) != NULL)
{
@@ -973,10 +961,6 @@ AOCSFileSegInfoAddVpe(Relation prel, int32 segno,
segrel = heap_open(segrelid, RowExclusiveLock);
tupdesc = RelationGetDescr(segrel);
- /*
- * Since we have the segment-file entry under lock (with
- * LockRelationAppendOnlySegmentFile) we can use SnapshotNow.
- */
scan = systable_beginscan(segrel, InvalidOid, false, NULL, 0, NULL);
while (segno != tuple_segno && (oldtup = systable_getnext(scan)) != NULL)
{
@@ -1092,10 +1076,6 @@ AOCSFileSegInfoAddCount(Relation prel, int32 segno,
segrel = heap_open(segrelid, RowExclusiveLock);
tupdesc = RelationGetDescr(segrel);
- /*
- * Since we have the segment-file entry under lock (with
- * LockRelationAppendOnlySegmentFile) we can use SnapshotNow.
- */
scan = systable_beginscan(segrel, InvalidOid, false, NULL, 0, NULL);
while (segno != tuple_segno && (oldtup = systable_getnext(scan)) != NULL)
{
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index cc17e6e079..00b0ece764 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2933,11 +2933,6 @@ CommitTransaction(void)
* signals (which may attempt to abort our now partially-completed
* transaction) until we've notified the QEs.
*
- * Very important that PGPROC still thinks the transaction is still in progress so
- * SnapshotNow reader don't jump to the conclusion this distributed transaction is
- * finished. So, notifyCommittedDtxTransaction will take responsbility to clear
- * PGPROC under the ProcArrayLock after the broadcast. MPP-16087.
- *
* And, that we have not master released locks, yet, too.
*
* Note: do this BEFORE clearing the resource owner, as the dispatch
diff --git a/src/test/isolation/specs/ao-insert-eof.spec b/src/test/isolation/specs/ao-insert-eof.spec
index 58d70e552b..31ac008e1d 100644
--- a/src/test/isolation/specs/ao-insert-eof.spec
+++ b/src/test/isolation/specs/ao-insert-eof.spec
@@ -10,9 +10,6 @@
# written without serializable by using fault-injector, by suspending insert
# statement after acquiring snapshot but before reaching segment file selection
# logic for AO.
-# Without the fix for using SnapshotNow to read aoseg during inserts, it used to
-# overwrite and corrupt the data in some cases or error out inserts hiting the
-# sanity checks.
setup
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 05/16: Avoid syncscan for vacuum full and cluster for catalog tables
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit ed99c71940275925c2ed57362da3ddccf43261e1
Author: Ashwin Agrawal <aa...@vmware.com>
AuthorDate: Fri Mar 3 16:39:47 2023 -0800
Avoid syncscan for vacuum full and cluster for catalog tables
Backends load or build relcache when starting (process title conveys
"startup"). If relcache init file is present then can just load
relcache from it. In absence of the file (file is deleted on sinval
message), need to perform sequential scan on pg_class, pg_attribute
for locating tuples related to these critical system tables and
indexes to build the relcache, refer RelationCacheInitializePhase3().
General expectation is tuples corresponding to these critical catalog
tables (created during bootstrap and with xmin=1) will be present in
starting blocks and hence seqscan and tuple visibility will not be
costly to perform during backend startup. Though occassionally in
production setups these bootstrap tuples were found in very high block
numbers for pg_attribute. As a effect from this, backends stalled for
very long time in startup phase, specially if tuple visibility gets
costly due to presence of subtransaction overflow or long running
transaction. VACUUM FULL was traced as the culprit for moving these
tuples from starting blocks to very high block numbers.
VACUUM FULL used syncscan during rewrite. Effect of that is scans the
table circularly, from block X up to the end and then from block 0 to
X-1. If X != 0, then all the tuples from block 0 end up last in new
file (higher block numbers). Hence disabling to use syncscan for
vacuum full and cluster operations to avoid movement of these critical
tuples from starting block numbers.
Refer:
https://www.postgresql.org/message-id/flat/CAKSySwf%2BYH_4%3DUDosdyNG2%2BEYOFaThsATB9AfNkUjM4uq%2B69vQ%40mail.gmail.com
Also fixes https://github.com/greenplum-db/gpdb/issues/13453.
Reviewed-by: Huansong Fu <fu...@gmail.com>
---
src/backend/access/heap/heapam_handler.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index 2537fc9ea5..6ed3ad07b3 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -778,7 +778,18 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
pgstat_progress_update_param(PROGRESS_CLUSTER_PHASE,
PROGRESS_CLUSTER_PHASE_SEQ_SCAN_HEAP);
- tableScan = table_beginscan(OldHeap, SnapshotAny, 0, (ScanKey) NULL);
+ /*
+ * For Catalog tables avoid syncscan, so that scan always starts from
+ * block 0 during rewrite and helps retain bootstrap tuples in initial
+ * pages only. If using syncscan, then bootstrap tuples may move to
+ * higher blocks, which will lead to degraded performance for relcache
+ * initialization during connection starts.
+ */
+ if (IsCatalogRelation(OldHeap))
+ tableScan = table_beginscan_strat(OldHeap,
+ SnapshotAny, 0, (ScanKey) NULL, true, false);
+ else
+ tableScan = table_beginscan(OldHeap, SnapshotAny, 0, (ScanKey) NULL);
heapScan = (HeapScanDesc) tableScan;
indexScan = NULL;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 11/16: Fix pullup error when the target list contains RelabelType node (#15173)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit f30f66ba5fa95e5f41286a7f26f3b37188deb236
Author: dreamedcheng <dr...@gmail.com>
AuthorDate: Thu Mar 16 09:55:54 2023 +0800
Fix pullup error when the target list contains RelabelType node (#15173)
This commit fix issue#15149 that was found by sqlancer. We should
ignore the RelabelType node in target list when doing pull up.
Co-authored-by: wuchengwen <wc...@alibaba-inc.com>
---
src/backend/cdb/cdbpullup.c | 2 +-
src/test/regress/expected/gp_pullup_expr.out | 10 ++++++++++
src/test/regress/greenplum_schedule | 2 +-
src/test/regress/sql/gp_pullup_expr.sql | 7 +++++++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/backend/cdb/cdbpullup.c b/src/backend/cdb/cdbpullup.c
index 05e7d410d5..cf1e318ae9 100644
--- a/src/backend/cdb/cdbpullup.c
+++ b/src/backend/cdb/cdbpullup.c
@@ -95,7 +95,7 @@ pullUpExpr_mutator(Node *node, void *context)
/* Is targetlist a List of TargetEntry? (Plan nodes use this format) */
if (IsA(linitial(ctx->targetlist), TargetEntry))
{
- tle = tlist_member((Expr *) var, ctx->targetlist);
+ tle = tlist_member_ignore_relabel((Expr *) var, ctx->targetlist);
/* Fail if P's result does not include this column. */
if (!tle)
diff --git a/src/test/regress/expected/gp_pullup_expr.out b/src/test/regress/expected/gp_pullup_expr.out
new file mode 100644
index 0000000000..d3fb0ef1bb
--- /dev/null
+++ b/src/test/regress/expected/gp_pullup_expr.out
@@ -0,0 +1,10 @@
+-- This case is based on the reproduce steps reported on https://github.com/greenplum-db/gpdb/issues/15149
+CREATE TABLE issue_15149(c1 varchar);
+NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'c1' 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.
+SELECT t.c1 FROM (SELECT DISTINCT ON (upper(c1)) c1 COLLATE "C" FROM issue_15149)t;
+ c1
+----
+(0 rows)
+
+DROP TABLE issue_15149;
diff --git a/src/test/regress/greenplum_schedule b/src/test/regress/greenplum_schedule
index 5857ba8190..8eb7a1d500 100755
--- a/src/test/regress/greenplum_schedule
+++ b/src/test/regress/greenplum_schedule
@@ -68,7 +68,7 @@ test: gp_connections
# bitmap_index triggers recovery, run it seperately
test: bitmap_index
test: gp_dump_query_oids analyze gp_owner_permission incremental_analyze truncate_gp
-test: indexjoin as_alias regex_gp gpparams with_clause transient_types gp_rules dispatch_encoding motion_gp
+test: indexjoin as_alias regex_gp gpparams with_clause transient_types gp_rules dispatch_encoding motion_gp gp_pullup_expr
# interconnect tests
test: icudp/gp_interconnect_queue_depth icudp/gp_interconnect_queue_depth_longtime icudp/gp_interconnect_snd_queue_depth icudp/gp_interconnect_snd_queue_depth_longtime icudp/gp_interconnect_min_retries_before_timeout icudp/gp_interconnect_transmit_timeout icudp/gp_interconnect_cache_future_packets icudp/gp_interconnect_default_rtt icudp/gp_interconnect_fc_method icudp/gp_interconnect_min_rto icudp/gp_interconnect_timer_checking_period icudp/gp_interconnect_timer_period icudp/queue_depth_ [...]
diff --git a/src/test/regress/sql/gp_pullup_expr.sql b/src/test/regress/sql/gp_pullup_expr.sql
new file mode 100644
index 0000000000..3e05316a93
--- /dev/null
+++ b/src/test/regress/sql/gp_pullup_expr.sql
@@ -0,0 +1,7 @@
+-- This case is based on the reproduce steps reported on https://github.com/greenplum-db/gpdb/issues/15149
+
+CREATE TABLE issue_15149(c1 varchar);
+
+SELECT t.c1 FROM (SELECT DISTINCT ON (upper(c1)) c1 COLLATE "C" FROM issue_15149)t;
+
+DROP TABLE issue_15149;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 15/16: gpcheckcat: Replace expensive pg_attribute query
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 2a77533e73e9e61a70343159a7da466677a50ca2
Author: Soumyadeep Chakraborty <so...@gmail.com>
AuthorDate: Fri Mar 17 16:58:48 2023 -0700
gpcheckcat: Replace expensive pg_attribute query
We were querying pg_attribute once for each aocsseg table in the
database to obtain the CO table's attribute count.
We now rely on pg_class.relnatts instead.
---
gpMgmt/bin/gpcheckcat | 12 +++++-------
gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature | 2 +-
gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py | 16 ++++++++++++++++
3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/gpMgmt/bin/gpcheckcat b/gpMgmt/bin/gpcheckcat
index 8da2a0298a..9a0535e905 100755
--- a/gpMgmt/bin/gpcheckcat
+++ b/gpMgmt/bin/gpcheckcat
@@ -1433,8 +1433,9 @@ class checkAOSegVpinfoThread(execThread):
def run(self):
aoseg_query = """
- SELECT a.relname, a.relid, a.segrelid, cl.relname
- FROM (SELECT p.relid, p.segrelid, c.relname FROM pg_appendonly p LEFT JOIN pg_class c ON p.relid = c.oid WHERE p.columnstore = true) a
+ SELECT a.relname, a.relid, a.segrelid, cl.relname, a.relnatts
+ FROM (SELECT p.relid, p.segrelid, c.relname, c.relnatts FROM pg_appendonly p LEFT JOIN pg_class c ON p.relid = c.oid LEFT JOIN pg_am a ON (a.oid = c.relam)
+ WHERE a.amname = 'ao_column') a
LEFT JOIN pg_class cl ON a.segrelid = cl.oid;
"""
@@ -1442,10 +1443,7 @@ class checkAOSegVpinfoThread(execThread):
# Read the list of aoseg tables from the database
curs = self.db.query(aoseg_query)
- for relname, relid, segrelid, segrelname in curs.getresult():
- qry = "SELECT count(*) FROM pg_attribute WHERE attrelid=%d AND attnum > 0;" % (relid)
- attr_count = self.db.query(qry).getresult()[0][0]
-
+ for relname, relid, segrelid, segrelname, attr_count in curs.getresult():
qry = "SELECT distinct(length(vpinfo)) FROM pg_aoseg.%s where state = 1;" % (segrelname)
vpinfo_curs = self.db.query(qry)
nrows = vpinfo_curs.ntuples()
@@ -1479,7 +1477,7 @@ class checkAOSegVpinfoThread(execThread):
GV.checkStatus = False
setError(ERROR_NOREPAIR)
logger.info('[FAIL] inconsistent vpinfo')
- logger.error("vpinfo in 'pg_aoseg.{segrelname}' of table '{relname}' contains {vpinfo_attr_count} attributes, while pg_attribute has {attr_count} attributes on segment {content}"
+ logger.error("vpinfo in 'pg_aoseg.{segrelname}' of table '{relname}' contains {vpinfo_attr_count} attributes, while pg_class has {attr_count} attributes on segment {content}"
.format(segrelname = segrelname,
relname = relname,
vpinfo_attr_count = vpinfo_attr_count,
diff --git a/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature b/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature
index 0baa0278c7..acfe9ab329 100644
--- a/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature
+++ b/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature
@@ -579,7 +579,7 @@ Feature: gpcheckcat tests
And there is a "co" table "public.co_vpinfo" in "vpinfo_inconsistent_db" with data
When the user runs "gpcheckcat vpinfo_inconsistent_db"
Then gpcheckcat should return a return code of 0
- When an attribute of table "co_vpinfo" in database "vpinfo_inconsistent_db" is deleted on segment with content id "0"
+ When a table "co_vpinfo" in database "vpinfo_inconsistent_db" has its relnatts inflated on segment with content id "0"
Then psql should return a return code of 0
When the user runs "gpcheckcat -R aoseg_table vpinfo_inconsistent_db"
Then gpcheckcat should print "Failed test\(s\) that are not reported here: aoseg_table" to stdout
diff --git a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py
index 2562a2f92e..deefd608a0 100644
--- a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py
+++ b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py
@@ -2278,6 +2278,22 @@ ssh %s "source %s; export PGUSER=%s; export PGPORT=%s; export PGOPTIONS=\\\"-c g
""" % (host, source_file, user, port, dbname, table)
run_command(context, remote_cmd.strip())
+@when('a table "{table}" in database "{dbname}" has its relnatts inflated on segment with content id "{segid}"')
+def impl(context, table, dbname, segid):
+ local_cmd = 'psql %s -t -c "SELECT port,hostname FROM gp_segment_configuration WHERE content=%s and role=\'p\';"' % (
+ dbname, segid)
+ run_command(context, local_cmd)
+ port, host = context.stdout_message.split("|")
+ port = port.strip()
+ host = host.strip()
+ user = os.environ.get('USER')
+ source_file = os.path.join(os.environ.get('GPHOME'), 'greenplum_path.sh')
+ # Yes, the below line is ugly. It looks much uglier when done with separate strings, given the multiple levels of escaping required.
+ remote_cmd = """
+ssh %s "source %s; export PGUSER=%s; export PGPORT=%s; export PGOPTIONS=\\\"-c gp_role=utility\\\"; psql -d %s -c \\\"SET allow_system_table_mods=true; UPDATE pg_class SET relnatts=relnatts + 2 WHERE relname=\'%s\';\\\""
+""" % (host, source_file, user, port, dbname, table)
+ run_command(context, remote_cmd.strip())
+
@then('The user runs sql "{query}" in "{dbname}" on first primary segment')
@when('The user runs sql "{query}" in "{dbname}" on first primary segment')
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 03/16: AO/CO: reword misleading comment
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit cfa6d829ce88286bc6b551d273927586efa2300f
Author: Alexandra Wang <wa...@vmware.com>
AuthorDate: Tue Feb 21 16:31:25 2023 -0800
AO/CO: reword misleading comment
Fixup commit 03f2040112a4751f5382d9b1d450ed3456450104
---
src/backend/access/aocs/aocsam_handler.c | 6 ++++--
src/backend/access/appendonly/appendonlyam_handler.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/backend/access/aocs/aocsam_handler.c b/src/backend/access/aocs/aocsam_handler.c
index 6b6a76b482..40ba70cd73 100644
--- a/src/backend/access/aocs/aocsam_handler.c
+++ b/src/backend/access/aocs/aocsam_handler.c
@@ -1453,8 +1453,10 @@ aoco_vacuum_rel(Relation onerel, VacuumParams *params,
BufferAccessStrategy bstrategy)
{
/*
- * Implemented but not invoked, we do the AO_COLUMN different phases vacuuming by
- * calling ao_vacuum_rel() in vacuum_rel() directly for now.
+ * We VACUUM an AO_COLUMN table through multiple phases. vacuum_rel()
+ * orchestrates the phases and calls itself again for each phase, so we
+ * get here for every phase. ao_vacuum_rel() is a wrapper of dedicated
+ * ao_vacuum_rel_*() functions for the specific phases.
*/
ao_vacuum_rel(onerel, params, bstrategy);
diff --git a/src/backend/access/appendonly/appendonlyam_handler.c b/src/backend/access/appendonly/appendonlyam_handler.c
index aff85e68c5..39858fe393 100644
--- a/src/backend/access/appendonly/appendonlyam_handler.c
+++ b/src/backend/access/appendonly/appendonlyam_handler.c
@@ -1307,8 +1307,10 @@ appendonly_vacuum_rel(Relation onerel, VacuumParams *params,
BufferAccessStrategy bstrategy)
{
/*
- * Implemented but not invoked, we do the AO_ROW different phases vacuuming by
- * calling ao_vacuum_rel() in vacuum_rel() directly for now.
+ * We VACUUM an AO_ROW table through multiple phases. vacuum_rel()
+ * orchestrates the phases and calls itself again for each phase, so we
+ * get here for every phase. ao_vacuum_rel() is a wrapper of dedicated
+ * ao_vacuum_rel_*() functions for the specific phases.
*/
ao_vacuum_rel(onerel, params, bstrategy);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 12/16: gpexpand: Fix tables not copied to new segments
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 48865dbc01a96d7467d76ffaf5e7653e1da9fb02
Author: Nihal Jain <jn...@vmware.com>
AuthorDate: Wed Feb 22 01:32:29 2023 +0530
gpexpand: Fix tables not copied to new segments
**Issue:**
A customer reported an issue where they were unable to DROP time-based login constraints for users after running gpexpand. This was because, if there are time-based login constraints for users, there are entries in the `pg_auth_time_constraints` catalog table that are identical across all segments. However, when gpexpand was run, this table was not replicated to new segments. As a result, running the DROP command would give an error.
```
NOTICE: dropping DENY rule for "user03" between Thursday 18:00:00 and Saturday 23:59:59
ERROR: cannot find matching DENY rules for "user03" (seg3 192.168.50.53:6000 pid=4429)
```
**RCA:**
The reason why the table was not getting replicated is because gpexpand creates a template of the coordinator segment and uses it to create new segments in the cluster. As part of the cleanup process(since it uses coordinator template), some catalog tables present only on the coordinator are being removed from the new segments. This list of tables is defined in the `COORDINATOR_ONLY_TABLES` list in `gpcatalog.py`.
Catalog tables like `pg_auth_time_constraint`, `pg_description`, and `pg_shdescription` are also part of the `COORDINATOR_ONLY_TABLES` list, but these are present on all segments and not just on the coordinator.
**Fix:**
This commit removes the tables mentioned above from the `COORDINATOR_ONLY_TABLES` list.
Also added a behave test case to verify if these tables are present on all the newly created segments.
---
gpMgmt/bin/gppylib/gpcatalog.py | 3 --
gpMgmt/test/behave/mgmt_utils/gpexpand.feature | 63 ++++++++++++++++++++++-
gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py | 15 ++++++
3 files changed, 77 insertions(+), 4 deletions(-)
diff --git a/gpMgmt/bin/gppylib/gpcatalog.py b/gpMgmt/bin/gppylib/gpcatalog.py
index 2b29ee8569..45a4ae7e4b 100644
--- a/gpMgmt/bin/gppylib/gpcatalog.py
+++ b/gpMgmt/bin/gppylib/gpcatalog.py
@@ -48,9 +48,6 @@ COORDINATOR_ONLY_TABLES_NON_MAPPED = [
COORDINATOR_ONLY_TABLES = [ # TODO: Why 'gp_segment_configuration' is missing here?
'gp_configuration_history',
- 'pg_auth_time_constraint',
- 'pg_description',
- 'pg_shdescription',
'pg_stat_last_operation',
'pg_stat_last_shoperation',
'pg_statistic',
diff --git a/gpMgmt/test/behave/mgmt_utils/gpexpand.feature b/gpMgmt/test/behave/mgmt_utils/gpexpand.feature
index 83f57083b5..5cb2810f84 100644
--- a/gpMgmt/test/behave/mgmt_utils/gpexpand.feature
+++ b/gpMgmt/test/behave/mgmt_utils/gpexpand.feature
@@ -473,4 +473,65 @@ Feature: expand the cluster by adding more segments
When the user runs gpexpand interview to add 0 new segment and 2 new host "sdw2,sdw3"
Then the number of segments have been saved
When the user runs gpexpand with the latest gpexpand_inputfile with additional parameters "--silent"
- Then verify that pg_hba.conf file has "replication" entries in each segment data directories
\ No newline at end of file
+ Then verify that pg_hba.conf file has "replication" entries in each segment data directories
+
+ @gpexpand_segment
+ Scenario: on expand check if one or more cluster is down
+ Given the database is not running
+ And a working directory of the test as '/data/gpdata/gpexpand'
+ And a temporary directory under "/data/gpdata/gpexpand/expandedData" to expand into
+ And a cluster is created with mirrors on "cdw" and "sdw1"
+ And the user runs gpinitstandby with options " "
+ And database "gptest" exists
+ And there are no gpexpand_inputfiles
+ And the cluster is setup for an expansion on hosts "cdw,sdw1"
+ And the primary on content 0 is stopped
+ And user can start transactions
+ And an FTS probe is triggered
+ And the status of the primary on content 0 should be "d"
+ When the user runs gpexpand with a static inputfile for a single-node cluster with mirrors without ret code check
+ Then gpexpand should return a return code of 0
+ Then gpexpand should print "One or more segments are either down or not in preferred role." to stdout
+
+ Scenario: on expand check if one or more cluster is not in their preferred role
+ Given the database is not running
+ And a working directory of the test as '/data/gpdata/gpexpand'
+ And a temporary directory under "/data/gpdata/gpexpand/expandedData" to expand into
+ And a cluster is created with mirrors on "cdw" and "sdw1"
+ And the user runs gpinitstandby with options " "
+ And database "gptest" exists
+ And there are no gpexpand_inputfiles
+ And the cluster is setup for an expansion on hosts "cdw,sdw1"
+ And the primary on content 0 is stopped
+ And user can start transactions
+ And an FTS probe is triggered
+ And the status of the primary on content 0 should be "d"
+ When the user runs "gprecoverseg -a"
+ Then gprecoverseg should return a return code of 0
+ And all the segments are running
+ And the segments are synchronized
+ When the user runs gpexpand with a static inputfile for a single-node cluster with mirrors without ret code check
+ Then gpexpand should return a return code of 0
+ And gpexpand should print "One or more segments are either down or not in preferred role." to stdout
+
+ @gpexpand_no_mirrors
+ @gpexpand_segment
+ Scenario: expand a cluster and verify necessary catalog tables are copied to new segments
+ Given the database is not running
+ And a working directory of the test as '/data/gpdata/gpexpand'
+ And a temporary directory under "/data/gpdata/gpexpand/expandedData" to expand into
+ And a cluster is created with no mirrors on "cdw" and "sdw1"
+ And database "gptest" exists
+ And the user runs psql with "-c 'CREATE ROLE abc; ALTER ROLE abc DENY DAY 0 DENY DAY 2 DENY BETWEEN DAY 4 AND DAY 5;'" against database "gptest"
+ And there are no gpexpand_inputfiles
+ And the cluster is setup for an expansion on hosts "cdw,sdw1"
+ When the user runs gpexpand interview to add 2 new segment and 0 new host "ignored.host"
+ Then the number of segments have been saved
+ When the user runs gpexpand with the latest gpexpand_inputfile with additional parameters "--silent"
+ Then verify that the cluster has 2 new segments
+ And verify that "pg_description" catalog table is present on new segments
+ And verify that "pg_shdescription" catalog table is present on new segments
+ And verify that "pg_auth_time_constraint" catalog table is present on new segments
+ When the user runs "gpcheckcat gptest"
+ Then gpcheckcat should return a return code of 0
+ And the user runs psql with "-c 'DROP ROLE abc'" against database "gptest"
diff --git a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py
index d96929ec07..2562a2f92e 100644
--- a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py
+++ b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py
@@ -3187,6 +3187,21 @@ def impl(context, num_of_segments):
"%s\ndump of gp_segment_configuration: %s" %
(context.start_data_segments, end_data_segments, rows))
+@when('verify that {table_name} catalog table is present on new segments')
+@then('verify that {table_name} catalog table is present on new segments')
+def impl(context, table_name):
+ dbname = 'gptest'
+ with closing(dbconn.connect(dbconn.DbURL(dbname=dbname), unsetSearchPath=False)) as conn:
+ query = """SELECT count(*) from gp_segment_configuration where -1 < content and role='p'"""
+ no_of_segments = dbconn.querySingleton(conn, query)
+
+ query = """select count(distinct(gp_segment_id)) from gp_dist_random('%s')""" % table_name
+ no_segments_table_present = dbconn.querySingleton(conn, query)
+
+ if no_of_segments != no_segments_table_present:
+ raise Exception("Table %s is not present on newly expanded segments" % table_name)
+
+
@given('the cluster is setup for an expansion on hosts "{hostnames}"')
def impl(context, hostnames):
hosts = hostnames.split(",")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 07/16: Allow GRANT on pg_log_backend_memory_contexts().
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit f9dbcda775b1dedbf346f3c10372393bae26704c
Author: Jeff Davis <jd...@postgresql.org>
AuthorDate: Tue Oct 26 13:13:52 2021 -0700
Allow GRANT on pg_log_backend_memory_contexts().
Backport of upstream commit: f0b051e322d530a340e62f2ae16d99acdbcb3d05
Moved REVOKE EXECUTE invocation to src/backend/catalog/system_views.sql because GPDB has not yet
split out function definitions into src/backend/catalog/system_functions.sql.
Manually removed ereport call on non-superuser access to function, as git cherry-pick was not
correctly applying that change
Backported by: Andrew Repp
Original Commit Message:
Remove superuser check, allowing any user granted permissions on
pg_log_backend_memory_contexts() to log the memory contexts of any
backend.
Note that this could allow a privileged non-superuser to log the
memory contexts of a superuser backend, but as discussed, that does
not seem to be a problem.
Reviewed-by: Nathan Bossart, Bharath Rupireddy, Michael Paquier, Kyotaro Horiguchi, Andres Freund
Discussion: https://postgr.es/m/e5cf6684d17c8d1ef4904ae248605ccd6da03e72.camel@j-davis.com
Fix func2
---
src/backend/catalog/system_functions.sql | 1 +
src/backend/utils/adt/mcxtfuncs.c | 14 +++------
src/test/regress/expected/misc_functions.out | 33 +++++++++++++++++++--
.../regress/expected/misc_functions_optimizer.out | 34 ++++++++++++++++++++--
src/test/regress/sql/misc_functions.sql | 26 +++++++++++++++--
5 files changed, 92 insertions(+), 16 deletions(-)
diff --git a/src/backend/catalog/system_functions.sql b/src/backend/catalog/system_functions.sql
index 1e1f25ddae..5e3db477e6 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -724,6 +724,7 @@ REVOKE EXECUTE ON FUNCTION pg_ls_dir(text) FROM public;
REVOKE EXECUTE ON FUNCTION pg_ls_dir(text,boolean,boolean) FROM public;
+REVOKE EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer) FROM PUBLIC;
--
-- We also set up some things as accessible to standard roles.
--
diff --git a/src/backend/utils/adt/mcxtfuncs.c b/src/backend/utils/adt/mcxtfuncs.c
index 0d52613bc3..6ddbf70b30 100644
--- a/src/backend/utils/adt/mcxtfuncs.c
+++ b/src/backend/utils/adt/mcxtfuncs.c
@@ -162,10 +162,10 @@ pg_get_backend_memory_contexts(PG_FUNCTION_ARGS)
* pg_log_backend_memory_contexts
* Signal a backend process to log its memory contexts.
*
- * Only superusers are allowed to signal to log the memory contexts
- * because allowing any users to issue this request at an unbounded
- * rate would cause lots of log messages and which can lead to
- * denial of service.
+ * By default, only superusers are allowed to signal to log the memory
+ * contexts because allowing any users to issue this request at an unbounded
+ * rate would cause lots of log messages and which can lead to denial of
+ * service. Additional roles can be permitted with GRANT.
*
* On receipt of this signal, a backend sets the flag in the signal
* handler, which causes the next CHECK_FOR_INTERRUPTS() to log the
@@ -177,12 +177,6 @@ pg_log_backend_memory_contexts(PG_FUNCTION_ARGS)
int pid = PG_GETARG_INT32(0);
PGPROC *proc;
- /* Only allow superusers to log memory contexts. */
- if (!superuser())
- ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("must be a superuser to log memory contexts")));
-
proc = BackendPidGetProc(pid);
/*
diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out
index 73696351a4..3037612377 100644
--- a/src/test/regress/expected/misc_functions.out
+++ b/src/test/regress/expected/misc_functions.out
@@ -140,14 +140,43 @@ HINT: No function matches the given name and argument types. You might need to
--
-- Memory contexts are logged and they are not returned to the function.
-- Furthermore, their contents can vary depending on the timing. However,
--- we can at least verify that the code doesn't fail.
+-- we can at least verify that the code doesn't fail, and that the
+-- permissions are set properly.
--
-SELECT * FROM pg_log_backend_memory_contexts(pg_backend_pid());
+SELECT pg_log_backend_memory_contexts(pg_backend_pid());
pg_log_backend_memory_contexts
--------------------------------
t
(1 row)
+CREATE ROLE regress_log_memory;
+SELECT has_function_privilege('regress_log_memory',
+ 'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- no
+ has_function_privilege
+------------------------
+ f
+(1 row)
+
+GRANT EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer)
+ TO regress_log_memory;
+SELECT has_function_privilege('regress_log_memory',
+ 'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- yes
+ has_function_privilege
+------------------------
+ t
+(1 row)
+
+SET ROLE regress_log_memory;
+SELECT pg_log_backend_memory_contexts(pg_backend_pid());
+ pg_log_backend_memory_contexts
+--------------------------------
+ t
+(1 row)
+
+RESET ROLE;
+REVOKE EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer)
+ FROM regress_log_memory;
+DROP ROLE regress_log_memory;
--
-- Test some built-in SRFs
--
diff --git a/src/test/regress/expected/misc_functions_optimizer.out b/src/test/regress/expected/misc_functions_optimizer.out
index b6734e1308..618eee30fa 100644
--- a/src/test/regress/expected/misc_functions_optimizer.out
+++ b/src/test/regress/expected/misc_functions_optimizer.out
@@ -140,14 +140,44 @@ HINT: No function matches the given name and argument types. You might need to
--
-- Memory contexts are logged and they are not returned to the function.
-- Furthermore, their contents can vary depending on the timing. However,
--- we can at least verify that the code doesn't fail.
+-- we can at least verify that the code doesn't fail, and that the
+-- permissions are set properly.
--
-SELECT * FROM pg_log_backend_memory_contexts(pg_backend_pid());
+SELECT pg_log_backend_memory_contexts(pg_backend_pid());
pg_log_backend_memory_contexts
--------------------------------
t
(1 row)
+CREATE ROLE regress_log_memory;
+NOTICE: resource queue required -- using default resource queue "pg_default"
+SELECT has_function_privilege('regress_log_memory',
+ 'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- no
+ has_function_privilege
+------------------------
+ f
+(1 row)
+
+GRANT EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer)
+ TO regress_log_memory;
+SELECT has_function_privilege('regress_log_memory',
+ 'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- yes
+ has_function_privilege
+------------------------
+ t
+(1 row)
+
+SET ROLE regress_log_memory;
+SELECT pg_log_backend_memory_contexts(pg_backend_pid());
+ pg_log_backend_memory_contexts
+--------------------------------
+ t
+(1 row)
+
+RESET ROLE;
+REVOKE EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer)
+ FROM regress_log_memory;
+DROP ROLE regress_log_memory;
--
-- Test some built-in SRFs
--
diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql
index 36799eb6e1..e9aeafe915 100644
--- a/src/test/regress/sql/misc_functions.sql
+++ b/src/test/regress/sql/misc_functions.sql
@@ -38,9 +38,31 @@ SELECT num_nulls();
--
-- Memory contexts are logged and they are not returned to the function.
-- Furthermore, their contents can vary depending on the timing. However,
--- we can at least verify that the code doesn't fail.
+-- we can at least verify that the code doesn't fail, and that the
+-- permissions are set properly.
--
-SELECT * FROM pg_log_backend_memory_contexts(pg_backend_pid());
+
+SELECT pg_log_backend_memory_contexts(pg_backend_pid());
+
+CREATE ROLE regress_log_memory;
+
+SELECT has_function_privilege('regress_log_memory',
+ 'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- no
+
+GRANT EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer)
+ TO regress_log_memory;
+
+SELECT has_function_privilege('regress_log_memory',
+ 'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- yes
+
+SET ROLE regress_log_memory;
+SELECT pg_log_backend_memory_contexts(pg_backend_pid());
+RESET ROLE;
+
+REVOKE EXECUTE ON FUNCTION pg_log_backend_memory_contexts(integer)
+ FROM regress_log_memory;
+
+DROP ROLE regress_log_memory;
--
-- Test some built-in SRFs
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 01/16: Fix ic_proxy compilation for when HOST_NAME_MAX is unavailable
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 438a6a6a698e90fa71be08ffd55f0bcfe7e1e9a8
Author: Jimmy Yih <jy...@vmware.com>
AuthorDate: Thu Mar 2 15:35:33 2023 -0800
Fix ic_proxy compilation for when HOST_NAME_MAX is unavailable
When compiling proxy interconnect code on MacOS, it fails to compile
with the following error:
```
In file included from ic_proxy_main.c:23:
./ic_proxy_addr.h:35:17: error: use of undeclared identifier 'HOST_NAME_MAX'
char hostname[HOST_NAME_MAX]; /* hostname or IP */
^
ic_proxy_main.c:112:14: error: use of undeclared identifier 'HOST_NAME_MAX'
char name[HOST_NAME_MAX];
^
ic_proxy_main.c:168:14: error: use of undeclared identifier 'HOST_NAME_MAX'
char name[HOST_NAME_MAX] = "unknown";
```
Some systems like FreeBSD or MacOS do not define HOST_NAME_MAX so we
need to define it ourselves. Using the POSIX value of 255 seems to be
a safe fallback value so define it as such if HOST_NAME_MAX is
unavailable.
---
contrib/interconnect/proxy/ic_proxy_addr.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/contrib/interconnect/proxy/ic_proxy_addr.h b/contrib/interconnect/proxy/ic_proxy_addr.h
index 70a5975019..d0a2eaf666 100644
--- a/contrib/interconnect/proxy/ic_proxy_addr.h
+++ b/contrib/interconnect/proxy/ic_proxy_addr.h
@@ -12,6 +12,13 @@
#ifndef IC_PROXY_ADDR_H
#define IC_PROXY_ADDR_H
+/*
+ * Some systems like FreeBSD or MacOS do not define HOST_NAME_MAX. In general,
+ * 255 seems to be a safe fallback value and is POSIX.
+ */
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
typedef struct ICProxyAddr ICProxyAddr;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org