atlas git commit: ATLAS-2982: import fails to create classification-def - #2
Repository: atlas Updated Branches: refs/heads/branch-1.0 73185dc51 -> 943e5c711 ATLAS-2982: import fails to create classification-def - #2 (cherry picked from commit 9a5553731b3ace19b2bca05f91676ec61b33f338) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/943e5c71 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/943e5c71 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/943e5c71 Branch: refs/heads/branch-1.0 Commit: 943e5c7c29f9f46bcb9a2e120a97e539efb5 Parents: 73185dc Author: Madhan Neethiraj Authored: Thu Nov 29 16:48:58 2018 -0800 Committer: Madhan Neethiraj Committed: Thu Nov 29 17:33:20 2018 -0800 -- .../java/org/apache/atlas/repository/impexp/ImportService.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/943e5c71/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java -- diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java index d06fd4a..a52c3f9 100644 --- a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java +++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java @@ -80,8 +80,6 @@ public class ImportService { public AtlasImportResult run(ZipSource source, AtlasImportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { -RequestContext.get().setImportInProgress(true); - if (request == null) { request = new AtlasImportRequest(); } @@ -91,6 +89,8 @@ public class ImportService { try { LOG.info("==> import(user={}, from={}, request={})", userName, requestingIP, request); +RequestContext.get().setImportInProgress(true); + String transforms = MapUtils.isNotEmpty(request.getOptions()) ? request.getOptions().get(TRANSFORMS_KEY) : null; setImportTransform(source, transforms); @@ -110,6 +110,8 @@ public class ImportService { throw new AtlasBaseException(excp); } finally { +RequestContext.get().setImportInProgress(false); + source.close(); LOG.info("<== import(user={}, from={}): status={}", userName, requestingIP, result.getOperationStatus()); }
atlas git commit: ATLAS-2982: import fails to create classification-def - #2
Repository: atlas Updated Branches: refs/heads/master 18a4984a4 -> 9a5553731 ATLAS-2982: import fails to create classification-def - #2 Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/9a555373 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/9a555373 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/9a555373 Branch: refs/heads/master Commit: 9a5553731b3ace19b2bca05f91676ec61b33f338 Parents: 18a4984 Author: Madhan Neethiraj Authored: Thu Nov 29 16:48:58 2018 -0800 Committer: Madhan Neethiraj Committed: Thu Nov 29 17:32:47 2018 -0800 -- .../java/org/apache/atlas/repository/impexp/ImportService.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/9a555373/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java -- diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java index d06fd4a..a52c3f9 100644 --- a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java +++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java @@ -80,8 +80,6 @@ public class ImportService { public AtlasImportResult run(ZipSource source, AtlasImportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { -RequestContext.get().setImportInProgress(true); - if (request == null) { request = new AtlasImportRequest(); } @@ -91,6 +89,8 @@ public class ImportService { try { LOG.info("==> import(user={}, from={}, request={})", userName, requestingIP, request); +RequestContext.get().setImportInProgress(true); + String transforms = MapUtils.isNotEmpty(request.getOptions()) ? request.getOptions().get(TRANSFORMS_KEY) : null; setImportTransform(source, transforms); @@ -110,6 +110,8 @@ public class ImportService { throw new AtlasBaseException(excp); } finally { +RequestContext.get().setImportInProgress(false); + source.close(); LOG.info("<== import(user={}, from={}): status={}", userName, requestingIP, result.getOperationStatus()); }
atlas git commit: ATLAS-2982: import fails to create classification-def
Repository: atlas Updated Branches: refs/heads/master 18350777e -> 5ebb16901 ATLAS-2982: import fails to create classification-def Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/5ebb1690 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/5ebb1690 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/5ebb1690 Branch: refs/heads/master Commit: 5ebb16901040c22a717de29f962ca53941ba4078 Parents: 1835077 Author: Madhan Neethiraj Authored: Wed Nov 28 08:15:21 2018 -0800 Committer: Madhan Neethiraj Committed: Wed Nov 28 21:01:24 2018 -0800 -- .../atlas/authorize/AtlasAuthorizationUtils.java | 6 +++--- .../apache/atlas/repository/impexp/ImportService.java | 3 +++ .../repository/store/graph/v2/AtlasEntityStoreV2.java | 13 ++--- .../repository/store/graph/v2/EntityGraphMapper.java | 10 +- .../store/graph/v2/EntityMutationContext.java | 4 .../store/graph/v2/IDBasedEntityResolver.java | 5 +++-- .../src/main/java/org/apache/atlas/RequestContext.java | 8 7 files changed, 28 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/5ebb1690/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java -- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java index 3f5bd24..c59b186 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java @@ -111,7 +111,7 @@ public class AtlasAuthorizationUtils { boolean ret = false; String userName = getCurrentUserName(); -if (StringUtils.isNotEmpty(userName)) { +if (StringUtils.isNotEmpty(userName) && !RequestContext.get().isImportInProgress()) { try { AtlasAuthorizer authorizer = AtlasAuthorizerFactory.getAtlasAuthorizer(); @@ -132,7 +132,7 @@ public class AtlasAuthorizationUtils { boolean ret = false; String userName = getCurrentUserName(); -if (StringUtils.isNotEmpty(userName)) { +if (StringUtils.isNotEmpty(userName) && !RequestContext.get().isImportInProgress()) { try { AtlasAuthorizer authorizer = AtlasAuthorizerFactory.getAtlasAuthorizer(); @@ -153,7 +153,7 @@ public class AtlasAuthorizationUtils { boolean ret = false; String userName = getCurrentUserName(); -if (StringUtils.isNotEmpty(userName)) { +if (StringUtils.isNotEmpty(userName) && !RequestContext.get().isImportInProgress()) { try { AtlasAuthorizer authorizer = AtlasAuthorizerFactory.getAtlasAuthorizer(); http://git-wip-us.apache.org/repos/asf/atlas/blob/5ebb1690/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java -- diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java index b5d8b7c..d06fd4a 100644 --- a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java +++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java @@ -19,6 +19,7 @@ package org.apache.atlas.repository.impexp; import com.google.common.annotations.VisibleForTesting; import org.apache.atlas.AtlasErrorCode; +import org.apache.atlas.RequestContext; import org.apache.atlas.entitytransform.BaseEntityHandler; import org.apache.atlas.entitytransform.TransformerContext; import org.apache.atlas.exception.AtlasBaseException; @@ -79,6 +80,8 @@ public class ImportService { public AtlasImportResult run(ZipSource source, AtlasImportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { +RequestContext.get().setImportInProgress(true); + if (request == null) { request = new AtlasImportRequest(); } http://git-wip-us.apache.org/repos/asf/atlas/blob/5ebb1690/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java -- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java index 6ee0279..d97b74d 100644 ---