Skip to content

Conversation

sriram-atlan
Copy link

Change description

send all internal properties like __glossary, __meanings etc which are not defined in typeDefs to kafka for ES Isolation
Intercept AtlasJanusElement setProperty, removeProperty, removePropertyValue, removeAllPropertyValues and populate a Map per entity
Use this map in NotificationListener to send out more attributes.

Type of change

  • Bug fix (fixes an issue)
  • New feature (adds functionality)

Related issues

https://atlanhq.atlassian.net/browse/MLH-1226

Fix #1

Helm Config Changes for Running Tests (Staging PR)

Does this PR require Helm config changes for testing?

  • Tests are NOT required for this commit. (You can proceed with the PR.) ✅
  • No, Helm config changes are not needed. (You can proceed with the PR.) ✅
  • Yes, I have already updated the config-values on enpla9up36. (You can proceed with the PR.) ✅
  • Yes, but I have NOT updated the config-values. (Please update them before proceeding; or, tests will run with default values.)⚠️

Checklists

Development

  • Lint rules pass locally
  • Application changes have been tested thoroughly
  • Automated tests covering modified code pass

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

Code review

  • Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached as necessary
  • "Ready for review" label attached and reviewers assigned
  • Changes have been reviewed by at least one other contributor
  • Pull request linked to task tracker where applicable

cursor[bot]

This comment was marked as outdated.


public Map<String, Map<String, Object>> getAllInternalAttributesMap() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the getter later after all intializations


public Map<String, Map<String, Object>> getAllInternalAttributesMap() {
return allInternalAttributesMap;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class has a method clearCache(), please clear the allInternalAttributesMap in this method

if (MapUtils.isNotEmpty(allInternalAttributesMap)) {
for (String key : allInternalAttributesMap.keySet()) {
Object value = allInternalAttributesMap.get(key);
ret.setAttribute(key, value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will put internal attributes in attributes like attributes.__meanings. Nothing wrong in this just wanted to highlight

Iterator<? extends Property<String>> it = getWrappedElement().properties(propertyName);
while(it.hasNext()) {
Property<String> property = it.next();
property.remove();
//fill the map for the entityGuid and remove value
if (propertyName.startsWith(INTERNAL_PROPERTY_KEY_PREFIX)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will collect attrs like __createdBy, __createdAt & other attributes which not denorm attrs. shall we exclude them as well?
or we can even have inclusion list but we will loose future readyness & have to update the inclusion list everytime we introduce new denorm attribute

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do this change after i test this in an environment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Comment on lines 168 to 179
if (propertyName.startsWith(INTERNAL_PROPERTY_KEY_PREFIX)) {
String entityGuid = this.getProperty(GUID_PROPERTY_KEY, String.class);
if (StringUtils.isNotEmpty(entityGuid)) {
if (context.getAllInternalAttributesMap().get(entityGuid) != null) {
context.getAllInternalAttributesMap().get(entityGuid).put(propertyName, null);
} else {
Map<String, Object> map = new HashMap<>();
map.put(propertyName, null);
context.getAllInternalAttributesMap().put(entityGuid, map);
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From method name I think intention is to remove all items from value list

E.g
Imagine __meaningNames current has values ["term_0", "term_1"],
Someone updates asset to remove both term_0, term_1

I will check more on this method & get back

cursor[bot]

This comment was marked as outdated.

@@ -130,25 +130,14 @@ public void removePropertyValue(String propertyName, Object propertyValue) {
RequestContext context = RequestContext.get();
Iterator<? extends Property<Object>> it = getWrappedElement().properties(propertyName);
// we create a map of properties that are only internal
fillInternalPropertiesIfApplicable(propertyName, propertyValue, it, context);
it = getWrappedElement().properties(propertyName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea to avoid iterating twice

cursor[bot]

This comment was marked as outdated.

@@ -109,36 +114,49 @@ public void removeProperty(String propertyName) {
while(it.hasNext()) {
Property<String> property = it.next();
property.remove();
recordInternalAttribute(propertyName, null);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Inconsistent Property Removal Logging

The removeProperty method repeatedly calls recordInternalAttribute within its loop for each property value removed. This creates unnecessary overhead and is inconsistent with other remove methods that record the final state once.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants