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

Apply select with update lock only for MSSQL for updatePropertyWithID method #4048

Draft
wants to merge 1 commit into
base: 4.10.x
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,13 @@ protected void updatePropertyWithID(Connection dbConnection, String userID, Stri
throw new UserStoreException("The sql statement for add user property sql is null.");
}

// Select and update lock the rows to be updated in a particular order before the actual update operation to
// prevent the deadlock scenario.
// Currently, this issue is only reproduced in SQL Server.
if (isMSSQLDB(dbConnection)) {
selectRowsForUpdate(dbConnection, userID);
}

if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) {
updateStringValuesToDatabase(dbConnection, sqlStmt, value, userID, tenantId, propertyName, profileName,
tenantId);
Expand Down