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

How can we have distributed locks so that NoSQL databases can have login functionality? #91

Open
rishabhpoddar opened this issue Oct 29, 2020 · 1 comment
Labels
question Further information is requested

Comments

@rishabhpoddar
Copy link
Contributor

rishabhpoddar commented Oct 29, 2020

❓ Questions and Help

  • Ask the user to have a SQL database only used for advisory locking
  • Use another service like redis for locks only.
  • This would require an interface for locks to be provided by the core so that the APIs can use them
  • Is there a way to build your own locks across the SuperTokens cluster?

This issue is related to: supertokens/supertokens-plugin-interface#3

@rishabhpoddar
Copy link
Contributor Author

rishabhpoddar commented Apr 27, 2021

Essentially locking can be achieved by consensus across cores. We can achieve consensus by having an ordered queue in the database (using ordered UUIDs). Core1 would insert some UUID, Core2 would insert something else. They both would read both the UUIDs, and order them, and if Core1's UUID is "first", then Core1 knows it is the winner.

  • This approach may not work since core1 can generate a UUID whose value is lesser than core2's UUID, but end up writing that value in the db much later than core2. This could lead to core2 having read that it's the only one who has inserted a UUID and then both will take a lock.

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

No branches or pull requests

1 participant