kakao / s2graph

This code base is retained for historical interest only, please visit Apache Incubator Repo for latest one
https://github.com/apache/incubator-s2graph
Other
250 stars 32 forks source link

[BUG] _to option gives wrong result on query. #220

Open SteamShon opened 8 years ago

SteamShon commented 8 years ago

step to reproduce.

create service.

curl -XPOST localhost:9000/graphs/createService -H 'Content-Type: Application/json' -d '
{"serviceName": "s2graph-test"}
'

create label.

curl -XPOST alpha-s2graph.daumkakao.io:9000/graphs/createLabel -H 'Content-Type: Application/json' -d '
{
    "label": "friend",
    "srcServiceName": "s2graph-test",
    "srcColumnName": "user_id",
    "srcColumnType": "string",
    "tgtServiceName": "s2graph-test",
    "tgtColumnName": "user_id",
    "tgtColumnType": "string",
    "indices": [],
    "props": [],
    "serviceName": "s2graph-test",
    "consistencyLevel": "strong"
}
'

insert test data.

curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d '
[
{"timestamp": 1451374817379, "from": "4c9343846613f66931000007", "to": "4cc8ad306899f56692000004", "label": "friend"}
]
'

delete above relation

curl -XPOST localhost:9000/graphs/edges/delete -H 'Content-Type: Application/json' -d '
[
{"timestamp": 1451374817380, "from": "4c9343846613f66931000007", "to": "4cc8ad306899f56692000004", "label": "friend"}
]
'

select index edges.

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{
        "serviceName": "s2graph-test",
        "columnName": "user_id",
        "id": "4c9343846613f66931000007"
    }],
    "steps": [{
        "step": [{
            "label": "path_friend",
            "direction": "out",
            "offset": 0,
            "limit": 10
        }]
    }]
}
'

this gives no edges which is expected.

with "_to" specified, then it gives deleted edge.

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{
        "serviceName": "s2graph-test",
        "columnName": "user_id",
        "id": "4c9343846613f66931000007"
    }],
    "steps": [{
        "step": [{
            "label": "path_friend",
            "direction": "out",
            "offset": 0,
            "limit": 10, 
            "_to": "4cc8ad306899f56692000004"
        }]
    }]
}
'

I think after delete operation finished, there should be no edge left even with "_to" option.

SteamShon commented 8 years ago

problem with this bug is hard coded value for isInnerCall for public method on query builder.

https://github.com/kakao/s2graph/blob/develop/s2core/src/main/scala/com/kakao/s2graph/core/storage/hbase/AsynchbaseQueryBuilder.scala#L230

easy fix would be just change isInnerCall = true to isInnerCall = false.

HyunsungJo commented 8 years ago

This is issue is moved to the following JIRA: https://issues.apache.org/jira/browse/S2GRAPH-28?jql=project%20%3D%20S2GRAPH