Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only one configuration should exist per service
- Loading branch information
1 parent
759510a
commit 831bd3f
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/service-configuration/service_configuration_server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Only one configuration should ever exist for each service. | ||
// A unique index helps avoid various race conditions which could | ||
// otherwise lead to an inconsistent database state (when there are multiple | ||
// configurations for a single service, which configuration is correct?) | ||
try { | ||
ServiceConfiguration.configurations._ensureIndex( | ||
{ "service": 1 }, | ||
{ unique: true } | ||
); | ||
} catch (err) { | ||
console.error( | ||
"The service-configuration package persists configuration in the " + | ||
"meteor_accounts_loginServiceConfiguration collection in MongoDB. As " + | ||
"each service should have exactly one configuration, Meteor " + | ||
"automatically creates a MongoDB index with a unique constraint on the " + | ||
" meteor_accounts_loginServiceConfiguration collection. The " + | ||
"_ensureIndex command which creates that index is failing.\n\n" + | ||
"Meteor versions <= 1.0.3.1 did not create this index. If you recently " + | ||
"upgraded and are seeing this error message for the first time, please " + | ||
"check your meteor_accounts_loginServiceConfiguration collection for " + | ||
"multiple configuration entries for the same service and delete " + | ||
"configuration entries until there is no more than one configuration " + | ||
"entry per service.\n\n" + | ||
"If the meteor_accounts_loginServiceConfiguration collection looks " + | ||
"fine, the _ensureIndex command is failing for some other reason.\n\n" + | ||
"For more information on this history of this issue, please see " + | ||
"https://github.com/meteor/meteor/pull/3514.\n" | ||
); | ||
throw err; | ||
} |