avamingli opened a new pull request, #786:
URL: https://github.com/apache/cloudberry/pull/786
## Handle of data status changes for materialized views associated with
partitioned tables.
Writable operations (**INSERT, UPDATE, DELETE, COPY, TRUNCATE, CLUSTER and
etc**) on a base table lead to changes in the data status of linked
materialized views. For partitioned tables, changes in child partitions can
impact parent and ancestor tables, necessitating updates to the relevant
materialized views.
For example, consider a root partitioned table P0 with two child partitioned
tables: P1 and P2. Each child table further has
two sub-partitions: P1 has P1_1 and P1_2, while P2 has P2_1 and P2_2.

If we insert rows into P1_1, the data status of both mv0 (based on P0) and
mv1 (based on P1) will change, as P1_1's parent table P1 and the root table P0
now contain more rows.

Conversely, if we insert rows into P2_1, only the data status of mv2_1
(based on P2_1) and mv0 will be affected, while mv1 remains unchanged because
the data in P1 has not changed.

## Propagation Direction:
Data status changes propagate both UP and DOWN the partition tree, except
for specific DDL operations:
* **Create Table XXX Partition Of**:
Indicates an insert operation on the parent table.
* **Drop Table**:
Indicates a delete operation on the parent table.
* **Alter Table ATTACH/DETACH** :
Attaching implies an insert, while detaching implies a delete.
Handling **TRUNCATE** and **CLUSTER**: A TRUNCATE operation on a parent
table is treated as a DELETE on its child tables, affecting both the parent and
its descendants. Similarly, a CLUSTER operation will transform the data status
in both UP and DOWN directions. However, CLUSTER has a recognized status to
indicate that the changes have been applied to the pages of the tables.
The **COPY** command indicates that data has been inserted into the table
and its ancestor tables.
The **VACUUM** command indicates that data has been recognized on the table
and its ancestor tables.
Authored-by: Zhang Mingli [email protected]
<!-- Thank you for your contribution to Apache Cloudberry (Incubating)! -->
Fixes #ISSUE_Number
### What does this PR do?
<!-- Brief overview of the changes, including any major features or fixes -->
### 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
<!-- Remove if not applicable. If yes, explain impact and migration path -->
### Test Plan
<!-- How did you test these changes? -->
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Passed `make installcheck`
- [ ] Passed `make -C src/test installcheck-cbdb-parallel`
### Impact
<!-- Remove sections that don't apply -->
**Performance:**
<!-- Any performance implications? -->
**User-facing changes:**
<!-- Any changes visible to users? -->
**Dependencies:**
<!-- New dependencies or version changes? -->
### Checklist
- [ ] Followed [contribution
guide](https://cloudberry.apache.org/contribute/code)
- [ ] Added/updated documentation
- [ ] Reviewed code for security implications
- [ ] Requested review from [cloudberry
committers](https://github.com/orgs/apache/teams/cloudberry-committers)
### Additional Context
<!-- Any other information that would help reviewers? Remove if none -->
### CI Skip Instructions
<!--
To skip CI builds, add the appropriate CI skip identifier to your PR title.
The identifier must:
- Be in square brackets []
- Include the word "ci" and either "skip" or "no"
- Only use for documentation-only changes or when absolutely necessary
-->
---
<!-- Join our community:
- Mailing list:
[[email protected]](https://lists.apache.org/[email protected])
(subscribe: [email protected])
- Discussions: https://github.com/apache/cloudberry/discussions -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]