Mattermost, Inc.

Mattermost integrity check by CLI

Hello everybody,
I recently moved our Mattermost server into a DockerContainer and changed the database (from MySQL to Postgres)
I made a mistake which I have already corrected.
The CLI was a great help as I used mattermost integrity --verbose to find out where I had to manually repair things.
The integrity check also shows me problems that appear to have nothing to do with my migration.
It marks items in the fileinfo and channels tables that seem to point at the wrong parent.

It looks like this:

Found 74 records in relation FileInfo orphans of relation Posts
  Child xyzxyzxzyxzyxzyxzy (FileInfo.Id) has empty ParentIdAttr (FileInfo.PostId)

Found 220 records in relation Channels orphans of relation Teams
  Child abcabcabcabcabcabc (Channels.Id) has empty ParentIdAttr (Channels.TeamId)

I looked up the corresponding items in the db. The fileinfo items seem to belong to posts that have been manually deleted (left join results in empty post) and I have no clue what is wrong with the channels items. It has severaly channel entries with an empty teamid. I only have one team in my installation and that did never change.
Is this something I have to worry about?

And if not, why does the integrity check show these as orphaned?

Thanks in advance,
Andreas

What Mattermost server version are you on?

I’m running version 5.22.0

@paulrothrock Could someone on support team take a look at this?

1 Like

Hi, Andreas!

I had a discussion with the team on this in the Ask R&D channel about this. I asked the following questions:

  1. May I know what is causing the orphans to occur?
  2. What can I do to optimize the database schema integrity?

According to @streamer45:

  1. That depends. It usually happens when entries are manually deleted from the DB. We don’t enforce foreign keys constraints so you won’t get an error if you delete a record that has other records referencing it.
  2. First of all I would try to figure out the cause of the integrity failures. Whether it was manual deletion, some external script that has write access to the db or even mattermost itself (in which cause it would most probably be a bug).

Feel free to join the discussion if you have more questions about this. Thanks.

Thank you.
I replied to your last comment and added some details to “orphaned” channels.
At least those seem to be a bug

I’m not sure how the R&D Team works there.
Would it be better to create a new post that can be replied to?

Bug ticket here: https://mattermost.atlassian.net/browse/MM-25023

1 Like