You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2021/09/27 23:41:23 UTC
[atlas] branch master updated: ATLAS-4358: Address race condition
in AtlasPatchRegistry in HA mode.
This is an automated email from the ASF dual-hosted git repository.
amestry pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new a2eaca4 ATLAS-4358: Address race condition in AtlasPatchRegistry in HA mode.
a2eaca4 is described below
commit a2eaca4ed9a992b42bed18ba73c1da6ed414566e
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Fri Sep 24 10:53:48 2021 -0700
ATLAS-4358: Address race condition in AtlasPatchRegistry in HA mode.
---
.../repository/patches/AtlasPatchManager.java | 45 +++++++++++++---------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java b/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java
index e2a38ab..d30971a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java
+++ b/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java
@@ -40,28 +40,19 @@ import static org.apache.atlas.model.patches.AtlasPatch.PatchStatus.SKIPPED;
public class AtlasPatchManager {
private static final Logger LOG = LoggerFactory.getLogger(AtlasPatchManager.class);
- private final PatchContext context;
private final List<AtlasPatchHandler> handlers = new ArrayList<>();
+ private final AtlasGraph atlasGraph;
+ private final AtlasTypeRegistry typeRegistry;
+ private final GraphBackedSearchIndexer indexer;
+ private final EntityGraphMapper entityGraphMapper;
+ private PatchContext context;
@Inject
public AtlasPatchManager(AtlasGraph atlasGraph, AtlasTypeRegistry typeRegistry, GraphBackedSearchIndexer indexer, EntityGraphMapper entityGraphMapper) {
- this.context = new PatchContext(atlasGraph, typeRegistry, indexer, entityGraphMapper);
- }
-
- @PostConstruct
- public void init() {
- LOG.info("==> AtlasPatchManager.init()");
-
- // register all java patches here
- handlers.add(new UniqueAttributePatch(context));
- handlers.add(new ClassificationTextPatch(context));
- handlers.add(new FreeTextRequestHandlerPatch(context));
- handlers.add(new SuggestionsRequestHandlerPatch(context));
- handlers.add(new IndexConsistencyPatch(context));
- handlers.add(new ReIndexPatch(context));
- handlers.add(new ProcessNamePatch(context));
-
- LOG.info("<== AtlasPatchManager.init()");
+ this.atlasGraph = atlasGraph;
+ this.typeRegistry = typeRegistry;
+ this.indexer = indexer;
+ this.entityGraphMapper = entityGraphMapper;
}
public AtlasPatches getAllPatches() {
@@ -70,6 +61,7 @@ public class AtlasPatchManager {
public void applyAll() {
LOG.info("==> AtlasPatchManager.applyAll()");
+ init();
try {
for (AtlasPatchHandler handler : handlers) {
@@ -90,6 +82,23 @@ public class AtlasPatchManager {
LOG.info("<== AtlasPatchManager.applyAll()");
}
+ private void init() {
+ LOG.info("==> AtlasPatchManager.init()");
+
+ this.context = new PatchContext(atlasGraph, typeRegistry, indexer, entityGraphMapper);
+
+ // register all java patches here
+ handlers.add(new UniqueAttributePatch(context));
+ handlers.add(new ClassificationTextPatch(context));
+ handlers.add(new FreeTextRequestHandlerPatch(context));
+ handlers.add(new SuggestionsRequestHandlerPatch(context));
+ handlers.add(new IndexConsistencyPatch(context));
+ handlers.add(new ReIndexPatch(context));
+ handlers.add(new ProcessNamePatch(context));
+
+ LOG.info("<== AtlasPatchManager.init()");
+ }
+
public void addPatchHandler(AtlasPatchHandler patchHandler) {
handlers.add(patchHandler);
}