Index error after update RocketChat Version 7.0.0 to 7.1.0
Description:
In the Mongo DB exist in Version 7.0.0 an index which can not changed in the update procedure to version 7.1.0
Some indexes for collection 'rocketchat_user_data_files' could not be created: Error: An existing index has the same name as the requested index. When index names are not specified, they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1" }
Steps to reproduce:
-
Install RocketChat Version 7.0.0 with Mongo in an Docker Container (my Rocket Version 7.0.0 has a Update History from Version 6)
-
Make an Update to the RocketChat 7.1.0 Container (docker compose update -d)
-
I have in the startup log from the RocketChat Container the Error
Some indexes for collection 'rocketchat_user_data_files' could not be created: An existing index has the same name as the requested index. When index names are not specified, they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1" }
Expected behavior:
Normal Startup from the RocketChat Container without this message. It ist a problem in the Indexmodel in Mogo Database from RocketChat Schema.
Actual behavior:
Server Setup Information:
-+---------------------------------------------------------+ | SERVER RUNNING | +---------------------------------------------------------+ | | | Rocket.Chat Version: 7.1.0 | | NodeJS Version: 20.18.0 - x64 | | MongoDB Version: 7.0.7 | | MongoDB Engine: wiredTiger | | Platform: linux | | Process Port: 3000 | | Site URL: https://rocketchat.xxxx.de | | ReplicaSet OpLog: Enabled | | Commit Hash: 73af9c5375 | | Commit Branch: HEAD | | | +---------------------------------------------------------+
Additional context
Relevant logs:
Full Startup Process
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/count" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/offset" (strictTypes)
(node:1) NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode.
SDK releases are limited to address critical bug fixes and security issues only.
Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the blog post at https://a.co/cUPnyil
(Use node --trace-warnings ... to show where the warning was created)
Some indexes for collection 'rocketchat_user_data_files' could not be created:
An existing index has the same name as the requested index. When index names are not specified, they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1" }
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
2024-12-06T13:46:47.604Z 40 pid=1 hostname=2e57b0365cd5 name=VoIPAsteriskService msg=Voip is not enabled. Cant start the service
2024-12-06T13:46:47.858Z 51 pid=1 hostname=2e57b0365cd5 name=Migrations msg=Not migrating, already at version 318
[2024-12-06T13:46:47.892Z] INFO e74b1b66-9d09-4ce7-9ebd-5faf8e1bc57d/BROKER: Moleculer v0.14.35 is starting...
[2024-12-06T13:46:47.907Z] INFO e74b1b66-9d09-4ce7-9ebd-5faf8e1bc57d/BROKER: Namespace:
ufs: temp directory created at "/tmp/ufs"
+---------------------------------------------------------+ | SERVER RUNNING | +---------------------------------------------------------+ | | | Rocket.Chat Version: 7.1.0 | | NodeJS Version: 20.18.0 - x64 | | MongoDB Version: 7.0.7 | | MongoDB Engine: wiredTiger | | Platform: linux | | Process Port: 3000 | | Site URL: https://rocketchat.xxxx.de | | ReplicaSet OpLog: Enabled | | Commit Hash: 73af9c5375 | | Commit Branch: HEAD | | | +---------------------------------------------------------+
2024-12-06T13:46:50.332Z 51 pid=1 hostname=xxx name=License msg=License installed version=3.0 hash=xxx
Hey, i have look in Mongo with mongo express an have made a screenshot from the index from the collection rocketchat_user_data_files.
Hey, can i do an Index workaroud on mongo-db manually ? :-) db.collectionName.dropIndex("indexName") db.collection.createIndex({ feldName: 1 }, { sparse: true })
Yeah getting the same error now..if users signed out, they can not sign in.
Signout/SignIn with the Browser and iOS App Login works in my enviroment. I Must add that i have less user with Little Chat data
Just drop the indexes.
The system will create as required.
Hey, now i have drop the Index.
When start rocket the same message ???!!!
(Use node --trace-warnings ... to show where the warning was created)
Some indexes for collection 'rocketchat_user_data_files' could not be created:
Index build failed: 155dba15-245c-4aa7-8cb3-392b1bde8990: Collection rocketchat.rocketchat_user_data_files ( e3e15cfc-88e6-4864-b001-de96d71af24c ) :: caused by :: index build on empty collection failed: 155dba15-245c-4aa7-8cb3-392b1bde8990 :: caused by :: An existing index has the same name as the requested index. When index names are not specified, they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1" }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true }
Can you send me the right create index statement ?
LocalStore: store created at
hey, i have test an initial setup.
- I setup an empty mongodb in an container (docker compose...)
- i setup rocketchat in an container (docker compose..)
- Index failure in startup when i make an initial setup !!
trict mode: use allowUnionTypes to allow union type keyword at "#/properties/count" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/offset" (strictTypes)
(node:1) NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode.
SDK releases are limited to address critical bug fixes and security issues only.
Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the blog post at https://a.co/cUPnyil
(Use node --trace-warnings ... to show where the warning was created)
Some indexes for collection 'rocketchat_user_data_files' could not be created:
An existing index has the same name as the requested index. When index names are not specified, they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1" }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true }
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
2024-12-09T09:39:01.430Z 40 pid=1 hostname=4b78f216a426 name=VoIPAsteriskService msg=Voip is not enabled. Cant start the service
[2024-12-09T09:39:09.585Z] INFO 3a2118d0-1c8c-4620-aeb9-05e62d30a9c4/BROKER: Moleculer v0.14.35 is starting...
[2024-12-09T09:39:09.586Z] INFO 3a2118d0-1c8c-4620-aeb9-05e62d30a9c4/BROKER: Namespace:
| ReplicaSet OpLog: Enabled |
| Commit Hash: 73af9c5375 |
| Commit Branch: HEAD |
| |
+---------------------------------------------------+
This are the installed collections. I see no collection 'rocketchat_user_data_files'. This are the setup initial collections in mongo !! _queue _raix_push_app_tokens instances meteor_accounts_loginServiceConfiguration meteor_oauth_pendingCredentials meteor_oauth_pendingRequestTokens migrations omnichannel_auto_close_on_hold_scheduler omnichannel_queue_inactivity_monitor omnichannel_scheduler pbx_events rocketchat__trash rocketchat_analytics rocketchat_apps_persistence rocketchat_apps_scheduler rocketchat_avatars rocketchat_avatars.chunks rocketchat_avatars.files rocketchat_banner rocketchat_banner_dismiss rocketchat_calendar_event rocketchat_credential_tokens rocketchat_cron rocketchat_cron_history rocketchat_custom_emoji rocketchat_custom_sounds rocketchat_custom_user_status rocketchat_email_inbox rocketchat_email_message_history rocketchat_export_operations rocketchat_federation_keys rocketchat_federation_room_events rocketchat_federation_servers rocketchat_import rocketchat_import_data rocketchat_integration_history rocketchat_integrations rocketchat_livechat_agent_activity rocketchat_livechat_business_hours rocketchat_livechat_contact rocketchat_livechat_custom_field rocketchat_livechat_department rocketchat_livechat_department_agents rocketchat_livechat_inquiry rocketchat_livechat_priority rocketchat_livechat_trigger rocketchat_livechat_visitor rocketchat_matrix_bridged_rooms rocketchat_matrix_bridged_users rocketchat_message rocketchat_message_reads rocketchat_notification_queue rocketchat_nps rocketchat_nps_vote rocketchat_oauth_access_tokens rocketchat_oauth_apps rocketchat_oauth_auth_codes rocketchat_oauth_refresh_tokens rocketchat_oembed_cache rocketchat_omnichannel_service_level_agreements rocketchat_permissions rocketchat_read_receipts rocketchat_roles rocketchat_room rocketchat_server_events rocketchat_sessions rocketchat_settings rocketchat_statistics rocketchat_subscription rocketchat_team rocketchat_team_member rocketchat_uploads rocketchat_video_conference rocketchat_webdav_accounts rocketchat_workspace_credentials users
Send this Info to the development, the collection does not create in the initail setup ?? Do you have the right connections, otherwise I will do it :-)
Not exactly sure why I got a thumbs down?
I'm stating a fact. Normally if you have a duplicate index you can just drop them and the system will re-create as required.
You also gave yourself a thumbs down. Perhaps you ought to go back and undo those?
Can you send me the right create index statement ?
You don't need one as per the above. They system attempts to create them itself.
I see no collection 'rocketchat_user_data_files'
Likely the issue. I think this collection holds information when a user requests a copy of their personal information. So it is probably nor created until first use. And so it will complain about failing to create an index on a non-existent collection.
Effectively it is log noise but I will refer it to the team, though I don't expect it will be high on the priority list.
NB: if you see this your server is essentially up and running happily.
+---------------------------------------------------+
| SERVER RUNNING |
+---------------------------------------------------+
| |
| Rocket.Chat Version: 7.1.0 |
Yes, the Server is running and working. Thats great. I am an Rocket Fan. Thanks for your fast reaction. Let us see what the Development do. I am an a Developer, too and i know this problems :-)
Thats funny. I have create the Index manually and restart rocket container
db.rocketchat_user_data_files.createIndex( { userId: 1 }, // Index-Schlüssel { name: "userId_1", sparse: true, v: 2 } // Optionen );
Than the output is:
Some indexes for collection 'rocketchat_user_data_files' could not be created: An existing index has the same name as the requested index. When index names are not specified, they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1" }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true } LocalStore: store created at
what ? sparse: true or not :-)
Info from top: Please refer to our documentation. Requested index: { v: 2, key: { userId: 1 }, name: "userId_1", sparse: true }, existing index: { v: 2, key: { userId: 1 }, name: "userId_1" }
Orginalindexes after Migration for this collection
{"indexes":[ {"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"id"}, {"v":{"$numberInt":"2"},"key":{"rid":{"$numberInt":"1"}},"name":"rid_1","sparse":true}, {"v":{"$numberInt":"2"},"key":{"userId":{"$numberInt":"1"}},"name":"userId_1"}, {"v":{"$numberInt":"2"},"key":{"name":{"$numberInt":"1"}},"name":"name_1","sparse":true}, {"v":{"$numberInt":"2"},"key":{"expiresAt":{"$numberInt":"1"}},"name":"expiresAt_1","sparse":true}]," uuid":"e3e15cfc88e64864b001de96d71af24c","collectionName":"rocketchat_user_data_files","type":"collection"}
I have create the Index manually and restart rocket container
You do not need to do that - the system does it automatically.
As I have described this is likely an error due to the collection not being created initially. It is probably only created on first use. But the system is trying to create an index immediately.
If you try and export user data you will probably find the collection is created and you can then drop the index on that collection, restart and let the server create new indexes.
There is nothing much else to do here - I have reported it o the team.
Thank You. I hope i can help with my informations.
I don't think so. We have two Bug Szenarios in my issues.
- Upgrade from Rocket Version 7.0.0 to 7.1.0
- Initial Setup from zero to Version 7.1.0
Possible two Bugs one cause. first the Index Creation and second the Collation creation in initial setup. I belive this is a Failure from the Index Creation BUG and then the Collation was not create.
Only the Code says the True :-)
We have two Bug Scenarios in my issues
I have already told you the likely underlying cause. The collection not being created on installation. And the index fails to be created thereafter.
I have also referred it to the development team so there is no need to comment endlessly about it. See what they say.
Of course if you have a solution they will be happy to look at your PR.
Thanks.
Will share with internal teams
hey guys,
I was able to reproduce the behavior on my end and can confirm that there is a problem with the collection creation starting from version 7.1.0
we will be working on a fix and will update this thread with progress as we address it
@thokich - thank you for bringing this to our attention
RocketChat Team - please refer to ARCH-1393 while solving this issue