summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-01-11 10:59:01 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-01-11 13:58:55 -0500
commit8d54bdfba49d0163be875def30e107348177c241 (patch)
treeab990338580e8efb1bb1d8a69700ed3baa23c42b /src/mongo/dbtests
parent715a6603f39869afa01079e38990eaa6f227691f (diff)
downloadmongo-8d54bdfba49d0163be875def30e107348177c241.tar.gz
SERVER-22113 Remove unused sharding-specific getLocsInRange code
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/dbhelper_tests.cpp119
1 files changed, 0 insertions, 119 deletions
diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp
index ca4280ada04..8d7909eac65 100644
--- a/src/mongo/dbtests/dbhelper_tests.cpp
+++ b/src/mongo/dbtests/dbhelper_tests.cpp
@@ -113,123 +113,4 @@ public:
}
} myall;
-//
-// Tests getting disk locs for an index range
-//
-
-TEST(DBHelperTests, FindDiskLocs) {
- OperationContextImpl txn;
- DBDirectClient client(&txn);
-
- // Some unique tag we can use to make sure we're pulling back the right data
- OID tag = OID::gen();
- client.remove(ns, BSONObj());
-
- int numDocsInserted = 10;
- for (int i = 0; i < numDocsInserted; ++i) {
- client.insert(ns, BSON("_id" << i << "tag" << tag));
- }
-
- long long maxSizeBytes = 1024 * 1024 * 1024;
-
- set<RecordId> locs;
- long long numDocsFound;
- long long estSizeBytes;
- {
- // search _id range (0, 10)
- ScopedTransaction transaction(&txn, MODE_IS);
- Lock::DBLock lk(txn.lockState(), nsToDatabaseSubstring(ns), MODE_S);
-
- KeyRange range(ns, BSON("_id" << 0), BSON("_id" << numDocsInserted), BSON("_id" << 1));
-
- Status result =
- Helpers::getLocsInRange(&txn, range, maxSizeBytes, &locs, &numDocsFound, &estSizeBytes);
-
- ASSERT_EQUALS(result, Status::OK());
- ASSERT_EQUALS(numDocsFound, numDocsInserted);
- ASSERT_NOT_EQUALS(estSizeBytes, 0);
- ASSERT_LESS_THAN(estSizeBytes, maxSizeBytes);
-
- Database* db = dbHolder().get(&txn, nsToDatabase(range.ns));
- const Collection* collection = db->getCollection(ns);
-
- // Make sure all the disklocs actually correspond to the right info
- for (set<RecordId>::const_iterator it = locs.begin(); it != locs.end(); ++it) {
- const BSONObj obj = collection->docFor(&txn, *it).value();
- ASSERT_EQUALS(obj["tag"].OID(), tag);
- }
- }
-}
-
-//
-// Tests index not found error getting disk locs
-//
-
-TEST(DBHelperTests, FindDiskLocsNoIndex) {
- OperationContextImpl txn;
- DBDirectClient client(&txn);
-
- client.remove(ns, BSONObj());
- client.insert(ns, BSON("_id" << OID::gen()));
-
- long long maxSizeBytes = 1024 * 1024 * 1024;
-
- set<RecordId> locs;
- long long numDocsFound;
- long long estSizeBytes;
- {
- ScopedTransaction transaction(&txn, MODE_IS);
- Lock::DBLock lk(txn.lockState(), nsToDatabaseSubstring(ns), MODE_S);
-
- // search invalid index range
- KeyRange range(ns, BSON("badIndex" << 0), BSON("badIndex" << 10), BSON("badIndex" << 1));
-
- Status result =
- Helpers::getLocsInRange(&txn, range, maxSizeBytes, &locs, &numDocsFound, &estSizeBytes);
-
- // Make sure we get the right error code
- ASSERT_EQUALS(result.code(), ErrorCodes::IndexNotFound);
- ASSERT_EQUALS(static_cast<long long>(locs.size()), 0);
- ASSERT_EQUALS(numDocsFound, 0);
- ASSERT_EQUALS(estSizeBytes, 0);
- }
-}
-
-//
-// Tests chunk too big error getting disk locs
-//
-
-TEST(DBHelperTests, FindDiskLocsTooBig) {
- OperationContextImpl txn;
- DBDirectClient client(&txn);
-
- client.remove(ns, BSONObj());
-
- int numDocsInserted = 10;
- for (int i = 0; i < numDocsInserted; ++i) {
- client.insert(ns, BSON("_id" << i));
- }
-
- // Very small max size
- long long maxSizeBytes = 10;
-
- set<RecordId> locs;
- long long numDocsFound;
- long long estSizeBytes;
- {
- ScopedTransaction transaction(&txn, MODE_IS);
- Lock::DBLock lk(txn.lockState(), nsToDatabaseSubstring(ns), MODE_S);
-
- KeyRange range(ns, BSON("_id" << 0), BSON("_id" << numDocsInserted), BSON("_id" << 1));
-
- Status result =
- Helpers::getLocsInRange(&txn, range, maxSizeBytes, &locs, &numDocsFound, &estSizeBytes);
-
- // Make sure we get the right error code and our count and size estimates are valid
- ASSERT_EQUALS(result.code(), ErrorCodes::InvalidLength);
- ASSERT_EQUALS(numDocsFound, numDocsInserted);
- ASSERT_GREATER_THAN(estSizeBytes, maxSizeBytes);
- }
-}
-
} // namespace RemoveTests