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

Improve HPOS sync of deleted or missing orders #42746

Closed
3 tasks
Tracked by #40702
jorgeatorres opened this issue Dec 13, 2023 · 0 comments · Fixed by #45330
Closed
3 tasks
Tracked by #40702

Improve HPOS sync of deleted or missing orders #42746

jorgeatorres opened this issue Dec 13, 2023 · 0 comments · Fixed by #45330
Assignees
Labels
focus: custom order tables / HPOS Issues related to High-Performance Order Storage (HPOS) née Custom Order Tables. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. team: Proton type: bug The issue is a confirmed bug.

Comments

@jorgeatorres
Copy link
Member

jorgeatorres commented Dec 13, 2023

There are a few edge cases or scenarios where our handling of deleted/missing orders isn't entirely correct.

  • When HPOS is authoritative and sync is enabled, deleting the corresponding post via wp_delete_post() also deletes the HPOS order.
  • Handling of trashed orders and backup posts.
    Steps to reproduce:
    1. Order is created and trashed (and so is backup post).
    2. Compat mode is disabled.
    3. Order is taken out of the trash (which doesn't propagate to post since sync is disabled).
    4. WP performs its scheduled delete of trashed posts.
    5. You're able to switch datastores or re-enable sync freely even though the backup post for an existing order no longer exists.
  • Missing backup posts or orders.
    Even though manually modifying the database isn't ideal, it can happen, and a record from either HPOS or posts tables might go missing. We should detect and restore those as part of sync.

Related: p1698440228829329-slack-C05BSQT06S3, p1702394164500349-slack-C0E1AV8T0, p1698945937061699/1698780173.096349-slack-C05BSQT06S3.

@jorgeatorres jorgeatorres added type: bug The issue is a confirmed bug. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. focus: custom order tables / HPOS Issues related to High-Performance Order Storage (HPOS) née Custom Order Tables. team: Proton labels Dec 13, 2023
@jorgeatorres jorgeatorres changed the title Improve HPOS sync of deleted orders Improve HPOS sync of deleted or missing orders Dec 13, 2023
@jorgeatorres jorgeatorres self-assigned this Feb 14, 2024
coreymckrill pushed a commit that referenced this issue Mar 8, 2024
…5330)

This PR short-circuits wp_delete_post() so that when HPOS is authoritative, any attempts to delete the backup post are not successful (which could also end up deleting the HPOS order). This only applies to non placeholder posts, as placeholder posts won't trigger the cascade of operations that might be problematic here.

Fixes #42746
Konamiman pushed a commit that referenced this issue Mar 13, 2024
…5330)

This PR short-circuits wp_delete_post() so that when HPOS is authoritative, any attempts to delete the backup post are not successful (which could also end up deleting the HPOS order). This only applies to non placeholder posts, as placeholder posts won't trigger the cascade of operations that might be problematic here.

Fixes #42746
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: custom order tables / HPOS Issues related to High-Performance Order Storage (HPOS) née Custom Order Tables. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. team: Proton type: bug The issue is a confirmed bug.
Projects
Development

Successfully merging a pull request may close this issue.

1 participant