[SERVER-18912] Fatal assertion (duplicate key error) when replicating insert on capped collection Created: 10/Jun/15  Updated: 05/Feb/16  Resolved: 29/Jun/15

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.1.6

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: 32qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-16444 Avoid copying data out of WT buffers ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run with `python buildscripts/smoke.py repro.js`

'use strict';
 
load('jstests/libs/parallelTester.js');
 
function cappedWorkload() {
    var conn = new Mongo();
    var db = conn.getDB('test');
 
    while (true) {
        try {
            if (Random.randInt(100) === 0) {
                db.foo.drop();
            }
            db.createCollection('foo', {capped: true, size: 4096});
 
            db.foo.ensureIndex({value: 1});
            for (var i = 0; i < 10; ++i) {
                db.foo.insert({_id: i, value: 0});
            }
        } catch (e) {
            // ignore
        }
    }
}
 
// start the replica set
var rs = new ReplSetTest({nodes: 3, startPort: 27017});
rs.startSet();
rs.initiate();
rs.awaitSecondaryNodes();
 
// start the workload threads
var threads = [];
for (var i = 0; i < 20; i++) {
    var t = new ScopedThread(cappedWorkload);
 
    threads.push(t);
    t.start();
}
 
threads.forEach(function(t) {
    t.join();
});

Sprint: Quint Iteration 5, Quint Iteration 6
Participants:
Linked BF Score: 0

 Description   

Versions affected: recent versions of master (i.e., versions after the bump for 3.1.4)

From some preliminary bisecting, this bug seems to have been introduced since 3.1.4. It only seems to affect the WiredTiger storage engine:

 m27019| 2015-06-10T15:06:40.940-0400 I INDEX    [repl writer worker 15] build index on: test.foo properties: { v: 1, key: { value: 1.0 }, name: "value_1", ns: "test.foo" }
 m27019| 2015-06-10T15:06:40.940-0400 I INDEX    [repl writer worker 15] 	 building index using bulk method
 m27019| 2015-06-10T15:06:40.946-0400 I INDEX    [repl writer worker 15] build index done.  scanned 0 total records. 0 secs
 m27019| 2015-06-10T15:06:40.996-0400 E REPL     [repl writer worker 10] writer worker caught exception:  :: caused by :: 11000 E11000 duplicate key error collection: test.foo index: _id_ dup key: { : 8.0 } on: { ts: Timestamp 1433963200000|13, t: 0, h: -3679832681211329472, v: 2, op: "i", ns: "test.foo", o: { _id: 8.0, value: 0.0 } }
 m27019| 2015-06-10T15:06:40.996-0400 I -        [repl writer worker 10] Fatal Assertion 16360
 m27019| 2015-06-10T15:06:40.996-0400 I -        [repl writer worker 10] 
 m27019| 
 m27019| ***aborting after fassert() failure


Versions



 Comments   
Comment by Githook User [ 30/Jun/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18912 WiredTigerRecordCursor::seekExact() should set _eof=false on success
Branch: master
https://github.com/mongodb/mongo/commit/fec53e85b90085e289bfac4d8defaaea2bfb52eb

Comment by Githook User [ 29/Jun/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18912 Document and implement correct capped visibility rules

Fixes a bug introduced by SERVER-16444 changes.
Branch: master
https://github.com/mongodb/mongo/commit/40ddfd261f48ff20c649a6601ff19ed6b806332d

Comment by Kamran K. [ 10/Jun/15 ]

My bisecting has pinpointed 3b731deb as the culprit (from SERVER-16444).

Generated at Thu Feb 08 03:49:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.