Varun Joshi: Solving Update Races in Balrog: The Plan |
The coding period for the Google Summer of Code has begun, so here is the plan for the project, as was promised.
Currently, when two submitter tasks request Balrog for a blob to update at the same time, they both have the same data_version in the blob they send back with the added locale. This leads to the server rejecting one of these and the submitter having to retry. In most cases, the updates can simply be merged, preventing the retries. For example, this series of events is something like what happens now:
At most times, the data in the blobs is similar apart from some added data such as added locales. So, we can try to reduce submission failures by devising a way to merge the blob versions when we receive a request with an outdated data_version. As my project, I will seek to implement the merging of two blobs. This will be with the utilization of a three-way merge algorithm, something similar to what git uses for merges. Since we currently do not have any libraries for this task, I will make a module for three-way merges of python data structures (and hopefully get it published on PyPI!) and use that within Balrog to accomplish the goals of this project.
The basic algorithm for three-way merges is described here:
Further analysis needs to be done for the handling of list and tuple values, since the preservation of order might be important in those data structures. We might want to support two modes: one where the preservation of the order of the list elements is important and another where it isn't. In some cases, merging strings might also be undesireable, so even might need to be made optional.
We may employ several merge-conflict resolution strategies:
This algorithm is based on this research paper and this email. Both show how a three way merge would work out for strings.
Here is a link to my proposal. Keep checking this space every week for updates on my project and feel free to point out if I can do anything better! Thank you :)
http://nurav.github.io/posts/solving-update-races-in-balrog-the-plan/
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |