Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
a5d52418
Commit
a5d52418
authored
Sep 06, 2017
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2114: Regression : Type Update using V1 APIs
parent
7eff37a6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
AtlasTypeDefStoreInitializer.java
...ository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+17
-11
AtlasTypeDefGraphStore.java
.../atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+1
-1
No files found.
repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
View file @
a5d52418
...
@@ -166,7 +166,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -166,7 +166,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
}
}
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
atlasTypeRegistry
);
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
atlasTypeRegistry
);
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
atlasTypeRegistry
);
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
atlasTypeRegistry
,
true
);
if
(!
typesToCreate
.
isEmpty
()
||
!
typesToUpdate
.
isEmpty
())
{
if
(!
typesToCreate
.
isEmpty
()
||
!
typesToUpdate
.
isEmpty
())
{
atlasTypeDefStore
.
createUpdateTypesDef
(
typesToCreate
,
typesToUpdate
);
atlasTypeDefStore
.
createUpdateTypesDef
(
typesToCreate
,
typesToUpdate
);
...
@@ -233,7 +233,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -233,7 +233,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
return
typesToCreate
;
return
typesToCreate
;
}
}
public
static
AtlasTypesDef
getTypesToUpdate
(
AtlasTypesDef
typesDef
,
AtlasTypeRegistry
typeRegistry
)
{
public
static
AtlasTypesDef
getTypesToUpdate
(
AtlasTypesDef
typesDef
,
AtlasTypeRegistry
typeRegistry
,
boolean
checkTypeVersion
)
{
AtlasTypesDef
typesToUpdate
=
new
AtlasTypesDef
();
AtlasTypesDef
typesToUpdate
=
new
AtlasTypesDef
();
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getStructDefs
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getStructDefs
()))
{
...
@@ -244,7 +244,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -244,7 +244,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
continue
;
continue
;
}
}
if
(
updateTypeAttributes
(
oldStructDef
,
newStructDef
))
{
if
(
updateTypeAttributes
(
oldStructDef
,
newStructDef
,
checkTypeVersion
))
{
typesToUpdate
.
getStructDefs
().
add
(
newStructDef
);
typesToUpdate
.
getStructDefs
().
add
(
newStructDef
);
}
}
}
}
...
@@ -258,7 +258,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -258,7 +258,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
continue
;
continue
;
}
}
if
(
updateTypeAttributes
(
oldClassifDef
,
newClassifDef
))
{
if
(
updateTypeAttributes
(
oldClassifDef
,
newClassifDef
,
checkTypeVersion
))
{
typesToUpdate
.
getClassificationDefs
().
add
(
newClassifDef
);
typesToUpdate
.
getClassificationDefs
().
add
(
newClassifDef
);
}
}
}
}
...
@@ -272,7 +272,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -272,7 +272,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
continue
;
continue
;
}
}
if
(
updateTypeAttributes
(
oldEntityDef
,
newEntityDef
))
{
if
(
updateTypeAttributes
(
oldEntityDef
,
newEntityDef
,
checkTypeVersion
))
{
typesToUpdate
.
getEntityDefs
().
add
(
newEntityDef
);
typesToUpdate
.
getEntityDefs
().
add
(
newEntityDef
);
}
}
}
}
...
@@ -286,7 +286,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -286,7 +286,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
continue
;
continue
;
}
}
if
(
isTypeUpdateApplicable
(
oldEnumDef
,
newEnumDef
))
{
if
(
isTypeUpdateApplicable
(
oldEnumDef
,
newEnumDef
,
checkTypeVersion
))
{
if
(
CollectionUtils
.
isNotEmpty
(
oldEnumDef
.
getElementDefs
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
oldEnumDef
.
getElementDefs
()))
{
for
(
AtlasEnumElementDef
oldEnumElem
:
oldEnumDef
.
getElementDefs
())
{
for
(
AtlasEnumElementDef
oldEnumElem
:
oldEnumDef
.
getElementDefs
())
{
if
(!
newEnumDef
.
hasElement
(
oldEnumElem
.
getValue
()))
{
if
(!
newEnumDef
.
hasElement
(
oldEnumElem
.
getValue
()))
{
...
@@ -308,7 +308,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -308,7 +308,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
continue
;
continue
;
}
}
if
(
updateTypeAttributes
(
oldRelationshipDef
,
relationshipDef
))
{
if
(
updateTypeAttributes
(
oldRelationshipDef
,
relationshipDef
,
checkTypeVersion
))
{
typesToUpdate
.
getRelationshipDefs
().
add
(
relationshipDef
);
typesToUpdate
.
getRelationshipDefs
().
add
(
relationshipDef
);
}
}
}
}
...
@@ -339,8 +339,8 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -339,8 +339,8 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
LOG
.
info
(
"<== AtlasTypeDefStoreInitializer.instanceIsPassive()"
);
LOG
.
info
(
"<== AtlasTypeDefStoreInitializer.instanceIsPassive()"
);
}
}
private
static
boolean
updateTypeAttributes
(
AtlasStructDef
oldStructDef
,
AtlasStructDef
newStructDef
)
{
private
static
boolean
updateTypeAttributes
(
AtlasStructDef
oldStructDef
,
AtlasStructDef
newStructDef
,
boolean
checkTypeVersion
)
{
boolean
ret
=
isTypeUpdateApplicable
(
oldStructDef
,
newStructDef
);
boolean
ret
=
isTypeUpdateApplicable
(
oldStructDef
,
newStructDef
,
checkTypeVersion
);
if
(
ret
)
{
if
(
ret
)
{
// make sure that all attributes in oldDef are in newDef as well
// make sure that all attributes in oldDef are in newDef as well
...
@@ -356,11 +356,17 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -356,11 +356,17 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
return
ret
;
return
ret
;
}
}
private
static
boolean
isTypeUpdateApplicable
(
AtlasBaseTypeDef
oldTypeDef
,
AtlasBaseTypeDef
newTypeDef
)
{
private
static
boolean
isTypeUpdateApplicable
(
AtlasBaseTypeDef
oldTypeDef
,
AtlasBaseTypeDef
newTypeDef
,
boolean
checkVersion
)
{
boolean
ret
=
true
;
if
(
checkVersion
)
{
String
oldTypeVersion
=
oldTypeDef
.
getTypeVersion
();
String
oldTypeVersion
=
oldTypeDef
.
getTypeVersion
();
String
newTypeVersion
=
newTypeDef
.
getTypeVersion
();
String
newTypeVersion
=
newTypeDef
.
getTypeVersion
();
return
ObjectUtils
.
compare
(
newTypeVersion
,
oldTypeVersion
)
>
0
;
ret
=
ObjectUtils
.
compare
(
newTypeVersion
,
oldTypeVersion
)
>
0
;
}
return
ret
;
}
}
private
void
applyTypePatches
(
String
typesDirName
)
{
private
void
applyTypePatches
(
String
typesDirName
)
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
View file @
a5d52418
...
@@ -348,7 +348,7 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
...
@@ -348,7 +348,7 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
@GraphTransaction
@GraphTransaction
public
AtlasTypesDef
createUpdateTypesDef
(
AtlasTypesDef
typesDef
)
throws
AtlasBaseException
{
public
AtlasTypesDef
createUpdateTypesDef
(
AtlasTypesDef
typesDef
)
throws
AtlasBaseException
{
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
typeRegistry
);
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
typeRegistry
);
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
typeRegistry
);
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
typeRegistry
,
false
);
return
createUpdateTypesDef
(
typesToCreate
,
typesToUpdate
);
return
createUpdateTypesDef
(
typesToCreate
,
typesToUpdate
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment