Check for new Gerrit on disk caches when upgrading Gerrit

Update the Gerrit upgrade job to check for new on disk h2 cache files.
We discovered well after the fact that Gerrit 3.5 added new (large)
cache files to disk that would've been good to be aware of prior to the
upgrade. This change will check for new files and produce a message if
they exist.

Change-Id: I4b52f95dd4b23636c0360c9960d84bbed1a5b2d4
This commit is contained in:
Clark Boylan 2022-07-20 12:22:36 -07:00
parent c5bce86dfa
commit 320dbd639a

View File

@ -34,6 +34,8 @@
cmd: docker-compose down cmd: docker-compose down
chdir: /etc/gerrit-compose/ chdir: /etc/gerrit-compose/
# This allows us to check that our config file isn't modified by newer
# Gerrit versions.
- name: Backup config files - name: Backup config files
block: block:
- name: Find .config files - name: Find .config files
@ -49,6 +51,14 @@
remote_src: true remote_src: true
loop: "{{ _config_files.files | map(attribute='path') | list }}" loop: "{{ _config_files.files | map(attribute='path') | list }}"
# Record h2 cache files. We will use this to highlight any new caches
# under the new Gerrit version.
- name: Record Gerrit old cache files
find:
paths: /home/gerrit2/review_site/cache
patterns: '*.h2.db'
register: _old_cache_files
- name: Perform gerrit upgrade - name: Perform gerrit upgrade
import_playbook: ../service-review.yaml import_playbook: ../service-review.yaml
vars: vars:
@ -64,8 +74,28 @@
loop: "{{ _config_files.files | map(attribute='path') | list }}" loop: "{{ _config_files.files | map(attribute='path') | list }}"
register: _diff_output register: _diff_output
- name: Check diffs - name: Check config diffs
fail: fail:
msg: 'Difference detected in file {{ item.item }} ' msg: 'Difference detected in file {{ item.item }} '
when: item.rc != 0 when: item.rc != 0
loop: '{{ _diff_output.results }}' loop: '{{ _diff_output.results }}'
- name: Record Gerrit new cache files
find:
paths: /home/gerrit2/review_site/cache
patterns: '*.h2.db'
register: _new_cache_files
- name: Manipulate find data for caches
set_fact:
_old_cache_paths: "{{ _old_cache_files.files | map(attribute='path') | list }}"
_new_cache_paths: "{{ _new_cache_files.files | map(attribute='path') | list }}"
- name: Find delta between cache listings
set_fact:
_gerrit_cache_difference: "{{ _old_cache_paths | symmetric_difference(_new_cache_paths) }}"
- name: Check for new cache files
debug:
msg: "The new Gerrit version produces new on disk caches: {{ _gerrit_cache_difference }}"
when: _gerrit_cache_difference | length > 0