Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

yamadapc
Copy link

@yamadapc yamadapc commented Apr 22, 2024

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.

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.
@facebook-github-bot
Copy link
Contributor

Hi @yamadapc!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@yamadapc yamadapc changed the title WIP - Implement maximum_results option Implement maximum_results option Apr 22, 2024
@yamadapc yamadapc marked this pull request as ready for review April 22, 2024 07:59
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@yamadapc
Copy link
Author

Hello, could I get an opinion on this diff?

@yamadapc
Copy link
Author

Hey 👋

@genevievehelsel
Copy link
Contributor

genevievehelsel commented May 23, 2024

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 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants