diff options
author | Henning Baldersheim <balder@oath.com> | 2018-06-14 09:33:31 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-06-14 09:33:31 +0200 |
commit | 02875a82a322965ba4079e2be168eba6b7b41c40 (patch) | |
tree | 2dcb3b1fcbbd1843a6f41d375fd7c25a9b0a8bb5 /searchcore | |
parent | e363d65cdb05648c6b56fc64262439d125fc9674 (diff) |
Reinstate update verification
Diffstat (limited to 'searchcore')
4 files changed, 5 insertions, 7 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index d704e4f3d27..a1bce7174bf 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -735,13 +735,11 @@ TEST_F("require that update with different document type repo can be ok", FeedHa checkUpdate(f, schema, "i1", false, true); } -#if 0 // TODO: Test disabled temporary TEST_F("require that update with different document type repo can be rejected", FeedHandlerFixture) { TwoFieldsSchemaContext schema; checkUpdate(f, schema, "i2", true, true); } -#endif TEST_F("require that update with same document type repo is ok, fallback to create document", FeedHandlerFixture) { @@ -754,13 +752,11 @@ TEST_F("require that update with different document type repo can be ok, fallbac checkUpdate(f, schema, "i1", false, false); } -#if 0 // TODO: Test disabled temporary TEST_F("require that update with different document type repo can be rejected, preventing fallback to create document", FeedHandlerFixture) { TwoFieldsSchemaContext schema; checkUpdate(f, schema, "i2", true, false); } -#endif TEST_F("require that put with different document type repo is ok", FeedHandlerFixture) { diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp index 824909d0431..dc83848152c 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp @@ -82,11 +82,12 @@ UpdateOperation::deserialize(vespalib::nbostream &is, const DocumentTypeRepo &re } void -UpdateOperation::deserializeUpdate(const DocumentTypeRepo &repo) +UpdateOperation::verifyUpdate(const DocumentTypeRepo &repo) { vespalib::nbostream stream; serializeUpdate(stream); deserializeUpdate(std::move(stream), repo); + _upd->eagerDeserialize(); // Will trigger exceptions if incompatible } vespalib::string diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h index 554778728f0..83e87fea096 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h @@ -30,7 +30,7 @@ public: const DocumentUpdateSP &getUpdate() const { return _upd; } void serialize(vespalib::nbostream &os) const override; void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; - void deserializeUpdate(const document::DocumentTypeRepo &repo); + void verifyUpdate(const document::DocumentTypeRepo &repo); vespalib::string toString() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index 66e721f9222..97cc25e635f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -14,6 +14,7 @@ #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> #include <vespa/searchcore/proton/persistenceengine/transport_latch.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchcorespi/index/ithreadingservice.h> #include <vespa/searchlib/common/gatecallback.h> @@ -522,7 +523,7 @@ FeedHandler::considerUpdateOperationForRejection(FeedToken &token, UpdateOperati */ if (_documentType != &update.getType()) { try { - op.deserializeUpdate(*_repo); + op.verifyUpdate(*_repo); } catch (document::FieldNotFoundException &e) { if (token) { auto message = make_string("Update operation rejected for document '%s' of type '%s': 'Field not found'", |