-
Notifications
You must be signed in to change notification settings - Fork 993
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
Implement maximum_results
option
#1215
base: main
Are you sure you want to change the base?
Conversation
When working on large mono-repos some queries might take a very long time due to listing all files on the project. This waiting time is a combination of building the results array and serialising it back. This commit adds a query option `maximum_results`, which allows clients to ask the server to truncate results above a certain threshold number. On that case, a flag is sent back indicating to the client results have been truncated.
Hi @yamadapc! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
maximum_results
optionmaximum_results
option
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Hello, could I get an opinion on this diff? |
Hey 👋 |
followed up in the Sapling discord (nice idea asking there :) ) but copy-pasting here for wider visibility: hi from the watchman team - I think this looks like a good idea 🙂 we've got a similar flag like @quark-zju mentioned for a watcher we use often (watcher/eden.cpp) for the same reasons you mentioned in your summary on the making the eden_file_count_threshold_for_fresh_instannce more universal, the code pointer for that is here: https://github.com/facebook/watchman/blob/main/watchman/watcher/eden.cpp#L760 It would be a lot cleaner IMO if we could just leverage the existing fresh_instance code for this, in a similar manner to how its done for the eden watcher, especially since some clients might already know how to handle fresh instances and they'd have to relearn how to handle a new flag if they wanted to use this feature we have an integration test for this flag for the eden watcher here: https://github.com/facebook/watchman/blob/main/watchman/integration/eden/test_eden_since.py#L296 if you went the route of returning fresh instances if threshold is reached, you could just make a similar test to the above but for a non-eden watcher 🙂 |
When working on large mono-repos some queries might take a very long time due to listing all files on the project.
This waiting time is a combination of building the results array and serialising it back.
This commit adds a query option
maximum_results
, which allows clients to ask the server to truncate results above a certain threshold number.On that case, a flag is sent back indicating to the client results have been truncated.
We could change this diff to read this value as a global setting rather than a per request setting. But then for any given instance we'd need to globally assume the setting is handled correctly, which may not be the case.
I still need to test direct BSER clients against this change.
I'd appreciate an opinion on the diff & where to write automated tests for this. I don't see unit-testing around this area, so I imagine those would be integration tests.