diff options
author | alabid <alabidan@gmail.com> | 2015-01-12 09:32:50 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2015-01-15 10:33:42 -0500 |
commit | 9c0417f6680b591cb89d0de55a8a42ab179698fd (patch) | |
tree | 533e19ffd0cbfc2fe34e08f3b616fe0978b19125 | |
parent | 8efb43a8e1f5e9c025758a9322121223fd300892 (diff) | |
download | mongo-9c0417f6680b591cb89d0de55a8a42ab179698fd.tar.gz |
SERVER-16797 Remove support for touch command in WiredTiger storage engine.
Closes #906
Signed-off-by: Benety Goh <benety@mongodb.com>
-rw-r--r-- | jstests/auth/commands_builtin_roles.js | 4 | ||||
-rw-r--r-- | jstests/auth/commands_user_defined_roles.js | 12 | ||||
-rw-r--r-- | jstests/auth/lib/commands_lib.js | 1 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/record_store_test_touch.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h | 2 |
7 files changed, 14 insertions, 18 deletions
diff --git a/jstests/auth/commands_builtin_roles.js b/jstests/auth/commands_builtin_roles.js index b1d4d84f76a..733600e521b 100644 --- a/jstests/auth/commands_builtin_roles.js +++ b/jstests/auth/commands_builtin_roles.js @@ -56,7 +56,9 @@ function testProperAuthorization(conn, t, testcase, r) { " on db " + testcase.runOnDb + " with role " + r.key; } - else if (res.ok == 0 && !testcase.expectFail) { + else if (res.ok == 0 && !testcase.expectFail && res.code != commandNotSupportedCode) { + // don't error if the test failed with code commandNotSupported since + // some storage engines (e.g wiredTiger) don't support some commands (e.g. touch) out = "command failed with " + tojson(res) + " on db " + testcase.runOnDb + " with role " + r.key; diff --git a/jstests/auth/commands_user_defined_roles.js b/jstests/auth/commands_user_defined_roles.js index 2aa340187d7..facf097ea61 100644 --- a/jstests/auth/commands_user_defined_roles.js +++ b/jstests/auth/commands_user_defined_roles.js @@ -33,16 +33,18 @@ function testProperAuthorization(conn, t, testcase) { var res = runOnDb.runCommand(t.command); - if (!testcase.expectFail && res.ok != 1) { + if (!testcase.expectFail && res.ok != 1 && res.code != commandNotSupportedCode) { + // don't error if the test failed with code commandNotSupported since + // some storage engines (e.g wiredTiger) don't support some commands (e.g. touch) out = "command failed with " + tojson(res) + " on db " + testcase.runOnDb + " with privileges " + tojson(testcase.privileges); } else if (testcase.expectFail && res.code == authErrCode) { - out = "expected authorization success" + - " but received " + tojson(res) + - " on db " + testcase.runOnDb + - " with privileges " + tojson(testcase.privileges); + out = "expected authorization success" + + " but received " + tojson(res) + + " on db " + testcase.runOnDb + + " with privileges " + tojson(testcase.privileges); } firstDb.logout(); diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 2ef0ac2616c..c73439d2494 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -82,6 +82,7 @@ var firstDbName = "roles_commands_1"; var secondDbName = "roles_commands_2"; var adminDbName = "admin"; var authErrCode = 13; +var commandNotSupportedCode = 115; var shard0name = "shard0000"; // useful shorthand when defining the tests below diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp index fd8d8d7acb8..84a6f0465f9 100644 --- a/src/mongo/db/catalog/collection.cpp +++ b/src/mongo/db/catalog/collection.cpp @@ -625,9 +625,9 @@ namespace mongo { if ( touchData ) { BSONObjBuilder b; Status status = _recordStore->touch( txn, &b ); - output->append( "data", b.obj() ); if ( !status.isOK() ) return status; + output->append( "data", b.obj() ); } if ( touchIndexes ) { diff --git a/src/mongo/db/storage/record_store_test_touch.cpp b/src/mongo/db/storage/record_store_test_touch.cpp index 505ab02c453..d1bcdfe488c 100644 --- a/src/mongo/db/storage/record_store_test_touch.cpp +++ b/src/mongo/db/storage/record_store_test_touch.cpp @@ -120,7 +120,8 @@ namespace mongo { { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - ASSERT_OK( rs->touch( opCtx.get(), NULL /* stats output */ ) ); + Status status = rs->touch( opCtx.get(), NULL /* stats output */ ); + ASSERT( status.isOK() || status.code() == ErrorCodes::CommandNotSupported ); } } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index e1fe44de5b1..5e2bde239cf 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -769,14 +769,6 @@ namespace { } - Status WiredTigerRecordStore::touch( OperationContext* txn, BSONObjBuilder* output ) const { - if (output) { - output->append("numRanges", 1); - output->append("millis", 0); - } - return Status::OK(); - } - Status WiredTigerRecordStore::setCustomOption( OperationContext* txn, const BSONElement& option, BSONObjBuilder* info ) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h index ca53976bca1..e363090e1d0 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h @@ -159,8 +159,6 @@ namespace mongo { BSONObjBuilder* result, double scale ) const; - virtual Status touch( OperationContext* txn, BSONObjBuilder* output ) const; - virtual Status setCustomOption( OperationContext* txn, const BSONElement& option, BSONObjBuilder* info = NULL ); |