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
d5a5238b
Commit
d5a5238b
authored
8 years ago
by
Sarath Subramanian
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1687: hbase_column_family and hbase_column are not loaded after upgrade
Change-Id: Ica0339cbcbb000b1785fed92ef82f09c41af32a8 Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
a9f3da62
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
10 deletions
+122
-10
0060-hbase_model.json
addons/models/0060-hbase_model.json
+1
-1
AtlasTypeDefStore.java
...c/main/java/org/apache/atlas/store/AtlasTypeDefStore.java
+2
-0
AtlasTypeRegistry.java
...rc/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+17
-3
AtlasTypeDefStoreInitializer.java
...ository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+102
-6
AtlasTypeDefGraphStore.java
.../atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+0
-0
No files found.
addons/models/0060-hbase_model.json
View file @
d5a5238b
...
...
@@ -8,7 +8,7 @@
"superTypes"
:
[
"DataSet"
],
"typeVersion"
:
"1.
0
"
,
"typeVersion"
:
"1.
1
"
,
"attributeDefs"
:
[
{
"name"
:
"uri"
,
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java
View file @
d5a5238b
...
...
@@ -83,6 +83,8 @@ public interface AtlasTypeDefStore {
AtlasTypesDef
updateTypesDef
(
AtlasTypesDef
atlasTypesDef
)
throws
AtlasBaseException
;
AtlasTypesDef
createUpdateTypesDef
(
AtlasTypesDef
typesToCreate
,
AtlasTypesDef
typesToUpdate
)
throws
AtlasBaseException
;
void
deleteTypesDef
(
AtlasTypesDef
atlasTypesDef
)
throws
AtlasBaseException
;
AtlasTypesDef
searchTypesDef
(
SearchFilter
searchFilter
)
throws
AtlasBaseException
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
View file @
d5a5238b
...
...
@@ -485,16 +485,30 @@ public class AtlasTypeRegistry {
}
if
(
typesDef
!=
null
)
{
updateTypesWithNoRefResolve
(
typesDef
);
resolveReferences
();
}
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasTypeRegistry.updateTypes({})"
,
typesDef
);
}
}
public
void
updateTypesWithNoRefResolve
(
AtlasTypesDef
typesDef
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasTypeRegistry.updateTypesWithNoRefResolve({})"
,
typesDef
);
}
if
(
typesDef
!=
null
)
{
updateTypesWithNoRefResolve
(
typesDef
.
getEnumDefs
());
updateTypesWithNoRefResolve
(
typesDef
.
getStructDefs
());
updateTypesWithNoRefResolve
(
typesDef
.
getClassificationDefs
());
updateTypesWithNoRefResolve
(
typesDef
.
getEntityDefs
());
resolveReferences
();
}
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasTypeRegistry.updateTypes({})"
,
typesDef
);
LOG
.
debug
(
"<== AtlasTypeRegistry.updateTypes
WithNoRefResolve
({})"
,
typesDef
);
}
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
View file @
d5a5238b
...
...
@@ -23,6 +23,7 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
...
...
@@ -31,6 +32,7 @@ import org.apache.atlas.type.AtlasType;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
...
...
@@ -87,16 +89,16 @@ public class AtlasTypeDefStoreInitializer {
}
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
typeRegistry
);
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
typeRegistry
);
if
(
typesToCre
ate
.
isEmpty
())
{
LOG
.
info
(
"No new type in file {}"
,
typeDefFile
.
getAbsolutePath
()
);
if
(
!
typesToCreate
.
isEmpty
()
||
!
typesToUpd
ate
.
isEmpty
())
{
typeDefStore
.
createUpdateTypesDef
(
typesToCreate
,
typesToUpdate
);
continue
;
LOG
.
info
(
"Created/Updated types defined in file {}"
,
typeDefFile
.
getAbsolutePath
());
}
else
{
LOG
.
info
(
"No new type in file {}"
,
typeDefFile
.
getAbsolutePath
());
}
LOG
.
info
(
"Loading types defined in file {}"
,
typeDefFile
.
getAbsolutePath
());
typeDefStore
.
createTypesDef
(
typesToCreate
);
}
catch
(
Throwable
t
)
{
LOG
.
error
(
"error while registering types in file {}"
,
typeDefFile
.
getAbsolutePath
(),
t
);
}
...
...
@@ -143,6 +145,100 @@ public class AtlasTypeDefStoreInitializer {
return
typesToCreate
;
}
public
static
AtlasTypesDef
getTypesToUpdate
(
AtlasTypesDef
typesDef
,
AtlasTypeRegistry
typeRegistry
)
{
AtlasTypesDef
typesToUpdate
=
new
AtlasTypesDef
();
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getStructDefs
()))
{
for
(
AtlasStructDef
newStructDef
:
typesDef
.
getStructDefs
())
{
AtlasStructDef
oldStructDef
=
typeRegistry
.
getStructDefByName
(
newStructDef
.
getName
());
if
(
oldStructDef
==
null
)
{
continue
;
}
if
(
updateTypeAttributes
(
oldStructDef
,
newStructDef
))
{
typesToUpdate
.
getStructDefs
().
add
(
newStructDef
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getClassificationDefs
()))
{
for
(
AtlasClassificationDef
newClassifDef
:
typesDef
.
getClassificationDefs
())
{
AtlasClassificationDef
oldClassifDef
=
typeRegistry
.
getClassificationDefByName
(
newClassifDef
.
getName
());
if
(
oldClassifDef
==
null
)
{
continue
;
}
if
(
updateTypeAttributes
(
oldClassifDef
,
newClassifDef
))
{
typesToUpdate
.
getClassificationDefs
().
add
(
newClassifDef
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEntityDefs
()))
{
for
(
AtlasEntityDef
newEntityDef
:
typesDef
.
getEntityDefs
())
{
AtlasEntityDef
oldEntityDef
=
typeRegistry
.
getEntityDefByName
(
newEntityDef
.
getName
());
if
(
oldEntityDef
==
null
)
{
continue
;
}
if
(
updateTypeAttributes
(
oldEntityDef
,
newEntityDef
))
{
typesToUpdate
.
getEntityDefs
().
add
(
newEntityDef
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
for
(
AtlasEnumDef
newEnumDef
:
typesDef
.
getEnumDefs
())
{
AtlasEnumDef
oldEnumDef
=
typeRegistry
.
getEnumDefByName
(
newEnumDef
.
getName
());
if
(
oldEnumDef
==
null
)
{
continue
;
}
if
(
isTypeUpdateApplicable
(
oldEnumDef
,
newEnumDef
))
{
if
(
CollectionUtils
.
isNotEmpty
(
oldEnumDef
.
getElementDefs
()))
{
for
(
AtlasEnumElementDef
oldEnumElem
:
oldEnumDef
.
getElementDefs
())
{
if
(!
newEnumDef
.
hasElement
(
oldEnumElem
.
getValue
()))
{
newEnumDef
.
addElement
(
oldEnumElem
);
}
}
}
typesToUpdate
.
getEnumDefs
().
add
(
newEnumDef
);
}
}
}
return
typesToUpdate
;
}
private
static
boolean
updateTypeAttributes
(
AtlasStructDef
oldStructDef
,
AtlasStructDef
newStructDef
)
{
boolean
ret
=
isTypeUpdateApplicable
(
oldStructDef
,
newStructDef
);
if
(
ret
)
{
// make sure that all attributes in oldDef are in newDef as well
if
(
CollectionUtils
.
isNotEmpty
(
oldStructDef
.
getAttributeDefs
())){
for
(
AtlasAttributeDef
oldAttrDef
:
oldStructDef
.
getAttributeDefs
())
{
if
(!
newStructDef
.
hasAttribute
(
oldAttrDef
.
getName
()))
{
newStructDef
.
addAttribute
(
oldAttrDef
);
}
}
}
}
return
ret
;
}
private
static
boolean
isTypeUpdateApplicable
(
AtlasBaseTypeDef
oldTypeDef
,
AtlasBaseTypeDef
newTypeDef
)
{
String
oldTypeVersion
=
oldTypeDef
.
getTypeVersion
();
String
newTypeVersion
=
newTypeDef
.
getTypeVersion
();
return
ObjectUtils
.
compare
(
newTypeVersion
,
oldTypeVersion
)
>
0
;
}
private
void
applyTypePatches
(
AtlasTypeDefStore
typeDefStore
,
AtlasTypeRegistry
typeRegistry
,
String
typesDirName
)
{
String
typePatchesDirName
=
typesDirName
+
File
.
separator
+
"patches"
;
File
typePatchesDir
=
new
File
(
typePatchesDirName
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
View file @
d5a5238b
This diff is collapsed.
Click to expand it.
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