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

RANGER-5104: Ranger Upgrade is failing while executing the PatchPreSql057_ForUpdateToUniqueGUID_J10052 #511

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

pradeepagrawal8184
Copy link
Contributor

What changes were proposed in this pull request?

Ranger SQL queries is selecting all columns which are not being used, The upgrade failed as 'gz_jsonData' column is not available during the PatchPreSql057_ForUpdateToUniqueGUID_J10052 execution.
gz_jsonData column values are not required for the PatchPreSql057_ForUpdateToUniqueGUID_J10052 hence rather selecting all columns only the required columns (id and name) of all records should be fetched.

How was this patch tested?

Retried the failing environment with this patch and same configuration. Upgrade completed successfully.

@kumaab
Copy link
Contributor

kumaab commented Jan 26, 2025

Verified that the issue is reproducible when upgrading from version 2.2.0 to 2.6.0, attached logs to the jira.

@kumaab
Copy link
Contributor

kumaab commented Jan 26, 2025

Verified that the patch works in fixing the upgrade path, tested on an upgrade from 2.2 to 2.6, ranger admin comes up fine.
However, there are some SQL Errors observed during upgrade (attached to the jira):

2025-01-26 05:21:57,804  [I] java patch PatchPreSql_057_ForUpdateToUniqueGUID_J10052 is being applied..
log4j:WARN No appenders could be found for logger (org.apache.ranger.patch.PatchPreSql_057_ForUpdateToUniqueGUID_J10052).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[EL Warning]: metadata: 2025-01-26 05:21:59.737--ServerSession(1899145692)--You have specified multiple ids for the entity class [org.apache.ranger.entity.view.VXXPrincipal] without specifying an @IdClass. By doing this you may lose the ability to find by identity, distributed cache support etc. Note: You may however use EntityManager find operations by passing a list of primary key fields. Else, you will have to use JPQL queries to read your entities. For other id options see @PrimaryKey.
[EL Warning]: 2025-01-26 05:22:00.705--UnitOfWork(1872258305)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: column "category" does not exist
  Position: 25
Error Code: 0
Call: SELECT id, ADDED_BY_ID, category, CREATE_TIME, datamask_options, def_id, item_id, label, name, sort_order, rb_key_label, rowfilter_options, UPDATE_TIME, UPD_BY_ID FROM x_access_type_def WHERE (def_id = ?) ORDER BY sort_order
bind => [1 parameter bound]
Query: ReadAllQuery(name="XXAccessTypeDef.findByServiceDefId" referenceClass=XXAccessTypeDef sql="SELECT id, ADDED_BY_ID, category, CREATE_TIME, datamask_options, def_id, item_id, label, name, sort_order, rb_key_label, rowfilter_options, UPDATE_TIME, UPD_BY_ID FROM x_access_type_def WHERE (def_id = ?) ORDER BY sort_order")
[EL Warning]: 2025-01-26 05:22:00.71--UnitOfWork(1872258305)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
Error Code: 0
Call: SELECT id, ADDED_BY_ID, CREATE_TIME, def_options, description, display_name, guid, impl_class_name, is_enabled, label, name, rb_key_description, rb_key_label, UPDATE_TIME, UPD_BY_ID, version FROM x_service_def WHERE (name = ?)
bind => [1 parameter bound]
Query: ReadAllQuery(name="XXServiceDef.findByName" referenceClass=XXServiceDef sql="SELECT id, ADDED_BY_ID, CREATE_TIME, def_options, description, display_name, guid, impl_class_name, is_enabled, label, name, rb_key_description, rb_key_label, UPDATE_TIME, UPD_BY_ID, version FROM x_service_def WHERE (name = ?)")
[EL Warning]: 2025-01-26 05:22:00.711--UnitOfWork(1872258305)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
Error Code: 0
Call: SELECT id, ADDED_BY_ID, CREATE_TIME, def_options, description, display_name, guid, impl_class_name, is_enabled, label, name, rb_key_description, rb_key_label, UPDATE_TIME, UPD_BY_ID, version FROM x_service_def WHERE (name = ?)
bind => [1 parameter bound]
Query: ReadAllQuery(name="XXServiceDef.findByName" referenceClass=XXServiceDef sql="SELECT id, ADDED_BY_ID, CREATE_TIME, def_options, description, display_name, guid, impl_class_name, is_enabled, label, name, rb_key_description, rb_key_label, UPDATE_TIME, UPD_BY_ID, version FROM x_service_def WHERE (name = ?)")
[EL Warning]: 2025-01-26 05:22:00.713--UnitOfWork(1872258305)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
Error Code: 0
Call: SELECT id, ADDED_BY_ID, CREATE_TIME, def_options, description, display_name, guid, impl_class_name, is_enabled, label, name, rb_key_description, rb_key_label, UPDATE_TIME, UPD_BY_ID, version FROM x_service_def WHERE (name = ?)
bind => [1 parameter bound]
Query: ReadAllQuery(name="XXServiceDef.findByName" referenceClass=XXServiceDef sql="SELECT id, ADDED_BY_ID, CREATE_TIME, def_options, description, display_name, guid, impl_class_name, is_enabled, label, name, rb_key_description, rb_key_label, UPDATE_TIME, UPD_BY_ID, version FROM x_service_def WHERE (name = ?)")
[EL Warning]: 2025-01-26 05:22:00.715--UnitOfWork(1872258305)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.12.v20230209-e5c4074ef3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
Error Code: 0

@kumaab kumaab requested a review from mneethiraj January 26, 2025 23:26
@pradeepagrawal8184 pradeepagrawal8184 merged commit 86b1bcd into master Jan 27, 2025
6 checks passed
asfgit pushed a commit that referenced this pull request Jan 27, 2025
…l057_ForUpdateToUniqueGUID_J10052 (#511)

* RANGER-5104: Ranger Upgrade is failing while executing the PatchPreSql057_ForUpdateToUniqueGUID_J10052

* Fix typo in db_setup.py

---------

Co-authored-by: Abhishek Kumar <[email protected]>
Change-Id: I214907b0487c1f38bf7e5854ea43810da8767c1c
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