summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-04-27 13:30:01 -0400
committerBenety Goh <benety@mongodb.com>2016-05-06 16:08:20 -0400
commitd7e278414b7ab0c8534db5a3ebc0b03e581a7e8a (patch)
tree9c06fa6c871db4e73d1eb56f6248812d94ea7670 /src/mongo/db/repl
parent9cb5a6e997c0b405bff5f87fe3409003972bf6ef (diff)
downloadmongo-d7e278414b7ab0c8534db5a3ebc0b03e581a7e8a.tar.gz
SERVER-23134 removed QueryFetcher
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/data_replicator.cpp44
-rw-r--r--src/mongo/db/repl/data_replicator.h10
-rw-r--r--src/mongo/db/repl/oplog_fetcher.h2
3 files changed, 21 insertions, 35 deletions
diff --git a/src/mongo/db/repl/data_replicator.cpp b/src/mongo/db/repl/data_replicator.cpp
index 25409758b65..b8f2d7f3a3a 100644
--- a/src/mongo/db/repl/data_replicator.cpp
+++ b/src/mongo/db/repl/data_replicator.cpp
@@ -35,7 +35,7 @@
#include <algorithm>
#include "mongo/base/status.h"
-#include "mongo/client/query_fetcher.h"
+#include "mongo/client/fetcher.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
@@ -224,9 +224,7 @@ struct InitialSyncState {
const NamespaceString& oplogNS);
void setStatus(const Status& s);
void setStatus(const CBHStatus& s);
- void _setTimestampStatus(const QueryResponseStatus& fetchResult,
- Fetcher::NextAction* nextAction,
- TimestampStatus* status);
+ void _setTimestampStatus(const QueryResponseStatus& fetchResult, TimestampStatus* status);
};
// Initial Sync state
@@ -244,7 +242,6 @@ TimestampStatus InitialSyncState::getLatestOplogTimestamp(ReplicationExecutor* e
stdx::bind(&InitialSyncState::_setTimestampStatus,
this,
stdx::placeholders::_1,
- stdx::placeholders::_2,
&timestampStatus));
Status s = f.schedule();
if (!s.isOK()) {
@@ -257,7 +254,6 @@ TimestampStatus InitialSyncState::getLatestOplogTimestamp(ReplicationExecutor* e
}
void InitialSyncState::_setTimestampStatus(const QueryResponseStatus& fetchResult,
- Fetcher::NextAction* nextAction,
TimestampStatus* status) {
if (!fetchResult.isOK()) {
*status = TimestampStatus(fetchResult.getStatus());
@@ -771,25 +767,22 @@ void DataReplicator::_onDataClonerFinish(const Status& status) {
<< "limit" << 1);
TimestampStatus timestampStatus(ErrorCodes::BadValue, "");
- _tmpFetcher.reset(new QueryFetcher(_exec,
- _syncSource,
- _opts.remoteOplogNS,
- query,
- stdx::bind(&DataReplicator::_onApplierReadyStart,
- this,
- stdx::placeholders::_1,
- stdx::placeholders::_2)));
+ _tmpFetcher = stdx::make_unique<Fetcher>(
+ _exec,
+ _syncSource,
+ _opts.remoteOplogNS.db().toString(),
+ query,
+ stdx::bind(&DataReplicator::_onApplierReadyStart, this, stdx::placeholders::_1));
Status s = _tmpFetcher->schedule();
if (!s.isOK()) {
_initialSyncState->setStatus(s);
}
}
-void DataReplicator::_onApplierReadyStart(const QueryResponseStatus& fetchResult,
- NextAction* nextAction) {
+void DataReplicator::_onApplierReadyStart(const QueryResponseStatus& fetchResult) {
// Data clone done, move onto apply.
TimestampStatus ts(ErrorCodes::OplogStartMissing, "");
- _initialSyncState->_setTimestampStatus(fetchResult, nextAction, &ts);
+ _initialSyncState->_setTimestampStatus(fetchResult, &ts);
if (ts.isOK()) {
// TODO: set minvalid?
LockGuard lk(_mutex);
@@ -1075,16 +1068,12 @@ void DataReplicator::_scheduleApplyAfterFetch(const Operations& ops) {
const BSONElement missingIdElem = ops.begin()->getIdElement();
const NamespaceString nss(ops.begin()->ns);
const BSONObj query = BSON("find" << nss.coll() << "filter" << missingIdElem.wrap());
- _tmpFetcher.reset(new QueryFetcher(_exec,
- _syncSource,
- nss,
- query,
- stdx::bind(&DataReplicator::_onMissingFetched,
- this,
- stdx::placeholders::_1,
- stdx::placeholders::_2,
- ops,
- nss)));
+ _tmpFetcher = stdx::make_unique<Fetcher>(
+ _exec,
+ _syncSource,
+ nss.db().toString(),
+ query,
+ stdx::bind(&DataReplicator::_onMissingFetched, this, stdx::placeholders::_1, ops, nss));
Status s = _tmpFetcher->schedule();
if (!s.isOK()) {
// record error and take next step based on it.
@@ -1094,7 +1083,6 @@ void DataReplicator::_scheduleApplyAfterFetch(const Operations& ops) {
}
void DataReplicator::_onMissingFetched(const QueryResponseStatus& fetchResult,
- Fetcher::NextAction* nextAction,
const Operations& ops,
const NamespaceString nss) {
if (!fetchResult.isOK()) {
diff --git a/src/mongo/db/repl/data_replicator.h b/src/mongo/db/repl/data_replicator.h
index 9206aca1b0a..441cbc10aa3 100644
--- a/src/mongo/db/repl/data_replicator.h
+++ b/src/mongo/db/repl/data_replicator.h
@@ -264,14 +264,12 @@ private:
// Fetches the last doc from the first operation, and reschedules the apply for the ops.
void _scheduleApplyAfterFetch(const Operations&);
void _onMissingFetched(const QueryResponseStatus& fetchResult,
- Fetcher::NextAction* nextAction,
const Operations& ops,
const NamespaceString nss);
void _onDataClonerFinish(const Status& status);
// Called after _onDataClonerFinish when the new Timestamp is avail, to use for minvalid
- void _onApplierReadyStart(const QueryResponseStatus& fetchResult,
- Fetcher::NextAction* nextAction);
+ void _onApplierReadyStart(const QueryResponseStatus& fetchResult);
Status _scheduleApplyBatch();
Status _scheduleApplyBatch_inlock();
@@ -317,9 +315,9 @@ private:
CollectionCloner::StorageInterface* _storage; // (M)
// set during scheduling and onFinish
- bool _fetcherPaused; // (X)
- std::unique_ptr<OplogFetcher> _fetcher; // (S)
- std::unique_ptr<QueryFetcher> _tmpFetcher; // (S)
+ bool _fetcherPaused; // (X)
+ std::unique_ptr<OplogFetcher> _fetcher; // (S)
+ std::unique_ptr<Fetcher> _tmpFetcher; // (S)
bool _reporterPaused; // (M)
Handle _reporterHandle; // (M)
diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h
index c6209461161..45814e29832 100644
--- a/src/mongo/db/repl/oplog_fetcher.h
+++ b/src/mongo/db/repl/oplog_fetcher.h
@@ -31,7 +31,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/timestamp.h"
-#include "mongo/client/query_fetcher.h"
+#include "mongo/client/fetcher.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/data_replicator_external_state.h"
#include "mongo/db/repl/optime_with.h"