-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
router: implement partial map-reduce API
Introduce a partial ref-map-reduce API for vshard. It guarantees that in case of success the function is executed exactly once on the storages, that contain the given list of buckets. Algorithm. Router: 1. Group buckets by replicasets based on the router's cache. 2. Ref stage. For each storage: a. Async send ref id, timeout and a group of the corresponding buckets to the storage. The aim is to reference this storage and check what buckets are absent. Storage: 3. Refer session with the ref id and timeout, passed from the router. 4. Lookup for the passed buckets. If any of them were not found on the storage, return these buckets back in response to the router. Router: 5. Await and collect returned responses. If timeout has expired, set the error for this response. 6. If any of responses contains error,send unref to the refed storages and return the error to the user. 7. If the collected results contain moved buckets, search for them and update the router's cache. Decrease the timeout and goto 1. 8. Map stage. For each storage: a. Replace a bucket list with a group of buckets refed on the target storage. b. Async send a map function with modified arguments and a ref id to the storage. Storage: 9. Execute storage_map: if the ref id has expired, return error. Otherwise, ref.use -> execute -> ref.del from storage_map(). Return results. Router: 10. Reduce stage. Await results (and optionally apply a callback to each result): if timeout expired, return error to the user. Otherwise, return result.
- Loading branch information
Showing
2 changed files
with
363 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters