-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/75210/#review226941
-----------------------------------------------------------




security-admin/src/main/java/org/apache/ranger/patch/PatchForTrxLogV2Migration_J10064.java
Lines 40 (patched)
<https://reviews.apache.org/r/75210/#comment315224>

    Instead of migration as a patch during Ranger admin startup, I suggest to 
make this available as a separate utility that can be run from command-line.
    
    1) Migration will likely take a long time in deployments having large 
number of entries in x_trx_log table. Ranger admin startup should not be held 
until migration is completed.
    2) Migration might be run in multiple phases, from most recent period to 
earlier times.



security-admin/src/main/java/org/apache/ranger/patch/PatchForTrxLogV2Migration_J10064.java
Lines 101 (patched)
<https://reviews.apache.org/r/75210/#comment315222>

    atTime(23, 59, 59, 999999999)



security-admin/src/main/java/org/apache/ranger/patch/PatchForTrxLogV2Migration_J10064.java
Lines 113 (patched)
<https://reviews.apache.org/r/75210/#comment315220>

    To monitor the migration, please add following log statements:
    
    logger.info("Found {} transactions to migrate", uniqueTrxIdList.size());
    
    int idx = 0;
    for (String trxId : uniqueTrxIdList) {
      createTransactionLogByTrxId(trxId);
      
      idx++;
      
      if (idx % 1000 == 0) {
        logger.info("PROGRESS: {} of {} transactions migrated", idx, 
uniqueTrxIdList.size());
      }
    }



security-admin/src/main/java/org/apache/ranger/patch/PatchForTrxLogV2Migration_J10064.java
Lines 124 (patched)
<https://reviews.apache.org/r/75210/#comment315221>

    trxLogsV2 could be null. Please update to handle this case.



security-admin/src/main/java/org/apache/ranger/patch/PatchForTrxLogV2Migration_J10064.java
Lines 128 (patched)
<https://reviews.apache.org/r/75210/#comment315223>

    Consider using named queries (in jpa_named_queries.xml) in #128, #103 and 
#94.


- Madhan Neethiraj


On Sept. 18, 2024, 1:12 p.m., Rakesh Gupta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/75210/
> -----------------------------------------------------------
> 
> (Updated Sept. 18, 2024, 1:12 p.m.)
> 
> 
> Review request for ranger, Dineshkumar Yadav, Kishor Gollapalliwar, Abhay 
> Kulkarni, Madhan Neethiraj, Mehul Parikh, Pradeep Agrawal, Ramesh Mani, 
> sanket shelar, Sailaja Polavarapu, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-4809
>     https://issues.apache.org/jira/browse/RANGER-4809
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> With updates in RANGER-4803, Ranger will store admin audit records in 
> x_trx_log_v2 table. Prior to this, x_trx_log table was used to store these 
> records. To make earlier admin audits available to updated Ranger, existing 
> entries in x_trx_log should be migrated to x_trx_log_v2 table.
> 
> 
> Diffs
> -----
> 
>   security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql 
> 80af2c8ce 
>   security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql 
> 8d528e4ee 
>   security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql 
> 6bb9c525a 
>   
> security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql
>  a37c9eb8e 
>   security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql 
> 151f6804b 
>   
> security-admin/src/main/java/org/apache/ranger/patch/PatchForTrxLogV2Migration_J10064.java
>  PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/75210/diff/2/
> 
> 
> Testing
> -------
> 
> 1)Verified that all transaction from the x_trx_log table has been migrated to 
> the x_trx_log_v2 table when the default config value is -1.
> 2)Verified that data migration from the x_trx_log table to the x_trx_log_v2 
> table follows the config 
> "ranger.admin.migrate.transaction_records.retention.days", ensuring that only 
> records within the specified number of days are migrated.
> 3)Verified that multiple records with the same trx_id from the x_trx_log 
> table are merged into a single transaction record in the x_trx_log_v2 table.
> 4)Verified that the x_trx_log_v2.change_info column is populated with the 
> combined contents of the attr_name, prev_val, and new_val columns from 
> multiple x_trx_log rows.
> 5)Verified that new transactions are being correctly stored in the 
> x_trx_log_v2 table.
> 
> 
> Thanks,
> 
> Rakesh Gupta
> 
>

Reply via email to