[SERVER-23655] CollectionInfoCache is not invalidated when starting an index build Created: 12/Apr/16  Updated: 02/Aug/18  Resolved: 15/Apr/16

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Internal Code, MMAPv1
Affects Version/s: 3.3.4
Fix Version/s: 3.2.6, 3.3.5

Type: Task Priority: Critical - P2
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: code-only
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-22970 Background index build produces an in... Closed
Related
related to SERVER-44432 Per index access stats Closed
Backwards Compatibility: Fully Compatible
Backport Completed:
Sprint: Integration 13 (04/22/16)
Participants:

 Description   

When running on MMAPv1, transformAndUpdate calls Collection::updateDocumentWithDamages() when performing an in-place update when a background index build is in progress. However, it can't do this when the field being updated is indexed, as the damage vector update doesn't take index changes into account.



 Comments   
Comment by Githook User [ 16/Apr/16 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: SERVER-23655 invalidate CollectionInfoCache on index build

This forces a rebuild of a collection's info cache once an index build has
started, rather than waiting until the build has completed. This way,
updates occurring while a background index build is in progress correctly know
that the index will be affected and perform the update accordingly.
Branch: v3.2
https://github.com/mongodb/mongo/commit/9f3da9f28f1179ff0ee1171b6e714f553e793165

Comment by Githook User [ 15/Apr/16 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: SERVER-23655 invalidate CollectionInfoCache on index build

This forces a rebuild of a collection's info cache once an index build has
started, rather than waiting until the build has completed. This way,
updates occurring while a background index build is in progress correctly know
that the index will be affected and perform the update accordingly.
Branch: master
https://github.com/mongodb/mongo/commit/7736f20d7bd202e45f3aca04d183dd79ef37001d

Comment by Kyle Suarez [ 14/Apr/16 ]

Bisection shows that the bug was introduced in SERVER-2227: a change to index create moved the cache invalidation of the CollectionInfoCache to after success, so that index usage tracking statistics can be registered.

Comment by Kyle Suarez [ 12/Apr/16 ]

Looks like the situation is the following:

The UpdateDriver determines that an update can (possibly) be done in-place if it does not touch any indexed fields. It does this by consulting the collection's CollectionInfoCache to see if any of its indexed paths are affected. This CollectionInfoCache correctly includes indexes that are in progress, but the CollectionInfoCache only regenerates the indexes it knows about after the index build has finished successfully. This means that a background index build in progress won't be registered in time with the cache, and the UpdateDriver will falsely believe that there's no need to update any indexes.

Updating the cache when the index build starts should fix this, though it's still unclear if this will affect other behavior.

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