Operational Defect Database

BugZero found this defect 2475 days ago.

MongoDB | 383517

[SERVER-29197] Dangling index records when initial syncing node clones a capped collection that deletes records during collection scan

Last update date:

10/30/2023

Affected products:

MongoDB Server

Affected releases:

3.4.0

3.4.1

3.4.2

3.4.3

3.4.4

Fixed releases:

3.4.6

3.5.9

Description:

Info

During an initial sync of a capped collection, the collection scan reads until it hits EOF. If records are inserted on the sync source during the collection scan, the scan may read more documents than the collection cap allows, which will result in records being deleted during the collection scan. The collection cloner for initial sync uses a MultiIndexBlock builder, which does not expect records to be deleted while it builds indexes. If records are deleted before the MultiIndexBlock commits at the end of the collection scan, it can leave dangling index records pointing to deleted records. On WiredTiger, this simply results in an error when the index records are scanned. On MMAPv1, the index records point to invalid record data, which may or may not produce a BSON parsing error that looks like this: 2017-05-15T09:45:48.697-0400 I - [conn3] Assertion: 10334:BSONObj size: -286331154 (0xEEEEEEEE) is invalid. Size must be between 0 and 16793600(16MB) First element: _id: ObjectId('5919b0b5f337b48af7a0be4d') src/mongo/bson/bsonobj.cpp 58 The collections in question will fail an index validation by the validate command. To repair this issue, run the reindex command.

Top User Comments

xgen-internal-githook commented on Wed, 14 Jun 2017 13:07:20 +0000: Author: {u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'} Message: SERVER-29197 initial sync now builds capped indexes correctly In initial sync, capped indexes were built along with regular indexes, as documents were inserted, using the MultiIndexBlock. This structure requires that no records are deleted before committing the index builds. But the collection cap might delete records prior to commit. The new way to build capped indexes will be to create the indexes on a capped collection prior to inserting any records, for initial sync. (cherry picked from commit 3a3a6def395bab81e7545b15a93bee7799d9efb1) Branch: v3.4 https://github.com/mongodb/mongo/commit/34d292df70c97fadbac07296dea3cb04b6021a4d xgen-internal-githook commented on Wed, 31 May 2017 19:05:13 +0000: Author: {u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'} Message: SERVER-29197 initial sync now builds capped indexes correctly In initial sync, capped indexes were built along with regular indexes, as documents were inserted, using the MultiIndexBlock. This structure requires that no records are deleted before committing the index builds. But the collection cap might delete records prior to commit. The new way to build capped indexes will be to create the indexes on a capped collection prior to inserting any records, for initial sync. Branch: master https://github.com/mongodb/mongo/commit/3a3a6def395bab81e7545b15a93bee7799d9efb1

Additional Resources / Links

Share:

BugZero Risk Score

Coming soon

Status

Closed

Have you been affected by this bug?

cost-cta-background

Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.

Discussion

Login to read and write comments.

Have you ever...

had your data corrupted from a

VMware

bug?

Search:

...