----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/74019/ -----------------------------------------------------------
(Updated July 13, 2022, 7:15 a.m.) Review request for atlas, Jayendra Parab, Mandar Ambawane, and Pinal Shah. Changes ------- ATLAS-4573.2.patch Bugs: ATLAS-4573 https://issues.apache.org/jira/browse/ATLAS-4573 Repository: atlas Description ------- Steps followed: Create types , entities, relationship with is_legacy_attribute set initially to False Update the relationshipDef to have is_legacy_attribute to True For the entities that were created before updating the is_legacy_attribute to True, relationshipAttributes is now reset Initial relationship def: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/types/relationshipdef/name/ASSOCIATION_5YEDIO (This will now fetch the updated def) { category: "RELATIONSHIP", guid: "-294437519020", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648474404121, updateTime: 1648474404121, version: 1, name: "ASSOCIATION_5YEDIO", description: "default relationshipDef description with name: ASSOCIATION_5YEDIO", typeVersion: "1.0", attributeDefs: [], relationshipCategory: "ASSOCIATION", propagateTags: "NONE", endDef1: { type: "type_1_ASSOCIATION_O6FR7Q", name: "rel_attribute", isContainer: false, cardinality: "SINGLE", isLegacyAttribute: false, description: "default relationshipEndDef description with name: rel_attribute" }, endDef2: { type: "type_2_ASSOCIATION_XP3JPH", name: "rel_attribute", isContainer: false, cardinality: "SINGLE", isLegacyAttribute: false, description: "default relationshipEndDef description with name: rel_attribute" } } Entiry1 def before update to True: { referredEntities: {}, entity: { typeName: "type_1_ASSOCIATION_O6FR7Q", attributes: { name: "entity_1_PP8ULL" }, guid: "daa724fe-1e14-4734-ab95-85c4a5aafee4", isIncomplete: false, status: "ACTIVE", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648474464955, updateTime: 1648474464955, version: 0, relationshipAttributes: { rel_attribute: { guid: "51111271-ecdb-4792-8962-4bc6a68df3a2", typeName: "type_2_ASSOCIATION_XP3JPH", entityStatus: "ACTIVE", displayText: "entity_2_L47P2H", relationshipType: "ASSOCIATION_5YEDIO", relationshipGuid: "8e390507-cdfc-4f83-bded-16862498ac0c", relationshipStatus: "ACTIVE", relationshipAttributes: { typeName: "ASSOCIATION_5YEDIO" } } }, labels: [] } } Entity2 def before Update to True: { referredEntities: {}, entity: { typeName: "type_2_ASSOCIATION_XP3JPH", attributes: { name: "entity_2_L47P2H" }, guid: "51111271-ecdb-4792-8962-4bc6a68df3a2", isIncomplete: false, status: "ACTIVE", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648474464955, updateTime: 1648474464955, version: 0, relationshipAttributes: { rel_attribute: { guid: "daa724fe-1e14-4734-ab95-85c4a5aafee4", typeName: "type_1_ASSOCIATION_O6FR7Q", entityStatus: "ACTIVE", displayText: "entity_1_PP8ULL", relationshipType: "ASSOCIATION_5YEDIO", relationshipGuid: "8e390507-cdfc-4f83-bded-16862498ac0c", relationshipStatus: "ACTIVE", relationshipAttributes: { typeName: "ASSOCIATION_5YEDIO" } } }, labels: [] } } Updated relationship def: { category: "RELATIONSHIP", guid: "-294437519020", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648474404121, updateTime: 1648474705804, version: 2, name: "ASSOCIATION_5YEDIO", description: "default relationshipDef description with name: ASSOCIATION_5YEDIO", typeVersion: "1.0", attributeDefs: [], relationshipCategory: "ASSOCIATION", propagateTags: "NONE", endDef1: { type: "type_1_ASSOCIATION_O6FR7Q", name: "rel_attribute", isContainer: false, cardinality: "SINGLE", isLegacyAttribute: true, description: "default relationshipEndDef description with name: rel_attribute" }, endDef2: { type: "type_2_ASSOCIATION_XP3JPH", name: "rel_attribute", isContainer: false, cardinality: "SINGLE", isLegacyAttribute: true, description: "default relationshipEndDef description with name: rel_attribute" } } Entity1 def after update to True: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/daa724fe-1e14-4734-ab95-85c4a5aafee4 { referredEntities: {}, entity: { typeName: "type_1_ASSOCIATION_O6FR7Q", attributes: { rel_attribute: null, name: "entity_1_PP8ULL" }, guid: "daa724fe-1e14-4734-ab95-85c4a5aafee4", isIncomplete: false, status: "ACTIVE", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648474464955, updateTime: 1648474464955, version: 0, relationshipAttributes: { rel_attribute: null }, labels: [] } } Entity2 def after update to True: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/51111271-ecdb-4792-8962-4bc6a68df3a2 { referredEntities: {}, entity: { typeName: "type_2_ASSOCIATION_XP3JPH", attributes: { rel_attribute: null, name: "entity_2_L47P2H" }, guid: "51111271-ecdb-4792-8962-4bc6a68df3a2", isIncomplete: false, status: "ACTIVE", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648474464955, updateTime: 1648474464955, version: 0, relationshipAttributes: { rel_attribute: null }, labels: [] } } New entity Entity3 def created after update to True: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/0ac1d17b-7252-4ccc-a400-d94abc5e2e01 { referredEntities: {}, entity: { typeName: "type_1_ASSOCIATION_O6FR7Q", attributes: { rel_attribute: { guid: "52e76d12-d5ab-43e7-ab28-f194444f9f67", typeName: "type_2_ASSOCIATION_XP3JPH" }, name: "entity_3_MKC1MV" }, guid: "0ac1d17b-7252-4ccc-a400-d94abc5e2e01", isIncomplete: false, status: "ACTIVE", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648475166152, updateTime: 1648475166152, version: 0, relationshipAttributes: { rel_attribute: { guid: "52e76d12-d5ab-43e7-ab28-f194444f9f67", typeName: "type_2_ASSOCIATION_XP3JPH", entityStatus: "ACTIVE", displayText: "entity_4_3ATB39", relationshipType: "ASSOCIATION_5YEDIO", relationshipGuid: "fbdffdd8-95b8-4c55-87e7-be0cdcbf56a0", relationshipStatus: "ACTIVE", relationshipAttributes: { typeName: "ASSOCIATION_5YEDIO" } } }, labels: [] } } new entity Entity4 def created after update to True: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/52e76d12-d5ab-43e7-ab28-f194444f9f67 { referredEntities: {}, entity: { typeName: "type_2_ASSOCIATION_XP3JPH", attributes: { rel_attribute: { guid: "0ac1d17b-7252-4ccc-a400-d94abc5e2e01", typeName: "type_1_ASSOCIATION_O6FR7Q" }, name: "entity_4_3ATB39" }, guid: "52e76d12-d5ab-43e7-ab28-f194444f9f67", isIncomplete: false, status: "ACTIVE", createdBy: "hrt_qa", updatedBy: "hrt_qa", createTime: 1648475166152, updateTime: 1648475166152, version: 0, relationshipAttributes: { rel_attribute: { guid: "0ac1d17b-7252-4ccc-a400-d94abc5e2e01", typeName: "type_1_ASSOCIATION_O6FR7Q", entityStatus: "ACTIVE", displayText: "entity_3_MKC1MV", relationshipType: "ASSOCIATION_5YEDIO", relationshipGuid: "3727d6a7-e49b-4e1b-a03a-a7c84c91dc28", relationshipStatus: "ACTIVE", relationshipAttributes: { typeName: "ASSOCIATION_5YEDIO" } } }, labels: [] } } Here we can see that relationshipAttributes of the entities that were created before update were reset and the response is inconsistent with the newly created entities The values are reset in the reverse scenario too. Tried to update the value from True to False and here is the data: Relationship def before updating isLegacyAttribute to False https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/types/relationshipdef/name/ASSOCIATION_4UTG43{ "category": "RELATIONSHIP", "guid": "-974050521988", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522025999, "updateTime": 1648522025999, "version": 1, "name": "ASSOCIATION_4UTG43", "description": "default relationshipDef description with name: ASSOCIATION_4UTG43", "typeVersion": "1.0", "attributeDefs": [], "relationshipCategory": "ASSOCIATION", "propagateTags": "NONE", "endDef1": { "type": "type_1_ASSOCIATION_90RHH6", "name": "rel_attribute", "isContainer": false, "cardinality": "SINGLE", "isLegacyAttribute": true, "description": "default relationshipEndDef description with name: rel_attribute" }, "endDef2": { "type": "type_2_ASSOCIATION_2AN03T", "name": "rel_attribute", "isContainer": false, "cardinality": "SINGLE", "isLegacyAttribute": true, "description": "default relationshipEndDef description with name: rel_attribute" } } Entity 1 before updating isLegacyAttribute to False: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/010f014d-6265-42a9-9211-9008026d36f0 { "referredEntities": {}, "entity": { "typeName": "type_1_ASSOCIATION_90RHH6", "attributes": { "rel_attribute": { "guid": "272394c3-b91a-4c5c-9bb6-2fd8038ea0e6", "typeName": "type_2_ASSOCIATION_2AN03T" }, "name": "entity_1_YX99F2" }, "guid": "010f014d-6265-42a9-9211-9008026d36f0", "isIncomplete": false, "status": "ACTIVE", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522086614, "updateTime": 1648522086614, "version": 0, "relationshipAttributes": { "rel_attribute": { "guid": "272394c3-b91a-4c5c-9bb6-2fd8038ea0e6", "typeName": "type_2_ASSOCIATION_2AN03T", "entityStatus": "ACTIVE", "displayText": "entity_2_MAW7SL", "relationshipType": "ASSOCIATION_4UTG43", "relationshipGuid": "1b9b8fba-af2e-4bc0-9343-4d7a72219845", "relationshipStatus": "ACTIVE", "relationshipAttributes": { "typeName": "ASSOCIATION_4UTG43" } } }, "labels": [] } }Entity 2 before updating isLegacyAttribute to False: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/272394c3-b91a-4c5c-9bb6-2fd8038ea0e6{ "referredEntities": {}, "entity": { "typeName": "type_2_ASSOCIATION_2AN03T", "attributes": { "rel_attribute": { "guid": "010f014d-6265-42a9-9211-9008026d36f0", "typeName": "type_1_ASSOCIATION_90RHH6" }, "name": "entity_2_MAW7SL" }, "guid": "272394c3-b91a-4c5c-9bb6-2fd8038ea0e6", "isIncomplete": false, "status": "ACTIVE", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522086614, "updateTime": 1648522086614, "version": 0, "relationshipAttributes": { "rel_attribute": { "guid": "010f014d-6265-42a9-9211-9008026d36f0", "typeName": "type_1_ASSOCIATION_90RHH6", "entityStatus": "ACTIVE", "displayText": "entity_1_YX99F2", "relationshipType": "ASSOCIATION_4UTG43", "relationshipGuid": "e2a16930-6746-4417-a797-78b39941d212", "relationshipStatus": "ACTIVE", "relationshipAttributes": { "typeName": "ASSOCIATION_4UTG43" } } }, "labels": [] } }Reflationship def after updating isLegacyAttribute to False { "category": "RELATIONSHIP", "guid": "-974050521988", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522025999, "updateTime": 1648522501410, "version": 2, "name": "ASSOCIATION_4UTG43", "description": "default relationshipDef description with name: ASSOCIATION_4UTG43", "typeVersion": "1.0", "attributeDefs": [], "relationshipCategory": "ASSOCIATION", "propagateTags": "NONE", "endDef1": { "type": "type_1_ASSOCIATION_90RHH6", "name": "rel_attribute", "isContainer": false, "cardinality": "SINGLE", "isLegacyAttribute": false, "description": "default relationshipEndDef description with name: rel_attribute" }, "endDef2": { "type": "type_2_ASSOCIATION_2AN03T", "name": "rel_attribute", "isContainer": false, "cardinality": "SINGLE", "isLegacyAttribute": false, "description": "default relationshipEndDef description with name: rel_attribute" } }Payload that was used to update {"enumDefs": [], "entityDefs": [], "relationshipDefs": [{"category": "RELATIONSHIP", "updateTime": 1648522025999, "propagateTags": "NONE", "name": "ASSOCIATION_4UTG43", "relationshipCategory": "ASSOCIATION", "typeVersion": "1.0", "attributeDefs": [], "version": 1, "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "endDef2": {"name": "rel_attribute", "isLegacyAttribute": false, "isContainer": false, "cardinality": "SINGLE", "type": "type_2_ASSOCIATION_2AN03T", "description": "default relationshipEndDef description with name: rel_attribute"}, "endDef1": {"name": "rel_attribute", "isLegacyAttribute": false, "isContainer": false, "cardinality": "SINGLE", "type": "type_1_ASSOCIATION_90RHH6", "description": "default relationshipEndDef description with name: rel_attribute"}, "guid": "-974050521988", "createTime": 1648522025999, "description": "default relationshipDef description with name: ASSOCIATION_4UTG43"}], "businessMetadataDefs": [], "structDefs": [], "classificationDefs": []} Entity 1 after updating isLegacyAttribute to False: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/010f014d-6265-42a9-9211-9008026d36f0{ "referredEntities": {}, "entity": { "typeName": "type_1_ASSOCIATION_90RHH6", "attributes": { "name": "entity_1_YX99F2" }, "guid": "010f014d-6265-42a9-9211-9008026d36f0", "isIncomplete": false, "status": "ACTIVE", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522086614, "updateTime": 1648522086614, "version": 0, "relationshipAttributes": { "rel_attribute": null }, "labels": [] } } Entity 2 after updating isLegacyAttribute to False: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/272394c3-b91a-4c5c-9bb6-2fd8038ea0e6 { "referredEntities": {}, "entity": { "typeName": "type_2_ASSOCIATION_2AN03T", "attributes": { "name": "entity_2_MAW7SL" }, "guid": "272394c3-b91a-4c5c-9bb6-2fd8038ea0e6", "isIncomplete": false, "status": "ACTIVE", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522086614, "updateTime": 1648522086614, "version": 0, "relationshipAttributes": { "rel_attribute": null }, "labels": [] } }Entity3 created after updating isLegacyAttribute to False: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/9aac1cef-10f3-4846-a5e9-3fe9c5a21226 { "referredEntities": {}, "entity": { "typeName": "type_1_ASSOCIATION_90RHH6", "attributes": { "name": "entity_3_REC4QF" }, "guid": "9aac1cef-10f3-4846-a5e9-3fe9c5a21226", "isIncomplete": false, "status": "ACTIVE", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522763043, "updateTime": 1648522763043, "version": 0, "relationshipAttributes": { "rel_attribute": { "guid": "3f8dddc3-77cd-4278-bc9c-630ed8d0cd24", "typeName": "type_2_ASSOCIATION_2AN03T", "entityStatus": "ACTIVE", "displayText": "entity_4_527JL7", "relationshipType": "ASSOCIATION_4UTG43", "relationshipGuid": "0005e59d-7cd1-4ffb-9528-c09a8a6f2af5", "relationshipStatus": "ACTIVE", "relationshipAttributes": { "typeName": "ASSOCIATION_4UTG43" } } }, "labels": [] } } Entity4 created after updating isLegacyAttribute to False: https://quasar-uytlae-4.quasar-uytlae.root.hwx.site:31443/api/atlas/v2/entity/guid/3f8dddc3-77cd-4278-bc9c-630ed8d0cd24{ "referredEntities": {}, "entity": { "typeName": "type_2_ASSOCIATION_2AN03T", "attributes": { "name": "entity_4_527JL7" }, "guid": "3f8dddc3-77cd-4278-bc9c-630ed8d0cd24", "isIncomplete": false, "status": "ACTIVE", "createdBy": "hrt_qa", "updatedBy": "hrt_qa", "createTime": 1648522763043, "updateTime": 1648522763043, "version": 0, "relationshipAttributes": { "rel_attribute": { "guid": "9aac1cef-10f3-4846-a5e9-3fe9c5a21226", "typeName": "type_1_ASSOCIATION_90RHH6", "entityStatus": "ACTIVE", "displayText": "entity_3_REC4QF", "relationshipType": "ASSOCIATION_4UTG43", "relationshipGuid": "0005e59d-7cd1-4ffb-9528-c09a8a6f2af5", "relationshipStatus": "ACTIVE", "relationshipAttributes": { "typeName": "ASSOCIATION_4UTG43" } } }, "labels": [] } } Diffs (updated) ----- intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java 5b1737b70 repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java a8fe5a762 Diff: https://reviews.apache.org/r/74019/diff/2/ Changes: https://reviews.apache.org/r/74019/diff/1-2/ Testing ------- Manual testing is done. Pre-commit : https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/1115/consoleFull CASE 1 PROBLEM STATEMENT: In case, isLegacyAtrribute of both endDef1 and endDef2 is true. In this case as per the current condition if isLegacyAtrribute of both endDef1 and endDef2 is true then relationship label is not set and edge direction of endDef2 reverses, so we get Relationship Attribute as null for both entities. FIX DETAILS: To fix this, we have added conditions in case if isLegacyAtrribute of both endDef1 and endDef2 is true so that the relationship label will be set and in turn the edge direction of endDef2 will have no change and the Relationship Attribute details will be shown for both entities. CASE 2 PROBLEM STATEMENT: In case, if isLegacyAtrribute is false for endDef1 and true for endDef2 In this case, as per the current logic edge Direction will be reversed for both entities and hence we will be getting relationshipAtribute as null for entities. FIX DETAILS: To fix this, we have added a condition which will check if edge direction is reversed and in case it is reversed then update the edge direction to BOTH, so that the relationshipAttrribute will be populated as shown below. Thanks, Sanket Shelar