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
bc57e15e
Commit
bc57e15e
authored
7 years ago
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2549: Regression with respect to Partition keys
parent
8ef6a436
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
31 deletions
+25
-31
AtlasTypeDefStoreInitializer.java
...ository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+25
-31
No files found.
repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
View file @
bc57e15e
...
@@ -152,50 +152,44 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
...
@@ -152,50 +152,44 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
File
[]
typeDefFiles
=
typesDir
.
exists
()
?
typesDir
.
listFiles
()
:
null
;
File
[]
typeDefFiles
=
typesDir
.
exists
()
?
typesDir
.
listFiles
()
:
null
;
if
(
typeDefFiles
==
null
||
typeDefFiles
.
length
==
0
)
{
if
(
typeDefFiles
==
null
||
typeDefFiles
.
length
==
0
)
{
LOG
.
info
(
"Types directory {} does not exist or not readable or has no typedef files"
,
typesDirName
);
LOG
.
info
(
"Types directory {} does not exist or not readable or has no typedef files"
,
typesDirName
);
}
else
{
}
else
{
// sort the files by filename
// sort the files by filename
Arrays
.
sort
(
typeDefFiles
);
Arrays
.
sort
(
typeDefFiles
);
for
(
File
typeDefFile
:
typeDefFiles
)
{
try
{
readTypesFromFile
(
typeDefFile
);
}
catch
(
Throwable
t
)
{
LOG
.
error
(
"error while registering types in file {}"
,
typeDefFile
.
getAbsolutePath
(),
t
);
}
}
}
LOG
.
info
(
"<== AtlasTypeDefStoreInitializer({})"
,
typesDir
);
for
(
File
typeDefFile
:
typeDefFiles
)
{
}
if
(
typeDefFile
.
isFile
())
{
try
{
String
jsonStr
=
new
String
(
Files
.
readAllBytes
(
typeDefFile
.
toPath
()),
StandardCharsets
.
UTF_8
);
AtlasTypesDef
typesDef
=
AtlasType
.
fromJson
(
jsonStr
,
AtlasTypesDef
.
class
);
public
void
readTypesFromFile
(
File
typeDefFile
)
{
if
(
typesDef
==
null
||
typesDef
.
isEmpty
())
{
if
(!
typeDefFile
.
isFile
())
{
LOG
.
info
(
"No type in file {}"
,
typeDefFile
.
getAbsolutePath
());
return
;
}
try
{
continue
;
String
jsonStr
=
new
String
(
Files
.
readAllBytes
(
typeDefFile
.
toPath
()),
StandardCharsets
.
UTF_8
);
}
AtlasTypesDef
typesDef
=
AtlasType
.
fromJson
(
jsonStr
,
AtlasTypesDef
.
class
);
if
(
typesDef
==
null
||
typesDef
.
isEmpty
())
{
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
atlasTypeRegistry
);
LOG
.
info
(
"No type in file {}"
,
typeDefFile
.
getAbsolutePath
());
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
atlasTypeRegistry
,
true
);
return
;
}
AtlasTypesDef
typesToCreate
=
getTypesToCreate
(
typesDef
,
atlasTypeRegistry
);
if
(!
typesToCreate
.
isEmpty
()
||
!
typesToUpdate
.
isEmpty
())
{
AtlasTypesDef
typesToUpdate
=
getTypesToUpdate
(
typesDef
,
atlasTypeRegistry
,
tru
e
);
atlasTypeDefStore
.
createUpdateTypesDef
(
typesToCreate
,
typesToUpdat
e
);
if
(!
typesToCreate
.
isEmpty
()
||
!
typesToUpdate
.
isEmpty
())
{
LOG
.
info
(
"Created/Updated types defined in file {}"
,
typeDefFile
.
getAbsolutePath
());
atlasTypeDefStore
.
createUpdateTypesDef
(
typesToCreate
,
typesToUpdate
);
}
else
{
LOG
.
info
(
"No new type in file {}"
,
typeDefFile
.
getAbsolutePath
());
}
LOG
.
info
(
"Created/Updated types defined in file {}"
,
typeDefFile
.
getAbsolutePath
());
}
catch
(
Throwable
t
)
{
}
else
{
LOG
.
error
(
"error while registering types in file {}"
,
typeDefFile
.
getAbsolutePath
(),
t
);
LOG
.
info
(
"No new type in file {}"
,
typeDefFile
.
getAbsolutePath
());
}
}
}
}
}
catch
(
Throwable
t
)
{
applyTypePatches
(
typesDir
.
getPath
());
LOG
.
error
(
"error while registering types in file {}"
,
typeDefFile
.
getAbsolutePath
(),
t
);
}
}
LOG
.
info
(
"<== AtlasTypeDefStoreInitializer({})"
,
typesDir
);
}
}
public
static
AtlasTypesDef
getTypesToCreate
(
AtlasTypesDef
typesDef
,
AtlasTypeRegistry
typeRegistry
)
{
public
static
AtlasTypesDef
getTypesToCreate
(
AtlasTypesDef
typesDef
,
AtlasTypeRegistry
typeRegistry
)
{
...
...
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