[SERVER-16676] Compact with WiredTiger does not rebuild indexes Created: 27/Dec/14  Updated: 23/Jan/15  Resolved: 15/Jan/15

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Storage
Affects Version/s: 2.8.0-rc4
Fix Version/s: 3.0.0-rc6

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

Issue Links:
Related
related to SERVER-16967 WT_WITH_TABLE_LOCK assert failure dur... Closed
Tested
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var coll = db.foo;
coll.drop();
 
coll.insert({_id: 1});
assert.neq(null, coll.findOne({_id: 1}));
 
var res = coll.runCommand({compact: coll.getName()});
assert.commandWorked(res, tojson(res));
 
// this assert fails because findOne returns null
assert.neq(null, coll.findOne({_id: 1}));
 
// run validate to see index keys: { "test.foo.$_id_" : 0 }
res = coll.runCommand({validate: coll.getName(), full: true});
printjson(res.keysPerIndex);

Participants:

 Description   

Compacting a WiredTiger collection removes or corrupts index keys, which leads to failed queries.


Version: b0014456ddef



 Comments   
Comment by Githook User [ 15/Jan/15 ]

Author:

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

Message: SERVER-16676 don't trash indexes for RecordStores that can compact in-place
Branch: master
https://github.com/mongodb/mongo/commit/59fec904c441998dc6381b8e26bd4b90d8718a3e

Comment by J Rassi [ 27/Dec/14 ]

The logic that rebuilds indexes after a compact currently depends on the record store's compact() implementation invoking the RecordStoreCompactAdaptor::inserted() callback on each record in the collection. It looks like the current implementation (and the original implementation) of WiredTigerRecordStore::compact() ignores the "adaptor" argument being passed in, which leaves the collection's indexes empty after the compact.

Marking 2.8.0-rc5, changing summary to "Compact with WiredTiger does not rebuild indexes". cc eliot, redbeard0531.

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