Re: Review Request 73606: AtlasPatchManager: Avoid Race Condition in HA Mode

2021-09-27 Thread Sarath Subramanian

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


Ship it!




Spring Bean initialization is not guaranteed, even though order is specified 
for the following spring components:

* GraphBackedSearchIndexer (Order-1)
* AtlasPatchService (Order-3)

AtlasPatchService need the component 'AtlasPatchManager' to be injected and is 
therefore initialized before the indexes are created in 
GraphBackedSearchIndexer.

This patch will address 2 issues:

1. Avoid full table scan in getAllPatches() in AtlasPatchRegistry which happens 
when query is fired before indexes are created for the first time.
2. Avoid post-construct of PatchContext initalization, which caused individual 
patch queries to be fired during initialization (before indexes got created) -> 
moved to applyAll() method.

Good fix!

- Sarath Subramanian


On Sept. 24, 2021, 11:14 a.m., Ashutosh Mestry wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73606/
> ---
> 
> (Updated Sept. 24, 2021, 11:14 a.m.)
> 
> 
> Review request for atlas, Jayendra Parab, Mandar Ambawane, Nikhil Bonte, 
> Nixon Rodrigues, and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-4358
> https://issues.apache.org/jira/browse/ATLAS-4358
> 
> 
> Repository: atlas
> 
> 
> Description
> ---
> 
> **Problem**
> During start-up in HA mode, the _AtlasPatchManager_ tries to read the patch 
> data while another instanace of Atlas is trying to create the indexes.
> 
> This causes indexes not to be created correctly. When this happens, the patch 
> registry ends up doing a a full database scan. With sizable data, this can 
> result in long startup times. This is detremental for setup that use 
> containerized cluster setup.
> 
> **Approach**
> Initialize the _PatchContext_ in the _applyAll_ method.
> 
> 
> Diffs
> -
> 
>   
> repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java
>  e2a38ab52 
> 
> 
> Diff: https://reviews.apache.org/r/73606/diff/1/
> 
> 
> Testing
> ---
> 
> **PC Build**
> https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/864/
> 
> 
> Thanks,
> 
> Ashutosh Mestry
> 
>



Review Request 73606: AtlasPatchManager: Avoid Race Condition in HA Mode

2021-09-24 Thread Ashutosh Mestry via Review Board

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

Review request for atlas, Jayendra Parab, Mandar Ambawane, Nikhil Bonte, Nixon 
Rodrigues, and Sarath Subramanian.


Bugs: ATLAS-4358
https://issues.apache.org/jira/browse/ATLAS-4358


Repository: atlas


Description
---

**Problem**
During start-up in HA mode, the _AtlasPatchManager_ tries to read the patch 
data while another instanace of Atlas is trying to create the indexes.

This causes indexes not to be created correctly. When this happens, the patch 
registry ends up doing a a full database scan. With sizable data, this can 
result in long startup times. This is detremental for setup that use 
containerized cluster setup.

**Approach**
Initialize the _PatchContext_ in the _applyAll_ method.


Diffs
-

  
repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java
 e2a38ab52 


Diff: https://reviews.apache.org/r/73606/diff/1/


Testing
---

**PC Build**
https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/864/


Thanks,

Ashutosh Mestry