perf: combine rewards tables by removing snapshot date suffix#385
perf: combine rewards tables by removing snapshot date suffix#385seanmcgary wants to merge 14 commits intomasterfrom
Conversation
83d6e1d to
3d9eb27
Compare
9f42954 to
1335f78
Compare
1335f78 to
7527e61
Compare
There was a problem hiding this comment.
Bug: SQL Template Syntax Error
The DeleteCorruptedRewardsFromBlockHeight function incorrectly uses Go template syntax {{.generatedRewardsSnapshotId}} within raw SQL query strings. These queries are then executed with sql.Named parameters, which expect SQL placeholder syntax (e.g., @generatedRewardsSnapshotId). This mismatch results in literal {{.generatedRewardsSnapshotId}} text in the executed SQL, causing syntax errors. The correct approach is to use @generatedRewardsSnapshotId for SQL named parameters or properly render the string as a template.
Additionally, if no previous snapshot is found (i.e., gorm.ErrRecordNotFound for previousSnapshot), the previousSnapshot variable remains nil, leading to a panic when previousSnapshot.Id is subsequently accessed.
pkg/rewards/rewards.go#L410-L431
sidecar/pkg/rewards/rewards.go
Lines 410 to 431 in 7527e61
Bug: Incorrect Table Pattern Causes Migration Failure
The ExistingTablePattern for the rewards_gold_10_avs_od_reward_amounts sub-migration is incorrectly set to gold_[0-9]+_staker_avs_od_reward_amounts_[0-9_]+$. The pattern includes an erroneous "staker_" prefix and should be gold_[0-9]+_avs_od_reward_amounts_[0-9_]+$. This prevents the migration from finding and processing the correct existing avs_od_reward_amounts tables.
pkg/postgres/migrations/202505301218_migrateRewardsTables/up.go#L354-L355
sidecar/pkg/postgres/migrations/202505301218_migrateRewardsTables/up.go
Lines 354 to 355 in 7527e61
Was this report helpful? Give feedback by reacting with 👍 or 👎
6e92d01 to
d49be48
Compare
58ba633 to
c6cb895
Compare
improve migration add back function fix
6ba2306 to
7e6ac5b
Compare
Description
Remove suffix of gold tables and add
generated_rewards_snapshot_idcolumn. This will prune gold tables and improve on table sizes.Fixes #403
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist: