Reindex after data loss?
-
We lost a bunch of, but not all, recent keys in the database. The result is that clicking on a thread tries to lead you to a post that isn't there and thus you land at the first post of a potentially 20k post thread. Is there a way of sanitizing this and removing links that link to posts that don't exist? If not, how do I do it manually? Go over all notifications and remove those that link to a non-existing post?
Thanks! -
It sounds like you need to set the user topic bookmarks, this controls how far a user has a read a topic and then lets them click on the title of a topic and go to where they left off. You can go through the topics and set the value of
tid:${tid}:bookmarks
. Each topic has one of this sorted set, the value stored is the uid of the user and the score is the number of posts they have read in that topic.For example you can if a topic has 20 posts and the user has read them all you can set it with
db.sortedSetAdd(
tid:${tid}:bookmarks, 20, uidOfUser)
-
Incredibly stupid user error, so I don't think this is actionable on your side.
Accidentally erased a part of the redis database while trying to find ways to speed it up. Found a webpage talking about memory optimization saying that you can set the order in which "cache keys are invalidated" by setting maxmemory-policy to allkeys-lru through the cli. So I did that, only after a quarter of the forum went away did I read the actual manual which didn't talk about invalidation of cache keys but deletion of database keys...
The backup we had was a few months old (as I wasn't planning to do anything to the database here), so I couldn't restore it, but I could calculate the diff of keys and import all the keys in the diff.