-
Notifications
You must be signed in to change notification settings - Fork 156
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
optimizations #1607
optimizations #1607
Conversation
schema/migration-2-0035-20240108.sql
Outdated
BEGIN | ||
SELECT stage_two + 1 INTO next_version FROM schema_version ; | ||
IF next_version = 35 THEN | ||
EXECUTE 'alter domain addr29type drop constraint addr29type_check' ; |
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.
When we create these domains
CREATE DOMAIN addr29type AS bytea CHECK (octet_length (VALUE) = 29);
we don't give any name to the constraint. addr29type_check
is the name that postgres gives by default.
schema/migration-2-0038-20240117.sql
Outdated
EXECUTE 'ALTER TABLE "instant_reward" ALTER COLUMN "amount" SET NOT NULL' ; | ||
EXECUTE 'ALTER TABLE "instant_reward" ALTER COLUMN "spendable_epoch" SET NOT NULL' ; | ||
EXECUTE 'ALTER TABLE "instant_reward" DROP COLUMN "earned_epoch"' ; | ||
EXECUTE 'ALTER TABLE "instant_reward" ADD COLUMN "earned_epoch" bigint NOT NULL GENERATED ALWAYS AS ((CASE WHEN spendable_epoch >= 1 then spendable_epoch-1 else 0 end)) STORED' ; |
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.
There is no way to ALTER
an existing column to add a GENERATED ALWAYS AS
clause. This clause can only be added to a new column. So we drop the old one and add it here. I've checked on a new snapshot that the GENERATED ALWAYS AS
rule is always followed even if it didn't exist before. Similarly for reward
table.
b321982
to
df2b608
Compare
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.
LGTM minor question and suggestions
The hlint check seems to be failing |
ce8b581
to
c3853bc
Compare
950110c
to
f85980b
Compare
Move MIR to a separate table Use "generated always as" for earned_epoch Remove primary keys
Since instant rewards no longer cause a uniqueness issue
66bc886
to
9bb7ed3
Compare
9bb7ed3
to
d5e5e13
Compare
d5e5e13
to
f58aab6
Compare
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.
LGTM minor recommendation
@@ -197,11 +197,11 @@ insertShelleyBlock syncEnv shouldLog withinTwoMins withinHalfHour blk details is | |||
|
|||
insertStakeSlice syncEnv $ apStakeSlice applyResult | |||
|
|||
when (ioGov iopts) | |||
when (ioGov iopts && (withinHalfHour || unBlockNo (Generic.blkBlockNo blk) `mod` 10000 == 0)) |
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.
(withinHalfHour || unBlockNo (Generic.blkBlockNo blk)
mod 10000 == 0)
could probably sit in the where clause
Description
Fixes #1589, #1582, #1584, #1606
Checklist
fourmolu
on version 0.10.1.0 (which can be run withscripts/fourmolize.sh
)Migrations
The reward migration works on upgrade
The tx_out migation is WIP