-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Router discovery is a heavy operation - it downloads all the buckets from all the storages. Sometimes that creates problems on the storages, when they need to send thousands of buckets.
After #210 the situation should become less problematic. But still not perfect. For the ideal discovery a router should be able to stop downloading anything from storages, when all is discovered. However still send requests to the storages to check if anything changed since the last discovery.
Need to introduce some kind of 'cookie'. A value, which a router would save when all is discovered. When it is sent to storage, it either returns nothing if the cookie is the most actual, or returns buckets if anything changed since the last discovery.
Cookie probably could be a pair {bucket_generation, bucket_timestamp}
. Bucket generation is a volatile counter incremented on every _bucket change by every storage. Only generation is not enough, because the storage may change _bucket, restart, and the counter can become exactly the same as it was before restart, but with different bucket set.
Timestamps should protect from that. Maybe just timestamp would be enough though.