我们一直在Travis构建中使用默认的MongoDB版本,即3.2。升级到MongoDB 3.4(3.4.10)后,我们开始看到间歇性构建失败:
An error occurred while loading ./spec/controllers/users_controller_spec.rb.
Failure/Error: require File.expand_path("../../config/environment", __FILE__)
Mongo::Error::OperationFailure:
Didn't find RecordId in WiredTigerRecordStore (28556)
# ./vendor/bundle/ruby/2.3.0/gems/mongo-2.4.3/lib/mongo/operation/result.rb:256:in `validate!'
# ./vendor/bundle/ruby/2.3.0/gems/mongo-2.4.3/lib/mongo/operation/write/write_command_enabled.rb:57:in `execute_write_command'
# ./vendor/bundle/ruby/2.3.0/gems/mongo-2.4.3/lib/mongo/operation/write/write_command_enabled.rb:41:in `execute'
# ./vendor/bundle/ruby/2.3.0/gems/mongo-2.4.3/lib/mongo/index/view.rb:159:in `create_many'
# ./vendor/bundle/ruby/2.3.0/gems/mongo-2.4.3/lib/mongo/index/view.rb:130:in `create_one'
# ./vendor/bundle/ruby/2.3.0/gems/mongoid-6.2.1/lib/mongoid/indexable.rb:38:in `block in create_indexes'
# ./vendor/bundle/ruby/2.3.0/gems/mongoid-6.2.1/lib/mongoid/indexable.rb:31:in `each'
# ./vendor/bundle/ruby/2.3.0/gems/mongoid-6.2.1/lib/mongoid/indexable.rb:31:in `create_indexes'
# ./config/application.rb:60:in `block (2 levels) in <class:Application>'
# ./config/application.rb:60:in `each'
# ./config/application.rb:60:in `block in <class:Application>'
# ./vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook'
# ./vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
# ./vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
# ./vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
# ./vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
# ./vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
# ./vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
# ./vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
# ./vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
# ./vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
# ./vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
# ./vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
# ./config/environment.rb:5:in `<top (required)>'
# ./spec/rails_helper.rb:13:in `require'
# ./spec/rails_helper.rb:13:in `<top (required)>'
# ./spec/controllers/users_controller_spec.rb:1:in `require'
# ./spec/controllers/users_controller_spec.rb:1:in `<top (required)>'
在我们的application.rb(第60行)中,我们确保创建所有相关的MongoDB索引:
User.create_indexes
版本
关于可能导致这种情况的任何想法?