Impact and examples 1.0.4.1.R2.1

0

I noticed 1.0.4.1.R2.1 was released recently with a vague description of fixes...

"Disabled an optimization for Gremlin conditional insert patterns which can add or append to existing labels and properties"

I'm trying to determine if our team has been impacted and whether we need to cleanup any bad data.
Could example queries be provided that were affected?
Are there ways to detect if Nodes/Edges have been affected by this bug?

asked 3 years ago214 views
2 Answers
0
Accepted Answer

pwongSpins wrote:
I noticed 1.0.4.1.R2.1 was released recently with a vague description of fixes...

"Disabled an optimization for Gremlin conditional insert patterns which can add or append to existing labels and properties"

I'm trying to determine if our team has been impacted and whether we need to cleanup any bad data.
Could example queries be provided that were affected?
Are there ways to detect if Nodes/Edges have been affected by this bug?
pwongSpins wrote:
I noticed 1.0.4.1.R2.1 was released recently with a vague description of fixes...

"Disabled an optimization for Gremlin conditional insert patterns which can add or append to existing labels and properties"

I'm trying to determine if our team has been impacted and whether we need to cleanup any bad data.
Could example queries be provided that were affected?
Are there ways to detect if Nodes/Edges have been affected by this bug?
Hi pwongSpins,

Under a specific set of conditions, in version 1.0.4.1.R1 of Neptune, Gremlin conditional insert patterns can add or append to existing labels and properties in the following ways:

  1. Add a new property and value to an existing vertex.
  2. Add a new property value to an existing property and existing vertex.
  3. Update the value of a property attached to an existing edge.

The issue has been fixed in 1.0.4.1.R2.1 on 3/11/2021 and will be fixed in 10.4.1.R1.1 on 3/19/2021. Existing clusters will be upgraded to these versions as a patch in the next maintenance window.

To assess if your queries have been impacted, check if all of the following conditions are true:

  1. You run a conditional insert query with one of the following patterns:
    a. g.V(<ID>).fold().coalesce(unfold(), g.addV("L1").property(id,<ID>).property(<KEY>,<VALUE>))...
    b. g.E(<ID>).fold().coalesce(unfold(), V(<from>).addE(<label>).to(V(<to>)).property(id, <id>).property(<KEY>,<VALUE>))...
    c. g.E(<ID>).fold().coalesce(unfold(), g.addE(<label>).from(V<from>).to(V(<to>)).property(id, <id>).property(<KEY>,<VALUE>))...
  2. There already exists a vertex/edge in the database with the <ID> for such a query as described in 1. In such scenario, ideally the second condition inside coalesce should not do anything. Due to the bug, the second condition will end up attaching/updating the property(<KEY>,<VALUE>) to the existing vertex/edge.
  3. If the vertex/edge already exists (condition 2 is satisfied), it does not consist of a property having the exact key/value as described in second statement of the coalesce.
  4. You are not explicitly specifying cardinality for a vertex property such as property(Cardinality.single,<KEY>,<VALUE>))

You can also run an assessment query like the following to return all vertices with multi-valued properties as a map:

g.V().as("node").propertyMap().unfold().as("p").select(values).count(local).is(gt(1)).select("node","p")

If all of the above conditions are met by one or more of your existing queries, or the assessment query returns results, you may need to perform an audit of your data.

Some example queries to demonstrate the issue further:

Let’s say you have the following data in your database.

  • Vertex ID = “1", property {key=“name”, value=“pumba”}, label = “Animal”
  • Vertex ID = “2", property {key=“name”, value=“simba”}, label = “animal”
  • Edge ID = “3", property {key=“since”, value=1997}, label = “isFriendOf”

Now run queries in a version of Neptune that had executed conditional insert patterns on version 1.0.4.1.R1:
g.V("1").fold().coalesce(unfold(), g.addV("Animal").property(id,"1").property("name","pumba"))

Database after query: (no impact)

  • Vertex ID = “1", property {key=“name”, value=“pumba”}, label = “Animal”
  • Vertex ID = “2", property {key=“name”, value=“simba”}, label = “animal”
  • Edge ID = “3", property {key=“since”, value=1997}, label = “isFriendOf”

g.V("1").fold().coalesce(unfold(), g.addV("Animal").property(id,"1").property("name","mufasa"))

Database after query: (vertex property data impacted)

  • Vertex ID = “1", property {key=“name”, value=[“pumba”,“mufasa”]}, label = “Animal”
  • Vertex ID = “2”, property {key=“name”, value=“simba”}, label = “animal”
  • Edge ID = “3”, property {key=“since”, value=1997}, label = “isFriendOf”

g.V("1").fold().coalesce(unfold(), g.addV("Animal").property(id,"1").property("age",30))

Database after query: (vertex property data impacted)

  • Vertex ID = “1", property {key=“name”, value=[“pumba”,“mufasa”]},property {key=“age”, value=30}, label = “Animal”
  • Vertex ID = “2", property {key=“name”, value=“simba”}, label = “animal”
  • Edge ID = “3", property {key=“since”, value=1997}, label = “isFriendOf”

g.E("3").fold().coalesce(unfold(), V("1").addE("isFriendOf").to(V("2")).property(id, "3").property("since",1997))

Database after query: (no impact)

  • Vertex ID = “1”, property {key=“name”, value=“pumba”}, label = “Animal”
  • Vertex ID = “2”, property {key=“name”, value=“simba”}, label = “animal”
  • Edge ID = “3”, property {key=“since”, value=1997}, label = “isFriendOf”

g.E("3").fold().coalesce(unfold(), V("1").addE("isFriendOf").to(V("2")).property(id, "3").property("since",1998))

Database after query: (edge property data impacted)

  • Vertex ID = “1", property {key=“name”, value=“pumba”}, label = “Animal”
  • Vertex ID = “2", property {key=“name”, value=“simba”}, label = “animal”
  • Edge ID = “3", property {key=“since”, value=1998}, label = “isFriendOf”
joywa
answered 3 years ago
0

joywa,

Thank you for the detailed response! Although I'm not thrilled about bug like this, at least your example queries give me the tools to find and correct any issues in our databases.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions