summaryrefslogtreecommitdiff
path: root/src/mongo/db/range_deleter.h
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-08-11 17:23:25 -0400
committerRandolph Tan <randolph@10gen.com>2014-08-15 15:31:49 -0400
commit8aa630d79699ff72fcb47e381c4caf318161f01e (patch)
tree5955aab0a32f7abda9bbc680fbb65bbfda542fe9 /src/mongo/db/range_deleter.h
parent39d5795eab4da921e2c813b3c99ae52a0d913f6b (diff)
downloadmongo-8aa630d79699ff72fcb47e381c4caf318161f01e.tar.gz
SERVER-14657 use RangeDeleter for all migration cleanup in d_migrate.cpp
Diffstat (limited to 'src/mongo/db/range_deleter.h')
-rw-r--r--src/mongo/db/range_deleter.h50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/mongo/db/range_deleter.h b/src/mongo/db/range_deleter.h
index cda4578b02b..7dcdd5abc89 100644
--- a/src/mongo/db/range_deleter.h
+++ b/src/mongo/db/range_deleter.h
@@ -40,16 +40,18 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/write_concern_options.h"
+#include "mongo/s/range_arithmetic.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/concurrency/synchronization.h"
#include "mongo/util/time_support.h"
namespace mongo {
- struct RangeDeleterEnv;
class OperationContext;
- struct RangeDeleteEntry;
struct DeleteJobStats;
+ struct RangeDeleteEntry;
+ struct RangeDeleterEnv;
+ struct RangeDeleterOptions;
/**
* Class for deleting documents for a given namespace and range. It contains a queue of
@@ -135,11 +137,7 @@ namespace mongo {
* Returns true if the task is queued and false If the given range is blacklisted,
* is already queued, or stopWorkers() was called.
*/
- bool queueDelete(const std::string& ns,
- const BSONObj& min,
- const BSONObj& max,
- const BSONObj& shardKeyPattern,
- const WriteConcernOptions& writeConcern,
+ bool queueDelete(const RangeDeleterOptions& options,
Notification* notifyDone,
std::string* errMsg);
@@ -151,11 +149,7 @@ namespace mongo {
* was already queued, or stopWorkers() was called.
*/
bool deleteNow(OperationContext* txn,
- const std::string& ns,
- const BSONObj& min,
- const BSONObj& max,
- const BSONObj& shardKeyPattern,
- const WriteConcernOptions& writeConcern,
+ const RangeDeleterOptions& options,
std::string* errMsg);
/**
@@ -305,27 +299,25 @@ namespace mongo {
}
};
- struct RangeDeleteEntry {
- RangeDeleteEntry(const std::string& ns,
- const BSONObj& min,
- const BSONObj& max,
- const BSONObj& shardKey,
- const WriteConcernOptions& writeConcern);
-
- const std::string ns;
+ struct RangeDeleterOptions {
+ RangeDeleterOptions(const KeyRange& range);
- // Inclusive lower range.
- const BSONObj min;
+ const KeyRange range;
- // Exclusive upper range.
- const BSONObj max;
+ WriteConcernOptions writeConcern;
+ std::string removeSaverReason;
+ bool fromMigrate;
+ bool onlyRemoveOrphanedDocs;
+ bool waitForOpenCursors;
+ };
- // The key pattern of the index the range refers to.
- // This is relevant especially with special indexes types
- // like hash indexes.
- const BSONObj shardKeyPattern;
+ /**
+ * For internal use only.
+ */
+ struct RangeDeleteEntry {
+ RangeDeleteEntry(const RangeDeleterOptions& options);
- const WriteConcernOptions writeConcern;
+ const RangeDeleterOptions options;
// Sets of cursors to wait to close until this can be ready
// for deletion.