About cache size

220 views
Skip to first unread message

Z

unread,
Mar 2, 2026, 4:30:06 AMMar 2
to Repo and Gerrit Discussion
Dear Gerrit Community,

     gerrit version 3.12.4  and  following cache
      git_file_diff-v2.mv.db
      git_modified_files-v2.mv.db
      modified_files-v2.mv.db
       diff_summary-v2.mv.db
       change_kind-v2.mv.db
       web_sessions-v2.mv.db
        gerrit_file_diff-v2.mv.db    

If these caches become unusually large, what problems might that cause?

Thanks.

Matthias Sohn

unread,
Mar 2, 2026, 4:40:52 AMMar 2
to Z, Repo and Gerrit Discussion
We found that huge persistent h2 caches can lead to OOM errors and that such huge h2 caches
can be caused by offline reindexing the complete changes index.
We mitigated this with https://gerrit-review.googlesource.com/c/gerrit/+/473823 which allows to make persistent
caches read-only during offline reindexing. This feature is available since Gerrit 3.13. 
 
Thanks.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/4b4c7fa0-fb12-41f8-aa65-6fa7b4b673b9n%40googlegroups.com.

Luca Milanesio

unread,
Mar 2, 2026, 4:55:58 AMMar 2
to Repo and Gerrit Discussion, Luca Milanesio, Z, Matthias Sohn

On 2 Mar 2026, at 09:40, Matthias Sohn <matthi...@gmail.com> wrote:

On Mon, Mar 2, 2026 at 10:30 AM Z <vista...@gmail.com> wrote:
Dear Gerrit Community,

     gerrit version 3.12.4  and  following cache
      git_file_diff-v2.mv.db
      git_modified_files-v2.mv.db
      modified_files-v2.mv.db
       diff_summary-v2.mv.db
       change_kind-v2.mv.db
       web_sessions-v2.mv.db
        gerrit_file_diff-v2.mv.db    

If these caches become unusually large, what problems might that cause?

We found that huge persistent h2 caches can lead to OOM errors and that such huge h2 caches
can be caused by offline reindexing the complete changes index.

Yep,

I have also verified that large H2 caches can be *so slow* that running Gerrit without caches would make it faster, which could be counter-intuitive :-)

We mitigated this with https://gerrit-review.googlesource.com/c/gerrit/+/473823 which allows to make persistent
caches read-only during offline reindexing. This feature is available since Gerrit 3.13. 

+1 indeed.

Also, you may want to use a more efficient cache implementation that doesn’t degrade when the size grows.
See [1].

HTH

Luca.


 
Thanks.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/4b4c7fa0-fb12-41f8-aa65-6fa7b4b673b9n%40googlegroups.com.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Luca Milanesio

unread,
Mar 2, 2026, 5:49:50 AMMar 2
to Repo and Gerrit Discussion, Luca Milanesio


On 2 Mar 2026, at 10:12, Z <vista...@gmail.com> wrote:

Hi,luca:

 Thank you for your reply.

>>>    If the cache-chroniclemap also becomes very large, could it lead to OOM (Out of Memory)?

Nope, that’s the main difference between H2 and cache-chroniclemap.
See the last talk about Gerrit persistent caches options at [2].

HTH

Luca.



Thank you.



Luca Milanesio 在 2026年3月2日 星期一下午5:55:58 [UTC+8] 的信中寫道:

Z

unread,
Mar 8, 2026, 8:12:35 PMMar 8
to Repo and Gerrit Discussion
Hi, luca:

I have decided to accept your suggestion to use the cache-chroniclemap . However, when I then executed cache turning with the command "SSH cache-chroniclemap analyze-h2-caches", the following error occurred. Could you please advise on how to resolve it? Thank you.

java.lang.Exception: fatal: Table "data" not found (candidates are: "DATA"); SQL statement:
SELECT COUNT(*), AVG(OCTET_LENGTH(k)), AVG(OCTET_LENGTH(v)) FROM data [42103-232]
        at com.googlesource.gerrit.modules.cache.chroniclemap.H2CacheCommand.getStats(H2CacheCommand.java:62)
        at com.googlesource.gerrit.modules.cache.chroniclemap.AnalyzeH2Caches.run(AnalyzeH2Caches.java:60)
        at com.google.gerrit.sshd.SshCommand.lambda$start$1(SshCommand.java:87)
        at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:509)
        at com.google.gerrit.server.logging.LoggingContextAwareRunnable.run(LoggingContextAwareRunnable.java:113)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:940)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "data" not found (candidates are: "DATA"); SQL statement:
