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
16ced369
Commit
16ced369
authored
Jul 07, 2020
by
sidmishra
Committed by
Madhan Neethiraj
Jul 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3877: fix for error in retrieving audit for purged entity
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
d604085e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
DeleteHandlerV1.java
...ache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
+7
-1
AtlasEntityStoreV2.java
...e/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+1
-1
EntityREST.java
...p/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+26
-2
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
View file @
16ced369
...
...
@@ -108,7 +108,13 @@ public abstract class DeleteHandlerV1 {
// Record all deletion candidate entities in RequestContext
// and gather deletion candidate vertices.
for
(
GraphHelper
.
VertexInfo
vertexInfo
:
getOwnedVertices
(
instanceVertex
))
{
requestContext
.
recordEntityDelete
(
vertexInfo
.
getEntity
());
AtlasEntityHeader
entityHeader
=
vertexInfo
.
getEntity
();
if
(
requestContext
.
isPurgeRequested
())
{
entityHeader
.
setClassifications
(
entityRetriever
.
getAllClassifications
(
vertexInfo
.
getVertex
()));
}
requestContext
.
recordEntityDelete
(
entityHeader
);
deletionCandidateVertices
.
add
(
vertexInfo
.
getVertex
());
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
View file @
16ced369
...
...
@@ -177,7 +177,7 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
EntityGraphRetriever
entityRetriever
=
new
EntityGraphRetriever
(
graph
,
typeRegistry
);
AtlasEntityHeader
ret
=
entityRetriever
.
toAtlasEntityHeader
(
guid
);
AtlasEntityHeader
ret
=
entityRetriever
.
toAtlasEntityHeader
WithClassifications
(
guid
);
if
(
ret
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
...
...
webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
View file @
16ced369
...
...
@@ -21,6 +21,9 @@ import com.sun.jersey.core.header.FormDataContentDisposition;
import
com.sun.jersey.multipart.FormDataParam
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.EntityAuditEvent
;
import
org.apache.atlas.authorize.AtlasAuthorizationUtils
;
import
org.apache.atlas.authorize.AtlasEntityAccessRequest
;
import
org.apache.atlas.authorize.AtlasPrivilege
;
import
org.apache.atlas.bulkimport.BulkImportResponse
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
...
...
@@ -806,8 +809,18 @@ public class EntityREST {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"EntityREST.getAuditEvents("
+
guid
+
", "
+
startKey
+
", "
+
count
+
")"
);
}
// following call enforces authorization for entity-read
entitiesStore
.
getHeaderById
(
guid
);
// Enforces authorization for entity-read
try
{
entitiesStore
.
getHeaderById
(
guid
);
}
catch
(
AtlasBaseException
e
)
{
if
(
e
.
getAtlasErrorCode
()
==
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
)
{
AtlasEntityHeader
entityHeader
=
getEntityHeaderFromPurgedAudit
(
guid
);
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_READ
,
entityHeader
),
"read entity audit: guid="
,
guid
);
}
else
{
throw
e
;
}
}
List
<
EntityAuditEventV2
>
ret
=
new
ArrayList
<>();
...
...
@@ -1232,4 +1245,15 @@ public class EntityREST {
return
entitiesStore
.
bulkCreateOrUpdateBusinessAttributes
(
uploadedInputStream
,
fileDetail
.
getFileName
());
}
private
AtlasEntityHeader
getEntityHeaderFromPurgedAudit
(
String
guid
)
throws
AtlasBaseException
{
List
<
EntityAuditEventV2
>
auditEvents
=
auditRepository
.
listEventsV2
(
guid
,
EntityAuditActionV2
.
ENTITY_PURGE
,
null
,
(
short
)
1
);
AtlasEntityHeader
ret
=
CollectionUtils
.
isNotEmpty
(
auditEvents
)
?
auditEvents
.
get
(
0
).
getEntityHeader
()
:
null
;
if
(
ret
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
}
return
ret
;
}
}
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