)]}'
{
  "commit": "0cb659f69618c3fba5905bda6d19b3700be56c19",
  "tree": "12167625a01aa15062b991c503eff4a15502591a",
  "parents": [
    "fe7af1d43efa2509656c4d3af63d501ddcac6ea1"
  ],
  "author": {
    "name": "Antonio Barone",
    "email": "syntonyze@gmail.com",
    "time": "Mon Jan 31 21:01:11 2022 +0100"
  },
  "committer": {
    "name": "Antonio Barone",
    "email": "syntonyze@gmail.com",
    "time": "Tue Feb 01 20:31:44 2022 +0000"
  },
  "message": "Postpone call to get() when loading from the in-memory cache\n\nCaffeine\u0027s get() method relies on the `ConcurrentHashMap.compute()`\njava11 implementation, which locks concurrent access in [1].\n\nThe effect of this on cache-chroniclemap is that when multiple threads\ntry to access the in-memory cache concurrently, they result in being\nBLOCKED, as documented by the `ConcurrentHashMap.compute()` method:\n\n```\nSome attempted update operations on this map by other threads\nmay be blocked while computation is in progress, so the\ncomputation should be short and simple, and must not attempt to\nupdate any other mappings of this Map.\n```\n\nThis, in turn, causes high consumption of Gerrit threads, which might\neventually, make it unresponsive.\n\nWorkaround this problem by first trying to get the key _if present_ and\nonly calling get() in case no value could be loaded.\n\nThis works because getIfPresent(), as opposed to, get(), does not try to\n`compute` entries in the cache and thus decreases the chances of threads\nblocking in case of cache hits.\n\n[1] https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java#L1923\n\nBug: Issue 15645\nChange-Id: I7021d93d4011e252c5c022ffcd3eecee22820ff5\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "96b75da56096c01efb706b5484f3cdb694b5092f",
      "old_mode": 33188,
      "old_path": "src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/InMemoryCacheLoadingFromStoreImpl.java",
      "new_id": "d69be5b42676d12cf70147ef73ebf5fab2ece179",
      "new_mode": 33188,
      "new_path": "src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/InMemoryCacheLoadingFromStoreImpl.java"
    }
  ]
}