SELECT COUNT(*), AVG(OCTET_LENGTH(k)), AVG(OCTET_LENGTH(v)) FROM data [42103-232]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:514)
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
        at org.h2.message.DbException.get(DbException.java:223)
        at org.h2.command.Parser.getTableOrViewNotFoundDbException(Parser.java:7948)
        at org.h2.command.Parser.getTableOrViewNotFoundDbException(Parser.java:7916)
        at org.h2.command.Parser.readTableOrView(Parser.java:7895)
        at org.h2.command.Parser.readTablePrimary(Parser.java:1769)
        at org.h2.command.Parser.readTableReference(Parser.java:2249)
        at org.h2.command.Parser.parseSelectFromPart(Parser.java:2702)
        at org.h2.command.Parser.parseSelect(Parser.java:2810)
        at org.h2.command.Parser.parseQueryPrimary(Parser.java:2692)
        at org.h2.command.Parser.parseQueryTerm(Parser.java:2547)
        at org.h2.command.Parser.parseQueryExpressionBody(Parser.java:2526)
        at org.h2.command.Parser.parseQueryExpressionBodyAndEndOfQuery(Parser.java:2519)
        at org.h2.command.Parser.parseQueryExpression(Parser.java:2512)
        at org.h2.command.Parser.parseQuery(Parser.java:2479)
        at org.h2.command.Parser.parsePrepared(Parser.java:610)
        at org.h2.command.Parser.parse(Parser.java:581)
        at org.h2.command.Parser.parse(Parser.java:556)
        at org.h2.command.Parser.prepareCommand(Parser.java:484)
        at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:645)
        at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:561)
        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1164)
        at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:94)
        at com.googlesource.gerrit.modules.cache.chroniclemap.H2CacheCommand.getStats(H2CacheCommand.java:47)
        ... 11 more




Luca Milanesio 在 2026年3月2日 星期一下午5:55:58 [UTC+8] 的信中寫道:

Luca Milanesio

unread,
Mar 9, 2026, 4:45:34 AMMar 9
to Repo and Gerrit Discussion, Luca Milanesio
Hi,

On 9 Mar 2026, at 00:12, Z <vista...@gmail.com> wrote:

Hi, luca:

I have decided to accept your suggestion to use the cache-chroniclemap . However, when I then executed cache turning with the command "SSH cache-chroniclemap analyze-h2-caches", the following error occurred. Could you please advise on how to resolve it? Thank you.

java.lang.Exception: fatal: Table "data" not found (candidates are: "DATA"); SQL statement:
SELECT COUNT(*), AVG(OCTET_LENGTH(k)), AVG(OCTET_LENGTH(v)) FROM data [42103-232]
        at com.googlesource.gerrit.modules.cache.chroniclemap.H2CacheCommand.getStats(H2CacheCommand.java:62)
        at com.googlesource.gerrit.modules.cache.chroniclemap.AnalyzeH2Caches.run(AnalyzeH2Caches.java:60)
        at com.google.gerrit.sshd.SshCommand.lambda$start$1(SshCommand.java:87)
        at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:509)
        at com.google.gerrit.server.logging.LoggingContextAwareRunnable.run(LoggingContextAwareRunnable.java:113)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:940)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "data" not found (candidates are: "DATA"); SQL statement:

It looks like you don’t have an H2 schema, possibly your H2 is completely empty.
There is nothing to migrate then, the `analyze-h2-caches` isn’t useful for you.

Just start fresh with a new set of tables, automaticallhy created at startup.

HTH

Luca.

Z

unread,
Mar 11, 2026, 7:33:40 PM (12 days ago) Mar 11
to Repo and Gerrit Discussion

I'm very sorry, Luca. When choosing to reply to you, the system restricts your email address as unknown, so I can only select "Reply All."

However, some of the H2 version 2 cache databases under review_site/cache/ are quite large, especially the ones mentioned earlier, such as:



git_file_diff-v2.mv.db
git_modified_files-v2.mv.db
modified_files-v2.mv.db
diff_summary-v2.mv.db
change_kind-v2.mv.db
web_sessions-v2.mv.db
gerrit_file_diff-v2.mv.db

Do you mean that I should directly configure cache-chroniclemap and then restart Gerrit?


Luca Milanesio 在 2026年3月9日 星期一下午4:45:34 [UTC+8] 的信中寫道:

Luca Milanesio

unread,
Mar 12, 2026, 3:27:28 AM (11 days ago) Mar 12
to Repo and Gerrit Discussion, Luca Milanesio, Z
Hi,

