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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-07 13:21:03 UTC
  • mfrom: (44.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130807132103-5ch290okdlzg9u9y
Tags: 1:2.4.5-1ubuntu1
* 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/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.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
  - 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.
* Dropped changes, no longer required:
  - d/p/SConscript.client.patch: fixup install of client libraries.
* d/rules,control: Switch back to using gcc/g++ 4.8 as we have appropriate
  fixes in the Ubuntu delta.
* d/mongodb-server.mongodb.upstart: Sync changes from upstream packaging
  upstart configuration, specifically;
  - increase nofile limits to 20000/20000.
  - wait 300s between SIGTERM and SIGKILL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
695
695
            return BSONObj();
696
696
        }
697
697
 
698
 
        uassert(15916, str::stream() << "Can no longer connect to initial sync source: " << hn, missingObjReader.connect(hn));
699
 
 
700
 
        // might be more than just _id in the update criteria
701
 
        BSONObj query = BSONObjBuilder().append(o.getObjectField("o2")["_id"]).obj();
702
 
        BSONObj missingObj;
703
 
        try {
704
 
            missingObj = missingObjReader.findOne(ns, query);
705
 
        } catch(DBException& e) {
706
 
            log() << "replication assertion fetching missing object: " << e.what() << endl;
707
 
            throw;
 
698
        const int retryMax = 3;
 
699
        for (int retryCount = 1; retryCount <= retryMax; ++retryCount) {
 
700
            if (retryCount != 1) {
 
701
                // if we are retrying, sleep a bit to let the network possibly recover
 
702
                sleepsecs(retryCount * retryCount);
 
703
            }
 
704
            try {
 
705
                bool ok = missingObjReader.connect(hn);
 
706
                if (!ok) {
 
707
                    warning() << "network problem detected while connecting to the "
 
708
                              << "sync source, attempt " << retryCount << " of "
 
709
                              << retryMax << endl;
 
710
                        continue;  // try again
 
711
                }
 
712
            } 
 
713
            catch (const SocketException& exc) {
 
714
                warning() << "network problem detected while connecting to the "
 
715
                          << "sync source, attempt " << retryCount << " of "
 
716
                          << retryMax << endl;
 
717
                continue; // try again
 
718
            }
 
719
 
 
720
            // might be more than just _id in the update criteria
 
721
            BSONObj query = BSONObjBuilder().append(o.getObjectField("o2")["_id"]).obj();
 
722
            BSONObj missingObj;
 
723
            try {
 
724
                missingObj = missingObjReader.findOne(ns, query);
 
725
            } 
 
726
            catch (const SocketException& exc) {
 
727
                warning() << "network problem detected while fetching a missing document from the "
 
728
                          << "sync source, attempt " << retryCount << " of "
 
729
                          << retryMax << endl;
 
730
                continue; // try again
 
731
            } 
 
732
            catch (DBException& e) {
 
733
                log() << "replication assertion fetching missing object: " << e.what() << endl;
 
734
                throw;
 
735
            }
 
736
 
 
737
            // success!
 
738
            return missingObj;
708
739
        }
709
 
 
710
 
        return missingObj;
 
740
        // retry count exceeded
 
741
        msgasserted(15916, 
 
742
                    str::stream() << "Can no longer connect to initial sync source: " << hn);
711
743
    }
712
744
 
713
745
    bool Sync::shouldRetry(const BSONObj& o) {