695
695
return BSONObj();
698
uassert(15916, str::stream() << "Can no longer connect to initial sync source: " << hn, missingObjReader.connect(hn));
700
// might be more than just _id in the update criteria
701
BSONObj query = BSONObjBuilder().append(o.getObjectField("o2")["_id"]).obj();
704
missingObj = missingObjReader.findOne(ns, query);
705
} catch(DBException& e) {
706
log() << "replication assertion fetching missing object: " << e.what() << endl;
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);
705
bool ok = missingObjReader.connect(hn);
707
warning() << "network problem detected while connecting to the "
708
<< "sync source, attempt " << retryCount << " of "
710
continue; // try again
713
catch (const SocketException& exc) {
714
warning() << "network problem detected while connecting to the "
715
<< "sync source, attempt " << retryCount << " of "
717
continue; // try again
720
// might be more than just _id in the update criteria
721
BSONObj query = BSONObjBuilder().append(o.getObjectField("o2")["_id"]).obj();
724
missingObj = missingObjReader.findOne(ns, query);
726
catch (const SocketException& exc) {
727
warning() << "network problem detected while fetching a missing document from the "
728
<< "sync source, attempt " << retryCount << " of "
730
continue; // try again
732
catch (DBException& e) {
733
log() << "replication assertion fetching missing object: " << e.what() << endl;
740
// retry count exceeded
742
str::stream() << "Can no longer connect to initial sync source: " << hn);
713
745
bool Sync::shouldRetry(const BSONObj& o) {