Repository: incubator-atlas Updated Branches: refs/heads/0.8-incubating 5194b1259 -> ef6f51a56
ATLAS-855: Atlas logs contain stale transaction eviction message (cherry picked from commit b6eef8c2b732d49d9cd1c7b18d23aeed388cc395) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/ef6f51a5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/ef6f51a5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/ef6f51a5 Branch: refs/heads/0.8-incubating Commit: ef6f51a566f1dd32607579b0ab6dcbe8f7cdba1a Parents: 5194b12 Author: Sarath Subramanian <[email protected]> Authored: Mon May 8 22:06:06 2017 -0700 Committer: Sarath Subramanian <[email protected]> Committed: Mon May 8 22:07:10 2017 -0700 ---------------------------------------------------------------------- .../repository/store/graph/AtlasTypeDefGraphStore.java | 11 ----------- .../store/graph/v1/AtlasTypeDefGraphStoreV1.java | 6 +++++- 2 files changed, 5 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ef6f51a5/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java index 41de29f..4a8e1de 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java @@ -113,7 +113,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasEnumDef getEnumDefByName(String name) throws AtlasBaseException { AtlasEnumDef ret = typeRegistry.getEnumDefByName(name); if (ret == null) { @@ -123,7 +122,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasEnumDef getEnumDefByGuid(String guid) throws AtlasBaseException { AtlasEnumDef ret = typeRegistry.getEnumDefByGuid(guid); if (ret == null) { @@ -153,7 +151,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasStructDef getStructDefByName(String name) throws AtlasBaseException { AtlasStructDef ret = typeRegistry.getStructDefByName(name); @@ -165,7 +162,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasStructDef getStructDefByGuid(String guid) throws AtlasBaseException { AtlasStructDef ret = typeRegistry.getStructDefByGuid(guid); @@ -197,7 +193,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByName(name); @@ -209,7 +204,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasClassificationDef getClassificationDefByGuid(String guid) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByGuid(guid); @@ -243,7 +237,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByName(name); @@ -255,7 +248,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasEntityDef getEntityDefByGuid(String guid) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByGuid(guid); @@ -516,7 +508,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); @@ -549,7 +540,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasBaseTypeDef getByName(String name) throws AtlasBaseException { if (StringUtils.isBlank(name)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, "", name); @@ -559,7 +549,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ } @Override - @GraphTransaction public AtlasBaseTypeDef getByGuid(String guid) throws AtlasBaseException { if (StringUtils.isBlank(guid)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ef6f51a5/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java index b76dfef..3bf318f 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java @@ -73,7 +73,11 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore { try { init(); - } catch(AtlasBaseException excp) { + // commit/close the transaction after successful type store initialization. + atlasGraph.commit(); + + } catch (AtlasBaseException excp) { + atlasGraph.rollback(); LOG.error("failed to initialize types from graph store", excp); }
