summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2022-12-09 14:26:59 +0000
committerTor Brede Vekterli <vekterli@yahooinc.com>2022-12-09 14:26:59 +0000
commit136e428e41823454c7f09044277db05ea96168b3 (patch)
tree5cd5c3306dc886e755c60b5a0be2514e13e17662
parent0f15b405cad738460a8126bf9ef689ec3edfd094 (diff)
Propagate doc repo in update to auto-created blank document instance
-rw-r--r--document/src/vespa/document/update/documentupdate.cpp5
-rw-r--r--document/src/vespa/document/update/documentupdate.h5
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp4
3 files changed, 12 insertions, 2 deletions
diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp
index 7a3eb85d3d5..d6488c1381c 100644
--- a/document/src/vespa/document/update/documentupdate.cpp
+++ b/document/src/vespa/document/update/documentupdate.cpp
@@ -91,6 +91,11 @@ DocumentUpdate::getType() const {
return static_cast<const DocumentType &> (*_type);
}
+const DocumentTypeRepo*
+DocumentUpdate::getRepoPtr() const noexcept {
+ return _repo;
+}
+
const DocumentUpdate::FieldUpdateV &
DocumentUpdate::getUpdates() const {
ensureDeserialized();
diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h
index 192569ba6ee..5a7944b1188 100644
--- a/document/src/vespa/document/update/documentupdate.h
+++ b/document/src/vespa/document/update/documentupdate.h
@@ -60,7 +60,7 @@ public:
* The document type is not strictly needed, as we know this at applyTo()
* time, but search does not use applyTo() code to do the update, and don't
* know the document type of their objects, so this is supplied for
- * convinience. It also makes it possible to check updates for sanity at
+ * convenience. It also makes it possible to check updates for sanity at
* creation time.
*
* @param type The document type that this update is applicable for.
@@ -101,6 +101,9 @@ public:
/** @return The type of document this update is for. */
const DocumentType& getType() const;
+ // Returns pointer to repo used for underlying update, or nullptr if default-constructed
+ const DocumentTypeRepo* getRepoPtr() const noexcept;
+
void serializeHEAD(vespalib::nbostream &stream) const;
/**
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
index 7c04636dc50..59f52465b93 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
@@ -674,7 +674,9 @@ std::shared_ptr<document::Document>
TwoPhaseUpdateOperation::createBlankDocument() const
{
const document::DocumentUpdate& up(*_updateCmd->getUpdate());
- return std::make_shared<document::Document>(up.getType(), up.getId());
+ auto doc = std::make_shared<document::Document>(up.getType(), up.getId());
+ doc->setRepo(*up.getRepoPtr());
+ return doc;
}
void