terminusdb
terminusdb copied to clipboard
Can't delete/update inherited type instance with ValueHash subdocument that has a list
Describe the bug When creating a document with this configuration, it locks up the data product branch. It's not possible to delete/update inherited type instance with ValueHash subdocument that has a list, but it is also not possible to create anything else.
Note that this is performed in a branch called "_logic_main" and not in the main branch.
The only way back is to reset the branch to a previous commit.
Created document:
{
"@type": "SubCant",
"query": {
"@type": "And",
"and": []
}
}
To Reproduce Steps to reproduce the behavior:
- Created document above
- Delete or update document above
- See error message
Expected behavior It should be possible to delete and update the document without issue
Screenshots Here is the error message:
{
"name": "Server request error",
"message": "Error: rust_error(panic(\"called `Option::unwrap()` on a `None` value\"))\n [40] delete_document(<GetDocumentContext>,transaction_object{commit_info:commit_info{},descriptor:branch_descriptor{branch_name:\"_bug_issue\",repository_descriptor: ...},inference_objects:[],instance_objects:[...],parent:transaction_object{descriptor: ...,inference_objects:[],instance_objects: ...,parent: ...,schema_objects: ...},schema_objects:[...]},'terminusdb:///data/SubCant/AN_Mo-Rrfl1xvcqw',true)\n [35] forall(api_document:json_read_list_stream(<stream>(0x560a3d515500),\"SubCant/AN_Mo-Rrfl1xvcqw\"),api_document:(...,...)) at /usr/lib/swipl/boot/apply.pl:52\n [33] call(api_document:(...,...)) at /usr/lib/swipl/boot/init.pl:502\n [32] catch(database:call(...),fail_transaction,database:(_9098=true)) at /usr/lib/swipl/boot/init.pl:565\n [31] database:with_transaction_(query_context{all_witnesses:false,authorization:'#################',bindings:[],commit_info:commit_info{author:'###################',message:'delete document'},default_collection:branch_descriptor{branch_name:\"_bug_issue\",repository_descriptor: ...},files:[],filter:type_filter{types: ...},prefixes:_9206{'@base':\"terminusdb:///data/\",'@schema':\"terminusdb:///schema#\",'@type':'Context',api:'http://terminusdb.com/schema/api#',json:'http://terminusdb.com/schema/json#',owl:'http://www.w3.org/2002/07/owl#',rdf:'http://www.w3.org/1999/02/22-rdf-syntax-ns#',rdfs:'http://www.w3.org/2000/01/rdf-schema#',sys:'http://terminusdb.com/schema/sys#',vio:'http://terminusdb.com/schema/vio#',woql:'http://terminusdb.com/schema/woql#',xdd:'http://terminusdb.com/schema/xdd#',xsd:'http://www.w3.org/2001/XMLSchema#'},selected:[],system:system_descriptor{},transaction_objects:[...],update_guard:_9192,write_graph:branch_graph{branch_name:\"_bug_issue\",database_name:\"#################\",organization_name:\"##############",repository_name:\"local\",type:instance}},api_document:(...,...),_9140,[allow_destructive_migration(false),...|...]) at /app/terminusdb/src/core/transaction/database.pl:245\n [30] setup_call_catcher_cleanup(database:pre_transaction_tabling,database:with_transaction_(...,...,_9404,...),_9382,database:post_transaction_tabling) at /usr/lib/swipl/boot/init.pl:679\n [27] api_document:api_delete_documents('<garbage_collected>','terminusdb://system/data/User/######HIDDEN_USER########','##########HIDDEN_ORG_DP##############/local/branch/_bug_issue',<stream>(0x560a3d515500),no_data_version,_9458,'<garbage_collected>','<garbage_collected>') at /app/terminusdb/src/core/api/api_document.pl:415\n [26] '<meta-call>'('<garbage_collected>') <foreign>\n [25] catch(routes:(...,...),error(rust_error(...),context(_9556,_9558)),routes:do_or_die(...,...)) at /usr/lib/swipl/boot/init.pl:565\n [24] catch_with_backtrace('<garbage_collected>','<garbage_collected>','<garbage_collected>') at /usr/lib/swipl/boot/init.pl:645\n\nNote: some frames are missing due to last-call optimization.\nRe-run your program in debug mode (:- debug.) to get more detail.\n",
"data": {
"api:message": "Error: rust_error(panic(\"called `Option::unwrap()` on a `None` value\"))\n [40] delete_document(<GetDocumentContext>,transaction_object{commit_info:commit_info{},descriptor:branch_descriptor{branch_name:\"_bug_issue\",repository_descriptor: ...},inference_objects:[],instance_objects:[...],parent:transaction_object{descriptor: ...,inference_objects:[],instance_objects: ...,parent: ...,schema_objects: ...},schema_objects:[...]},'terminusdb:///data/SubCant/AN_Mo-Rrfl1xvcqw',true)\n [35] forall(api_document:json_read_list_stream(<stream>(0x560a3d515500),\"SubCant/AN_Mo-Rrfl1xvcqw\"),api_document:(...,...)) at /usr/lib/swipl/boot/apply.pl:52\n [33] call(api_document:(...,...)) at /usr/lib/swipl/boot/init.pl:502\n [32] catch(database:call(...),fail_transaction,database:(_9098=true)) at /usr/lib/swipl/boot/init.pl:565\n [31] database:with_transaction_(query_context{all_witnesses:false,authorization:'##########HIDE#############',bindings:[],commit_info:commit_info{author:'[email protected]',message:'delete document'},default_collection:branch_descriptor{branch_name:\"_bug_issue\",repository_descriptor: ...},files:[],filter:type_filter{types: ...},prefixes:_9206{'@base':\"terminusdb:///data/\",'@schema':\"terminusdb:///schema#\",'@type':'Context',api:'http://terminusdb.com/schema/api#',json:'http://terminusdb.com/schema/json#',owl:'http://www.w3.org/2002/07/owl#',rdf:'http://www.w3.org/1999/02/22-rdf-syntax-ns#',rdfs:'http://www.w3.org/2000/01/rdf-schema#',sys:'http://terminusdb.com/schema/sys#',vio:'http://terminusdb.com/schema/vio#',woql:'http://terminusdb.com/schema/woql#',xdd:'http://terminusdb.com/schema/xdd#',xsd:'http://www.w3.org/2001/XMLSchema#'},selected:[],system:system_descriptor{},transaction_objects:[...],update_guard:_9192,write_graph:branch_graph{branch_name:\"_bug_issue\",database_name:\"######HIDE#####\",organization_name:\"########HIDE#######\",repository_name:\"local\",type:instance}},api_document:(...,...),_9140,[allow_destructive_migration(false),...|...]) at /app/terminusdb/src/core/transaction/database.pl:245\n [30] setup_call_catcher_cleanup(database:pre_transaction_tabling,database:with_transaction_(...,...,_9404,...),_9382,database:post_transaction_tabling) at /usr/lib/swipl/boot/init.pl:679\n [27] api_document:api_delete_documents('<garbage_collected>','terminusdb://system/data/User/#######HIDE_USERNAME##########','#########HIDE_INSTANCE_DATAPRODUCT##########/local/branch/_bug_issue',<stream>(0x560a3d515500),no_data_version,_9458,'<garbage_collected>','<garbage_collected>') at /app/terminusdb/src/core/api/api_document.pl:415\n [26] '<meta-call>'('<garbage_collected>') <foreign>\n [25] catch(routes:(...,...),error(rust_error(...),context(_9556,_9558)),routes:do_or_die(...,...)) at /usr/lib/swipl/boot/init.pl:565\n [24] catch_with_backtrace('<garbage_collected>','<garbage_collected>','<garbage_collected>') at /usr/lib/swipl/boot/init.pl:645\n\nNote: some frames are missing due to last-call optimization.\nRe-run your program in debug mode (:- debug.) to get more detail.\n",
"api:status": "api:server_error"
}
}
Info (please complete the following information):
- OS: DFRNT
- Version: 11.1.11
Additional context Here is a minimal reproducible schema:
[
{
"@base": "terminusdb:///data/",
"@schema": "terminusdb:///schema#",
"@type": "@context"
},
{
"@type": "Class",
"@key": {
"@type": "Random"
},
"@id": "CantBeRemoved",
"query": "Container"
},
{
"@type": "Class",
"@key": {
"@type": "Random"
},
"@id": "Container",
"@subdocument": []
},
{
"@type": "Class",
"@key": {
"@type": "Random"
},
"@id": "SubCant",
"@inherits": [
"CantBeRemoved"
]
},
{
"@type": "Class",
"@key": {
"@type": "ValueHash"
},
"@id": "And",
"@inherits": [
"Container"
],
"@subdocument": [],
"and": {
"@class": "Container",
"@type": "List"
}
}
]
After some more testing, I seem to be getting more of this kinds of errors even when it's not a list. This is when working with a branch _logic_main.
Edit: After a more thorough checking, it seems that a type that previously inherited causes problems for new instances created from that type too. When I create a new type that has previously not inherited from the non-working type, all is smooth. It seems I have a workaround that enables the next couple of days' work.
Please also check that you can delete a branch with the WOQL schema as well. It seems that a branch with a WOQL schema can't be deleted (I believe it's the same basic issue, so I'm not creating another issue for it yet)
I think this can be fixed relatively straightforwardly.
I could delete the documents again with the latest version (v11.1.12 that is deployed at TerminusDB). This issue can be closed now!