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
92f3a91e
Commit
92f3a91e
authored
7 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2729: fix - audit logging fails for large entities
parent
52d5e474
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
EntityAuditListener.java
...rg/apache/atlas/repository/audit/EntityAuditListener.java
+11
-0
EntityAuditListenerV2.java
.../apache/atlas/repository/audit/EntityAuditListenerV2.java
+24
-1
No files found.
repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
View file @
92f3a91e
...
...
@@ -187,6 +187,17 @@ public class EntityAuditListener implements EntityChangeListener {
entity
.
setValues
(
null
);
auditString
=
auditPrefix
+
AtlasType
.
toV1Json
(
entity
);
auditBytes
=
auditString
.
getBytes
(
StandardCharsets
.
UTF_8
);
// recheck auditString size
auditSize
=
auditBytes
!=
null
?
auditBytes
.
length
:
0
;
if
(
auditMaxSize
>=
0
&&
auditSize
>
auditMaxSize
)
{
// don't store classifications as well
LOG
.
warn
(
"audit record still too long: entityType={}, guid={}, size={}; maxSize={}. audit will have only summary details"
,
entity
.
getTypeName
(),
entity
.
getId
().
_getId
(),
auditSize
,
auditMaxSize
);
Referenceable
shallowEntity
=
new
Referenceable
(
entity
.
getId
(),
entity
.
getTypeName
(),
null
,
entity
.
getSystemAttributes
(),
null
,
null
);
auditString
=
auditPrefix
+
AtlasType
.
toJson
(
shallowEntity
);
}
entity
.
setValues
(
attrValues
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java
View file @
92f3a91e
...
...
@@ -234,13 +234,36 @@ public class EntityAuditListenerV2 implements EntityChangeListenerV2 {
LOG
.
warn
(
"audit record too long: entityType={}, guid={}, size={}; maxSize={}. entity attribute values not stored in audit"
,
entity
.
getTypeName
(),
entity
.
getGuid
(),
auditSize
,
auditMaxSize
);
Map
<
String
,
Object
>
attrValues
=
entity
.
getAttributes
();
Map
<
String
,
Object
>
attrValues
=
entity
.
getAttributes
();
Map
<
String
,
Object
>
relAttrValues
=
entity
.
getRelationshipAttributes
();
entity
.
setAttributes
(
null
);
entity
.
setRelationshipAttributes
(
null
);
auditString
=
auditPrefix
+
AtlasType
.
toJson
(
entity
);
auditBytes
=
auditString
.
getBytes
(
StandardCharsets
.
UTF_8
);
// recheck auditString size
auditSize
=
auditBytes
!=
null
?
auditBytes
.
length
:
0
;
if
(
auditMaxSize
>=
0
&&
auditSize
>
auditMaxSize
)
{
// don't store classifications and meanings as well
LOG
.
warn
(
"audit record still too long: entityType={}, guid={}, size={}; maxSize={}. audit will have only summary details"
,
entity
.
getTypeName
(),
entity
.
getGuid
(),
auditSize
,
auditMaxSize
);
AtlasEntity
shallowEntity
=
new
AtlasEntity
();
shallowEntity
.
setGuid
(
entity
.
getGuid
());
shallowEntity
.
setTypeName
(
entity
.
getTypeName
());
shallowEntity
.
setCreateTime
(
entity
.
getCreateTime
());
shallowEntity
.
setUpdateTime
(
entity
.
getUpdateTime
());
shallowEntity
.
setCreatedBy
(
entity
.
getCreatedBy
());
shallowEntity
.
setUpdatedBy
(
entity
.
getUpdatedBy
());
shallowEntity
.
setStatus
(
entity
.
getStatus
());
shallowEntity
.
setVersion
(
entity
.
getVersion
());
auditString
=
auditPrefix
+
AtlasType
.
toJson
(
shallowEntity
);
}
entity
.
setAttributes
(
attrValues
);
entity
.
setRelationshipAttributes
(
relAttrValues
);
}
restoreEntityAttributes
(
entity
,
prunedAttributes
);
...
...
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