summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/dbhelpers.cpp2
-rw-r--r--src/mongo/db/dbhelpers.h2
-rw-r--r--src/mongo/db/repl/oplogreader.cpp12
-rw-r--r--src/mongo/db/repl/oplogreader.h24
4 files changed, 16 insertions, 24 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index fe7e0f53952..3f82479e08c 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -79,8 +79,6 @@ namespace mongo {
using logger::LogComponent;
- const BSONObj reverseNaturalObj = BSON( "$natural" << -1 );
-
void Helpers::ensureIndex(OperationContext* txn,
Collection* collection,
BSONObj keyPattern,
diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h
index 9fbaf372a96..d149176a443 100644
--- a/src/mongo/db/dbhelpers.h
+++ b/src/mongo/db/dbhelpers.h
@@ -37,8 +37,6 @@
namespace mongo {
- extern const BSONObj reverseNaturalObj; // {"$natural": -1 }
-
class Collection;
class Cursor;
class OperationContext;
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index bea0484fc44..f8e72373253 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -58,6 +58,8 @@ namespace mongo {
namespace repl {
+ const BSONObj reverseNaturalObj = BSON( "$natural" << -1 );
+
//number of readers created;
// this happens when the source source changes, a reconfig/network-error or the cursor dies
static Counter64 readersCreatedStats;
@@ -66,8 +68,6 @@ namespace repl {
&readersCreatedStats );
- static const BSONObj userReplQuery = fromjson("{\"user\":\"repl\"}");
-
bool replAuthenticate(DBClientBase *conn) {
if (!getGlobalAuthorizationManager()->isAuthEnabled())
return true;
@@ -123,18 +123,18 @@ namespace repl {
);
}
- void OplogReader::tailingQuery(const char *ns, const BSONObj& query, const BSONObj* fields ) {
+ void OplogReader::tailingQuery(const char *ns, const BSONObj& query) {
verify( !haveCursor() );
LOG(2) << ns << ".find(" << query.toString() << ')' << endl;
- cursor.reset( _conn->query( ns, query, 0, 0, fields, _tailingQueryOptions ).release() );
+ cursor.reset( _conn->query( ns, query, 0, 0, nullptr, _tailingQueryOptions ).release() );
}
- void OplogReader::tailingQueryGTE(const char *ns, Timestamp optime, const BSONObj* fields ) {
+ void OplogReader::tailingQueryGTE(const char *ns, Timestamp optime) {
BSONObjBuilder gte;
gte.append("$gte", optime);
BSONObjBuilder query;
query.append("ts", gte.done());
- tailingQuery(ns, query.done(), fields);
+ tailingQuery(ns, query.done());
}
HostAndPort OplogReader::getHost() const {
diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h
index bf089450535..fc19c83d5cb 100644
--- a/src/mongo/db/repl/oplogreader.h
+++ b/src/mongo/db/repl/oplogreader.h
@@ -38,10 +38,10 @@
#include "mongo/util/net/hostandport.h"
namespace mongo {
+namespace repl {
- extern const BSONObj reverseNaturalObj; // { $natural : -1 }
+ extern const BSONObj reverseNaturalObj; // {"$natural": -1 }
-namespace repl {
class ReplicationCoordinator;
/**
@@ -97,15 +97,9 @@ namespace repl {
int nToSkip,
const BSONObj* fields=0);
- void tailingQuery(const char *ns, const BSONObj& query, const BSONObj* fields=0);
+ void tailingQuery(const char *ns, const BSONObj& query);
- void tailingQueryGTE(const char *ns, Timestamp t, const BSONObj* fields=0);
-
- /* Do a tailing query, but only send the ts field back. */
- void ghostQueryGTE(const char *ns, Timestamp t) {
- const BSONObj fields = BSON("ts" << 1 << "_id" << 0);
- return tailingQueryGTE(ns, t, &fields);
- }
+ void tailingQueryGTE(const char *ns, Timestamp t);
bool more() {
uassert( 15910, "Doesn't have cursor for reading oplog", cursor.get() );
@@ -123,15 +117,17 @@ namespace repl {
return cursor->getMessage()->size();
}
- int getTailingQueryOptions() const { return _tailingQueryOptions; }
- void setTailingQueryOptions( int tailingQueryOptions ) { _tailingQueryOptions = tailingQueryOptions; }
+ BSONObj nextSafe() { return cursor->nextSafe(); }
+ BSONObj next() { return cursor->next(); }
+
+ // master/slave only
void peek(std::vector<BSONObj>& v, int n) {
if( cursor.get() )
cursor->peek(v,n);
}
- BSONObj nextSafe() { return cursor->nextSafe(); }
- BSONObj next() { return cursor->next(); }
+
+ // master/slave only
void putBack(BSONObj op) { cursor->putBack(op); }
HostAndPort getHost() const;