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

Add group-id parameter to GET /v2/transactions #1647

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

Conversation

agodnic
Copy link
Contributor

@agodnic agodnic commented Mar 10, 2025

Summary

Issue: #135

This pull request adds the group-id parameter to the endpoint GET /v2/transactions (this feature has already been implemented for Nodely in AlgoNode#2).

This new parameter is disabled by default.

Test plan

End-to-end tests have been added to api/handlers_e2e_test.go.

@agodnic agodnic marked this pull request as ready for review March 10, 2025 23:54
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 58.33333% with 10 lines in your changes missing coverage. Please review.

Project coverage is 65.01%. Comparing base (25c7ab7) to head (498035f).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
api/converter_utils.go 57.14% 4 Missing and 2 partials ⚠️
api/generated/v2/routes.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1647      +/-   ##
==========================================
- Coverage   69.44%   65.01%   -4.44%     
==========================================
  Files          38       40       +2     
  Lines        7386     8111     +725     
==========================================
+ Hits         5129     5273     +144     
- Misses       1839     2402     +563     
- Partials      418      436      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@urtho
Copy link
Contributor

urtho commented Mar 11, 2025

As discussed internally, this needs to make use of group index by conditionally removing LIMIT when filtering by group id.
There is no other easy way for Postgres query optimizer to consider indexes other than primary (round,intra).
Filtering by group_id generates small enough results so that getting rid of LIMIT is safe.

Query optimizer spends weeks (>2 seconds) on optimizing this query if TXN happens to be partitioned.
Fortunaltely not the case for default deployments.

CREATE INDEX txn_grp ON public.txn USING btree (((txn #>> '{txn,grp}'::text[]))) WHERE ((txn #>> '{txn,grp}'::text[]) IS NOT NULL);

@agodnic agodnic marked this pull request as draft March 11, 2025 12:08
@agodnic agodnic marked this pull request as ready for review March 11, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants