Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Vertex Id (string) on non-existent vertex returns a new vertex #4433

Open
pdsway opened this issue May 3, 2024 · 7 comments
Open

Comments

@pdsway
Copy link

pdsway commented May 3, 2024

Potential bug report when using custom vertex id's
Cannot check vertex existence via usual query because a non-existent vertex returns a new vertex instead of null as expected.

  • Version: v1.0 branch
  • Storage Backend: CQL
  • Mixed Index Backend: elasticsearch
  • Expected Behavior: gremlin query on non-existent vertex returns null
  • Current Behavior: gremlin returns a new empty vertex
  • Steps to Reproduce:
    a. create a graph with custom vertex id (as string)
    1. graph options "set-vertex-id" and "allow-custom-vid-types" = true
    2. query for any non-existent vertex: g.V("mycustomid")
    3. gremlin returns a vertex with that id and "label=vertex"
    4. should return null to indicate vertex not found
@pdsway pdsway changed the title Custom Vertex Id (string) running g.V("myidentifier") returns a new vertex Custom Vertex Id (string) on non-existent vertex returns a new vertex May 3, 2024
@FlorianHockmann
Copy link
Member

@li-boxuan are you available to look into this? I think you have most knowledge in this area since you've implemented the support for custom string vertex IDs.

@li-boxuan
Copy link
Member

@pdsway I cannot reproduce. Do you mind providing some screenshots?

@pdsway
Copy link
Author

pdsway commented May 9, 2024

first. tyvm for trying!
second, yes, i will work on a simple demonstration
third, let me know how you build/test (perhaps its my implementation)

some notes...

  • I'm using a custom build of JG 1.0 and TP 3.7.1 on jdk17
  • i access JG server via remote gremlin client
  • i create a basic ConfiguredGraphFactory graph with cql/elastic plus these custom id options:
    ---- graph.set-vertex-id = true, graph.allow-custom-vid-types = true
  • my graph has schema for vertex and edge labels

@pdsway
Copy link
Author

pdsway commented May 9, 2024

forgot to mention...

using the same JG instance, I can switch to a "normal" graph (with Long gremlin id) and perform the same test (searching for a V with non-existing id) and I get null (as expected).

@li-boxuan
Copy link
Member

li-boxuan commented May 11, 2024

That sounds very weird as custom vertex IDs are not fundamentally different from auto-generated IDs.

What if you set graph.allow-custom-vid-types = false, and use custom numeric IDs?

@pdsway
Copy link
Author

pdsway commented May 15, 2024

What if you set graph.allow-custom-vid-types = false, and use custom numeric IDs?

also strange (graph is empty so no V's should exist)....
g.V(1) -> null
g.V(123) -> null
g.V(1234).elementMap() -> {id=1058, label=vertex}
g.V(12345).elementMap() -> {id=12345, label=vertex}

IMPORTANT: Discovered this is a side-effect of also setting storage.batch-loading = true
I was using that graph setting by default, when I removed it, gremlin functions normally for this use-case

@li-boxuan
Copy link
Member

g.V(1234).elementMap() -> {id=1058, label=vertex}

I don't think a vertex is really created. Batch-loading disables consistency checks, so you are likely just seeing a temporary phantom vertex.

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

No branches or pull requests

3 participants