我有一個Rails 3.1的應用程序,關於Ruby 1.9.2,2.0.2蒙戈運行,使用Mongoid作爲ODM,但是,這應該是最繞過的Mongoid,只是使用MongoDB的Ruby驅動程序。我在一個頁面加載中幾次運行MapReduce查詢。這將查詢將在發展的同時可接受運行,說喜歡半天,然後失敗,並MongoDB的MapReduce的查詢隨機失敗
(assertion: 'value has to be set';
assertionCode: '10210';
errmsg: 'db assertion failure';
ok: '0.0')
在頁面的刷新,一切都將繼續奇妙工作一段時間。從執行日誌(有一些修剪出)...
(R) MONGODB development['$cmd'].find({"mapreduce"=>"values", "map"=><BSON::Code:70098680478720 @data="function() {
var value = { a: 0, b: 0 };
var count = { a: 0, b: 0 };
var min = { a: 100, b: 100 };
var max = { a: -100, b: -100 };
if (this.c == "a" || this.c == "b") {
value[this.c] = parseInt(this.value);
count[this.c]++;
min[this.c] = parseInt(this.value);
max[this.c] = parseInt(this.value);
emit(this.item_id,
{
count: count,
values: value,
min: min,
max: max,
avg: { a: null, b: null }
}
);
}
}" @scope="{}">, "reduce"=><BSON::Code:70098680478680 @data="function(key, data) {
var newDatum = data.pop();
data.forEach(function(item) {
newDatum.values.a += item.values.a;
newDatum.count.a += item.count.a;
if (item.min.a < newDatum.min.a)
newDatum.min.a = item.min.a;
if (item.max.a > newDatum.max.a)
newDatum.max.a = item.max.a;
// same for b
});
newDatum.avg.a = newDatum.values.actual/newDatum.count.a;
newDatum.avg.b = newDatum.values.ideal/newDatum.count.b;
return newDatum;
}" @scope="{}">, :out=>{:inline=>1}, :query=>{:about_id=>BSON::ObjectId('4f1d84de69c238941d000012'), :by_id=>{"$ne"=>BSON::ObjectId('4f1d84de69c238941d000012')}, :comp_id=>{"$in"=>[BSON::ObjectId('4f1d84de69c238941d000016'), BSON::ObjectId('4f1d84de69c238941d000019')]}}}).limit(-1)
現在對於一個在同一請求失敗...查詢部分(但同樣,將顯著往往不是成功)
}" @scope="{}">, :out=>{:inline=>1}, :query=>{:about_id=>BSON::ObjectId('4f1d84de69c238941d000012'), :by_id=>BSON::ObjectId('4f1d84de69c238941d000012'), :comp_id=>BSON::ObjectId('4f1d84de69c238941d000019')}}).limit(-1)
Completed 500 Internal Server Error in 516ms
Mongo::OperationFailure (Database command 'mapreduce' failed: (assertion: 'value has to be set'; assertionCode: '10210'; errmsg: 'db assertion failure'; ok: '0.0').):
如果它的任何價值的,這是在Mac OS X Lion的發生與蒙戈通過自制軟件安裝。
$ mongod --version
db version v2.0.2, pdfile version 4.5
Wed Feb 8 16:33:11 git version: 514b122d308928517f5841888ceaa4246a7f18e3
而我在日誌文件中可以看到這個事件。關於mr失敗的一條線似乎與事件相符。
Wed Feb 8 15:08:36 [clientcursormon] mem (MB) res:15 virt:2630 mapped:80
Wed Feb 8 15:11:37 [clientcursormon] mem (MB) res:17 virt:2630 mapped:80
Wed Feb 8 15:16:37 [clientcursormon] mem (MB) res:17 virt:2630 mapped:80
Wed Feb 8 15:21:37 [clientcursormon] mem (MB) res:17 virt:2630 mapped:80
Wed Feb 8 15:26:37 [clientcursormon] mem (MB) res:17 virt:2630 mapped:80
Wed Feb 8 15:31:37 [clientcursormon] mem (MB) res:17 virt:2630 mapped:80
Wed Feb 8 15:32:55 [conn3] mr failed, removing collection :: caused
by :: 10210 value has to be set
Wed Feb 8 15:36:37 [clientcursormon] mem (MB) res:18 virt:2630 mapped:80
Wed Feb 8 15:39:26 [initandlisten] connection accepted from 127.0.0.1:57001 #4
所以我的問題是,我能做些什麼來幫助追蹤這件事?我沒有注意到我們使用Mongo的其他問題。我不確定如何深入瞭解並瞭解發生了什麼。