Update to v5.0.4 failing with indexes errors

Description

We were running an outdated version v3.18.1 on our CentOS 7 server deployed manually. Today when we tried to update to the latest v5.0.4, the rocketchat service throwing below errors and getting failed when we start the service.

systemd[1]: Started The Rocket.Chat server.
rocketchat[32389]: Some indexes for collection 'rocketchat_integration_history' could not be created:
rocketchat[32389]: Index with name: _updatedAt_1 already exists with different options
rocketchat[32389]: Some indexes for collection 'rocketchat_nps_vote' could not be created:
rocketchat[32389]: Index with name: npsId_1_identifier_1 already exists with different options
systemd[1]: rocketchat.service: main process exited, code=killed, status=11/SEGV
systemd[1]: Unit rocketchat.service entered failed state.

The MongoDB was updated to v4.2 which is compatible with this RC version as per release data. Since this is a major version update, I think there could be some DB level changes in past versions, and not sure about these index errors thrown in Systemd. Could someone shed some light on this or let me know the solution to apply.

Server Setup Information

  • Version of Rocket.Chat Server: 5.0.4
  • Operating System: CentOS 7
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: yes
  • NodeJS Version: 14.19.3
  • MongoDB Version: 4.2
  • Proxy: Apache
  • Firewalls involved: No

As mentioned here 4.4.0 Upgrade: Error creating index: users -> { bio: 1 } · Issue #24347 · RocketChat/Rocket.Chat · GitHub , I tried dropping those indexes using:

mongo
use rocketchat
db.rocketchat_integration_history.dropIndexes()
db.rocketchat_nps_vote.dropIndexes()

Now these are not showing while restarting RC service, however, it is still getting failed without any errors in logs.

Aug 27 15:21:10  systemd[1]: Started The Rocket.Chat server.
Aug 27 15:21:24  systemd[1]: rocketchat.service: main process exited, code=killed, status=11/SEGV
Aug 27 15:21:24  systemd[1]: Unit rocketchat.service entered failed state.
Aug 27 15:21:24  systemd[1]: rocketchat.service failed.

Any idea?

Hi! Welcome back :slight_smile:

You should not go directly from 3.X to 5.X. While upgrading, don’t skip majors.

My suggestion:

  • Setup a docker instance, with the same version you are running.
  • Backup production
  • Restore in the same version docker deployment.
  • Start migrating, not skipping majors.

Let me know if this helps!

Thanks!