From 320dbd639ae9696079eedc62901a9846d77284e2 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 20 Jul 2022 12:22:36 -0700 Subject: [PATCH] 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 --- playbooks/zuul/upgrade-review.yaml | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/playbooks/zuul/upgrade-review.yaml b/playbooks/zuul/upgrade-review.yaml index 6695164852..9b46646400 100644 --- a/playbooks/zuul/upgrade-review.yaml +++ b/playbooks/zuul/upgrade-review.yaml @@ -34,6 +34,8 @@ cmd: docker-compose down chdir: /etc/gerrit-compose/ + # This allows us to check that our config file isn't modified by newer + # Gerrit versions. - name: Backup config files block: - name: Find .config files @@ -49,6 +51,14 @@ remote_src: true 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 import_playbook: ../service-review.yaml vars: @@ -64,8 +74,28 @@ loop: "{{ _config_files.files | map(attribute='path') | list }}" register: _diff_output - - name: Check diffs + - name: Check config diffs fail: msg: 'Difference detected in file {{ item.item }} ' when: item.rc != 0 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