diff options
author | dwight <dwight@10gen.com> | 2010-09-27 12:42:51 -0400 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2010-09-27 12:42:51 -0400 |
commit | 05ef187841a2dbedf8d689ab833737ad15f873f5 (patch) | |
tree | 7402ac1f21080ec58e99419ab8f2602d80bf7fab /db/pdfile.cpp | |
parent | c1b68a13dea69fce069eec237901cf3511052cf5 (diff) | |
parent | 5a5d766199cd952c868484d4c1e3fd880092c291 (diff) | |
download | mongo-05ef187841a2dbedf8d689ab833737ad15f873f5.tar.gz |
Merge branch 'master' of github.com:mongodb/mongo
Conflicts:
db/repl/manager.cpp
Diffstat (limited to 'db/pdfile.cpp')
-rw-r--r-- | db/pdfile.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 524d63ac52b..8e75ce41925 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -1396,7 +1396,7 @@ namespace mongo { insert( ns, o.objdata(), o.objsize(), god ); } - bool prepareToBuildIndex(const BSONObj& io, bool god, string& sourceNS, NamespaceDetails *&sourceCollection); + bool prepareToBuildIndex(const BSONObj& io, bool god, string& sourceNS, NamespaceDetails *&sourceCollection, BSONObj& fixedIndexObject ); // We are now doing two btree scans for all unique indexes (one here, and one when we've // written the record to the collection. This could be made more efficient inserting @@ -1461,11 +1461,18 @@ namespace mongo { NamespaceDetails *tableToIndex = 0; string tabletoidxns; + BSONObj fixedIndexObject; if ( addIndex ) { assert( obuf ); BSONObj io((const char *) obuf); - if( !prepareToBuildIndex(io, god, tabletoidxns, tableToIndex) ) + if( !prepareToBuildIndex(io, god, tabletoidxns, tableToIndex, fixedIndexObject ) ) return DiskLoc(); + + if ( ! fixedIndexObject.isEmpty() ){ + obuf = fixedIndexObject.objdata(); + len = fixedIndexObject.objsize(); + } + } const BSONElement *newId = &writeId; |