Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New series of ao/co - related cherry-picks #897

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

reshke
Copy link
Contributor

@reshke reshke commented Jan 28, 2025

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@reshke reshke added the cherry-pick cherry-pick upstream commts label Jan 28, 2025
@x4m
Copy link
Contributor

x4m commented Jan 29, 2025

uhhm, ic-isolation2 is flapping? or is it real fail?

@yjhjstz
Copy link
Member

yjhjstz commented Jan 29, 2025

uhhm, ic-isolation2 is flapping? or is it real fail?

never see those failures .

@reshke
Copy link
Contributor Author

reshke commented Jan 29, 2025

that a real issue with new test

-- Wait until some AO varblocks have been read.
SELECT gp_wait_until_triggered_fault('AppendOnlyStorageRead_ReadNextBlock_success', 10, dbid) FROM gp_segment_configuration WHERE content = 1 AND role = 'p';

I fought I fixed it

@reshke
Copy link
Contributor Author

reshke commented Jan 29, 2025

happy new year by the way.

@my-ship-it my-ship-it requested a review from yjhjstz February 11, 2025 01:00
@reshke reshke force-pushed the judewjidew branch 2 times, most recently from 1b031dd to 1859ea1 Compare February 13, 2025 14:47
@reshke
Copy link
Contributor Author

reshke commented Feb 24, 2025

cherry-picked greenplum-db/gpdb-archive@1248809 here, should fix CI stale

@reshke reshke force-pushed the judewjidew branch 2 times, most recently from 3bd0498 to 55967ca Compare February 25, 2025 19:18
@reshke reshke requested review from yjhjstz and my-ship-it February 26, 2025 04:35
soumyadeep2007 and others added 7 commits February 26, 2025 09:27
Though no special code was written for unique indexes in the context of
repeatable read transaction isolation, add a smoke test:

* For added coverage
* To illustrate how unique index checks cross transaction isolation
boundaries.
We don't have to do anything special for partial indexes. Keys not
satisfying the partial index predicate are never inserted into the
index, and hence there are no uniqueness checks triggered (see
ExecInsertIndexTuples()). Also during partial unique index builds, keys
that don't satisfy the partial index predicate are never inserted into
the index (see *_index_build_range_scan()).

Add smoke tests all the same:

* For added coverage
* For illustrative purposes
Now that unique indexes are supported on AO tables, allow ALTER TABLE
SET ACCESS METHOD TO ao_row|ao_column, on heap tables bearing unique
indexes.
This enables reporting for the table scan phase of index builds on AO
tables. This directly affects:
(1) pg_stat_progress_create_index.blocks_total
(2) pg_stat_progress_create_index.blocks_done

Sample:

Connect in utility mode to a segment, while CREATE INDEX is running on
an AO table:

postgres=# select pid, command, phase, blocks_total, blocks_done from pg_stat_progress_create_index;
  pid   |   command    |             phase              | blocks_total | blocks_done
--------+--------------+--------------------------------+--------------+-------------
 633034 | CREATE INDEX | building index: scanning table |        54993 |        4412
(1 row)

This commit introduces:

(1) Accounting in AppendOnlyScanDescData to track the total number of
bytes read across all segment files. It is updated whenever a new block
is read. If the block is compressed, its compressed length is added
(uncompressed length otherwise).

(2) Reporting code in appendonly_index_build_range_scan() to report in
increments of BLCKSZ, the number of blocks scanned so far. The total
number of blocks to be scanned is also published up front and is
determined by summing the compressed eof values of all segfiles.

(3) Marks RelationGuessNumberOfBlocksFromSize() as inline, since it is
now being called in a much hotter code path.

Note: We currently only support reporting for non-concurrent index
builds and serial builds.
This enables reporting for the table scan phase of index builds on AOCO
tables. This directly affects:
(1) pg_stat_progress_create_index.blocks_total
(2) pg_stat_progress_create_index.blocks_done

Sample:

Connect in utility mode to a segment, while CREATE INDEX is running on
an AOCO table:

postgres=# select pid, command, phase, blocks_total, blocks_done from pg_stat_progress_create_index;
  pid   |   command    |             phase              | blocks_total | blocks_done
--------+--------------+--------------------------------+--------------+-------------
 644771 | CREATE INDEX | building index: scanning table |         9779 |        6832

This commit introduces:

(1) Accounting in AOCSScanDescData to track the total number of bytes
read across all segment files. It is updated whenever a new block is
read. If the block is compressed, its compressed length is added
(uncompressed length otherwise).

(2) open_all_datumstreamread_segfiles() is touched since it also reads
blocks.  It's interface is made simpler by simply passing the scan
descriptor, which is also used to get at the total bytes counter.

(3) Reporting code in aoco_index_build_range_scan() to report in
increments of BLCKSZ, the number of blocks scanned so far. The total
number of blocks to be scanned is also published up front and is
determined by summing the compressed eof values of all segfiles. The
total number of blocks depends on whether a block directory is being
built as part of the scan. If it is being built, then the whole table
needs to be scanned, whereas only index columns need to be scanned
otherwise. A new function has been introduced to summarize the
filesegtotals which accepts column projection info:
GetAOCSSSegFilesTotalsWithProj().

Note: We currently only support reporting for non-concurrent and serial
builds.
@reshke
Copy link
Contributor Author

reshke commented Feb 28, 2025

@yjhjstz Hi! How do you like the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick cherry-pick upstream commts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants