mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-27 11:28:31 +01:00
70cbf3d5ae
* add synapse-auto-compressor workaround, fixes #3397 * Clarify what the PG-prefixed variables are for --------- Co-authored-by: Slavi Pantaleev <slavi@devture.com>
48 lines
1.3 KiB
Django/Jinja
48 lines
1.3 KiB
Django/Jinja
#jinja2: lstrip_blocks: "True"
|
|
#!/bin/bash
|
|
|
|
# this script is used to workaround the https://github.com/matrix-org/rust-synapse-compress-state/issues/78,
|
|
# and it is based on postgres' cli-non-interactive and https://github.com/matrix-org/rust-synapse-compress-state/issues/78#issuecomment-1409932869
|
|
|
|
docker run \
|
|
--rm \
|
|
--user={{ matrix_synapse_auto_compressor_uid }}:{{ matrix_synapse_auto_compressor_gid }} \
|
|
--cap-drop=ALL \
|
|
--interactive \
|
|
--network={{ matrix_synapse_auto_compressor_container_network }} \
|
|
--env-file={{ matrix_synapse_auto_compressor_base_path }}/env \
|
|
{{ matrix_synapse_auto_compressor_postgres_image }} \
|
|
psql -h {{ matrix_synapse_auto_compressor_database_hostname }} \
|
|
<<_EOF
|
|
BEGIN;
|
|
|
|
DELETE
|
|
FROM state_compressor_state AS scs
|
|
WHERE NOT EXISTS
|
|
(SELECT *
|
|
FROM rooms AS r
|
|
WHERE r.room_id = scs.room_id);
|
|
|
|
DELETE
|
|
FROM state_compressor_state AS scs
|
|
WHERE scs.room_id in
|
|
(SELECT DISTINCT room_id
|
|
FROM state_compressor_state AS scs2
|
|
WHERE scs2.current_head IS NOT NULL
|
|
AND NOT EXISTS
|
|
(SELECT *
|
|
FROM state_groups AS sg
|
|
WHERE sg.id = scs2.current_head));
|
|
|
|
DELETE
|
|
FROM state_compressor_progress AS scp
|
|
WHERE NOT EXISTS
|
|
(SELECT *
|
|
FROM state_compressor_state AS scs
|
|
WHERE scs.room_id = scp.room_id);
|
|
|
|
COMMIT;
|
|
_EOF
|
|
|
|
# vim: ft=sh
|