diff options
author | Geert Bosch <geert@mongodb.com> | 2016-04-07 14:22:08 -0400 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2016-04-07 15:09:18 -0400 |
commit | 36e6aaa4ae1a5e0ffa80b5586fd52dee597e1aca (patch) | |
tree | 058fe29e00dbbd743680a1333f07c65c62aacbb9 /src/mongo/db/index | |
parent | 4cf2b5e3fbd85c40ea98e2b562376426e8da4dd8 (diff) | |
download | mongo-36e6aaa4ae1a5e0ffa80b5586fd52dee597e1aca.tar.gz |
SERVER-22723 Remove unused noWarn flag and logIfError option
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r-- | src/mongo/db/index/index_access_method.cpp | 22 | ||||
-rw-r--r-- | src/mongo/db/index/index_access_method.h | 30 |
2 files changed, 13 insertions, 39 deletions
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp index f99d3104c30..2bb7ee67cb4 100644 --- a/src/mongo/db/index/index_access_method.cpp +++ b/src/mongo/db/index/index_access_method.cpp @@ -100,7 +100,7 @@ bool IndexAccessMethod::ignoreKeyTooLong(OperationContext* txn) { Status IndexAccessMethod::insert(OperationContext* txn, const BSONObj& obj, const RecordId& loc, - const InsertDeleteOptions& options, + bool dupsAllowed, int64_t* numInserted) { *numInserted = 0; @@ -110,7 +110,7 @@ Status IndexAccessMethod::insert(OperationContext* txn, Status ret = Status::OK(); for (BSONObjSet::const_iterator i = keys.begin(); i != keys.end(); ++i) { - Status status = _newInterface->insert(txn, *i, loc, options.dupsAllowed); + Status status = _newInterface->insert(txn, *i, loc, dupsAllowed); // Everything's OK, carry on. if (status.isOK()) { @@ -135,7 +135,7 @@ Status IndexAccessMethod::insert(OperationContext* txn, // Clean up after ourselves. for (BSONObjSet::const_iterator j = keys.begin(); j != i; ++j) { - removeOneKey(txn, *j, loc, options.dupsAllowed); + removeOneKey(txn, *j, loc, dupsAllowed); *numInserted = 0; } @@ -177,14 +177,14 @@ std::unique_ptr<SortedDataInterface::Cursor> IndexAccessMethod::newRandomCursor( Status IndexAccessMethod::remove(OperationContext* txn, const BSONObj& obj, const RecordId& loc, - const InsertDeleteOptions& options, + bool dupsAllowed, int64_t* numDeleted) { BSONObjSet keys; getKeys(obj, &keys); *numDeleted = 0; for (BSONObjSet::const_iterator i = keys.begin(); i != keys.end(); ++i) { - removeOneKey(txn, *i, loc, options.dupsAllowed); + removeOneKey(txn, *i, loc, dupsAllowed); ++*numDeleted; } @@ -271,7 +271,7 @@ Status IndexAccessMethod::validateUpdate(OperationContext* txn, const BSONObj& from, const BSONObj& to, const RecordId& record, - const InsertDeleteOptions& options, + bool dupsAllowed, UpdateTicket* ticket, const MatchExpression* indexFilter) { if (indexFilter == NULL || indexFilter->matchesBSON(from)) @@ -279,7 +279,7 @@ Status IndexAccessMethod::validateUpdate(OperationContext* txn, if (indexFilter == NULL || indexFilter->matchesBSON(to)) getKeys(to, &ticket->newKeys); ticket->loc = record; - ticket->dupsAllowed = options.dupsAllowed; + ticket->dupsAllowed = dupsAllowed; setDifference(ticket->oldKeys, ticket->newKeys, &ticket->removed); setDifference(ticket->newKeys, ticket->oldKeys, &ticket->added); @@ -342,9 +342,7 @@ IndexAccessMethod::BulkBuilder::BulkBuilder(const IndexAccessMethod* index, Status IndexAccessMethod::BulkBuilder::insert(OperationContext* txn, const BSONObj& obj, - const RecordId& loc, - const InsertDeleteOptions& options, - int64_t* numInserted) { + const RecordId& loc) { BSONObjSet keys; _real->getKeys(obj, &keys); @@ -355,10 +353,6 @@ Status IndexAccessMethod::BulkBuilder::insert(OperationContext* txn, _keysInserted++; } - if (NULL != numInserted) { - *numInserted += keys.size(); - } - return Status::OK(); } diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h index f0376af716a..3aafc1f07d2 100644 --- a/src/mongo/db/index/index_access_method.h +++ b/src/mongo/db/index/index_access_method.h @@ -46,7 +46,6 @@ extern std::atomic<bool> failIndexKeyTooLong; // NOLINT class BSONObjBuilder; class MatchExpression; class UpdateTicket; -struct InsertDeleteOptions; /** * An IndexAccessMethod is the interface through which all the mutation, lookup, and @@ -74,23 +73,22 @@ public: * 'loc') into the index. 'obj' is the object at the location 'loc'. If not NULL, * 'numInserted' will be set to the number of keys added to the index for the document. If * there is more than one key for 'obj', either all keys will be inserted or none will. - * - * The behavior of the insertion can be specified through 'options'. */ Status insert(OperationContext* txn, const BSONObj& obj, const RecordId& loc, - const InsertDeleteOptions& options, + bool dupsAllowed, int64_t* numInserted); /** * Analogous to above, but remove the records instead of inserting them. If not NULL, * numDeleted will be set to the number of keys removed from the index for the document. + * If dupsAllowed is false, the record can be unindexed without checking its loc. */ Status remove(OperationContext* txn, const BSONObj& obj, const RecordId& loc, - const InsertDeleteOptions& options, + bool dupsAllowed, int64_t* numDeleted); /** @@ -107,7 +105,7 @@ public: const BSONObj& from, const BSONObj& to, const RecordId& loc, - const InsertDeleteOptions& options, + bool dupsAllowed, UpdateTicket* ticket, const MatchExpression* indexFilter); @@ -203,11 +201,7 @@ public: /** * Insert into the BulkBuilder as-if inserting into an IndexAccessMethod. */ - Status insert(OperationContext* txn, - const BSONObj& obj, - const RecordId& loc, - const InsertDeleteOptions& options, - int64_t* numInserted); + Status insert(OperationContext* txn, const BSONObj& obj, const RecordId& loc); private: friend class IndexAccessMethod; @@ -288,18 +282,4 @@ private: RecordId loc; bool dupsAllowed; }; - -/** - * Flags we can set for inserts and deletes (and updates, which are kind of both). - */ -struct InsertDeleteOptions { - InsertDeleteOptions() : logIfError(false), dupsAllowed(false) {} - - // If there's an error, log() it. - bool logIfError; - - // Are duplicate keys allowed in the index? - bool dupsAllowed; -}; - } // namespace mongo |