summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-04-09 20:05:40 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-04-09 20:05:40 +0000
commit3c2d8d9b5937426617df29a5cb182cf346ef8834 (patch)
tree32906e168ab6ff13c0de74c921cabfbdd30e6b79 /searchcore
parente862fb33abde3bb6d6a953a2e74af2cc15506508 (diff)
Remove LID and add an assert before serializing.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp30
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/docstorevalidator.cpp5
3 files changed, 17 insertions, 23 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp
index d388b02852c..c6bdeb08ad5 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "removeoperation.h"
+#include <cassert>
using document::BucketId;
using document::DocumentId;
@@ -39,8 +40,7 @@ RemoveOperationWithDocId::serialize(vespalib::nbostream &os) const
void
-RemoveOperationWithDocId::deserialize(vespalib::nbostream &is,
- const DocumentTypeRepo &repo)
+RemoveOperationWithDocId::deserialize(vespalib::nbostream &is, const DocumentTypeRepo &repo)
{
RemoveOperation::deserialize(is, repo);
size_t oldSize = is.size();
@@ -55,18 +55,16 @@ RemoveOperationWithDocId::toString() const {
}
RemoveOperationWithGid::RemoveOperationWithGid()
- : RemoveOperation(FeedOperation::REMOVE_GID),
- _gid(),
- _docType(),
- _lid(0)
+ : RemoveOperation(FeedOperation::REMOVE_GID),
+ _gid(),
+ _docType()
{}
-RemoveOperationWithGid::RemoveOperationWithGid(BucketId bucketId, Timestamp timestamp, const GlobalId &gid, vespalib::stringref docType, uint32_t lid)
- : RemoveOperation(FeedOperation::REMOVE_GID, bucketId, timestamp),
- _gid(gid),
- _docType(docType),
- _lid(lid)
+RemoveOperationWithGid::RemoveOperationWithGid(BucketId bucketId, Timestamp timestamp, const GlobalId &gid, vespalib::stringref docType)
+ : RemoveOperation(FeedOperation::REMOVE_GID, bucketId, timestamp),
+ _gid(gid),
+ _docType(docType)
{}
RemoveOperationWithGid::~RemoveOperationWithGid() = default;
@@ -75,33 +73,31 @@ void
RemoveOperationWithGid::serialize(vespalib::nbostream &os) const
{
assertValidBucketId(_gid);
+ assert( ! getValidDbdId());
RemoveOperation::serialize(os);
size_t oldSize = os.size();
os.write(_gid.get(), GlobalId::LENGTH);
- os << _lid;
os.writeSmallString(_docType);
_serializedDocSize = os.size() - oldSize;
}
void
-RemoveOperationWithGid::deserialize(vespalib::nbostream &is,
- const DocumentTypeRepo &repo)
+RemoveOperationWithGid::deserialize(vespalib::nbostream &is, const DocumentTypeRepo &repo)
{
RemoveOperation::deserialize(is, repo);
size_t oldSize = is.size();
char buf[GlobalId::LENGTH];
is.read(buf, sizeof(buf));
_gid.set(buf);
- is >> _lid;
is.readSmallString(_docType);
_serializedDocSize = oldSize - is.size();
}
vespalib::string
RemoveOperationWithGid::toString() const {
- return make_string("RemoveGid(%s, %u, %s, %s)",
- _gid.toString().c_str(), _lid, _docType.c_str(), docArgsToString().c_str());
+ return make_string("RemoveGid(%s, %s, %s)",
+ _gid.toString().c_str(), _docType.c_str(), docArgsToString().c_str());
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h
index 8bd19d55ac9..ea1e62b8651 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h
@@ -40,17 +40,14 @@ public:
class RemoveOperationWithGid : public RemoveOperation {
document::GlobalId _gid;
vespalib::string _docType;
- uint32_t _lid;
public:
RemoveOperationWithGid();
RemoveOperationWithGid(document::BucketId bucketId,
storage::spi::Timestamp timestamp,
const document::GlobalId & gid,
- vespalib::stringref docType,
- uint32_t lid);
+ vespalib::stringref docType);
~RemoveOperationWithGid() override;
- uint32_t getLid() const { return _lid; }
const document::GlobalId & getGlobalId() const override { return _gid; }
void serialize(vespalib::nbostream &os) const override;
void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override;
diff --git a/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.cpp b/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.cpp
index 0eb11eddaf3..cc2beed8de7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.cpp
@@ -114,7 +114,8 @@ DocStoreValidator::getInvalidLids() const
return res;
}
-void DocStoreValidator::performRemoves(FeedHandler & feedHandler, const search::IDocumentStore &store, const document::DocumentTypeRepo & repo) const {
+void
+DocStoreValidator::performRemoves(FeedHandler & feedHandler, const search::IDocumentStore &store, const document::DocumentTypeRepo & repo) const {
for (search::DocumentIdT lid(_invalid->getFirstTrueBit(1));
lid < _docIdLimit;
lid = _invalid->getNextTrueBit(lid + 1))
@@ -128,7 +129,7 @@ void DocStoreValidator::performRemoves(FeedHandler & feedHandler, const search::
document::Document::UP document = store.read(lid, repo);
assert(document);
LOG(info, "Removing document with id %s and lid %u with gid %s in bucket %s", document->getId().toString().c_str(), lid, metaData.gid.toString().c_str(), metaData.bucketId.toString().c_str());
- auto remove = std::make_unique<RemoveOperationWithGid>(metaData.bucketId, metaData.timestamp, gid, document->getType().getName(), lid);
+ auto remove = std::make_unique<RemoveOperationWithGid>(metaData.bucketId, metaData.timestamp, gid, document->getType().getName());
feedHandler.performOperation(FeedToken(), std::move(remove));
}
}