Skip to content

RANGER-5696: Added deltaSyncServerType config to optimize delta sync … - #1218

Open
krishnamuttevi wants to merge 2 commits into
apache:masterfrom
krishnamuttevi:RANGER-5696
Open

RANGER-5696: Added deltaSyncServerType config to optimize delta sync …#1218
krishnamuttevi wants to merge 2 commits into
apache:masterfrom
krishnamuttevi:RANGER-5696

Conversation

@krishnamuttevi

Copy link
Copy Markdown
Contributor

Summary: Add configuration property to optimize AD/LDAP delta sync search filters

Description:
Currently, Ranger Usersync uses an OR conditional query containing both modifyTimeStamp and uSNChanged attributes to detect changes during delta syncs. According to customer feedback, executing a search query with both attributes combined negatively affects Active Directory (AD) performance. At present, this behavior is hardcoded by design and cannot be configured to use only the environment-specific attribute (such as uSNChanged for AD).

Changes:
Introduced a new configuration property (e.g., ranger.usersync.ldap.deltasync.servertype) to allow administrators to specify the directory server type and optimize the search query:

When set to ad: The delta sync query uses only the uSNChanged attribute.

When set to ldap: The delta sync query uses only the modifyTimestamp attribute.

When empty or unset: Falls back to the existing OR-combined filter to ensure backward compatibility.

Impact:
Improves Active Directory search performance and reduces query overhead by eliminating complex OR conditions and avoiding unsupported attribute queries. There is no behavioral change or impact on existing deployments unless the new property is explicitly configured.

Testing:

  • Verified delta sync works correctly against Active Directory when the property is configured as ad.

  • Verified delta sync works correctly against OpenLDAP when the property is configured as ldap.

  • Verified legacy backward compatibility behaves as expected (using the OR conditional) when the property is not configured.

  • Tested the performance by synchronizing ~1.14 million users. With the optimized ad configuration, the sync process completed 1 minute faster compared to the default OR-combined filter.

return groupSearchFirstEnabled;
}

public String getDeltaSyncServerType() {

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.

I don't think we need this method. Instead have this logic in LdapUserGroupBuilder.java

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.

Thanks for suggestion, I have removed the function and added the logic in LdapUserGroupBuilder.java


if (config.isDeltaSyncEnabled()) {
extendedUserSearchFilter = "(objectclass=" + userObjectClass + ")(|(uSNChanged>=" + deltaSyncUserTime + ")(modifyTimestamp>=" + deltaSyncUserTimeStamp + "Z))";
if ("ad".equalsIgnoreCase(deltaSyncServerType)) {

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.

Add a private method that returns extendedUserSearchFilter value and move the below logic there.

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.

I have updated the logic and added the private method getDeltaSyncFilter()

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.

2 participants