private DBCursor oplogCursor(final Timestamp<?> timestampOverride) throws SlurperException { Timestamp<?> time = timestampOverride == null ? MongoDBRiver.getLastTimestamp(client, definition) : timestampOverride; DBObject indexFilter = time.getOplogFilter(); if (indexFilter == null) { return null; } int options = Bytes.QUERYOPTION_TAILABLE | Bytes.QUERYOPTION_AWAITDATA | Bytes.QUERYOPTION_NOTIMEOUT; // Using OPLOGREPLAY to improve performance: // https://jira.mongodb.org/browse/JAVA-771 if (indexFilter.containsField(MongoDBRiver.OPLOG_TIMESTAMP)) { options = options | Bytes.QUERYOPTION_OPLOGREPLAY; } DBCursor cursor = oplogCollection.find(indexFilter).setOptions(options); isRiverStale(cursor, time); return cursor; }
protected boolean isIndexEmpty() { return MongoDBRiver.getIndexCount(client, definition) == 0; }
protected boolean riverHasIndexedFromOplog() { return MongoDBRiver.getLastTimestamp(client, definition) != null; }