-
Notifications
You must be signed in to change notification settings - Fork 248
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
Separate limit for re-announcements #1131
Conversation
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.
Seems blocked by #1133
Pieces that were added to the local cache and with skipped announcements won't be visible outside.
This PR doesn't decrease the queue size, in fact it adds even more buffering on top, so it is strictly better than what we had before. Though #1133 will certainly improve things further. |
Isn't it possible to proceed with an external task (record processing) even if we have all the internal tasks (announcing) busy? This will make saving to the local cache unnecessary because of the no future effect. We need to acquire reannouncing semaphore first to make it more strict. |
It will not have effect without #1133, but I see no reason why #1133 blocks this PR and makes it less useful. We already populate cache, which is great and will be beneficial.
I don't get this part, caching should happen regardless of whether we can re-announce afterwards or not. |
We don't need a cache unless we serve requests and there will be no requests unless we announce pieces. This PR in its current form introduces a situation when we have a piece in the cache but don't announce them (now or ever). We could mitigate it by rearranging semaphores. We could either implement #1133 and skip some of the announcements because they will be reannounced later. |
There will be requests in general, but we'll not be able to return node's info until #1133 is implemented, though I don't see how that reduces value of this PR and why it can't be merged first. It literally physically can't make things any worse than they are right now only better.
I don't understand why you want to re-arrange semaphores, sorry. With or without #1133 it doesn't make sense to me. |
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
Currently, we have:
Since tasks are processed in separate threads (at least logical threads) - they don't block each other even having taskB is started within taskA. If we rearrange semaphores
We make taskA dependent on the taskB being runnable. That will mean that starting taskA will be always accompanied by the starting taskB. OR we could fix #1133 and leave it as it is because we will have a different side effect - we could skip announcing pieces sometimes but they will be reannounced later. |
But that is the whole point of this PR: To cache pieces even if they can't be announced. With #1133 pieces that we have stored in the past will suddenly become accessible after farmer restart with new software.
Not could, we will. Moreover, we'll do it today. |
Ok. I can review it having this perspective in mind. |
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.
I tested it and found one minor issue: announcing pieces logs an invalid message Piece publishing for a sector succeeded...
. It's incorrect in this context. However, it wasn't introduced in the current PR.
Yeah, it was copy-pasted and needs to be made more generic indeed. |
The problem
With large number of incoming announcements farmer may not be able to process them all and re-announce pieces in real time. This is especially true before cache is full where all announced pieces will fit into cache.
As the result we were getting following warnings:
The solution
While #1129 will solve this long-term, in the meantime this PR distinguishes difference processing phases:
The rationale here is that as long as we pull and persist piece in the cache, it is still retrievable (because farmer did store it and the reason they did it is because they are close enough to the key), even if short-term we were not able to re-announce it.
The only negative effects when this happens are that not everyone on the network will be aware of all the nodes that have data and that may cause extra strain on nodes closer to the key.
Code contributor checklist: