-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Throw an NullPointerException error when querying with valueMap() #1812
Comments
Could you please try to reproduce this problem on a fresh installation of JanusGraph, ideally first without deleting any property key and then again after the deletion? You can for example simply load the graph of the gods to make it reproducible for us. |
please check the below |
@ammarove I tried to create a test for it, but wasn't able. @Test
public void testDeletionOfSchemaProperties(){
mgmt.makePropertyKey("propertyKey").dataType(String.class).cardinality(Cardinality.SINGLE).make();
graph.traversal().addV("vertexLabel").property("propertyKey", "test").next();
mgmt.getPropertyKey("propertyKey").remove();
\\clopen();
graph.traversal().addV("vertexLabel").property("propertyKey", "test").next();
List<Map<Object, Object>> maps = graph.traversal().V().valueMap().toList();
assertEquals(2, maps.size());
} It would be good if you say the correct version of JanusGraph you are using and also try to find reproduction steps. |
@farodin91 i'm trying to reproduce this bug,
and then re-find the propertykey
the key is not null; to reproduce the error i have to restart gremlin server;
RESTART GREMLIN SERVER THEN GREMLIN CLIENT
Gremlin server error logs:
reproduced with
|
Is that problem solved? |
Is this solved? I am experiencing same issue while using properties() or valueMap():
|
I am generatring my own IDs ( I'm also using I noticed that this happens with IDs which are way out of the normal range:
The error only occurs for the ID which is the outlier:
Output for ElementMap:
Janusgraph Version: |
We are dependent on JG for ids. |
Hoping to revive this thread, as I'm having the same issue. I was receiving the exact same error with the exact same ID regardless of the vertex ID I was querying against. I noticed in @lbornov2 example, the same thing: vertex id 302190240512 is not 2061. So why would querying for id 302190240512 have an issue with id 2061? I believe the answer lies in that vertex with id 2061 is a corrupt/ghost node. My guess is that for some reason, it's doing a full-index scan to find the vertex with the given ID, coming across the ghost node, and not gracefully handling it. I'm trying to understand how to run GhostVertexRemover on my JanusGraph instance to see if this fixes the issue - since I cannot remove my suspected ghost node with .drop(). Documentation for GhostVertexRemover is very sparse/non-existant. This is a pretty show-stopping bug, I think. |
Using GhostVertexRemover can help you scan the entire table and remove ghost vertices. I have to admit it is not well-documented and cannot be used out-of-the-box. I have a plan to revise and enhance that component but no ETA as of now. If you already know the ghost vertex and you want to delete it, try doing this: Iterator<JanusGraphRelation> iterator = v.query().noPartitionRestriction().relations().iterator();
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
v.remove(); |
@li-boxuan -- Thank you for the quick reply! I'm using the Gremlin console to run this, but can covert this to Groovy. It seems however that ghost nodes may not be the culprit here - after some more testing, it's the 'true' value in the valueMap() function which is causing the error. I haven't had this issue before with JanusGraph 0.3 -- but now using JanusGraph 0.5 with the same data as before. What am I missing here>
Yet this works:
and this works as well, which is odd because I would have thought it shouldn't:
So what exactly is Vertex with ID 130061 ?? Perhaps I should also note I'm using goblin (Python) to load everything into JanusGraph. Thank you! |
This type of errors produced because schema removed but data is exists with deleted schema Here snippet that remove entities without schema https://gist.github.com/mad/fdbc29215bc223f7ec33c0eb75d406cb |
I faced the same issue after removal the label from schema. Please could you advise how your snippet can be used to fix the data in graph (to remove entities without schema)? Thank you. |
Ok, I'm having the same proplem here. Please don't judge my stupidity, hindsight is 20:20 here. In my case, I removed a property from the schema that was already linked to some nodes. I get a NullPointerException every time I try and scan over properties of these nodes - This property was not part of any index (thank goodness). I'm not looking forward to recreating this data, however part of that cleanup involves dropping the old nodes, or writing new data where the old stuff should be, and I can't do either. I can add a new Is there a job that can clean up "zombie properties"? Or perhaps seeing as Janusgraph will let you do something like this, at least handle it so recovery is possible without having to rebuild the whole graph somehow? I've got a reproduction here, and as above only really rears its head once the cache has been cleared. Ignore the fact the label is 'tweet', it's not indicative of the real graph, but I needed to call it something. I've also simplified as much as I can here. // first, set up the schema
mgmt=graph.openManagement()
tweet = mgmt.makeVertexLabel('tweet').make()
t_id = mgmt.makePropertyKey('t_id').dataType(String.class).cardinality(SINGLE).make()
t_msg = mgmt.makePropertyKey('t_msg').dataType(String.class).cardinality(SINGLE).make()
// make sure to link the properties to the node
mgmt.addProperties(tweet, t_id, t_msg)
mgmt.commit()
// add some data
g.addV('tweet').property('t_id', '1').property('t_msg', 'msg 1').iterate()
// now, break the schema
mgmt=graph.openManagement()
mgmt.getPropertyKey('t_id').remove();
mgmt.commit()
Important: restart the server here and load a new console to remove all caching // these all fail
g.V().hasLabel('tweet').valueMap()
g.V().hasLabel('tweet').elementMap()
g.V().hasLabel('tweet').drop()
// this works, just one property shown though
g.V().hasLabel('tweet').properties('t_msg', 't_id') And now the attempted recovery: mgmt=graph.openManagement()
tweet = mgmt.getVertexLabel('tweet')
t_msg = mgmt.getPropertyKey('t_msg')
// recreate the property
t_id = mgmt.makePropertyKey('t_id').dataType(String.class).cardinality(SINGLE).make()
mgmt.addProperties(tweet, t_id, t_msg)
mgmt.commit()
// do a restart if you like
// succeeds
g.V().hasLabel('tweet').property('t_id', '1').iterate()
g.tx().commit()
// shows both properties
g.V().hasLabel('tweet').properties('t_msg', 't_id')
// all still fail with NPE
g.V().hasLabel('tweet').valueMap()
g.V().hasLabel('tweet').elementMap()
g.V().hasLabel('tweet').drop() So, by removing a schema property that's in use on nodes, you can pretty much brick your graph, and have no way to add the property back to it? Is there any way to recover here? I can, through a convoluted process, rebuild individual nodes and sort the edges etc. out, but I do really need to be able to clear these old ones. Surely there has to be a way here? The ultimate solution here - to be able to re-add the property back to nodes, rather than have to rebuild everything. I can get the values, I just need whatever is causing the NPE to get addressed. |
@Spiral90210 you can fix it using this #1812 (comment)
The logic of the job is quite simple, it runs through all relations and deletes those that are not in the schema |
I've been on vacation so not been able to look at this until today. I'm going to attempt this later in the week, but on the surface it looks to be exactly what I need. I'll report back when I do! |
we have create a schema and add some vertexes in Janusgraph. For example,
However, when we want to adjust the schema structure and remove some PropertyKey like:
mgmt.getPropertyKey('age').remove().
An NullPointerException error was thrown while querying with valueMap() after this operation in the Gremlin console,
So, how to fix this problem? thank you
The text was updated successfully, but these errors were encountered: