Neo4j& quot;不能等待资源"锁定错误 [英] Neo4j "Can't wait on resource" lock error

查看:195
本文介绍了Neo4j& quot;不能等待资源"锁定错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Node.js连接到托管的GrapheneDB Neo4j数据库,当尝试添加约1500条记录时,出现以下错误:

I am using Node.js to connect to a hosted GrapheneDB Neo4j database and when attempting to add about 1,500 records I get the following error:

LockClient[19] can't wait on resource 
RWLock[NODE(248), hash=1917331445] since => LockClient[19] 
<-[:HELD_BY]- RWLock[INDEX_ENTRY(153122458561043471), hash=1171319680] 
<-[:WAITING_FOR]- LockClient[15] <-[:HELD_BY]- RWLock[NODE(248), hash=1917331445]

生成此代码的代码来自路由,该路由获取JSON对象列表,然后将其存储在Neo4j中.导入大约1,500条记录时,始终出现此错误.

The code that generates this comes from a route that takes a list of JSON objects and then stores them in Neo4j. When importing approx 1,500 records I get this error consistently.

使用seraph模型进行数据库访问,仅查找记录,更新记录(如果存在),或者创建记录(不存在).

Using seraph-model to do the database accessing and just looking up the record, updating if it exists or creating it if it doesn't.

任何建议在哪里进行调查?

Any suggestions where to investigate?

推荐答案

您似乎正在同时进行多个大型交易,并同时触及了图形的同一区域.

It looks like you're doing multiple large transactions concurrently hitting the same region of your graph.

Neo4j执行写操作时,将在该节点/关系上获取写锁,并在事务关闭时释放写锁.试图同时获取已经锁定的实体上的写锁定的其他同时运行的事务需要等待-否则将打开一盒pandora的不一致性.如果锁的所有者是一个运行时间较长的事务,则另一个可能会遇到超时-这就是上面的错误消息.

When Neo4j performs a write, a write lock is acquired on that node/relationship and released when the transactions is closed. Other transaction running concurrently who try to acquire a write lock on a already locked entity need to wait - otherwise a box of pandora's inconsistencies would have had opened. If the owner of the lock is a rather long running transaction, the other one might run into a timeout - that would be the above error message.

因此您可以:

  1. 序列化操作:不要并行执行写操作,而要确保在给定的时间仅处理一个胖事务
  2. 使事务更小:如果您在单一事务中做的少,则持续时间将缩短,并且其他等待锁的事务也不会超时.

这篇关于Neo4j&amp; quot;不能等待资源&quot;锁定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