Hi Madhan,
I like the idea of using AtlasObjectId. Can I suggest that if we have a
single hashcode of it in the serialized form , then we cannot easily see
that a reference points to a particular object's guid. Maybe the Java API
reference should serialise to a nested structure containing the type and
guid. For readability / debugging I suggest we also add name into
AtlasObjectId (this approach proved very useful in ATLAS-1186). In this
way a reference contains the type and name (understandable by the human
reader, but not unique) and the guid (not understandable by the human
reader but useful for unique identification of objects and construction of
unambiguous object references).
So the children and parent references in json would look something like :
"children": [
{
"type": "TestType2",
"name": "child1",
"guid": “1234-5678-90123”
},
{
"type": "TestType2",
"name": "child2",
"guid": “1234-5678-90124”
},
]
"parent":
{
"type": "TestType1",
"name": "parent1",
"guid": “1234-5678-90123”
}
We would need something equivalent in toString().
What do you think?
Thanks, David.
----- Forwarded by David Radley/UK/IBM on 18/01/2017 09:45 -----
From: Madhan Neethiraj <[email protected]>
To: David Radley/UK/IBM@IBMGB
Date: 18/01/2017 01:47
Subject: Re: [jira] David Radley mentioned you (JIRA)
Sent by: Madhan Neethiraj <[email protected]>
David,
Thanks for the type-def JSONs and the steps to reproduce the issue. The
implementation should be updated to not get into such infinite loops. I
guess one approach would be to treat references to other entities as a
AtlasObjectId, even when the reference points to a full entity. For
example:
- toString() should print AtlasObjectId equivalent of the referenced
object. i.e. { “typeName”: “TestType1”, “guid”: “1234-5678-90123” }
- hashCode() should use (new AtlasObjectId(“TestType1”,
“1234-5678-90123”)).hashCode(), instead of calling child.hashCode() or
parent.hashCode()
What do you think?
Thanks,
Madhan
On 1/17/17, 7:11 AM, "David Radley (JIRA)" <[email protected]> wrote:
[
https://issues.apache.org/jira/browse/ATLAS-1458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Radley mentioned you on ATLAS-1458
--------------------------------
[~madhan.neethiraj]
As requested on the dev list, here are json files defining the types
that I used to recreate the loop.
The types create ok. To ge the loop using the 01-test.json, I do the
following
create an entity of TestType1 EntityA
create an entity of TestType2 EntityB
I update EntityA to have EntityB as a child.
I update EntityB to have EntityB as a parent. It loops during this
update.
I get the same loop for 02-test.json and 03-test.json.
> Key: ATLAS-1458
> View Online:
https://issues.apache.org/jira/browse/ATLAS-1458
> Add Comment:
https://issues.apache.org/jira/browse/ATLAS-1458#add-comment
Hint: You can mention someone in an issue description or comment by
typing "@" in front of their username.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU