~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to src/mongo/db/btreebuilder.cpp

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "stats/counters.h"
29
29
#include "dur_commitjob.h"
30
30
#include "btreebuilder.h"
 
31
#include "mongo/db/kill_current_op.h"
31
32
 
32
33
namespace mongo {
33
34
 
92
93
    }
93
94
 
94
95
    template<class V>
95
 
    void BtreeBuilder<V>::buildNextLevel(DiskLoc loc) {
 
96
    void BtreeBuilder<V>::buildNextLevel(DiskLoc loc, bool mayInterrupt) {
96
97
        int levels = 1;
97
98
        while( 1 ) {
98
99
            if( loc.btree<V>()->tempNext().isNull() ) {
108
109
 
109
110
            DiskLoc xloc = loc;
110
111
            while( !xloc.isNull() ) {
 
112
                killCurrentOp.checkForInterrupt( !mayInterrupt );
 
113
 
111
114
                if ( getDur().commitIfNeeded() ) {
112
115
                    b = cur.btreemod<V>();
113
116
                    up = upLoc.btreemod<V>();
134
137
                    x->parent = upLoc;
135
138
                }
136
139
                else {
137
 
                  if ( !x->nextChild.isNull() ) {
138
 
                    DiskLoc ll = x->nextChild;
139
 
                    ll.btreemod<V>()->parent = upLoc;
140
 
                    //(x->nextChild.btreemod<V>())->parent = upLoc;
141
 
                  }
142
 
                  x->deallocBucket( xloc, idx );
 
140
                    if ( !x->nextChild.isNull() ) {
 
141
                        DiskLoc ll = x->nextChild;
 
142
                        ll.btreemod<V>()->parent = upLoc;
 
143
                        //(x->nextChild.btreemod<V>())->parent = upLoc;
 
144
                    }
 
145
                    x->deallocBucket( xloc, idx );
143
146
                }
144
147
                xloc = nextLoc;
145
148
            }
154
157
 
155
158
    /** when all addKeys are done, we then build the higher levels of the tree */
156
159
    template<class V>
157
 
    void BtreeBuilder<V>::commit() {
158
 
        buildNextLevel(first);
 
160
    void BtreeBuilder<V>::commit(bool mayInterrupt) {
 
161
        buildNextLevel(first, mayInterrupt);
159
162
        committed = true;
160
163
    }
161
164
 
162
 
    template<class V>
163
 
    BtreeBuilder<V>::~BtreeBuilder() {
164
 
        DESTRUCTOR_GUARD(
165
 
            if( !committed ) {
166
 
                LOG(2) << "Rolling back partially built index space" << endl;
167
 
                DiskLoc x = first;
168
 
                while( !x.isNull() ) {
169
 
                    DiskLoc next = x.btree<V>()->tempNext();
170
 
                    string ns = idx.indexNamespace();
171
 
                    theDataFileMgr._deleteRecord(nsdetails(ns.c_str()), ns.c_str(), x.rec(), x);
172
 
                    x = next;
173
 
                    getDur().commitIfNeeded();
174
 
                }
175
 
                verify( idx.head.isNull() );
176
 
                LOG(2) << "done rollback" << endl;
177
 
            }
178
 
        )
179
 
    }
180
 
 
181
165
    template class BtreeBuilder<V0>;
182
166
    template class BtreeBuilder<V1>;
183
167