[bug] restoring db cant call activity_visibility from trigger #440
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#440
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Your setup
From source
Extra details
compiling things from a custom dockerfile which is similiar to the original one in the repo
Version
d782140e2b
PostgreSQL version
15
What were you trying to do?
When i restore the db from postgres 12 to 15 i get the following issue:
I checked the db, the function is the same as in
https://git.pleroma.social/pleroma/pleroma/-/blob/develop/priv/repo/migrations/20200508092434_update_counter_cache_table.exs
https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/priv/repo/migrations/20200508092434_update_counter_cache_table.exs
Also asked FloatingGhost about this:
11:46:37 h. hm that's unusual
11:46:50 but it's probably fine - provided it restored all of your rows it's probably fine though
11:47:18 just run a quick count(*) over activities and objects, if the function exists and the count is right you're probably good
11:53:58 yes it did, it restored all the things
11:54:14 just a bit worried that the trigger wont work anymore
11:58:01 the counter isn't very important, even if it were to break you wouldn't notice
What did you expect to happen?
not giving that error on restoring backups
What actually happened?
it restores everything except that it also throws this error
Logs
Severity
I can manage
Have you searched for this issue?
to document the issue properly and in case others are unsure:
12:19:45 if you're interested, all the counter does is like... fill in an admin endpoint
12:19:59 which i don't think is used anywhere
shit, i checked the wrong db, no it didnt import activities
this happens if someone uses plain pg_dump and psql, gona test out https://docs.akkoma.dev/develop/administration/backup/#backup now...
Ok, here is the deal and why it is important
According to the official Documentation (https://docs.akkoma.dev/develop/administration/backup/#backup) one should restore the backup at once.
But this way has some issues to big instances:
https://blog.freespeechextremist.com/blog/activities-visibility-index-slowness.html
TLDR: because it doesnt restore a specific index, the creation of the activities-visibility index is really really slow.
If you restore it, as in the blog recommended (schema first then data) you will get this issue which i documented here (the format of the dump doesnt matter).
So for larger instances there is basically only one way to restore their data:
CREATE INDEX CONCURRENTLY tmp_apid_follower_address ON users USING btree (ap_id, COALESCE(follower_address, ''::character varying));
note 3 on the restore options note that
y'know... Maybe it's a bit dirty, but what if we rename an index so it's not even an issue any more? If I'm not mistaken, the indexes are listed alphabetically, so changing the name could change the order of the indexes. Even with the note in the docs, I'm still seeing people struggle with it. I assume you normally let Ecto handle the naming, so I'm unsure if there'll be unintended side effects, but otherwise maybe worth a shot.
please forgive me, i am bad at reading instructions
ah i forgot to close this after the PR that closes it, closing now