Repository navigation
fix(cli): merge lower zooms before higher ones with several threads - #280
Open
shimoncohen wants to merge 1 commit into
Open
shimoncohen wants to merge 1 commit into
shimoncohen wants to merge 1 commit into
Conversation
With GENERAL__parallel__numOfThreads above 1, threads take the next batch and merge it at once, so a batch of a higher zoom could start while a batch of a lower zoom read before it was still being written. A partly covered tile is filled by upscaling the lower zoom already in the target, so the output depended on timing: two 8-thread runs differed on a few tiles and from the single-thread output on hundreds. A new ZoomOrderGate in MergerLogic/Batching gives each batch a ticket in read order. A batch waits until every earlier batch with a lower zoom has completed. Batches of the same zoom still run in parallel. The ticket is released in a finally, so a failing batch cannot block the others. Refs MAPCO-12827 (the service side of the same race is not covered here).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
GENERAL__parallel__numOfThreadsabove 1, the CLI could start merging a higher-zoom batch while a lower-zoom batch read before it was still being written. Partly covered tiles are filled by upscaling the lower zoom already in the target, so the output depended on thread timing.Tests: 5 new unit tests for the gate, and all 1,135 MergerLogic and 23 MergerService tests pass. On the z16 + z18 south Lebanon GPKG merge, the current master with 8 threads differed from its own single-thread output on 897 of 34,764 tiles, in all 3 runs. With this change, 3 runs at 8 threads are byte-identical to the single-thread output and take 29–37 s instead of 80 s.
Refs MAPCO-12827. The service has the same race between its per-zoom tasks, and this change does not cover it.