Rocker chat version updating issue 4.8 to 6.4

Description

i have update version of rocket chat 4.8 to 6.4 on my self host server but my server cpu unexpectedly spikes , all cpu are consume by mongodb . and when i send file (images) on rocketchat uploads was failed but text message send smoothly .

Server Setup Information

  • Version of Rocket.Chat Server:
  • Operating System: ubuntu
  • Deployment Method: docker-compose
  • Number of Running Instances: 1 ( 8 gb cpu and 16 db RAM )
  • NodeJS Version: 14
  • MongoDB Version: 5.0

could you share some logs of mongo?

This is probably due to missing indexes on rocketchat_upload’s collection.

You could check your indexes with:

  1. connect to mongo:
    docker compose exec -it mongo mongo mongo/rocketchat
  2. Execute:
    db.rocketchat_uploads.getIndexes()

you should have something like this:

[
	{
		"v" : 2,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_"
	},
	{
		"v" : 2,
		"key" : {
			"name" : 1
		},
		"name" : "name_1",
		"sparse" : true
	},
	{
		"v" : 2,
		"key" : {
			"rid" : 1
		},
		"name" : "rid_1",
		"sparse" : true
	},
	{
		"v" : 2,
		"key" : {
			"uploadedAt" : -1
		},
		"name" : "uploadedAt_-1"
	},
	{
		"v" : 2,
		"key" : {
			"rid" : 1,
			"_hidden" : 1,
			"typeGroup" : 1
		},
		"name" : "rid_1__hidden_1_typeGroup_1"
	}
]

If not, you probably need to add new indexes or run migrations.

In case you have missing indexes, try creating this index.

db.rocketchat_uploads.chunks.createIndex( { files_id: 1, n: 1 }, { unique: true } )