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
8e4ddf42
Commit
8e4ddf42
authored
Jun 09, 2015
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed types rollback on index creation exception
parent
33e4de48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
DefaultMetadataService.java
...ava/org/apache/atlas/services/DefaultMetadataService.java
+5
-2
TypeSystem.java
...in/java/org/apache/atlas/typesystem/types/TypeSystem.java
+8
-15
No files found.
repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
View file @
8e4ddf42
...
...
@@ -170,10 +170,13 @@ public class DefaultMetadataService implements MetadataService {
final
Map
<
String
,
IDataType
>
typesAdded
=
typeSystem
.
defineTypes
(
typesDef
);
try
{
typeStore
.
store
(
typeSystem
,
ImmutableList
.
copyOf
(
typesAdded
.
keySet
()));
/* Create indexes first so that if index creation fails then we rollback
the typesystem and also do not persist the graph
*/
onTypesAddedToRepo
(
typesAdded
);
typeStore
.
store
(
typeSystem
,
ImmutableList
.
copyOf
(
typesAdded
.
keySet
()));
}
catch
(
Throwable
t
)
{
typeSystem
.
removeTypes
(
typesAdded
);
typeSystem
.
removeTypes
(
typesAdded
.
keySet
()
);
throw
new
MetadataException
(
"Unable to persist types "
,
t
);
}
...
...
typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
View file @
8e4ddf42
...
...
@@ -29,15 +29,7 @@ import org.apache.atlas.typesystem.TypesDef;
import
javax.inject.Singleton
;
import
java.lang.reflect.Constructor
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TimeZone
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
@Singleton
...
...
@@ -307,12 +299,12 @@ public class TypeSystem {
return
false
;
}
public
void
removeTypes
(
Map
<
String
,
IDataType
>
typeNames
)
{
for
(
String
typeName
:
typeNames
.
keySet
())
{
types
.
remove
(
typeName
);
IDataType
dataType
=
typeNames
.
get
(
typeName
);
public
void
removeTypes
(
Collection
<
String
>
typeNames
)
{
for
(
String
typeName
:
typeNames
)
{
IDataType
dataType
=
types
.
get
(
typeName
);
final
DataTypes
.
TypeCategory
typeCategory
=
dataType
.
getTypeCategory
();
typeCategoriesToTypeNamesMap
.
get
(
typeCategory
).
remove
(
typeName
);
types
.
remove
(
typeName
);
}
}
...
...
@@ -573,9 +565,10 @@ public class TypeSystem {
}
Map
<
String
,
IDataType
>
defineTypes
()
throws
MetadataException
{
step1
();
step2
();
try
{
step1
();
step2
();
step3
();
step4
();
}
catch
(
MetadataException
me
)
{
...
...
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