> On 11 Mar 2026, at 23:33, Z <vista...@gmail.com> wrote:
>
> I'm very sorry, Luca. When choosing to reply to you, the system restricts your email address as unknown, so I can only select "Reply All."
>
> However, some of the H2 version 2 cache databases under review_site/cache/ are quite large, especially the ones mentioned earlier, such as:
>
> git_file_diff-v2.mv.db
> git_modified_files-v2.mv.db
> modified_files-v2.mv.db
> diff_summary-v2.mv.db
> change_kind-v2.mv.db
> web_sessions-v2.mv.db
> gerrit_file_diff-v2.mv.db

My bad, I misread the error. The issue is about the CASE_INSENSITIVE_IDENTIFIERS which is false by default in H2.
In [2] I’ve turned off the automatic switch to upper case identifiers and now it doesn’t find the ‘DATA’ table.

I believe it’s something I can fix.

> Do you mean that I should directly configure cache-chroniclemap and then restart Gerrit?

I still suggest waiting for my fix and do the tuning again.

P.S. Cache-chroniclemap is under BSL, please read carefully [3] and ensure you can legally use it in production.

HTH

Luca.

[2] https://gerrit-review.googlesource.com/c/modules/cache-chroniclemap/+/453601
[3] https://github.com/GerritForge/cache-chroniclemap?tab=License-1-ov-file#readme
> To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/44897b1e-a735-4841-8669-3bf098116b05n%40googlegroups.com.

Z

unread,
Mar 17, 2026, 10:07:55 PM (6 days ago) Mar 17
to Repo and Gerrit Discussion
Thanks you for your reply.   luca

Luca Milanesio 在 2026年3月12日 星期四下午3:27:28 [UTC+8] 的信中寫道:
Hi,

> On 11 Mar 2026, at 23:33, Z <vista...@gmail.com> wrote:
>
> I'm very sorry, Luca. When choosing to reply to you, the system restricts your email address as unknown, so I can only select "Reply All."
>
> However, some of the H2 version 2 cache databases under review_site/cache/ are quite large, especially the ones mentioned earlier, such as:
>
> git_file_diff-v2.mv.db
> git_modified_files-v2.mv.db
> modified_files-v2.mv.db
> diff_summary-v2.mv.db
> change_kind-v2.mv.db
> web_sessions-v2.mv.db
> gerrit_file_diff-v2.mv.db

>My bad, I misread the error. The issue is about the CASE_INSENSITIVE_IDENTIFIERS which is false by default in H2.
>In [2] I’ve turned off the automatic switch to upper case identifiers and now it doesn’t find the ‘DATA’ table.

> I believe it’s something I can fix.

 ok,wait for you and will it be fixed in the stable-3.12 branch? Thanks.



> Do you mean that I should directly configure cache-chroniclemap and then restart Gerrit?

> I still suggest waiting for my fix and do the tuning again.

>  P.S. Cache-chroniclemap is under BSL, please read carefully [3] and ensure you can legally use it in production.

 Also, Cache-chroniclemap is for learning purposes only, not for commercial.

Luca Milanesio

unread,
Mar 18, 2026, 2:37:20 AM (6 days ago) Mar 18
to Repo and Gerrit Discussion, Luca Milanesio, Z

On 18 Mar 2026, at 02:07, Z <vista...@gmail.com> wrote:

Thanks you for your reply.   luca

Luca Milanesio 在 2026年3月12日 星期四下午3:27:28 [UTC+8] 的信中寫道:
Hi,

> On 11 Mar 2026, at 23:33, Z <vista...@gmail.com> wrote:
>
> I'm very sorry, Luca. When choosing to reply to you, the system restricts your email address as unknown, so I can only select "Reply All."
>
> However, some of the H2 version 2 cache databases under review_site/cache/ are quite large, especially the ones mentioned earlier, such as:
>
> git_file_diff-v2.mv.db
> git_modified_files-v2.mv.db
> modified_files-v2.mv.db
> diff_summary-v2.mv.db
> change_kind-v2.mv.db
> web_sessions-v2.mv.db
> gerrit_file_diff-v2.mv.db

>My bad, I misread the error. The issue is about the CASE_INSENSITIVE_IDENTIFIERS which is false by default in H2.
>In [2] I’ve turned off the automatic switch to upper case identifiers and now it doesn’t find the ‘DATA’ table.

> I believe it’s something I can fix.

 ok,wait for you and will it be fixed in the stable-3.12 branch? Thanks.





> Do you mean that I should directly configure cache-chroniclemap and then restart Gerrit?

> I still suggest waiting for my fix and do the tuning again.

>  P.S. Cache-chroniclemap is under BSL, please read carefully [3] and ensure you can legally use it in production.

 Also, Cache-chroniclemap is for learning purposes only, not for commercial.

Cool, can you try cache-chroniclemap on v3.13 at [5]?

Luca.

Reply all
Reply to author
Forward
0 new messages