Description
Problem Statement: compressDeltas method returns two ranger policy entries for policy create+update case when provided lastKnownVersion is previous to create policy operation. As per the design it should return only one last updated entry for the policy even if multiple update policy request is made after the create policy request.
Steps to reproduce:
1) call the policy download api and note the policy lastKnownVersion.
2) call create policy api
3) call update policy api for the policy created in step 2 above.
4) call the policy download api and provide the policy lastKnownVersion noted in step 1 above.
Proposed Solution: At line 3013, we have already added the policy so in case of create+update operation first entry alone can be considered and all next update event can be skipped.
since x_policy table stores only latest entry of a policy, during delta calculation for both the change type(create/update) same policy text is fetched, hence received policy snapshot is same and there is no point of having two entries.