Skip to content

Refactor LR Publication responses to use partial metadata #17960

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

Merged
merged 1 commit into from
Jun 4, 2025

Conversation

seut
Copy link
Member

@seut seut commented Jun 2, 2025

Instead of responding concrete special entities for describing new or changed tables, the logical replication PublicationState action returns a partial Metadata containing all relevant information. This removes the handling of these special entities and also simplifies any future changes inside the table structures.

The new partial Metadata will contain the new RelationMetadata entities, any deprecated template handling is removed. Requests from/to older nodes are handled transparently

Relates to #17518, #17769.

@seut seut requested a review from mfussenegger June 2, 2025 14:36
@seut
Copy link
Member Author

seut commented Jun 3, 2025

re-test this please

@seut seut requested review from matriv and removed request for mfussenegger June 3, 2025 08:19
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! made a first pass and left some comments, but I will dive in more with a second pass.

public static AllocPosition forTable(RelationMetadata.Table table) {
int maxPosition = 0;
HashMap<ColumnIdent, Integer> colPositions = new HashMap<>();
for (Reference reference : table.columns()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember right table.columns() also contains deleted columns - might need to add a isDropped() check here to account for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, will do, thx!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, but also positions of dropped columns should be resolvable. E.g. we added concrete logic here https://github.com/crate/crate/blob/master/server/src/main/java/io/crate/execution/ddl/tables/MappingUtil.java#L65 to also resolve positions of dropped columns.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'd keep it like that or any objections @mfussenegger ?

Copy link
Member

@mfussenegger mfussenegger Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern was that the put of a dropped column could override it's replacement, which would mean the lookup would get the old position. Not sure if that causes issues here but could use a putIfAbsent for dropped cols.

If it's not an issue, fine to keep as is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I think you're right and this can be an issue. I've adapted the code to ensure dropped cols won't override existing entries by using a dedicated map.

@seut seut force-pushed the s/lr-publication-metadata branch from 52dd24f to a35d8fe Compare June 3, 2025 13:02
@seut seut requested review from matriv and mfussenegger June 3, 2025 13:03
@seut seut force-pushed the s/lr-publication-metadata branch from a35d8fe to 59c0149 Compare June 3, 2025 13:14
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@seut seut force-pushed the s/lr-publication-metadata branch from 59c0149 to 0254f05 Compare June 3, 2025 14:38
Copy link
Contributor

mergify bot commented Jun 3, 2025

This pull request has been removed from the queue for the following reason: pull request dequeued.

Pull request #17960 has been dequeued, merge conditions unmatch:

  • label=ready-to-merge
  • any of [🛡 GitHub branch protection]:
    • check-neutral = ci/jenkins/pr_tests
    • check-skipped = ci/jenkins/pr_tests
    • check-success = ci/jenkins/pr_tests
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #approved-reviews-by>=1
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

Instead of responding concrete special entities for describing
new or changed tables, the logical replication PublicationState
action returns a partial Metadata containing all relevant information.
This removes the handling of these special entities and also
simplifies any future changes inside the table structures.

The new partial Metadata will contain the new RelationMetadata
entities, any deprecated template handling is removed.
Requests from/to older nodes are handled transparently

Relates to #17518, #17769.
@seut seut force-pushed the s/lr-publication-metadata branch from b98a01c to 208d742 Compare June 4, 2025 07:40
Copy link
Contributor

mergify bot commented Jun 4, 2025

This pull request has been removed from the queue for the following reason: pull request dequeued.

Pull request #17960 has been dequeued, merge conditions unmatch:

  • label=ready-to-merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #approved-reviews-by>=1
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = ci/jenkins/pr_tests
    • check-neutral = ci/jenkins/pr_tests
    • check-skipped = ci/jenkins/pr_tests

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@seut seut added the ready-to-merge Let Mergify merge the PR once approved and checks pass label Jun 4, 2025
@seut
Copy link
Member Author

seut commented Jun 4, 2025

@Mergifyio requeue

Copy link
Contributor

mergify bot commented Jun 4, 2025

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

@mergify mergify bot merged commit 4d73c95 into master Jun 4, 2025
18 checks passed
@mergify mergify bot deleted the s/lr-publication-metadata branch June 4, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed ready-to-merge Let Mergify merge the PR once approved and checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants