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
3468c2b4
Commit
3468c2b4
authored
4 years ago
by
Ashutosh Mestry
Committed by
Sarath Subramanian
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3874: NotificationHookConsumer: Concurrent Message Processing
Change-Id: Ia5ccc6aeea2b0c44493636243b7627d16ad32c8f Signed-off-by:
Sarath Subramanian
<
sarath@apache.org
>
parent
250c2eaf
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
EntityGraphDiscoveryContext.java
...s/repository/store/graph/EntityGraphDiscoveryContext.java
+8
-2
NotificationHookConsumer.java
...g/apache/atlas/notification/NotificationHookConsumer.java
+16
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/EntityGraphDiscoveryContext.java
View file @
3468c2b4
...
@@ -96,11 +96,17 @@ public final class EntityGraphDiscoveryContext {
...
@@ -96,11 +96,17 @@ public final class EntityGraphDiscoveryContext {
}
}
public
AtlasVertex
getResolvedEntityVertex
(
AtlasObjectId
objId
)
{
public
AtlasVertex
getResolvedEntityVertex
(
AtlasObjectId
objId
)
{
if
(
objId
instanceof
AtlasRelatedObjectId
)
{
if
(
resolvedIdsByUniqAttribs
.
containsKey
(
objId
))
{
return
getAtlasVertexFromResolvedIdsByAttribs
(
objId
);
}
else
if
(
objId
instanceof
AtlasRelatedObjectId
)
{
objId
=
new
AtlasObjectId
(
objId
.
getGuid
(),
objId
.
getTypeName
(),
objId
.
getUniqueAttributes
());
objId
=
new
AtlasObjectId
(
objId
.
getGuid
(),
objId
.
getTypeName
(),
objId
.
getUniqueAttributes
());
}
}
AtlasVertex
vertex
=
resolvedIdsByUniqAttribs
.
get
(
objId
);
return
getAtlasVertexFromResolvedIdsByAttribs
(
objId
);
}
private
AtlasVertex
getAtlasVertexFromResolvedIdsByAttribs
(
AtlasObjectId
objId
)
{
AtlasVertex
vertex
=
resolvedIdsByUniqAttribs
.
get
(
objId
);
// check also for sub-types; ref={typeName=Asset; guid=abcd} should match {typeName=hive_table; guid=abcd}
// check also for sub-types; ref={typeName=Asset; guid=abcd} should match {typeName=hive_table; guid=abcd}
if
(
vertex
==
null
)
{
if
(
vertex
==
null
)
{
final
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
final
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
View file @
3468c2b4
...
@@ -117,6 +117,8 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -117,6 +117,8 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
private
static
final
String
TYPE_HIVE_COLUMN_LINEAGE
=
"hive_column_lineage"
;
private
static
final
String
TYPE_HIVE_COLUMN_LINEAGE
=
"hive_column_lineage"
;
private
static
final
String
ATTRIBUTE_INPUTS
=
"inputs"
;
private
static
final
String
ATTRIBUTE_INPUTS
=
"inputs"
;
private
static
final
String
ATTRIBUTE_QUALIFIED_NAME
=
"qualifiedName"
;
private
static
final
String
ATTRIBUTE_QUALIFIED_NAME
=
"qualifiedName"
;
private
static
final
String
EXCEPTION_CLASS_NAME_JANUSGRAPH_EXCEPTION
=
"JanusGraphException"
;
private
static
final
String
EXCEPTION_CLASS_NAME_PERMANENTLOCKING_EXCEPTION
=
"PermanentLockingException"
;
// from org.apache.hadoop.hive.ql.parse.SemanticAnalyzer
// from org.apache.hadoop.hive.ql.parse.SemanticAnalyzer
public
static
final
String
DUMMY_DATABASE
=
"_dummy_database"
;
public
static
final
String
DUMMY_DATABASE
=
"_dummy_database"
;
...
@@ -624,6 +626,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -624,6 +626,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
}
}
// Used for intermediate conversions during create and update
// Used for intermediate conversions during create and update
String
exceptionClassName
=
StringUtils
.
EMPTY
;
for
(
int
numRetries
=
0
;
numRetries
<
maxRetries
;
numRetries
++)
{
for
(
int
numRetries
=
0
;
numRetries
<
maxRetries
;
numRetries
++)
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"handleMessage({}): attempt {}"
,
message
.
getType
().
name
(),
numRetries
);
LOG
.
debug
(
"handleMessage({}): attempt {}"
,
message
.
getType
().
name
(),
numRetries
);
...
@@ -783,9 +786,15 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -783,9 +786,15 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
throw
new
IllegalStateException
(
"Unknown notification type: "
+
message
.
getType
().
name
());
throw
new
IllegalStateException
(
"Unknown notification type: "
+
message
.
getType
().
name
());
}
}
if
(
StringUtils
.
isNotEmpty
(
exceptionClassName
))
{
LOG
.
warn
(
"{}: Pausing & retry: Try: {}: Pause: {} ms. Handled!"
,
exceptionClassName
,
numRetries
,
adaptiveWaiter
.
waitDuration
);
exceptionClassName
=
StringUtils
.
EMPTY
;
}
break
;
break
;
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
RequestContext
.
get
().
resetEntityGuidUpdates
();
RequestContext
.
get
().
resetEntityGuidUpdates
();
exceptionClassName
=
e
.
getClass
().
getSimpleName
();
if
(
numRetries
==
(
maxRetries
-
1
))
{
if
(
numRetries
==
(
maxRetries
-
1
))
{
String
strMessage
=
AbstractNotification
.
getMessageJson
(
message
);
String
strMessage
=
AbstractNotification
.
getMessageJson
(
message
);
...
@@ -800,6 +809,13 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
...
@@ -800,6 +809,13 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
recordFailedMessages
();
recordFailedMessages
();
}
}
return
;
return
;
}
else
if
(
e
instanceof
org
.
apache
.
atlas
.
repository
.
graphdb
.
AtlasSchemaViolationException
||
exceptionClassName
.
equals
(
EXCEPTION_CLASS_NAME_JANUSGRAPH_EXCEPTION
)
||
exceptionClassName
.
equals
(
EXCEPTION_CLASS_NAME_PERMANENTLOCKING_EXCEPTION
))
{
LOG
.
warn
(
"{}: Pausing & retry: Try: {}: Pause: {} ms. {}"
,
exceptionClassName
,
numRetries
,
adaptiveWaiter
.
waitDuration
,
e
.
getMessage
());
adaptiveWaiter
.
pause
((
Exception
)
e
);
}
else
{
}
else
{
LOG
.
warn
(
"Error handling message"
,
e
);
LOG
.
warn
(
"Error handling message"
,
e
);
...
...
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