Do not throw when failing to store into chronicle-map

When storing a new entry in chronicle-map it is possible that the
operation might fail.

For instance, if the new entry diverges greatly from the configured
average key and value size, the available memory chunks might not be
enough to accommodate the new entry.

Chronicle-map fails with:

```
Entry is too large: requires X chunks, Y is the maximum.
```

Another typical case would be that the cache already reached the maximum
number of auto-resizes and thus it is not able to expand anymore.

Chronicle-map fails with:

```
Attempt to allocate #X extra segment tier, Y is maximum.
```

In these cases, as well as other possible failures, we don't want the
exception to bubble up to the stack and cause the caller to fail.

The caller might be a REST API initiated by the UI via ajax, which in
turn, would cause the UI to stop rendering and a bad user experience.

Catch chronicle-map's `put()` exception locally and simply avoid caching
the offending entry.

Bug: Issue 15483
Change-Id: Ia1811d66b676388f15cb6f42ef3ee4fd5d1aa94b
3 files changed
tree: 98db9291f02b095c31d44d510783aed4ed70148d
  1. src/
  2. .gitignore
  3. BUILD
  4. external_plugin_deps.bzl
  5. Jenkinsfile
  6. LICENSE
  7. README.md
README.md

Persistent cache for Gerrit, based on ChronicleMap

Non-blocking and super-fast on-disk cache libModule for Gerrit Code Review based on ChronicleMap on-disk implementation.

How to build

This libModule is built like a Gerrit in-tree plugin, using Bazelisk. See the build instructions for more details.

Setup

  • Install cache-chronicalmap module

Install the chronicle-map module into the $GERRIT_SITE/lib directory.

Add the cache-chroniclemap module to $GERRIT_SITE/etc/gerrit.config as follows:

[gerrit]
  installModule = com.googlesource.gerrit.modules.cache.chroniclemap.ChronicleMapCacheModule

For further information and supported options, refer to config documentation.

Migration from H2 caches

You can check how to migrate from H2 to chronicle-map here.