diff options
author | Stan Hu <stanhu@gmail.com> | 2018-03-06 17:01:12 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-03-07 06:25:21 -0800 |
commit | 611929eb96c0ee9f07d98163d0610325d8a2a322 (patch) | |
tree | 6dda6341c6a44c1b94d0db4d5fd915035c590c2a /changelogs | |
parent | ff00cfe45c744393de5bfcafdcfbd12108cc664f (diff) | |
download | gitlab-ce-611929eb96c0ee9f07d98163d0610325d8a2a322.tar.gz |
Memoize Repository#empty? instead of double caching the valuesh-remove-double-caching-repo-empty
We saw that in a customer instance, `empty?` was cached to be `true` even
though `has_visible_content?` and `exists?` were `true`. This double caching
can run into edge cases because there's no guarantee that the inner values
will properly expire the outer one, especially if there is Redis replication lag.
Consider this scenario:
1. `exists?` and `has_visible_content?` are false
2. `empty?` is expired
3. A subsequent call to `empty?` returns `true` because `exists?` is false even though `empty` is true
4. `exists?` and `has_visible_content?` are then expired
5. `exists?` and `has_visible_content?` are set to true
6. `empty?` is still stuck in the wrong value as `true`
Closes #43882
Diffstat (limited to 'changelogs')
-rw-r--r-- | changelogs/unreleased/sh-remove-double-caching-repo-empty.yml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/changelogs/unreleased/sh-remove-double-caching-repo-empty.yml b/changelogs/unreleased/sh-remove-double-caching-repo-empty.yml new file mode 100644 index 00000000000..1684be4e5e3 --- /dev/null +++ b/changelogs/unreleased/sh-remove-double-caching-repo-empty.yml @@ -0,0 +1,5 @@ +--- +title: Remove double caching of Repository#empty? +merge_request: +author: +type: fixed |