summaryrefslogtreecommitdiffstats
path: root/vdslib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-03-28 21:37:52 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-03-28 21:37:52 +0200
commitddf9abb798e3f6169ba9d04e5025eb4fa1cfe2e6 (patch)
tree835edb6a0c69c94d600ec76c099dab0a3d6b5eca /vdslib
parentc4abdb06a60852ac00c5920eff34aeefb3fc00e3 (diff)
Maintain old behavior for MultiOperation.
Diffstat (limited to 'vdslib')
-rw-r--r--vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp19
-rw-r--r--vdslib/src/vespa/vdslib/container/mutabledocumentlist.h4
2 files changed, 20 insertions, 3 deletions
diff --git a/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp b/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp
index 1c80e3ba8ee..6ceffa9cff7 100644
--- a/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp
+++ b/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp
@@ -6,6 +6,23 @@
using vespalib::nbostream;
+namespace {
+
+bool hasBodyField(const document::Document & value) {
+ for (document::StructuredFieldValue::const_iterator it(value.getFields().begin()), mt(value.getFields().end());
+ it != mt;
+ ++it)
+ {
+ if ( ! it.field().isHeaderField() ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+}
+
+
namespace vdslib {
MutableDocumentList::MutableDocumentList(const document::DocumentTypeRepo::SP & repo, char* buffer, uint32_t bufferSize, bool keepexisting)
: DocumentList(repo, buffer, bufferSize, keepexisting)
@@ -49,7 +66,7 @@ MutableDocumentList::addPut(const document::Document& doc, Timestamp ts,
doc.serializeHeader(stream);
uint32_t headerSize = stream.size();
- if (addBody) {
+ if (addBody && hasBodyField(doc)) {
doc.serializeBody(stream);
}
diff --git a/vdslib/src/vespa/vdslib/container/mutabledocumentlist.h b/vdslib/src/vespa/vdslib/container/mutabledocumentlist.h
index 99d29565d42..a61032a652d 100644
--- a/vdslib/src/vespa/vdslib/container/mutabledocumentlist.h
+++ b/vdslib/src/vespa/vdslib/container/mutabledocumentlist.h
@@ -14,8 +14,8 @@
#pragma once
-#include <vespa/vdslib/container/documentlist.h>
-#include <vespa/vdslib/container/operationlist.h>
+#include "documentlist.h"
+#include "operationlist.h"
namespace vdslib {