Skip to content

Commit

Permalink
Update index stats test to be in sync with 3d351d9
Browse files Browse the repository at this point in the history
Change vacuum row progress expected output

Fix vacuum_progress_column exp output

Also some little refactoring done around src/backend/catalog/pg_attribute_encoding.c
  • Loading branch information
reshke authored and my-ship-it committed Oct 11, 2024
1 parent 1591a3e commit 734a8a1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/backend/access/aocs/aocsam.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ open_all_datumstreamread_segfiles(AOCSScanDesc scan, AOCSFileSegInfo *segInfo)
static void
open_ds_write(Relation rel, DatumStreamWrite **ds, TupleDesc relationTupleDesc, bool checksum)
{
int nvp = relationTupleDesc->natts;
int natts = RelationGetNumberOfAttributes(rel);
StdRdOptions **opts = RelationGetAttributeOptions(rel);
RelFileNodeBackend rnode;

rnode.node = rel->rd_node;
rnode.backend = rel->rd_backend;

/* open datum streams. It will open segment file underneath */
for (int i = 0; i < nvp; ++i)
for (int i = 0; i < natts; ++i)
{
Form_pg_attribute attr = TupleDescAttr(relationTupleDesc, i);
char *ct;
Expand Down
9 changes: 6 additions & 3 deletions src/backend/catalog/pg_attribute_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,16 @@ RelationGetAttributeOptions(Relation rel)
Datum *dats;
StdRdOptions **opts;
int i;
int natts;

natts = RelationGetNumberOfAttributes(rel);

opts = palloc0(RelationGetNumberOfAttributes(rel) * sizeof(StdRdOptions *));
opts = palloc0(natts * sizeof(StdRdOptions *));

dats = get_rel_attoptions(RelationGetRelid(rel),
RelationGetNumberOfAttributes(rel));
natts);

for (i = 0; i < RelationGetNumberOfAttributes(rel); i++)
for (i = 0; i < natts; i++)
{
if (DatumGetPointer(dats[i]) != NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/isolation2/expected/vacuum_progress_column.out
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ DELETE 50000
SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_column';
relpages | reltuples | relallvisible
----------+-----------+---------------
0 | 0 | 0
0 | -1 | 0
(1 row)
SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
n_live_tup | n_dead_tup | last_vacuum | vacuum_count
Expand Down
2 changes: 1 addition & 1 deletion src/test/isolation2/expected/vacuum_progress_row.out
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ DELETE 50000
SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row';
relpages | reltuples | relallvisible
----------+-----------+---------------
0 | 0 | 0
0 | -1 | 0
(1 row)
SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row';
n_live_tup | n_dead_tup | last_vacuum | vacuum_count
Expand Down
8 changes: 4 additions & 4 deletions src/test/regress/expected/uao_compaction/index_stats.out
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ vacuum mytab2;
SELECT gp_segment_id, relname, reltuples FROM gp_dist_random('pg_class') WHERE relname = 'mytab2_int_idx1';
gp_segment_id | relname | reltuples
---------------+-----------------+-----------
0 | mytab2_int_idx1 | 0
1 | mytab2_int_idx1 | 0
2 | mytab2_int_idx1 | 0
0 | mytab2_int_idx1 | -1
1 | mytab2_int_idx1 | -1
2 | mytab2_int_idx1 | -1
(3 rows)

-- second vacuum update index stat with table stat
Expand Down Expand Up @@ -93,7 +93,7 @@ insert into mytab3 values(1,'aa',1001,101),(2,'bb',1002,102);
select reltuples from pg_class where relname='mytab3';
reltuples
-----------
0
-1
(1 row)

-- inspect the state of the stats on segments
Expand Down
8 changes: 4 additions & 4 deletions src/test/regress/expected/uaocs_compaction/index_stats.out
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ vacuum uaocs_index_stats2;
SELECT gp_segment_id, relname, reltuples FROM gp_dist_random('pg_class') WHERE relname = 'uaocs_index_stats2_int_idx1';
gp_segment_id | relname | reltuples
---------------+-----------------------------+-----------
0 | uaocs_index_stats2_int_idx1 | 0
1 | uaocs_index_stats2_int_idx1 | 0
2 | uaocs_index_stats2_int_idx1 | 0
0 | uaocs_index_stats2_int_idx1 | -1
1 | uaocs_index_stats2_int_idx1 | -1
2 | uaocs_index_stats2_int_idx1 | -1
(3 rows)

-- second vacuum update index stat with table stat
Expand Down Expand Up @@ -98,7 +98,7 @@ insert into uaocs_index_stats3 values(1,'aa',1001,101),(2,'bb',1002,102);
select reltuples from pg_class where relname='uaocs_index_stats3';
reltuples
-----------
0
-1
(1 row)

-- inspect the state of the stats on segments
Expand Down

0 comments on commit 734a8a1

Please sign in to comment.