Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using Raven compare/exchange to ensure uniqueness #5

Closed
JudahGabriel opened this issue Jan 29, 2019 · 3 comments
Closed

Consider using Raven compare/exchange to ensure uniqueness #5

JudahGabriel opened this issue Jan 29, 2019 · 3 comments

Comments

@JudahGabriel
Copy link
Owner

JudahGabriel commented Jan 29, 2019

We're currently relying on unique doc IDs to ensure unique emails/usersnames.

That's fine for a single database, but may not work in a cluster. Thus, we should use Raven compare/exchange to ensure uniqueness.

If we do that, we probably will no longer need IdentityUsersByUserName.

@marcuslindblom
Copy link

Are you still considering to change this?

@JudahGabriel
Copy link
Owner Author

Yes. I'll see if I can make this happen this week.

@JudahGabriel
Copy link
Owner Author

JudahGabriel commented Mar 21, 2019

Implemented. RavenDB.Identity v6, which is now on NuGet, uses compare/exchange to ensure email address uniqueness across clusters.

This has two side-effects, one good and one bad:

  • The good: We no longer store 2 entities per user; IdentityUserByUserName is obsolete. You can safely delete this collection.
  • The bad: If you were using a previous version of RavenDB.Identity and you're upgrading to v6 or later, you must call UserStore<AppUser>.MigrateToV6(docStore). Note that the method can take several minutes to run if you have thousands of users. Failure to do so will result in your users not being able to login. The MigrateToV6 method creates a compare/exchange value for each email address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants