-
Notifications
You must be signed in to change notification settings - Fork 10
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 metamorph records clearing #217
Conversation
nozim
commented
Dec 17, 2023
•
edited
Loading
edited
- add background job for clearing expired transactions in metamorph tables
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.
If you copy these files from this path: metamorph/store/postgresql/migrations
then they should be exactly the same as they are the migration files which are actually used in the deployment. Right now they're not the same
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.
The migrations are still not exaclty the same. This schema is missing
CREATE SCHEMA metamorph; |
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.
why does it have to have custom schema?
} | ||
|
||
func ClearMetamorph(params ClearRecordsParams) error { | ||
if err := runDelete("blocks", params); err != nil { |
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.
After adding the schema the from clause would be metamorph.blocks
like here
arc/metamorph/store/postgresql/postgres.go
Line 603 in fbe2265
q := `INSERT INTO metamorph.blocks ( |
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.
I'm not sure it's a good idea to hardcode database name inside the query. Because if the name inside db connection can be different from the one inside the query.
if err := runDelete("blocks", params); err != nil { | ||
return err | ||
} | ||
if err := runDelete("transactions", params); err != nil { |
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.
The same here
q := `UPDATE metamorph.transactions SET locked_by = 'NONE' WHERE hash = ANY($1);` |
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.
same here, why do we need to hardcode the database name?
|
* Add metamorph records clearing * Add metamorph database testing utility code * Fix compilation errors * Fix typo * Amend blocktx tests * Fix compilation errors * Fix test failure * Fix compilation error * Fix formatting in blocktx db utility * Add timestamp columnes for metamorph tables * Rename migrations * Fix test errors, amend migrations * Amend schema name migrations * Amend metamorph tests --------- Co-authored-by: Nozim Mehrubonov <[email protected]>