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

Honor timestamp param for token by id endpoint #10495

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

Conversation

jnels124
Copy link
Contributor

@jnels124 jnels124 commented Feb 26, 2025

Description:

Related issue(s):

Fixes #10408

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@jnels124 jnels124 added the bug Type: Something isn't working label Feb 26, 2025
@jnels124 jnels124 added this to the 0.125.0 milestone Feb 26, 2025
@jnels124 jnels124 self-assigned this Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ Complexity Δ
hedera-mirror-rest/model/customFee.js 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
hedera-mirror-rest/model/token.js 53.70% <100.00%> (+37.03%) 0.00 <0.00> (ø)
hedera-mirror-rest/tokens.js 97.02% <100.00%> (+0.08%) 0.00 <0.00> (ø)

... and 616 files with indirect coverage changes

@jnels124 jnels124 force-pushed the 10408-when-getting-a-deleted-token-by-id-and-passing-a-timestamp-deleted-is-always-set-to-true branch from a2e5e6d to 5852ba1 Compare February 26, 2025 05:07
Signed-off-by: Jesse Nelson <[email protected]>
@jnels124
Copy link
Contributor Author

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Custom Scan (Citus Adaptive)  (cost=0.00..0.00 rows=0 width=0) (actual time=11.003..11.004 rows=1 loops=1)
                                                                                                                QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Custom Scan (Citus Adaptive)  (cost=0.00..0.00 rows=0 width=0) (actual time=11.003..11.004 rows=1 loops=1)
   Task Count: 1
   Tuple data received from nodes: 562 bytes
   Tasks Shown: All
   ->  Task
         Tuple data received from node: 562 bytes
         Node: host=10.4.6.17 port=6432 dbname=mirror_node
         ->  Nested Loop Left Join  (cost=8.57..12.01 rows=1 width=568) (actual time=0.102..0.104 rows=1 loops=1)
               ->  Nested Loop  (cost=5.76..8.04 rows=1 width=528) (actual time=0.064..0.066 rows=1 loops=1)
                     ->  Subquery Scan on t_1  (cost=2.81..3.94 rows=1 width=425) (actual time=0.032..0.033 rows=1 loops=1)
                           Filter: (t_1.token_id = 1275)
                           ->  Limit  (cost=2.81..3.93 rows=1 width=433) (actual time=0.031..0.031 rows=1 loops=1)
                                 ->  Merge Append  (cost=2.81..5.05 rows=2 width=433) (actual time=0.030..0.031 rows=1 loops=1)
                                       Sort Key: (lower(t_2.timestamp_range)) DESC
                                       ->  Sort  (cost=2.52..2.52 rows=1 width=412) (actual time=0.014..0.015 rows=1 loops=1)
                                             Sort Key: (lower(t_2.timestamp_range)) DESC
                                             Sort Method: quicksort  Memory: 25kB
                                             ->  Index Scan using token__pk_102491 on token_102491 t_2  (cost=0.29..2.51 rows=1 width=412) (actual time=0.009..0.010 rows=1 loops=1)
                                                   Index Cond: (token_id = 1275)
                                                   Filter: (lower(timestamp_range) <= '1706816457709028192'::bigint)
                                       ->  Limit  (cost=0.28..2.50 rows=1 width=451) (actual time=0.015..0.015 rows=0 loops=1)
                                             ->  Index Scan Backward using token_history__token_id_timestamp_range_102507 on token_history_102507 t_2_1  (cost=0.28..2.50 rows=1 width=451) (actual time=0.015..0.015 rows=0 loops=1)
                                                   Index Cond: ((token_id = 1275) AND (lower(timestamp_range) <= '1706816457709028192'::bigint))
                     ->  Subquery Scan on e_1  (cost=2.96..4.09 rows=1 width=103) (actual time=0.030..0.031 rows=1 loops=1)
                           Filter: (e_1.id = 1275)
                           ->  Limit  (cost=2.96..4.08 rows=1 width=111) (actual time=0.030..0.030 rows=1 loops=1)
                                 ->  Merge Append  (cost=2.96..5.20 rows=2 width=111) (actual time=0.030..0.030 rows=1 loops=1)
                                       Sort Key: (lower(e_2.timestamp_range)) DESC
                                       ->  Sort  (cost=2.66..2.66 rows=1 width=101) (actual time=0.012..0.012 rows=1 loops=1)
                                             Sort Key: (lower(e_2.timestamp_range)) DESC
                                             Sort Method: quicksort  Memory: 25kB
                                             ->  Index Scan using entity__id_type_102015 on entity_102015 e_2  (cost=0.42..2.65 rows=1 width=101) (actual time=0.009..0.009 rows=1 loops=1)
                                                   Index Cond: (id = 1275)
                                                   Filter: (lower(timestamp_range) <= '1706816457709028192'::bigint)
                                       ->  Limit  (cost=0.29..2.51 rows=1 width=121) (actual time=0.018..0.018 rows=1 loops=1)
                                             ->  Index Scan Backward using entity_history__id_lower_timestamp_102267 on entity_history_102267 e_2_1  (cost=0.29..2.51 rows=1 width=121) (actual time=0.018..0.018 rows=1 loops=1)
                                                   Index Cond: ((id = 1275) AND (lower(timestamp_range) <= '1706816457709028192'::bigint))
               ->  Subquery Scan on cf_1  (cost=2.81..3.94 rows=1 width=540) (actual time=0.028..0.029 rows=1 loops=1)
                     Filter: (cf_1.entity_id = 1275)
                     ->  Limit  (cost=2.81..3.93 rows=1 width=548) (actual time=0.028..0.028 rows=1 loops=1)
                           ->  Merge Append  (cost=2.81..5.05 rows=2 width=548) (actual time=0.028..0.028 rows=1 loops=1)
                                 Sort Key: (lower(cf_2.timestamp_range)) DESC
                                 ->  Sort  (cost=2.52..2.53 rows=1 width=522) (actual time=0.017..0.017 rows=1 loops=1)
                                       Sort Key: (lower(cf_2.timestamp_range)) DESC
                                       Sort Method: quicksort  Memory: 25kB
                                       ->  Index Scan using custom_fee__pk_102235 on custom_fee_102235 cf_2  (cost=0.29..2.51 rows=1 width=522) (actual time=0.014..0.014 rows=1 loops=1)
                                             Index Cond: (entity_id = 1275)
                                             Filter: (lower(timestamp_range) <= '1706816457709028192'::bigint)
                                 ->  Limit  (cost=0.27..2.49 rows=1 width=574) (actual time=0.011..0.011 rows=0 loops=1)
                                       ->  Index Scan Backward using custom_fee_history__token_id_timestamp_range_102251 on custom_fee_history_102251 cf_2_1  (cost=0.27..2.49 rows=1 width=574) (actual time=0.011..0.011 rows=0 loops=1)
                                             Index Cond: ((entity_id = 1275) AND (lower(timestamp_range) <= '1706816457709028192'::bigint))
             Planning Time: 1.780 ms
             Execution Time: 0.183 ms
 Planning Time: 0.873 ms
 Execution Time: 11.037 ms

@jnels124
Copy link
Contributor Author

Scenario URL VUS Pass% RPS Pass RPS Avg. Req Duration Skipped? Comment
rampUp /accounts 1500 98.14 209.64/s 205.74/s 3587.86ms No
tokensId /tokens/2186153 1500 99.84 6349.38/s 6339.22/s 234.98ms No
tokensIdTimestampLte /tokens/2186153?timestamp=lte:1740548828.862 1500 99.93 6290.06/s 6285.66/s 236.29ms No

@jnels124 jnels124 marked this pull request as ready for review February 26, 2025 15:19
@jnels124 jnels124 requested a review from a team as a code owner February 26, 2025 15:19
@jnels124
Copy link
Contributor Author

Lots of sql tests that I would prefer to write after any feedback on functionality is addressed.

Copy link
Contributor

@steven-sheehy steven-sheehy left a comment

Choose a reason for hiding this comment

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

Approach seems good. Tests are failing and it's missing spec changes to account for history tables.

Edit: Now I see your last comment.

Comment on lines -1 to -2
// SPDX-License-Identifier: Apache-2.0

Copy link
Contributor

Choose a reason for hiding this comment

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

Revert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When getting a deleted token by ID and passing a timestamp, deleted is always set to true
2 participants