-
Notifications
You must be signed in to change notification settings - Fork 897
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
MiqQueue consistency with purging #14676
Conversation
7cbd421
to
4e25b61
Compare
5799585
to
4aa5eaf
Compare
app/models/mixins/purging_mixin.rb
Outdated
# mode = value.number_with_method? ? :date : :remaining | ||
# value = value.to_i_with_method.seconds.ago.utc if mode == :date | ||
# return mode, value | ||
# end |
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.
This comment is confusing to me.
app/models/mixins/purging_mixin.rb
Outdated
module PurgingMixin | ||
extend ActiveSupport::Concern | ||
|
||
module ClassMethods | ||
# This provides backward support for date only implementations | ||
# It is assumed most classes will override to provide `:remaining` support |
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 most classes will override, then why not make that the default and only do the rare places for override.
Even so, I think this comment is wrong, and I can't understand it. Everything supports by date, so why does it say "backward support for date only implementations". Nearly all of them are date only, right?
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.
no, just under half are mode and date (options: :remaining
, :date
)
app/models/metric/purging.rb
Outdated
@@ -35,15 +35,14 @@ def self.purge_realtime_timer(ts = nil) | |||
purge_timer(ts, "realtime") | |||
end | |||
|
|||
# NOTE: purge_#{interval} was introduced to make uniqueness easier | |||
# now that we do not require unique purging, possibly go back to :args => [value, interval] |
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 feel like these NOTEs to yourself (as well as the others in this PR) would be better served if moved into a separate github issue.
following PurgingMixin framework - removed limit support, and manually overriding window_size - kept purge_date defaulting (to prevent oops and deleting everything)
converted put_or_update to put on general queue queuing directly into purge_by_{mode}
- converted put_or_update to put on general queue - queuing directly into purge_by_{mode} - delete already defined purge_timer
- converted put_or_update to put on general queue - queuing directly into purge_by_date
- converted put_or_update to put on general queue - allow multiple inserts into the queue NOTE: this is still not a typical purger
- converted put_or_update to put on general queue - introduce purge_by_date concept (which is just naming) NOTE: this is still not a typical purger
4aa5eaf
to
ecb49ef
Compare
Checked commits kbrock/manageiq@d7a1e3a~...ecb49ef with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
end | ||
|
||
def purge_queue(mode, value) | ||
MiqQueue.put( |
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.
@kbrock Role is not specified any more. Is it by intention?
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.
Purging is quick. We perform it as pure sql and do not download tons of records.
So the thought is there is no reason to limit which workers can purge.
But that is my though, wanted your feedback here.
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.
Agreed, purging is a pure database function and can be done anywhere
) | ||
end | ||
alias_method :purge_timer, :purge_queue | ||
|
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.
Hmm, is the commit message wrong here?
- converted put_or_update to put on general queue
- queuing directly into purge_by_date
Are we now using the mixin's method which does a put? All I see is deleted lines here, no new method.
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 ok, it's coming from the mixin. It wasn't clear when looking at the commit message.
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.
thanks for keeping me honest.
Yes, most of these come from the default implementation
This approach looks good to me. Is it possible to have generic tests that each of these classes can be tested with shared examples? |
@kbrock Is this for fine? |
Any reason it shouldnt be in fine? |
ok, |
MiqQueue consistency with purging (cherry picked from commit 932ac57)
Fine backport details:
|
related to #14569
Bring consistency to
Purging
:put_unless_exists
over toput
.