[SERVER-12550] Restore some form of two step (phase) index key insertion Created: 30/Jan/14  Updated: 11/Jul/16  Resolved: 31/Mar/14

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.5.4
Fix Version/s: 2.6.0-rc3

Type: Bug Priority: Critical - P2
Reporter: Dwight Merriman Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

v2.4.x has two phase insertion of keys in indexes on inserts. first it descends and finds insertion points in all indexes, then it goes and does the actual key insertions. it was done this way so that as much reading as possible is done before doing a write, as once we mutate something, pagefaultexceptions are no longer possible. i.e. imagine a collection with 10 indexes, after inserting a key in index 1 you can't then PFE on any remaining index lookups.

for context:

$ git checkout r2.4.9
HEAD is now at 52fe0d2... BUMP 2.4.9
~/mongo/src/mongo/db$ grep -r twoStep *
btree.cpp:    void BtreeBucket<V>::twoStepInsert(DiskLoc thisLoc, IndexInsertionContinuationImpl<V> &c,
btree.h:        void twoStepInsert(DiskLoc thisLoc, IndexInsertionContinuationImpl<V> &c, bool dupsAllowed) const;
index.cpp:            _idx.head.btree<V>()->twoStepInsert(_idx.head, *continuation, dupsAllowed);



 Comments   
Comment by Githook User [ 02/Apr/14 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-12550: use Context instead of ReadContext and don't check shard version
this happens later
Branch: v2.6
https://github.com/mongodb/mongo/commit/91e679c2102b2870cfc0b2eeb31035eabc234deb

Comment by Githook User [ 30/Mar/14 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-12550: insert has 3 phases:
a) outside of lock generate keys
b) inside lock touch btree pages
c) do insert
Branch: v2.6
https://github.com/mongodb/mongo/commit/ee42f85b2c7497a78b56eb6e8b293305125b4cc2

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