Skip to content
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

Avoid modifying source objects when merging cache results. #4089

Merged
merged 3 commits into from
Nov 2, 2018

Commits on Nov 2, 2018

  1. Avoid modifying source objects when merging cache results.

    As #4081 demonstrates, if there are key collisions during result merging,
    it's possible for source objects that were previously merged by reference
    into the target object (finalResult.result) to be modified destructively
    by later merges, which in some cases can lead to cycles in the results
    returned by the cache.
    
    This version of the merge function uses a copy-on-first-write strategy to
    ensure we never modify target objects that might once have been source
    objects. The code could have been considerably simpler if I didn't try to
    track pastCopies, but performance and memory usage are very important for
    this code, which is why I went to the trouble of limiting the number of
    shallow copies made during a single merge.
    benjamn committed Nov 2, 2018
    Configuration menu
    Copy the full SHA
    08c8148 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7752cf1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d5181f2 View commit details
    Browse the repository at this point in the history