[英]MongoDB safe write issue
We have noticed this issue where data that is being "safely" written to the database, is not available few seconds later (say 2 seconds). 我们注意到此问题,即“安全”写入数据库的数据在几秒钟后(例如2秒钟)不可用。 Basically we do some safe writes to a collection (inside a web worker/request) and expect that data to be available from another process (Sidekiq workers).
基本上,我们对集合(在Web worker /请求内部)进行了一些安全的写操作,并期望可以从另一个进程(Sidekiq worker)获得数据。
Anyone know why this could be happening or has anyone seen similar behavior with MongoDB? 有谁知道为什么会发生这种情况,或者有人看到过MongoDB的类似行为?
Ours is a Rails 3.2.9/Ruby 1.9.3/Mongo 2.0.4 application. 我们的是Rails 3.2.9 / Ruby 1.9.3 / Mongo 2.0.4应用程序。 We are using
Mongoid
as the ORM tool. 我们正在使用
Mongoid
作为ORM工具。
Here's how we doing safe writes: 这是我们进行安全写入的方式:
account.safely.save!
Also, sharding is enabled for this collection and there is significant load on the server. 此外,为此集合启用了分片,并且服务器上的负载很大。
Following are the gems we use: 以下是我们使用的宝石:
gem 'mongo', '1.6.1'
gem 'mongoid', '2.4.10'
You are experiencing this because there are per-connection queues. 您正在遇到此问题,因为存在每个连接队列。 This is common when using connection pooling.
使用连接池时,这很常见。 From the same connection, you would have a consistent result.
通过相同的连接,您将获得一致的结果。
Check out this Mongoid Issue on GitHub: 在GitHub上查看此Mongoid问题:
https://github.com/mongoid/mongoid/issues/2605 https://github.com/mongoid/mongoid/issues/2605
The milestone for this was Mongoid 3.0.15 -- you are using 2.4.10, which is pretty ancient 里程碑是Mongoid 3.0.15-您使用的是2.4.10,这非常古老
I'd recommend upgrading.. 3.1 is out already. 我建议升级。3.1已经淘汰。
LOL - never mind - I just realize from your avatar that you opened that issue. 大声笑-没关系-我只是从您的头像中意识到您打开了该问题。 :-)
:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.