-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
provider: clear provide queue when reprovide strategy changes #10863
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
Conversation
When the currently configured reprovide strategy does not match the previous strategy read from the datastore, then clear the reprovide queue and update the reprovide strategy that is stored in the datastore. Depends on ipfs/boxo#978 Closes #10829
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! We may also want to add a command to allow users to manually purge the provider queue.
Co-authored-by: Guillaume Michel <guillaumemichel@users.noreply.github.com>
We could, but what is the use case? If the use case is very rare, then a user could always change the reprovide strategy, restart, then change it back and restart again. |
Yeah, I think it would be useful (if not too complicated). It can be useful for debugging purposes. "Is reproviding the cause of my high CPU/network usage?".. the question can be answered quickly by cleaning the queue and seeing if problem resolves at that moment. Might also be useful when you have pinned many things and then unpinned them, but you are nevertheless reproviding them. The "edit config and restart-workaround" will also eliminate other potential explanations for problems and it is not very obvious. |
Just to be clear, this PR is clearing the provide queue but not changing anything about reprovides. The provide process is as follow:
Hence, with a command, users would be able to know whether providing is the cause of high CPU/network usage.
In this case it would help, no keys would be provided after the provide queue is cleared (for better or worse). But in any case, unpinned cids would NOT have been reprovided. |
@guillaumemichel @hsanjuan I will provide a command/subcommand to clear the provide queue, but I will do this is a separate PR. The command will be |
5c5293d
to
4f5248a
Compare
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.
ipfs provide clear
That's perfect!
The `provide clear` command clears all items from the provide queue and prints out the number of items removed from the queue. The `quiet` option tells the command not to print output.
Add
|
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.
small nits inline
core/commands/provide.go
Outdated
Subcommands: map[string]*cmds.Command{ | ||
"clear": provideClearCmd, |
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.
💭 in the future we may want to deprecate ipfs routing provide
and ipfs routing reprovide
have modern version at ipfs provide stat [cid]
that returns state of both systems + optional stat per cid (when/why it was provided last time)
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 can do that, but in a separate PR.
Issue #10865
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.
We may want to deprecate ipfs stats provide
and ipfs stats reprovide
, but probably not ipfs routing provide <cid>
since the command allows the user to advertise a provider record matching the cid to the Amino DHT.
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.
@guillaumemichel Want to create an issue?
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
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.
ipfs provide clear
That's perfect!
Now that I think again about it, it would be better to group the command (if possible) as a subcommand of ipfs routing provide
rather than create the new ipfs provide
just to clear the queue.
The
This means that the clear subcommand would instead need to become a flag, or the keyword "clear" will need to be specially recognized as not a CID. I do not like making a So, maybe better to have a different subcommand for |
@gammazero how about a subcommand like in 6b7dacf? I don't think that Feel free to revert the commit. |
a76d0a9
to
5eb2fda
Compare
5eb2fda
to
6b7dacf
Compare
It is not collision that I worry about, it is this is not how any of the rest of the CLI works, and is therefore strange and unexpected. @lidel Do you have suggestion? |
Triage notes:
|
moving to new namespace to avoid conflicts, and also document other commands
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, automatic queue purging will likely help people who were stuck with all/flag
.
Pushed non-functional changes:
- moved
clear
command to new EXPERIMENTAL namespace (ipfs provide
) - updated changelog/docs + wrote basic
ipfs provide --help
that will help users to discover existing provider-related commands
@gammazero @guillaumemichel If my changes look ok, feel free to merge.
let's create ipfs provide
and see how it goes
When the currently configured reprovide strategy does not match the previous strategy read from the datastore, then clear the provide queue and update the reprovide strategy that is stored in the datastore.
Testing was done manually.
Depends on ipfs/boxo#978
Closes #10829