I updated retention days to 30 "SENTRY_EVENT_RETENTION_DAYS " in both .env and sentry.conf.py. However when I restart the sentry-cleanup service I still see that it is using the default 90 days.
Found the solution. After updating the SENTRY_EVENT_RETENTION_DAYS .env file I have to run docker compose again so the changes are applied by stopping and recreating the container.
docker-compose up -d sentry-cleanup
In any case I don’t understand why we have SENTRY_EVENT_RETENTION_DAYS in sentry.conf.py if the change is no applied by that script.
The script does not use the configuration variable and instead accepts a command line argument. The reason is you can run cleanup with many different parameters. This is why we united them under the env variable which we can share.
That said, if you think it should default to that value, you can submit a PR to Sentry first and then to the on-premise repo to remove the env variable.
The cleanup script ran last night successfully however I noticed that the size on disk never goes down. Looking at the tables in the database the ‘nodestore_node’ table keeps growing. In the past two days it has grown from 575 GB to 590 GB. It does not seem to go down in size even after cleanup. Does one of the other options help clean this table? We do not have infinite storage and would like to see this table stabilise however for the past several months it keeps growing.
It seems the solution provided in the trouble shooting guide needs to be updated. As it does not work as expected. The pg_repack command fails with an error
$ docker-compose run -T postgres bash -c "apt update && apt install -y --no-install-recommends postgresql-9.6-repack && su postgres -c 'pg_repack -E info -t nodestore_node'"
ERROR: pg_repack failed with error: pg_repack 1.3.4 is not installed in the database
ERROR: 20
To fix this issues I added the extension to the database.
Then I reran the pg_repack for nodestore and got a different error.
$ docker-compose exec postgres bash -c "su postgres -c 'pg_repack -E info -t nodestore_node'"
INFO: repacking table "nodestore_node"
ERROR: query failed: ERROR: unexpected index definition: CREATE INDEX nodestore_node_timestamp_a6fca047 ON public.nodestore_node USING btree ("timestamp") TABLESPACE pg_default
DETAIL: query was: SELECT indexrelid, repack.repack_indexdef(indexrelid, indrelid, $2, FALSE) FROM pg_index WHERE indrelid = $1 AND indisvalid
ERROR: 254
It seems that this version of pg_repack is not able to parse schema qualified indexdef. See link below for details.
The solution was to install a newer version of pg_repack. For me postgresql-9.6-repack_1.4.7-1 worked. After installing this version I was able to run repack to free up space.
docker-compose run -exec postgres bash -c "su postgres -c 'pg_repack -E info -t nodestore_node'"
The above command runs in the existing postgres service. I think the document should be updated inline with my finding. We have version 20.11.1 4468076 of selfhosted Sentry.