-
Notifications
You must be signed in to change notification settings - Fork 94
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
Performance Improvement of create login in BBF #3291
Performance Improvement of create login in BBF #3291
Conversation
Signed-off-by: ANJU BHARTI <[email protected]>
467a273
to
4ae0999
Compare
Pull Request Test Coverage Report for Build 12581937147Details
💛 - Coveralls |
Signed-off-by: ANJU BHARTI <[email protected]>
Signed-off-by: ANJU BHARTI <[email protected]>
Signed-off-by: ANJU BHARTI <[email protected]>
Signed-off-by: ANJU BHARTI <[email protected]>
@@ -1,5 +1,4 @@ | |||
-- sla 180000 | |||
-- TODO: BABEL-5349 | |||
-- sla 55000 |
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.
let us also merge this fix in 17.2 & 16.7. This will help us skip creating before and after files for this test case.
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.
We will still need to create before file for version before 16.7 as it was failing for 16.1 and some other versions as well.
This commit can be cherry-picked into 16.7 and 17.2 branch as well.
Signed-off-by: ANJU BHARTI <[email protected]>
Signed-off-by: ANJU BHARTI <[email protected]>
memlist = SearchSysCacheList2(AUTHMEMROLEMEM, | ||
ObjectIdGetDatum(role), | ||
ObjectIdGetDatum(member)); | ||
for (int i = 0; i < memlist->n_members; i++) |
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.
let us not assume that memlist will be non-null, we should check for it and fallback to PG in case of null
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.
SearchCatCacheList
inside SearchSysCacheList2
ensures that memlist value should not be null as it allocates memory to memlist even if no entry matches in the search and assign memlist->n_members as 0.
And when memlist->n_members will be 0, this API will return false falling back to PG API.
Extension PR : babelfish-for-postgresql/babelfish_extensions#3291 In Major version 16 Babelfish introduced a new role bbf_admin_role which is a member of all the roles which created implicitly from TSQL. This increases the Load on any Grant/Revoke operations that happen since in BBF to "select the role through which it gets permission to current user to grant", is inefficient and loops over members of members to find the all members of the role even though the required role is find. This commit optimizes the selection of role with is_admin_option true for babelfish by escaping the search for any TSQL roles conditionally. Issues Resolved BABEL-5349
4602ff1
into
babelfish-for-postgresql:BABEL_5_X_DEV
…sql#507) Extension PR : babelfish-for-postgresql/babelfish_extensions#3291 In Major version 16 Babelfish introduced a new role bbf_admin_role which is a member of all the roles which created implicitly from TSQL. This increases the Load on any Grant/Revoke operations that happen since in BBF to "select the role through which it gets permission to current user to grant", is inefficient and loops over members of members to find the all members of the role even though the required role is find. This commit optimizes the selection of role with is_admin_option true for babelfish by escaping the search for any TSQL roles conditionally. Issues Resolved BABEL-5349
…sql#3291) Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#507 In Major version 16 Babelfish introduced a new role bbf_admin_role which is a member of all the roles which created implicitly from TSQL. This increases the Load on any Grant/Revoke operations that happen since in BBF to "select the role through which it gets permission to current user to grant", is inefficient and loops over members of members to find the all members of the role even though the required role is find. This commit optimizes the selection of role with is_admin_option true for babelfish by escaping the search for any TSQL roles conditionally. Signed-off-by: ANJU BHARTI <[email protected]> Issues Resolved BABEL-5349
Extension PR : babelfish-for-postgresql/babelfish_extensions#3291 In Major version 16 Babelfish introduced a new role bbf_admin_role which is a member of all the roles which created implicitly from TSQL. This increases the Load on any Grant/Revoke operations that happen since in BBF to "select the role through which it gets permission to current user to grant", is inefficient and loops over members of members to find the all members of the role even though the required role is find. This commit optimizes the selection of role with is_admin_option true for babelfish by escaping the search for any TSQL roles conditionally. Task: BABEL-5349 Signed-off-by: Anju Bharti <[email protected]>
Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#507 In Major version 16 Babelfish introduced a new role bbf_admin_role which is a member of all the roles which created implicitly from TSQL. This increases the Load on any Grant/Revoke operations that happen since in BBF to "select the role through which it gets permission to current user to grant", is inefficient and loops over members of members to find the all members of the role even though the required role is find. This commit optimizes the selection of role with is_admin_option true for babelfish by escaping the search for any TSQL roles conditionally. Task: BABEL-5349 Signed-off-by: ANJU BHARTI <[email protected]>
Description
Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#507
In Major version 16 Babelfish introduced a new role bbf_admin_role which is a member of all the roles which created implicitly from TSQL. This increases the Load on any Grant/Revoke operations that happen since in BBF to "select the role through which it gets permission to current user to grant", is inefficient and loops over members of members to find the all members of the role even though the required role is find.
This commit optimizes the selection of role with is_admin_option true for babelfish by escaping the search for any TSQL roles conditionally.
Without the changes the time taken to create a login increases drastically and linearly:
Flame graph :
The average time consumed by create login stmt(with 125 dbs and 125 logins present) : 12836 ms
with these changes we see the time taken to create login increasing linearly but not as drastically as it was before the changes:
Flame graph :
The average time consumed by create login stmt(with 125 dbs and 125 logins present) : 49 ms
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.