-
Notifications
You must be signed in to change notification settings - Fork 499
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
services/horizon/internal/db2/history: Fix claimable_balance_claimants subquery in GetClaimableBalances() #5207
services/horizon/internal/db2/history: Fix claimable_balance_claimants subquery in GetClaimableBalances() #5207
Conversation
Query plan for the old query:
Query plan for the new query (containing the bug fix):
|
|
||
Where( | ||
sq.Expr( | ||
fmt.Sprintf("(%s.last_modified_ledger, %s.id) > (?, ?)", tableName, tableName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
embedded sql text fragment assemblies become so tedious, difficult to recognize the overall sql statement, not suggesting anything here, just mentioning go-jet again, to see if type-safe sql bindings re-resonate with anyone. the concept was actually pitched in a future ideas worksheet a ways back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's a good idea. I think it's worth reviving go-jet
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
needed with deprecations, added features, breaking changes, and DB schema changes.
semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
The request to
/claimable_balances?claimant=GDFZV7N7WXJCHL27IX4CI6TQY7ZDHLXMLVX5XHOV6CPCQVUCGDKKFPGQ
times out on staging (running horizon 2.28.2) but not on production (running horizon 2.28.0). The degradation in this endpoint is caused by bug introduced in #5200The query corresponding to
/claimable_balances?claimant=GDFZV7N7WXJCHL27IX4CI6TQY7ZDHLXMLVX5XHOV6CPCQVUCGDKKFPGQ
in horizon 2.28.2 is:The problem is in the subquery which selects from
claimable_balance_claimants
:Notice that the order by clause refers to the
claimable_balances
table. It should actually be referring to theclaimable_balance_claimants
table.In this commit, the query is fixed to:
Now the subquery explicitly refers to claimable_balance_claimants instead of the claimable_balances table.
Known limitations
[N/A]