-
Notifications
You must be signed in to change notification settings - Fork 0
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/delete only changed overlap records #132
Conversation
jsteverman
commented
Sep 16, 2021
- moves ETAS database ops to Module ETAS
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 think the split into OverlapTableUpdate
and ClusterUpdate
makes sense. I think we should try to come up with a better name for the module they're in (admittedly not my forte).
I'll separately comment with thoughts on a test to add to make sure we're doing what we think we are regarding minimizing churn.
Regarding testing that minimizing churn is working as expected: The specs are a little bit hard to follow but I think are basically already doing this by checking that the delete count is smaller than the old overlap count & likewise that the add count is smaller than the new overlap count. You could consider adding a more explicit test like: describe "#deletes" do
it "does not include things in both the old & new overlaps" do
do_some_setup
expect(deletes).not_to contain(thing_that_shouldnt_be_deleted)
end
end
describe "#adds" do
it "does not include things in both the old & new overlaps" do
do_some_setup
expect(adds).not_to contain(thing_that_shouldnt_need_to_be_re_added)
end
end Regarding testing that it's actually reducing churn in mysql, probably the way to do that would be to stub the overlap table and then check that it receives the expected number of insert & delete calls: it "doesn't churn" do
mock_overlap_table = stub(:overlap_table)
allow(mock_overlap_table).to receive(:filter).and_return(mock_overlap_table)
expect(mock_overlap_table).to receive(:delete).exactly(M).times
expect(mock_overlap_table).to receive(:insert).exactly(N).times
do_some_setup
described_class.new(mock_overlap_table, cluster).upsert
end You could I suppose set an expectation that |
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.
Changes look good to me. Should be good to go once you resolve the merge conflict & squash.
ab0a9dc
to
283e91e
Compare
* only updates records that have been changed * avoids use of constants * does NOT move ETAS database ops to Module ETAS * debug log cluster._id
283e91e
to
ca4b51b
Compare