{"id":28535532,"url":"https://github.com/gerritcodereview/modules_cache-postgres","last_synced_at":"2026-02-05T08:30:53.707Z","repository":{"id":84111668,"uuid":"287382936","full_name":"GerritCodeReview/modules_cache-postgres","owner":"GerritCodeReview","description":"null  - (mirror of https://gerrit.googlesource.com/modules/cache-postgres)","archived":false,"fork":false,"pushed_at":"2022-12-13T22:33:17.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-23T19:05:43.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gerrit.googlesource.com/modules/cache-postgres","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GerritCodeReview.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-08-13T21:25:33.000Z","updated_at":"2020-08-13T21:26:32.000Z","dependencies_parsed_at":"2023-03-12T21:44:32.951Z","dependency_job_id":null,"html_url":"https://github.com/GerritCodeReview/modules_cache-postgres","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GerritCodeReview/modules_cache-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cache-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cache-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cache-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cache-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GerritCodeReview","download_url":"https://codeload.github.com/GerritCodeReview/modules_cache-postgres/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cache-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29116965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T17:15:42.043Z","updated_at":"2026-02-05T08:30:53.691Z","avatar_url":"https://github.com/GerritCodeReview.png","language":"Starlark","readme":"# Gerrit Postgres based persistent cache\n\nGerrit lib module to swap existing persistent cache implementation\n(that is H2 based) with implementation that stores data in Postgres.\nNote that is uses [INSERT INTO ... ON CONFLICT DO UPDATE ...](https://stackoverflow.com/questions/17267417/how-to-upsert-merge-insert-on-duplicate-update-in-postgresql)\nupsert syntax therefore it is Postgres *9.5+* compatible.\n\n## How to build\n\nBuild this module similarly to standalone build for any other,\nbazel based Gerrit plugin:\n\n- Clone the cache-postgres source tree\n- Run ```bazel build cache-postgres```\n- The ```cache-postgres.jar``` module is generated under ```/bazel-genfiles/cache-postgres.jar```\n\n## How install\n\nCopy ```cache-postgres.jar``` library to Gerrit ```/lib``` and add the following\ntwo extra settings to ```gerrit.config```:\n\n```\n[gerrit]\n  installModule = com.googlesource.gerrit.modules.cache.pg.CacheModule\n\n[cache]\n  url = jdbc:postgresql://localhost:5432/gerrit_caches?user=gerrit\u0026password=gerrit\n```\n\n## Core Gerrit settings: section `cache`\n\ncache.url\n: URI that specifies connection to existing DB (including both\nusername and passwword).\n\ncache.poolLimit\n: Maximum number of open database connections. If the server needs\nmore than this number, request processing threads will wait up\nto `cache.poolMaxWait` seconds for a connection to be released before\nthey abort with an exception.\nDefault value is taken from `database.poolLimit`.\n\ncache.poolMinIdle\n: Minimum number of connections to keep idle in the pool.\nDefault is `4`.\n\ncache.poolMaxIdle\n: Maximum number of connections to keep idle in the pool. If there\nare more idle connections, connections will be closed instead of\nbeing returned back to the pool.\nDefault is min(`cache.poolLimit`, `16`).\n\ncache.poolMaxWait\nMaximum amount of time a request processing thread will wait to\nacquire a database connection from the pool. If no connection is\nreleased within this time period, the processing thread will abort\nits current operations and return an error to the client.\nValues should use common unit suffixes to express their setting:\n* ms, milliseconds\n* s, sec, second, seconds\n* m, min, minute, minutes\n* h, hr, hour, hours\n\nIf a unit suffix is not specified, `milliseconds` is assumed.\nDefault is `30 seconds`.\n\n## Testing with docker based Postgres setup\n\nOne can start test Postgres server that contains both `gerrit_review`\n(Gerrit db) and `gerrit_caches` (db for caches) with the\nfollowing command\n```\ndocker-compose -f docker/gerrit-caches-compose.yaml up\n```\n\nOne nedds to add the following parameters to `gerrit.config`\n```\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config database.type POSTGRESQL\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config database.hostname localhost\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config database.port 5432\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config database.database gerrit_review\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config database.username gerrit\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config database.password gerrit\ngit config --file ${GERRIT_ETC_DIR}/gerrit.config cache.url \"jdbc:postgresql://localhost:5432/gerrit_caches?user=gerrit\u0026password=gerrit\"\n```\n\nwhere `GERRIT_ETC_DIR` is `GERRIT_SITE/etc`;\n\nNotes\n* container name is `gerrit-pg`\n* container uses `docker_gerrit-db-data` volume therefore restarting it\npreserves data\n* details of Postgres user/dbs setup can be found in `docker/create-gerrit-dbs.sh`\n* Postgres container details (ports, volumes, etc.) are in `docker/gerrit-caches-compose.yaml`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerritcodereview%2Fmodules_cache-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgerritcodereview%2Fmodules_cache-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerritcodereview%2Fmodules_cache-postgres/lists"}