-
Notifications
You must be signed in to change notification settings - Fork 65
[*] migrate maintenance task logic to PL/pgSQL #1025
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
base: master
Are you sure you want to change the base?
[*] migrate maintenance task logic to PL/pgSQL #1025
Conversation
- move individual metric update logic to `admin.update_listing_table()`. - move dropped tables removal logic to `admin.remove_dropped_tables_listing()`. - use these new functions in the maintenance routine.
- the `MaintainUniqueSources` test calls `pgw.MaintainUniqueSources()` 3 times which sleeps a minute each time.
5c6510c to
c245c16
Compare
Pull Request Test Coverage Report for Build 19437140385Details
💛 - Coveralls |
| if err := pgw.sinkDb.QueryRow(pgw.ctx, sqlGetAdvisoryLock).Scan(&lock); err != nil { | ||
| logger.Error("Getting admin.all_distinct_dbname_metrics maintainer advisory lock failed:", err) | ||
| logger.Infof("Trying to get maintenance advisory lock...") // to only have one "maintainer" in case of a "push" setup, as can get costly | ||
| if err := pgw.sinkDb.QueryRow(pgw.ctx, "SELECT admin.try_get_maintenance_lock();").Scan(&lock); 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.
I'm not sure it's a great improvement! :-D
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.
It's not, but I think of it in terms of abstracting the maintenance logic from the Go code.
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.
Got it. I will get back to this later. I want to experiment locally. Need to produce some loads first.
admin.try_get_maintenance_lock().admin.update_listing_table(metric_table_name text).admin.remove_dropped_tables_listing(existing_metrics text[]).