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
Split big preloading-IN query into multiple queries (#283) #285
Conversation
Codecov Report
@@ Coverage Diff @@
## master #285 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 33 33
Lines 2768 2778 +10
=========================================
+ Hits 2768 2778 +10
Continue to review full report at Codecov.
|
hi, can you fix the test coverage? thanks |
Yes of course, I will do 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.
lgtm in terms of the logic
|
||
return scanMulti(cur, keyField, keyType, targets) | ||
scanFinish := r.instrumenter.Observe(cw.ctx, "rel-scan-multi", "scanning all records to multiple targets") | ||
err = scanMulti(cur, keyField, keyType, targets) |
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.
can you confirm calling this multiple time won't reset the slice of association field?
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.
that's something I am also not sure. In my first test with my example project it works just well, but I will look into it.
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.
Maybe this can be added as assertion in the unit test?
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.
Ok, as long as the keys do not re-occur in the subsequent calls it works just fine, as each scanMulti call only modifies the occurred keys.
This works as long as each call uses unique keys which is here the case as r.targetIDs returns unique keys.
So it should be fine here. Tell me if you think otherwise.
I added a test to scanMulti for this.
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
This is an initial version to fix #283.
Feel free to review it :-)