summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2017-02-22 11:55:28 -0500
committerMaria van Keulen <maria@mongodb.com>2017-02-23 10:59:18 -0500
commit1350e958318c0f857df524c65b95b4e028157845 (patch)
tree0dbd20d86a2391e468bf45fca7d93dcea1799552 /src/mongo/db
parenta2ff6ec6b8f88e5d79e6c09c333033f151a59961 (diff)
downloadmongo-1350e958318c0f857df524c65b95b4e028157845.tar.gz
SERVER-27890 Remove tempness of cappedTruncateAfter
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/collection.cpp4
-rw-r--r--src/mongo/db/catalog/collection.h3
-rw-r--r--src/mongo/db/commands/test_commands.cpp2
-rw-r--r--src/mongo/db/repl/oplog.cpp3
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp4
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp2
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp6
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/heap_record_store_btree.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_capped.h3
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_simple.h2
-rw-r--r--src/mongo/db/storage/record_store.h3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp6
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp20
16 files changed, 31 insertions, 37 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 1cb7361590f..1edad781f0c 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -914,14 +914,14 @@ Status Collection::truncate(OperationContext* txn) {
return Status::OK();
}
-void Collection::temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
+void Collection::cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
dassert(txn->lockState()->isCollectionLockedForMode(ns().toString(), MODE_IX));
invariant(isCapped());
BackgroundOperation::assertNoBgOpInProgForNs(ns());
invariant(_indexCatalog.numIndexesInProgress(txn) == 0);
_cursorManager.invalidateAll(false, "capped collection truncated");
- _recordStore->temp_cappedTruncateAfter(txn, end, inclusive);
+ _recordStore->cappedTruncateAfter(txn, end, inclusive);
}
Status Collection::setValidator(OperationContext* txn, BSONObj validatorDoc) {
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index f5e702e8f0e..6e9b1c56b1b 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -376,9 +376,8 @@ public:
* collection. The collection cannot be completely emptied using this
* function. An assertion will be thrown if that is attempted.
* @param inclusive - Truncate 'end' as well iff true
- * XXX: this will go away soon, just needed to move for now
*/
- void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive);
+ void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive);
enum ValidationAction { WARN, ERROR_V };
enum ValidationLevel { OFF, MODERATE, STRICT_V };
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index ccba3bfb41a..560e6496688 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -277,7 +277,7 @@ public:
}
}
- collection->temp_cappedTruncateAfter(txn, end, inc);
+ collection->cappedTruncateAfter(txn, end, inc);
return true;
}
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 3b4309cf44c..1cb67f64a53 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -325,8 +325,7 @@ void truncateOplogTo(OperationContext* txn, Timestamp truncateTimestamp) {
// oplog is < truncateTimestamp.
if (count != 1) {
invariant(!oldestIDToDelete.isNull());
- oplogCollection->temp_cappedTruncateAfter(
- txn, oldestIDToDelete, /*inclusive=*/true);
+ oplogCollection->cappedTruncateAfter(txn, oldestIDToDelete, /*inclusive=*/true);
}
return;
}
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index c2f7666ab7a..dc5894cafc8 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -690,7 +690,7 @@ void syncFixUp(OperationContext* txn,
// RecordId loc = Helpers::findById(nsd, pattern);
if (!loc.isNull()) {
try {
- collection->temp_cappedTruncateAfter(txn, loc, true);
+ collection->cappedTruncateAfter(txn, loc, true);
} catch (const DBException& e) {
if (e.getCode() == 13415) {
// hack: need to just make cappedTruncate do this...
@@ -768,7 +768,7 @@ void syncFixUp(OperationContext* txn,
str::stream() << "Can't find " << rsOplogName));
}
// TODO: fatal error if this throws?
- oplogCollection->temp_cappedTruncateAfter(txn, fixUpInfo.commonPointOurDiskloc, false);
+ oplogCollection->cappedTruncateAfter(txn, fixUpInfo.commonPointOurDiskloc, false);
}
Status status = getGlobalAuthorizationManager()->initialize(txn);
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index 10371e0502f..6210971ae84 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -148,7 +148,7 @@ public:
return Status::OK();
}
- virtual void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {}
+ virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {}
virtual Status validate(OperationContext* txn,
ValidateCmdLevel level,
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
index 3d51b105240..111242d5784 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
@@ -518,9 +518,9 @@ Status EphemeralForTestRecordStore::truncate(OperationContext* txn) {
return Status::OK();
}
-void EphemeralForTestRecordStore::temp_cappedTruncateAfter(OperationContext* txn,
- RecordId end,
- bool inclusive) {
+void EphemeralForTestRecordStore::cappedTruncateAfter(OperationContext* txn,
+ RecordId end,
+ bool inclusive) {
Records::iterator it =
inclusive ? _data->records.lower_bound(end) : _data->records.upper_bound(end);
while (it != _data->records.end()) {
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h
index 58dd3d564e3..33168e1dc99 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h
@@ -90,7 +90,7 @@ public:
virtual Status truncate(OperationContext* txn);
- virtual void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive);
+ virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive);
virtual Status validate(OperationContext* txn,
ValidateCmdLevel level,
diff --git a/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h b/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h
index 3eb905d7b60..e01b85db55c 100644
--- a/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h
+++ b/src/mongo/db/storage/mmap_v1/heap_record_store_btree.h
@@ -106,7 +106,7 @@ public:
invariant(false);
}
- virtual void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
+ virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
invariant(false);
}
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp
index 7dab4124df6..a4c62cf2d63 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp
@@ -253,9 +253,7 @@ Status CappedRecordStoreV1::truncate(OperationContext* txn) {
return Status::OK();
}
-void CappedRecordStoreV1::temp_cappedTruncateAfter(OperationContext* txn,
- RecordId end,
- bool inclusive) {
+void CappedRecordStoreV1::cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
cappedTruncateAfter(txn, _ns.c_str(), DiskLoc::fromRecordId(end), inclusive);
}
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.h b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.h
index 454f2595905..3fc64a76cd9 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.h
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.h
@@ -60,9 +60,8 @@ public:
* collection. The collection cannot be completely emptied using this
* function. An assertion will be thrown if that is attempted.
* @param inclusive - Truncate 'end' as well iff true
- * XXX: this will go away soon, just needed to move for now
*/
- void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) final;
+ void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) final;
std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* txn,
bool forward) const final;
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_simple.h b/src/mongo/db/storage/mmap_v1/record_store_v1_simple.h
index 0b7d98ba821..80fe4e8018b 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_simple.h
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_simple.h
@@ -60,7 +60,7 @@ public:
virtual Status truncate(OperationContext* txn);
- virtual void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
+ virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) {
invariant(!"cappedTruncateAfter not supported");
}
diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h
index ac04c5ca5e2..f17e07bfa59 100644
--- a/src/mongo/db/storage/record_store.h
+++ b/src/mongo/db/storage/record_store.h
@@ -510,9 +510,8 @@ public:
* collection. The collection cannot be completely emptied using this
* function. An assertion will be thrown if that is attempted.
* @param inclusive - Truncate 'end' as well iff true
- * XXX: this will go away soon, just needed to move for now
*/
- virtual void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) = 0;
+ virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) = 0;
/**
* does this RecordStore support the compact operation?
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index fb254424b5a..85048dc5552 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -1856,9 +1856,9 @@ RecordId WiredTigerRecordStore::_fromKey(int64_t key) {
return RecordId(key);
}
-void WiredTigerRecordStore::temp_cappedTruncateAfter(OperationContext* txn,
- RecordId end,
- bool inclusive) {
+void WiredTigerRecordStore::cappedTruncateAfter(OperationContext* txn,
+ RecordId end,
+ bool inclusive) {
Cursor cursor(txn, *this);
auto record = cursor.seekExact(end);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
index 1997970c9e1..98cd612513d 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
@@ -184,7 +184,7 @@ public:
virtual Status touch(OperationContext* txn, BSONObjBuilder* output) const;
- virtual void temp_cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive);
+ virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive);
virtual boost::optional<RecordId> oplogStartHack(OperationContext* txn,
const RecordId& startingPosition) const;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
index a76f51c4a44..f8e8604d31b 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
@@ -620,7 +620,7 @@ TEST(WiredTigerRecordStoreTest, OplogHack) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(2, 2), false); // no-op
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(2, 2), false); // no-op
}
{
@@ -630,7 +630,7 @@ TEST(WiredTigerRecordStoreTest, OplogHack) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 2), false); // deletes 2,2
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 2), false); // deletes 2,2
}
{
@@ -640,7 +640,7 @@ TEST(WiredTigerRecordStoreTest, OplogHack) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 2), true); // deletes 1,2
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 2), true); // deletes 1,2
}
{
@@ -880,7 +880,7 @@ TEST(WiredTigerRecordStoreTest, OplogOrder) {
{
auto client2 = harnessHelper->serviceContext()->makeClient("c2");
auto txn = harnessHelper->newOperationContext(client2.get());
- rs->temp_cappedTruncateAfter(txn.get(), id1, /*inclusive*/ false);
+ rs->cappedTruncateAfter(txn.get(), id1, /*inclusive*/ false);
}
{
@@ -1280,7 +1280,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_Truncate) {
}
}
-// Insert multiple records, truncate the oplog using RecordStore::temp_cappedTruncateAfter(), and
+// Insert multiple records, truncate the oplog using RecordStore::cappedTruncateAfter(), and
// verify that the metadata for each stone is updated. If a full stone is partially truncated, then
// it should become the stone currently being filled.
TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
@@ -1322,7 +1322,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 8), true);
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 8), true);
ASSERT_EQ(7, rs->numRecords(opCtx.get()));
ASSERT_EQ(2350, rs->dataSize(opCtx.get()));
@@ -1336,7 +1336,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 6), true);
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 6), true);
ASSERT_EQ(5, rs->numRecords(opCtx.get()));
ASSERT_EQ(1950, rs->dataSize(opCtx.get()));
@@ -1350,7 +1350,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 3), false);
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 3), false);
ASSERT_EQ(3, rs->numRecords(opCtx.get()));
ASSERT_EQ(1400, rs->dataSize(opCtx.get()));
@@ -1364,7 +1364,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 2), false);
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 2), false);
ASSERT_EQ(2, rs->numRecords(opCtx.get()));
ASSERT_EQ(1200, rs->dataSize(opCtx.get()));
@@ -1378,7 +1378,7 @@ TEST(WiredTigerRecordStoreTest, OplogStones_CappedTruncateAfter) {
{
ServiceContext::UniqueOperationContext opCtx(harnessHelper.newOperationContext());
- rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1, 1), false);
+ rs->cappedTruncateAfter(opCtx.get(), RecordId(1, 1), false);
ASSERT_EQ(1, rs->numRecords(opCtx.get()));
ASSERT_EQ(400, rs->dataSize(opCtx.get()));