diff options
author | Daniel Alabi <alabidan@gmail.com> | 2015-03-16 14:58:13 -0400 |
---|---|---|
committer | Daniel Alabi <alabidan@gmail.com> | 2015-03-16 14:58:13 -0400 |
commit | 9ac525aa529e825634004758fade4738c3c7b0a8 (patch) | |
tree | b1b975b8a74b67385c5d054ae7d16be7ad74af27 /src | |
parent | bb9b4e27c8c31542af52d80f4c3751c435909d69 (diff) | |
download | mongo-9ac525aa529e825634004758fade4738c3c7b0a8.tar.gz |
Revert "SERVER-6558 Add writeConcern option to findAndModify command"
This reverts commit bb9b4e27c8c31542af52d80f4c3751c435909d69.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/commands.h | 8 | ||||
-rw-r--r-- | src/mongo/db/commands/find_and_modify.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/commands/write_commands/batch_executor.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/write_concern.cpp | 36 | ||||
-rw-r--r-- | src/mongo/db/write_concern.h | 17 |
6 files changed, 9 insertions, 84 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 8c95e60b919..fe3bda293d8 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -51,7 +51,6 @@ #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" #include "mongo/db/server_parameters.h" -#include "mongo/s/write_ops/wc_error_detail.h" #include "mongo/util/log.h" namespace mongo { @@ -262,15 +261,6 @@ namespace mongo { } } - void Command::appendCommandWCStatus(BSONObjBuilder& result, const Status& status) { - if (!status.isOK()) { - WCErrorDetail wcError; - wcError.setErrCode(status.code()); - wcError.setErrMessage(status.reason()); - result.append("writeConcernError", wcError.toBSON()); - } - } - Status Command::getStatusFromCommandResult(const BSONObj& result) { return mongo::getStatusFromCommandResult(result); } diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index 7c9b2f66b55..f256f3ceac5 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -48,8 +48,8 @@ namespace mongo { class BSONObjBuilder; class Client; class Database; - class OperationContext; class Timer; + class OperationContext; namespace mutablebson { class Document; @@ -315,12 +315,6 @@ namespace mutablebson { BSONArray firstBatch, BSONObjBuilder* builder); - /** - * Helper for setting a writeConcernError field in the command result object if - * a writeConcern error occurs. - */ - static void appendCommandWCStatus(BSONObjBuilder& result, const Status& status); - // Set by command line. Controls whether or not testing-only commands should be available. static int testCommandsEnabled; diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index 4e2ebd6bf3d..2cba4a3960f 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -47,7 +47,6 @@ #include "mongo/db/ops/update_lifecycle_impl.h" #include "mongo/db/query/get_executor.h" #include "mongo/db/repl/replication_coordinator_global.h" -#include "mongo/db/write_concern.h" #include "mongo/util/log.h" namespace mongo { @@ -115,12 +114,6 @@ namespace mongo { return false; } - StatusWith<WriteConcernOptions> wcResult = extractWriteConcern(cmdObj); - if (!wcResult.isOK()) { - return appendCommandStatus(result, wcResult.getStatus()); - } - setupSynchronousCommit(wcResult.getValue(), txn); - bool ok = false; MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { errmsg = ""; @@ -182,13 +175,6 @@ namespace mongo { errmsg); } - WriteConcernResult res; - wcResult = waitForWriteConcern(txn, - wcResult.getValue(), - txn->getClient()->getLastOp(), - &res); - appendCommandWCStatus(result, wcResult.getStatus()); - return ok; } diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp index 48f1f0a1be4..ae0c16e30f6 100644 --- a/src/mongo/db/commands/write_commands/batch_executor.cpp +++ b/src/mongo/db/commands/write_commands/batch_executor.cpp @@ -756,6 +756,14 @@ namespace mongo { Collection* _collection; }; + void setupSynchronousCommit( const WriteConcernOptions& writeConcern, + OperationContext* txn ) { + if ( writeConcern.syncMode == WriteConcernOptions::JOURNAL || + writeConcern.syncMode == WriteConcernOptions::FSYNC ) { + txn->recoveryUnit()->goingToAwaitCommit(); + } + } + void WriteBatchExecutor::bulkExecute( const BatchedCommandRequest& request, const WriteConcernOptions& writeConcern, std::vector<BatchedUpsertDetail*>* upsertedIds, diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp index db55f59e220..97db25a5c5b 100644 --- a/src/mongo/db/write_concern.cpp +++ b/src/mongo/db/write_concern.cpp @@ -31,7 +31,6 @@ #include "mongo/db/write_concern.h" #include "mongo/base/counter.h" -#include "mongo/bson/util/bson_extract.h" #include "mongo/db/commands/server_status_metric.h" #include "mongo/db/global_environment_experiment.h" #include "mongo/db/operation_context.h" @@ -53,41 +52,6 @@ namespace mongo { static ServerStatusMetricField<Counter64> gleWtimeoutsDisplay("getLastError.wtimeouts", &gleWtimeouts ); - void setupSynchronousCommit(const WriteConcernOptions& writeConcern, - OperationContext* txn) { - if ( writeConcern.syncMode == WriteConcernOptions::JOURNAL || - writeConcern.syncMode == WriteConcernOptions::FSYNC ) { - txn->recoveryUnit()->goingToAwaitCommit(); - } - } - - StatusWith<WriteConcernOptions> extractWriteConcern(const BSONObj& cmdObj) { - BSONElement writeConcernElement; - Status wcStatus = bsonExtractTypedField(cmdObj, - "writeConcern", - Object, - &writeConcernElement); - - if (!wcStatus.isOK()) { - if (wcStatus == ErrorCodes::NoSuchKey) { - return repl::getGlobalReplicationCoordinator()->getGetLastErrorDefault(); - } - return wcStatus; - } - - WriteConcernOptions writeConcern; - wcStatus = writeConcern.parse(writeConcernElement.Obj()); - - if (wcStatus.isOK()) { - wcStatus = validateWriteConcern(writeConcern); - } - if (!wcStatus.isOK()) { - return wcStatus; - } - - return writeConcern; - } - Status validateWriteConcern( const WriteConcernOptions& writeConcern ) { const bool isJournalEnabled = getGlobalEnvironment()->getGlobalStorageEngine()->isDurable(); diff --git a/src/mongo/db/write_concern.h b/src/mongo/db/write_concern.h index 19513e4f969..98d7893a2e1 100644 --- a/src/mongo/db/write_concern.h +++ b/src/mongo/db/write_concern.h @@ -34,23 +34,6 @@ namespace mongo { class OperationContext; - template <typename T> class StatusWith; - - /** - * If "writeConcern" indicates a durable commit level, - * marks the RecoveryUnit associated with "txn" appropriately. - * Provides a hint to the storage engine that - * particular operations will be waiting for their changes to become durable. - */ - void setupSynchronousCommit(const WriteConcernOptions& writeConcern, - OperationContext* txn); - - /** - * Attempts to extract a writeConcern from cmdObj. - * Verifies that the writeConcern is of type Object (BSON type) and - * that the resulting writeConcern is valid for this particular host. - */ - StatusWith<WriteConcernOptions> extractWriteConcern(const BSONObj& cmdObj); /** * Verifies that a WriteConcern is valid for this particular host. |