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
1ff82a7e
Commit
1ff82a7e
authored
Jun 09, 2015
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted back type change listeners invocation for index creation
parent
8e4ddf42
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
GraphBackedSearchIndexer.java
...ache/atlas/repository/graph/GraphBackedSearchIndexer.java
+4
-4
DefaultMetadataService.java
...ava/org/apache/atlas/services/DefaultMetadataService.java
+17
-7
No files found.
repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
View file @
1ff82a7e
...
...
@@ -29,6 +29,7 @@ import com.tinkerpop.blueprints.Vertex;
import
org.apache.atlas.MetadataException
;
import
org.apache.atlas.discovery.SearchIndexer
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.IndexCreationException
;
import
org.apache.atlas.repository.IndexException
;
import
org.apache.atlas.repository.RepositoryException
;
import
org.apache.atlas.typesystem.types.AttributeInfo
;
...
...
@@ -153,9 +154,8 @@ public class GraphBackedSearchIndexer implements SearchIndexer {
LOG
.
info
(
"Index creation for type {} complete"
,
typeName
);
}
catch
(
Throwable
throwable
)
{
// gets handle to currently open transaction
LOG
.
error
(
"Error creating index for type {}"
,
dataType
,
throwable
);
throw
new
IndexException
(
"Error while creating index for type "
+
dataType
,
throwable
);
throw
new
Index
Creation
Exception
(
"Error while creating index for type "
+
dataType
,
throwable
);
}
}
...
...
@@ -351,7 +351,7 @@ public class GraphBackedSearchIndexer implements SearchIndexer {
public
void
commit
()
throws
IndexException
{
try
{
management
.
commit
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Index commit failed"
,
e
);
throw
new
IndexException
(
"Index commit failed "
,
e
);
}
...
...
@@ -361,7 +361,7 @@ public class GraphBackedSearchIndexer implements SearchIndexer {
public
void
rollback
()
throws
IndexException
{
try
{
management
.
rollback
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Index rollback failed "
,
e
);
throw
new
IndexException
(
"Index rollback failed "
,
e
);
}
...
...
repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
View file @
1ff82a7e
...
...
@@ -59,6 +59,9 @@ import org.slf4j.LoggerFactory;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -80,16 +83,16 @@ public class DefaultMetadataService implements MetadataService {
private
final
TypeSystem
typeSystem
;
private
final
MetadataRepository
repository
;
private
final
ITypeStore
typeStore
;
private
final
Provider
<
SearchIndexer
>
searchIndexProvider
;
private
final
Set
<
Provider
<
SearchIndexer
>>
typeChangeListeners
;
@Inject
DefaultMetadataService
(
MetadataRepository
repository
,
Provider
<
SearchIndexer
>
searchIndexProvider
,
ITypeStore
typeStore
)
throws
MetadataException
{
DefaultMetadataService
(
final
MetadataRepository
repository
,
final
Provider
<
SearchIndexer
>
searchIndexProvider
,
final
ITypeStore
typeStore
)
throws
MetadataException
{
this
.
typeStore
=
typeStore
;
this
.
typeSystem
=
TypeSystem
.
getInstance
();
this
.
repository
=
repository
;
this
.
searchIndexProvider
=
searchIndexProvider
;
this
.
typeChangeListeners
=
new
LinkedHashSet
<
Provider
<
SearchIndexer
>>()
{{
add
(
searchIndexProvider
);
}};
restoreTypeSystem
();
}
...
...
@@ -394,18 +397,25 @@ public class DefaultMetadataService implements MetadataService {
}
private
void
onTypesAddedToRepo
(
Map
<
String
,
IDataType
>
typesAdded
)
throws
MetadataException
{
final
SearchIndexer
indexer
=
searchIndexProvider
.
get
();
Map
<
SearchIndexer
,
Throwable
>
caughtExceptions
=
new
HashMap
<>();
for
(
Provider
<
SearchIndexer
>
indexerProvider
:
typeChangeListeners
)
{
final
SearchIndexer
indexer
=
indexerProvider
.
get
();
try
{
for
(
Map
.
Entry
<
String
,
IDataType
>
entry
:
typesAdded
.
entrySet
())
{
indexer
.
onAdd
(
entry
.
getKey
(),
entry
.
getValue
());
}
indexer
.
commit
();
}
catch
(
IndexCreationException
ice
)
{
}
catch
(
IndexCreationException
ice
)
{
LOG
.
error
(
"Index creation for listener {} failed "
,
indexerProvider
,
ice
);
indexer
.
rollback
();
throw
ice
;
caughtExceptions
.
put
(
indexer
,
ice
)
;
}
}
if
(
caughtExceptions
.
size
()
>
0
)
{
throw
new
IndexCreationException
(
"Index creation failed for types "
+
typesAdded
.
keySet
()
+
". Aborting"
);
}
}
private
void
onEntityAddedToRepo
(
ITypedReferenceableInstance
typedInstance
)
throws
MetadataException
{
...
...
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