-
Notifications
You must be signed in to change notification settings - Fork 17
fix: isolation level and primary user reservation #288
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
base: master
Are you sure you want to change the base?
Changes from all commits
e5dcad6
0125d22
3234b87
ad7d6b2
0f48674
2930e09
98582a7
854a1a3
b6b5b2c
27f3ded
4c211e0
768ecb1
c33b8d5
df5c584
0d4cd8d
e2868b1
ae89e02
854414b
5e69e02
a050582
2f3490f
cc411fb
a135aac
bae0bc6
77ec671
5edff93
4b2a0c6
0675cd7
e86ed96
e9019bc
21b3043
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright (c) 2020, VRAI Labs and/or its affiliates. All rights reserved. | ||
| * | ||
| * This software is licensed under the Apache License, Version 2.0 (the | ||
| * "License") as published by the Apache Software Foundation. | ||
| * | ||
| * You may not use this file except in compliance with the License. You may | ||
| * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.supertokens.storage.postgresql; | ||
|
|
||
| public class LockFailure extends Exception { | ||
| public LockFailure() { | ||
| super("Failed to acquire advisory lock"); | ||
| } | ||
|
|
||
| public LockFailure(String message) { | ||
| super(message); | ||
| } | ||
| } |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -243,6 +243,10 @@ public static void overwriteTenantConfig(Start start, TenantConfig tenantConfig) | |
| Connection sqlCon = (Connection) con.getConnection(); | ||
| { | ||
| try { | ||
| { | ||
| io.supertokens.storage.postgresql.queries.Utils.takeAdvisoryLock( | ||
| sqlCon, tenantConfig.tenantIdentifier.getConnectionUriDomain() + "~" + tenantConfig.tenantIdentifier.getAppId() + "~" + tenantConfig.tenantIdentifier.getTenantId()); | ||
| } | ||
|
Comment on lines
+246
to
+249
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this? What do we want to achieve with this here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tenant information is updated by deleting all existing information and then re-adding it (across multiple tables). we do not want any parallel createOrUpdate for a given tenant. |
||
| { | ||
| String QUERY = "DELETE FROM " + getConfig(start).getTenantConfigsTable() | ||
| + " WHERE connection_uri_domain = ? AND app_id = ? AND tenant_id = ?;"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO