summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2018-08-14 17:11:56 -0400
committerDavid Storch <david.storch@10gen.com>2018-08-29 09:32:45 -0400
commit78901fd754958d57b914e7209e702eec53543d81 (patch)
tree371204633fed7b2cdca15e82cc1164127136c9a5
parentf55559368fe6a51689ffc3c08bab4434cb1b2b99 (diff)
downloadmongo-78901fd754958d57b914e7209e702eec53543d81.tar.gz
SERVER-36662 Delete UpdateNotifier.
The UpdateNotifier was a callback mechanism for issuing MMAPv1 diskloc invalidations. It does nothing now that MMAPv1 invalidations are themselves deleted.
-rw-r--r--src/mongo/db/catalog/collection.h12
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp7
-rw-r--r--src/mongo/db/catalog/collection_impl.h6
-rw-r--r--src/mongo/db/catalog/collection_mock.h7
-rw-r--r--src/mongo/db/storage/biggie/biggie_record_store.cpp3
-rw-r--r--src/mongo/db/storage/biggie/biggie_record_store.h3
-rw-r--r--src/mongo/db/storage/devnull/devnull_kv_engine.cpp3
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp12
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h3
-rw-r--r--src/mongo/db/storage/kv/kv_catalog.cpp8
-rw-r--r--src/mongo/db/storage/kv/kv_engine_test_timestamps.cpp2
-rw-r--r--src/mongo/db/storage/mobile/mobile_record_store.cpp7
-rw-r--r--src/mongo/db/storage/mobile/mobile_record_store.h3
-rw-r--r--src/mongo/db/storage/record_store.h23
-rw-r--r--src/mongo/db/storage/record_store_test_harness.cpp2
-rw-r--r--src/mongo/db/storage/record_store_test_updaterecord.cpp63
-rw-r--r--src/mongo/db/storage/record_store_test_updaterecord.h69
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp34
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp2
-rw-r--r--src/mongo/dbtests/validate_tests.cpp18
22 files changed, 52 insertions, 243 deletions
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index d593c058954..fce9ba050d7 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -181,13 +181,13 @@ private:
* this is NOT safe through a yield right now.
* not sure if it will be, or what yet.
*/
-class Collection final : CappedCallback, UpdateNotifier {
+class Collection final : CappedCallback {
public:
enum ValidationAction { WARN, ERROR_V };
enum ValidationLevel { OFF, MODERATE, STRICT_V };
enum class StoreDeletedDoc { Off, On };
- class Impl : virtual CappedCallback, virtual UpdateNotifier {
+ class Impl : virtual CappedCallback {
public:
virtual ~Impl() = 0;
@@ -203,9 +203,6 @@ public:
const RecordId& loc,
RecordData data) = 0;
- virtual Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx,
- const RecordId& loc) = 0;
-
public:
virtual bool ok() const = 0;
@@ -744,11 +741,6 @@ private:
return this->_impl().aboutToDeleteCapped(opCtx, loc, data);
}
- inline Status recordStoreGoingToUpdateInPlace(OperationContext* const opCtx,
- const RecordId& loc) final {
- return this->_impl().recordStoreGoingToUpdateInPlace(opCtx, loc);
- }
-
// This structure exists to give us a customization point to decide how to force users of this
// class to depend upon the corresponding `collection.cpp` Translation Unit (TU). All public
// forwarding functions call `_impl(), and `_impl` creates an instance of this structure.
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index e465d5839c3..0a961beecb1 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -646,7 +646,7 @@ RecordId CollectionImpl::updateDocument(OperationContext* opCtx,
args->preImageDoc = oldDoc.value().getOwned();
Status updateStatus =
- _recordStore->updateRecord(opCtx, oldLocation, newDoc.objdata(), newDoc.objsize(), this);
+ _recordStore->updateRecord(opCtx, oldLocation, newDoc.objdata(), newDoc.objsize());
// Update each index with each respective UpdateTicket.
if (indexesAffected) {
@@ -676,11 +676,6 @@ RecordId CollectionImpl::updateDocument(OperationContext* opCtx,
return {oldLocation};
}
-Status CollectionImpl::recordStoreGoingToUpdateInPlace(OperationContext* opCtx,
- const RecordId& loc) {
- return Status::OK();
-}
-
bool CollectionImpl::updateWithDamagesSupported() const {
if (_validator)
return false;
diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h
index e61ba96bc94..9c146f8b555 100644
--- a/src/mongo/db/catalog/collection_impl.h
+++ b/src/mongo/db/catalog/collection_impl.h
@@ -37,9 +37,7 @@
namespace mongo {
class IndexConsistency;
class UUIDCatalog;
-class CollectionImpl final : virtual public Collection::Impl,
- virtual CappedCallback,
- virtual UpdateNotifier {
+class CollectionImpl final : virtual public Collection::Impl, virtual CappedCallback {
private:
static const int kMagicNumber = 1357924;
@@ -372,8 +370,6 @@ private:
*/
Status checkValidation(OperationContext* opCtx, const BSONObj& document) const;
- Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx, const RecordId& loc);
-
Status aboutToDeleteCapped(OperationContext* opCtx, const RecordId& loc, RecordData data);
/**
diff --git a/src/mongo/db/catalog/collection_mock.h b/src/mongo/db/catalog/collection_mock.h
index 9813c60cdc8..a7eb21154a1 100644
--- a/src/mongo/db/catalog/collection_mock.h
+++ b/src/mongo/db/catalog/collection_mock.h
@@ -35,9 +35,7 @@ namespace mongo {
/**
* This class comprises a mock Collection for use by UUIDCatalog unit tests.
*/
-class CollectionMock : virtual public Collection::Impl,
- virtual CappedCallback,
- virtual UpdateNotifier {
+class CollectionMock : virtual public Collection::Impl, virtual CappedCallback {
public:
CollectionMock(const NamespaceString& ns) : _ns(ns) {}
~CollectionMock() = default;
@@ -59,9 +57,6 @@ private:
std::abort();
}
- Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx, const RecordId& loc) {
- std::abort();
- }
const NamespaceString _ns;
public:
diff --git a/src/mongo/db/storage/biggie/biggie_record_store.cpp b/src/mongo/db/storage/biggie/biggie_record_store.cpp
index d7afd580edc..45d25c0ba0d 100644
--- a/src/mongo/db/storage/biggie/biggie_record_store.cpp
+++ b/src/mongo/db/storage/biggie/biggie_record_store.cpp
@@ -192,8 +192,7 @@ Status RecordStore::insertRecordsWithDocWriter(OperationContext* opCtx,
Status RecordStore::updateRecord(OperationContext* opCtx,
const RecordId& oldLocation,
const char* data,
- int len,
- UpdateNotifier* notifier) {
+ int len) {
StringStore* workingCopy = getRecoveryUnitBranch_forking(opCtx);
std::string key = createKey(_ident, oldLocation.repr());
StringStore::const_iterator it = workingCopy->find(key);
diff --git a/src/mongo/db/storage/biggie/biggie_record_store.h b/src/mongo/db/storage/biggie/biggie_record_store.h
index 9310a875c24..3ff845fe422 100644
--- a/src/mongo/db/storage/biggie/biggie_record_store.h
+++ b/src/mongo/db/storage/biggie/biggie_record_store.h
@@ -94,8 +94,7 @@ public:
virtual Status updateRecord(OperationContext* opCtx,
const RecordId& oldLocation,
const char* data,
- int len,
- UpdateNotifier* notifier);
+ int len);
virtual bool updateWithDamagesSupported() const;
diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
index dc4eedf8751..10fea74f461 100644
--- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
+++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp
@@ -126,8 +126,7 @@ public:
virtual Status updateRecord(OperationContext* opCtx,
const RecordId& oldLocation,
const char* data,
- int len,
- UpdateNotifier* notifier) {
+ int len) {
return Status::OK();
}
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 f033ae3e576..cb3bd83d8ff 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
@@ -474,8 +474,7 @@ Status EphemeralForTestRecordStore::insertRecordsWithDocWriter(OperationContext*
Status EphemeralForTestRecordStore::updateRecord(OperationContext* opCtx,
const RecordId& loc,
const char* data,
- int len,
- UpdateNotifier* notifier) {
+ int len) {
stdx::lock_guard<stdx::recursive_mutex> lock(_data->recordsMutex);
EphemeralForTestRecord* oldRecord = recordFor(loc);
int oldLen = oldRecord->size;
@@ -483,15 +482,6 @@ Status EphemeralForTestRecordStore::updateRecord(OperationContext* opCtx,
// Documents in capped collections cannot change size. We check that above the storage layer.
invariant(!_isCapped || len == oldLen);
- if (notifier) {
- // The in-memory KV engine uses the invalidation framework (does not support
- // doc-locking), and therefore must notify that it is updating a document.
- Status callbackStatus = notifier->recordStoreGoingToUpdateInPlace(opCtx, loc);
- if (!callbackStatus.isOK()) {
- return callbackStatus;
- }
- }
-
EphemeralForTestRecord newRecord(len);
memcpy(newRecord.data.get(), data, len);
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 0cd91406ff4..4b3a3df1e96 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
@@ -80,8 +80,7 @@ public:
virtual Status updateRecord(OperationContext* opCtx,
const RecordId& oldLocation,
const char* data,
- int len,
- UpdateNotifier* notifier);
+ int len);
virtual bool updateWithDamagesSupported() const;
diff --git a/src/mongo/db/storage/kv/kv_catalog.cpp b/src/mongo/db/storage/kv/kv_catalog.cpp
index 51c6e4943f8..7b294457e63 100644
--- a/src/mongo/db/storage/kv/kv_catalog.cpp
+++ b/src/mongo/db/storage/kv/kv_catalog.cpp
@@ -310,9 +310,7 @@ void KVCatalog::FeatureTracker::putInfo(OperationContext* opCtx, const FeatureBi
fassert(40113, rid.getStatus());
_rid = rid.getValue();
} else {
- UpdateNotifier* notifier = nullptr;
- auto status =
- _catalog->_rs->updateRecord(opCtx, _rid, obj.objdata(), obj.objsize(), notifier);
+ auto status = _catalog->_rs->updateRecord(opCtx, _rid, obj.objdata(), obj.objsize());
fassert(40114, status);
}
}
@@ -517,7 +515,7 @@ void KVCatalog::putMetaData(OperationContext* opCtx,
}
LOG(3) << "recording new metadata: " << obj;
- Status status = _rs->updateRecord(opCtx, loc, obj.objdata(), obj.objsize(), NULL);
+ Status status = _rs->updateRecord(opCtx, loc, obj.objdata(), obj.objsize());
fassert(28521, status.isOK());
}
@@ -542,7 +540,7 @@ Status KVCatalog::renameCollection(OperationContext* opCtx,
b.appendElementsUnique(old);
BSONObj obj = b.obj();
- Status status = _rs->updateRecord(opCtx, loc, obj.objdata(), obj.objsize(), NULL);
+ Status status = _rs->updateRecord(opCtx, loc, obj.objdata(), obj.objsize());
fassert(28522, status.isOK());
}
diff --git a/src/mongo/db/storage/kv/kv_engine_test_timestamps.cpp b/src/mongo/db/storage/kv/kv_engine_test_timestamps.cpp
index 82cb77e8b8b..0df7528ac21 100644
--- a/src/mongo/db/storage/kv/kv_engine_test_timestamps.cpp
+++ b/src/mongo/db/storage/kv/kv_engine_test_timestamps.cpp
@@ -119,7 +119,7 @@ public:
auto op = makeOperation();
WriteUnitOfWork wuow(op);
ASSERT_OK(op->recoveryUnit()->setTimestamp(_counter));
- ASSERT_OK(rs->updateRecord(op, id, contents.c_str(), contents.length() + 1, nullptr));
+ ASSERT_OK(rs->updateRecord(op, id, contents.c_str(), contents.length() + 1));
wuow.commit();
}
diff --git a/src/mongo/db/storage/mobile/mobile_record_store.cpp b/src/mongo/db/storage/mobile/mobile_record_store.cpp
index 1ba8020a76f..76b7d1322b8 100644
--- a/src/mongo/db/storage/mobile/mobile_record_store.cpp
+++ b/src/mongo/db/storage/mobile/mobile_record_store.cpp
@@ -351,8 +351,7 @@ Status MobileRecordStore::insertRecordsWithDocWriter(OperationContext* opCtx,
Status MobileRecordStore::updateRecord(OperationContext* opCtx,
const RecordId& recId,
const char* data,
- int len,
- UpdateNotifier* notifier) {
+ int len) {
MobileSession* session = MobileRecoveryUnit::get(opCtx)->getSession(opCtx, false);
std::string dataSizeQuery =
"SELECT IFNULL(LENGTH(data), 0) FROM \"" + _ident + "\" WHERE rec_id = ?;";
@@ -363,10 +362,6 @@ Status MobileRecordStore::updateRecord(OperationContext* opCtx,
int64_t dataSizeBefore = dataSizeStmt.getColInt(0);
_changeDataSize(opCtx, -dataSizeBefore + len);
- if (notifier) {
- fassert(37054, notifier->recordStoreGoingToUpdateInPlace(opCtx, recId));
- }
-
std::string updateQuery = "UPDATE \"" + _ident + "\" SET data = ? " + "WHERE rec_id = ?;";
SqliteStatement updateStmt(*session, updateQuery);
updateStmt.bindBlob(0, data, len);
diff --git a/src/mongo/db/storage/mobile/mobile_record_store.h b/src/mongo/db/storage/mobile/mobile_record_store.h
index 60d4a844386..e4d30a88b6f 100644
--- a/src/mongo/db/storage/mobile/mobile_record_store.h
+++ b/src/mongo/db/storage/mobile/mobile_record_store.h
@@ -74,8 +74,7 @@ public:
Status updateRecord(OperationContext* opCtx,
const RecordId& oldLocation,
const char* data,
- int len,
- UpdateNotifier* notifier) override;
+ int len) override;
bool updateWithDamagesSupported() const override;
diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h
index 097a56e3cbb..178574f43ab 100644
--- a/src/mongo/db/storage/record_store.h
+++ b/src/mongo/db/storage/record_store.h
@@ -73,19 +73,6 @@ protected:
};
/**
- * @see RecordStore::updateRecord
- *
- * TODO SERVER-36662: Without MMAPv1 diskloc invalidations, this interface is no longer necessary.
- * This callback's entire role was to issue INVALIDATION_MUTATION notifications.
- */
-class UpdateNotifier {
-public:
- virtual ~UpdateNotifier() {}
- virtual Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx,
- const RecordId& loc) = 0;
-};
-
-/**
* The data items stored in a RecordStore.
*/
struct Record {
@@ -413,15 +400,13 @@ public:
}
/**
- * @param notifier - Only used by record stores which do not support doc-locking. Called only
- * in the case of an in-place update. Called just before the in-place write
- * occurs.
+ * Updates the record with id 'recordId', replacing its contents with those described by
+ * 'data' and 'len'.
*/
virtual Status updateRecord(OperationContext* opCtx,
- const RecordId& oldLocation,
+ const RecordId& recordId,
const char* data,
- int len,
- UpdateNotifier* notifier) = 0;
+ int len) = 0;
/**
* @return Returns 'false' if this record store does not implement
diff --git a/src/mongo/db/storage/record_store_test_harness.cpp b/src/mongo/db/storage/record_store_test_harness.cpp
index 4ee95575612..f752c32da02 100644
--- a/src/mongo/db/storage/record_store_test_harness.cpp
+++ b/src/mongo/db/storage/record_store_test_harness.cpp
@@ -264,7 +264,7 @@ TEST(RecordStoreTestHarness, Update1) {
ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- Status status = rs->updateRecord(opCtx.get(), loc, s2.c_str(), s2.size() + 1, NULL);
+ Status status = rs->updateRecord(opCtx.get(), loc, s2.c_str(), s2.size() + 1);
ASSERT_OK(status);
uow.commit();
diff --git a/src/mongo/db/storage/record_store_test_updaterecord.cpp b/src/mongo/db/storage/record_store_test_updaterecord.cpp
index c6b96def16d..3f7186140a4 100644
--- a/src/mongo/db/storage/record_store_test_updaterecord.cpp
+++ b/src/mongo/db/storage/record_store_test_updaterecord.cpp
@@ -30,9 +30,6 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/storage/record_store_test_updaterecord.h"
-
-
#include "mongo/db/record_id.h"
#include "mongo/db/storage/record_data.h"
#include "mongo/db/storage/record_store.h"
@@ -80,7 +77,7 @@ TEST(RecordStoreTestHarness, UpdateRecord) {
ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
{
WriteUnitOfWork uow(opCtx.get());
- Status res = rs->updateRecord(opCtx.get(), loc, data.c_str(), data.size() + 1, NULL);
+ Status res = rs->updateRecord(opCtx.get(), loc, data.c_str(), data.size() + 1);
ASSERT_OK(res);
uow.commit();
@@ -138,8 +135,7 @@ TEST(RecordStoreTestHarness, UpdateMultipleRecords) {
string data = ss.str();
WriteUnitOfWork uow(opCtx.get());
- Status res =
- rs->updateRecord(opCtx.get(), locs[i], data.c_str(), data.size() + 1, NULL);
+ Status res = rs->updateRecord(opCtx.get(), locs[i], data.c_str(), data.size() + 1);
ASSERT_OK(res);
uow.commit();
@@ -160,60 +156,5 @@ TEST(RecordStoreTestHarness, UpdateMultipleRecords) {
}
}
-// Insert a record, try to update it, and examine how the UpdateNotifier is called.
-TEST(RecordStoreTestHarness, UpdateRecordWithMoveNotifier) {
- const auto harnessHelper(newRecordStoreHarnessHelper());
- unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(0, rs->numRecords(opCtx.get()));
- }
-
- string oldData = "my record";
- RecordId loc;
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- {
- WriteUnitOfWork uow(opCtx.get());
- StatusWith<RecordId> res =
- rs->insertRecord(opCtx.get(), oldData.c_str(), oldData.size() + 1, Timestamp());
- ASSERT_OK(res.getStatus());
- loc = res.getValue();
- uow.commit();
- }
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- ASSERT_EQUALS(1, rs->numRecords(opCtx.get()));
- }
-
- string newData = "my updated record--";
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- {
- UpdateNotifierSpy umn(opCtx.get(), loc, oldData.c_str(), oldData.size());
-
- WriteUnitOfWork uow(opCtx.get());
- Status res =
- rs->updateRecord(opCtx.get(), loc, newData.c_str(), newData.size() + 1, &umn);
- ASSERT_OK(res);
- ASSERT_GTE(1, umn.numInPlaceCallbacks());
-
- uow.commit();
- }
- }
-
- {
- ServiceContext::UniqueOperationContext opCtx(harnessHelper->newOperationContext());
- {
- RecordData record = rs->dataFor(opCtx.get(), loc);
- ASSERT_EQUALS(newData.size() + 1, static_cast<size_t>(record.size()));
- ASSERT_EQUALS(newData, record.data());
- }
- }
-}
-
} // namespace
} // namespace mongo
diff --git a/src/mongo/db/storage/record_store_test_updaterecord.h b/src/mongo/db/storage/record_store_test_updaterecord.h
deleted file mode 100644
index e20b32bcce4..00000000000
--- a/src/mongo/db/storage/record_store_test_updaterecord.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// record_store_test_updaterecord.h
-
-/**
- * Copyright (C) 2014 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include "mongo/db/record_id.h"
-#include "mongo/db/storage/record_data.h"
-#include "mongo/db/storage/record_store.h"
-#include "mongo/unittest/unittest.h"
-
-namespace mongo {
-namespace {
-
-class UpdateNotifierSpy : public UpdateNotifier {
-public:
- UpdateNotifierSpy(OperationContext* opCtx, const RecordId& loc, const char* buf, size_t size)
- : _opCtx(opCtx), _loc(loc), _data(buf, size), nInPlaceCalls(0) {}
-
- ~UpdateNotifierSpy() {}
-
- Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx, const RecordId& loc) {
- nInPlaceCalls++;
- ASSERT_EQUALS(_opCtx, opCtx);
- ASSERT_EQUALS(_loc, loc);
- return Status::OK();
- }
-
- int numInPlaceCallbacks() const {
- return nInPlaceCalls;
- }
-
-private:
- OperationContext* _opCtx;
- RecordId _loc;
- std::string _data;
-
- // To verify the number of callbacks to the notifier.
- int nInPlaceCalls;
-};
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 09b42c028ec..72e9e39b064 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -1425,8 +1425,7 @@ Status WiredTigerRecordStore::insertRecordsWithDocWriter(OperationContext* opCtx
Status WiredTigerRecordStore::updateRecord(OperationContext* opCtx,
const RecordId& id,
const char* data,
- int len,
- UpdateNotifier* notifier) {
+ int len) {
dassert(opCtx->lockState()->isWriteLocked());
WiredTigerCursor curwrap(_uri, _tableId, true, opCtx);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
index 4af3703456c..38b720e0da7 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
@@ -157,10 +157,9 @@ public:
RecordId* idsOut);
virtual Status updateRecord(OperationContext* opCtx,
- const RecordId& oldLocation,
+ const RecordId& recordId,
const char* data,
- int len,
- UpdateNotifier* notifier);
+ int len);
virtual bool updateWithDamagesSupported() 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 28b6efcebaf..76820080332 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp
@@ -136,12 +136,12 @@ TEST(WiredTigerRecordStoreTest, Isolation1) {
rs->dataFor(t1.get(), id1);
rs->dataFor(t2.get(), id1);
- ASSERT_OK(rs->updateRecord(t1.get(), id1, "b", 2, NULL));
- ASSERT_OK(rs->updateRecord(t1.get(), id2, "B", 2, NULL));
+ ASSERT_OK(rs->updateRecord(t1.get(), id1, "b", 2));
+ ASSERT_OK(rs->updateRecord(t1.get(), id2, "B", 2));
try {
// this should fail
- rs->updateRecord(t2.get(), id1, "c", 2, NULL).transitional_ignore();
+ rs->updateRecord(t2.get(), id1, "c", 2).transitional_ignore();
ASSERT(0);
} catch (WriteConflictException&) {
w2.reset(NULL);
@@ -187,7 +187,7 @@ TEST(WiredTigerRecordStoreTest, Isolation2) {
{
WriteUnitOfWork w(t1.get());
- ASSERT_OK(rs->updateRecord(t1.get(), id1, "b", 2, NULL));
+ ASSERT_OK(rs->updateRecord(t1.get(), id1, "b", 2));
w.commit();
}
@@ -196,7 +196,7 @@ TEST(WiredTigerRecordStoreTest, Isolation2) {
ASSERT_EQUALS(string("a"), rs->dataFor(t2.get(), id1).data());
try {
// this should fail as our version of id1 is too old
- rs->updateRecord(t2.get(), id1, "c", 2, NULL).transitional_ignore();
+ rs->updateRecord(t2.get(), id1, "c", 2).transitional_ignore();
ASSERT(0);
} catch (WriteConflictException&) {
}
@@ -524,10 +524,10 @@ TEST(WiredTigerRecordStoreTest, OplogStones_UpdateRecord) {
BSONObj changed2 = makeBSONObjWithSize(Timestamp(1, 2), 51);
WriteUnitOfWork wuow(opCtx.get());
- ASSERT_NOT_OK(rs->updateRecord(
- opCtx.get(), RecordId(1, 1), changed1.objdata(), changed1.objsize(), nullptr));
- ASSERT_NOT_OK(rs->updateRecord(
- opCtx.get(), RecordId(1, 2), changed2.objdata(), changed2.objsize(), nullptr));
+ ASSERT_NOT_OK(
+ rs->updateRecord(opCtx.get(), RecordId(1, 1), changed1.objdata(), changed1.objsize()));
+ ASSERT_NOT_OK(
+ rs->updateRecord(opCtx.get(), RecordId(1, 2), changed2.objdata(), changed2.objsize()));
}
// Attempts to shrink the records should also fail.
@@ -538,10 +538,10 @@ TEST(WiredTigerRecordStoreTest, OplogStones_UpdateRecord) {
BSONObj changed2 = makeBSONObjWithSize(Timestamp(1, 2), 49);
WriteUnitOfWork wuow(opCtx.get());
- ASSERT_NOT_OK(rs->updateRecord(
- opCtx.get(), RecordId(1, 1), changed1.objdata(), changed1.objsize(), nullptr));
- ASSERT_NOT_OK(rs->updateRecord(
- opCtx.get(), RecordId(1, 2), changed2.objdata(), changed2.objsize(), nullptr));
+ ASSERT_NOT_OK(
+ rs->updateRecord(opCtx.get(), RecordId(1, 1), changed1.objdata(), changed1.objsize()));
+ ASSERT_NOT_OK(
+ rs->updateRecord(opCtx.get(), RecordId(1, 2), changed2.objdata(), changed2.objsize()));
}
// Changing the contents of the records without changing their size should succeed.
@@ -552,10 +552,10 @@ TEST(WiredTigerRecordStoreTest, OplogStones_UpdateRecord) {
BSONObj changed2 = makeBSONObjWithSize(Timestamp(1, 2), 50, 'z');
WriteUnitOfWork wuow(opCtx.get());
- ASSERT_OK(rs->updateRecord(
- opCtx.get(), RecordId(1, 1), changed1.objdata(), changed1.objsize(), nullptr));
- ASSERT_OK(rs->updateRecord(
- opCtx.get(), RecordId(1, 2), changed2.objdata(), changed2.objsize(), nullptr));
+ ASSERT_OK(
+ rs->updateRecord(opCtx.get(), RecordId(1, 1), changed1.objdata(), changed1.objsize()));
+ ASSERT_OK(
+ rs->updateRecord(opCtx.get(), RecordId(1, 2), changed2.objdata(), changed2.objsize()));
wuow.commit();
ASSERT_EQ(1U, oplogStones->numStones());
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp
index 83cd9a47c2c..8c62fcc7c79 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp
@@ -205,7 +205,7 @@ TEST_F(WiredTigerRecoveryUnitTestFixture, CreateAndCheckForCachePressure) {
ASSERT_OK(ru1->setTimestamp(Timestamp(time++)));
std::string s = str::stream()
<< "abcbcdcdedefefgfghghihijijkjklklmlmnmnomopopqpqrqrsrststutuv" << j;
- ASSERT_OK(rs->updateRecord(opCtx, recordId, s.c_str(), s.size() + 1, nullptr));
+ ASSERT_OK(rs->updateRecord(opCtx, recordId, s.c_str(), s.size() + 1));
wuow.commit();
} catch (const DBException& ex) {
invariant(ex.toStatus().code() == ErrorCodes::WriteConflict);
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index 87c4aaad88a..874a3ca172a 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -328,7 +328,7 @@ public:
{
WriteUnitOfWork wunit(&_opCtx);
auto doc = BSON("_id" << 1 << "a" << 9);
- auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
@@ -379,7 +379,7 @@ public:
{
WriteUnitOfWork wunit(&_opCtx);
auto doc = BSON("_id" << 9);
- auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}
@@ -392,7 +392,7 @@ public:
{
WriteUnitOfWork wunit(&_opCtx);
auto doc = BSON("_id" << 1);
- auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}
@@ -484,8 +484,7 @@ public:
// Update a document's indexed field without updating the index.
{
WriteUnitOfWork wunit(&_opCtx);
- auto updateStatus =
- rs->updateRecord(&_opCtx, id1, doc1_b.objdata(), doc1_b.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc1_b.objdata(), doc1_b.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}
@@ -498,8 +497,7 @@ public:
// Index validation should still be valid.
{
WriteUnitOfWork wunit(&_opCtx);
- auto updateStatus =
- rs->updateRecord(&_opCtx, id1, doc1_c.objdata(), doc1_c.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc1_c.objdata(), doc1_c.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}
@@ -567,7 +565,7 @@ public:
{
WriteUnitOfWork wunit(&_opCtx);
auto doc = BSON("_id" << 2 << "a" << 3);
- auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}
@@ -640,7 +638,7 @@ public:
{
WriteUnitOfWork wunit(&_opCtx);
auto doc = BSON("_id" << 1);
- auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}
@@ -802,7 +800,7 @@ public:
{
WriteUnitOfWork wunit(&_opCtx);
auto doc = BSON("_id" << 1 << "a" << 1 << "b" << 3);
- auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize(), NULL);
+ auto updateStatus = rs->updateRecord(&_opCtx, id1, doc.objdata(), doc.objsize());
ASSERT_OK(updateStatus);
wunit.commit();
}