Skip to content

RANGER-5463: Update userstore version after group-user mapping changes in createOrDeleteXGroupUserList - #824

Closed
kimsehwan96 wants to merge 2 commits into
apache:masterfrom
kimsehwan96:RANGER-5463
Closed

kimsehwan96 wants to merge 2 commits into
apache:masterfrom
kimsehwan96:RANGER-5463

Conversation

@kimsehwan96

@kimsehwan96 kimsehwan96 commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Added missing updateUserStoreVersion() call in XUserMgr.createOrDeleteXGroupUserList().

Without this fix, when user-group membership changes in LDAP (e.g., a user is added to or removed from a group), the
UserSync successfully updates the x_group_users table in Ranger Admin, but the RangerUserStore version remains unchanged.

Other similar methods like createXGroupUserFromMap() and createOrUpdateXGroups() already call updateUserStoreVersion() after modifying user/group data.

How was this patch tested?

  • Built locally and deployed to a test environment
  • Configured UserSync with LDAP source / Added user to a group in LDAP / Verified userstore version increments after sync

@@ -2964,6 +2964,9 @@ public int createOrDeleteXGroupUserList(List<GroupUserInfo> groupUserInfoList) {

updatedGroups = groupUserInfoList.size();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at implementation of xGroupUserService.createOrDeleteXGroupUsers(), no update might be performed in some scenarios - depending on contents of parameter groupUserInfo. I suggest updating this method to return true when it performs any update and use that to increment updatedGroups.

@kimsehwan96 kimsehwan96 Jan 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mneethiraj Changed xGroupUserService.createOrDeleteXGroupUsers() method to return boolean. If the method early returned with no actual updates then return false and If actual update was performed then return true.

And increment updatedGroups and return its count as createOrDeleteGroupUserList return and if at lease one update was really performed then update user store version.

Alos I added test code about it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, returning boolean with name createOrDeleteXGroupUsers might be little awkward

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mneethiraj Can you review this? Thanks.

@horvatic

horvatic commented Mar 9, 2026

Copy link
Copy Markdown

Is there a work around for this? It looks like I am getting hit by this bug

@mneethiraj

mneethiraj commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

Thank you @kimsehwan96 for reporting this issue and the fix.

Merged in master & ranger-2.9 branches.

@mneethiraj mneethiraj closed this Apr 6, 2026
@horvatic

Copy link
Copy Markdown

Just for anyone using 2.7 or 2.8 trying to find a work around

We made a DB trigger on public.x_ugsync_audit_info to update x_ranger_global_state

We add one to the RangerUserStore which can be found under state_name

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

Successfully merging this pull request may close these issues.

3 participants