diff options
author | Harald Musum <musum@yahoo-inc.com> | 2018-01-30 19:30:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-30 19:30:16 +0100 |
commit | 0c585016ca2f8fbd25756f761552693e2445c23d (patch) | |
tree | 4ba84755780853b3ea7e670605456d716fed38ca | |
parent | 4d175c3c37d6ffada13dd15023d575f8e663351e (diff) |
Revert "Geirst/add bucket space to document api"
117 files changed, 120 insertions, 788 deletions
@@ -1 +1 @@ -6.199.0 +6.10.0 diff --git a/configdefinitions/src/main/java/com/yahoo/vespa/config/content/core/package-info.java b/configdefinitions/src/main/java/com/yahoo/vespa/config/content/core/package-info.java deleted file mode 100644 index a85b025fc08..00000000000 --- a/configdefinitions/src/main/java/com/yahoo/vespa/config/content/core/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -@ExportPackage -package com.yahoo.vespa.config.content.core; - -import com.yahoo.osgi.annotation.ExportPackage; diff --git a/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java b/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java index 0efdefa197e..01abd6454a9 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java @@ -20,7 +20,6 @@ import java.util.TreeMap; public class VisitorParameters extends Parameters { private String documentSelection; - private String bucketSpace = "default"; private String visitorLibrary = "DumpVisitor"; private int maxPending = 32; private long timeoutMs = -1; @@ -70,7 +69,6 @@ public class VisitorParameters extends Parameters { */ public VisitorParameters(VisitorParameters params) { setDocumentSelection(params.getDocumentSelection()); - setBucketSpace(params.getBucketSpace()); setVisitorLibrary(params.getVisitorLibrary()); setMaxPending(params.getMaxPending()); setTimeoutMs(params.getTimeoutMs()); @@ -110,9 +108,6 @@ public class VisitorParameters extends Parameters { /** @return The selection string used for visiting. */ public String getDocumentSelection() { return documentSelection; } - /** @return The bucket space to visit */ - public String getBucketSpace() { return bucketSpace; } - /** @return What visitor library to use for the visiting. The library in question must be installed on each storage node in the target cluster. */ public String getVisitorLibrary() { return visitorLibrary; } @@ -197,9 +192,6 @@ public class VisitorParameters extends Parameters { /** Set the document selection expression */ public void setDocumentSelection(String selection) { documentSelection = selection; } - /** Set which (single) bucket space this visiting will be against. */ - public void setBucketSpace(String bucketSpace) { this.bucketSpace = bucketSpace; } - /** Set which visitor library is used for visiting in storage. DumpVisitor is most common implementation. */ public void setVisitorLibrary(String library) { visitorLibrary = library; } @@ -351,11 +343,11 @@ public class VisitorParameters extends Parameters { this.dynamicMaxBucketsIncreaseFactor = dynamicMaxBucketsIncreaseFactor; } + // Inherit docs from Object public String toString() { StringBuffer sb = new StringBuffer(); sb.append("VisitorParameters(\n") .append(" Document selection: ").append(documentSelection).append('\n') - .append(" Bucket space: ").append(bucketSpace).append('\n') .append(" Visitor library: ").append(visitorLibrary).append('\n') .append(" Max pending: ").append(maxPending).append('\n') .append(" Timeout (ms): ").append(timeoutMs).append('\n') diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java index a146caa972e..4dd78278df0 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java @@ -595,7 +595,6 @@ public class MessageBusVisitorSession implements VisitorSession { msg.setTimeRemaining(messageTimeoutMs); msg.setBuckets(Arrays.asList(bucket.getSuperbucket(), bucket.getProgress())); msg.setDocumentSelection(params.getDocumentSelection()); - msg.setBucketSpace(params.getBucketSpace()); msg.setFromTimestamp(params.getFromTimestamp()); msg.setToTimestamp(params.getToTimestamp()); msg.setMaxPendingReplyCount(params.getMaxPending()); diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/CreateVisitorMessage.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/CreateVisitorMessage.java index e6d51103b3e..57384836001 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/CreateVisitorMessage.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/CreateVisitorMessage.java @@ -12,7 +12,6 @@ public class CreateVisitorMessage extends DocumentMessage { private String controlDestination = ""; private String dataDestination = ""; private String docSelection = ""; - private String bucketSpace = "default"; private int maxPendingReplyCount = 8; private List<BucketId> buckets = new ArrayList<>(); private long fromTime = 0; @@ -77,14 +76,6 @@ public class CreateVisitorMessage extends DocumentMessage { docSelection = documentSelection; } - public String getBucketSpace() { - return bucketSpace; - } - - public void setBucketSpace(String bucketSpace) { - this.bucketSpace = bucketSpace; - } - public int getMaxPendingReplyCount() { return maxPendingReplyCount; } @@ -211,7 +202,6 @@ public class CreateVisitorMessage extends DocumentMessage { sb.append(", time ").append(fromTime).append('-').append(toTime); } sb.append(", selection '").append(docSelection).append('\''); - sb.append(", bucket space '").append(bucketSpace).append('\''); if (!libName.equals("DumpVisitor")) { sb.append(", library ").append(libName); } diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentProtocol.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentProtocol.java index 57e7070296f..e1e501d3e1b 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentProtocol.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentProtocol.java @@ -298,13 +298,10 @@ public class DocumentProtocol implements Protocol { VersionSpecification version50 = new VersionSpecification(5, 0); VersionSpecification version51 = new VersionSpecification(5, 1); VersionSpecification version52 = new VersionSpecification(5, 115); - VersionSpecification version6 = new VersionSpecification(6, 999); // TODO change once stable protocol - // TODO ensure version semantics - List<VersionSpecification> from50 = Arrays.asList(version50, version51, version52, version6); - List<VersionSpecification> from51 = Arrays.asList(version51, version52, version6); - List<VersionSpecification> from52 = Arrays.asList(version52, version6); - List<VersionSpecification> from6 = Collections.singletonList(version6); // TODO decide minor version... + List<VersionSpecification> from50 = Arrays.asList(version50, version51, version52); + List<VersionSpecification> from51 = Arrays.asList(version51, version52); + List<VersionSpecification> from52 = Arrays.asList(version52); // 5.0 serialization (keep alphabetized please) putRoutableFactory(MESSAGE_BATCHDOCUMENTUPDATE, new RoutableFactories50.BatchDocumentUpdateMessageFactory(), from50); @@ -355,11 +352,6 @@ public class DocumentProtocol implements Protocol { putRoutableFactory(MESSAGE_PUTDOCUMENT, new RoutableFactories52.PutDocumentMessageFactory(), from52); putRoutableFactory(MESSAGE_UPDATEDOCUMENT, new RoutableFactories52.UpdateDocumentMessageFactory(), from52); putRoutableFactory(MESSAGE_REMOVEDOCUMENT, new RoutableFactories52.RemoveDocumentMessageFactory(), from52); - - // 6.x serialization - putRoutableFactory(MESSAGE_CREATEVISITOR, new RoutableFactories60.CreateVisitorMessageFactory(), from6); - putRoutableFactory(MESSAGE_STATBUCKET, new RoutableFactories60.StatBucketMessageFactory(), from6); - putRoutableFactory(MESSAGE_GETBUCKETLIST, new RoutableFactories60.GetBucketListMessageFactory(), from6); } /** diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/GetBucketListMessage.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/GetBucketListMessage.java index 5e5d79f86b7..74629018e55 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/GetBucketListMessage.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/GetBucketListMessage.java @@ -6,19 +6,13 @@ import com.yahoo.document.BucketId; public class GetBucketListMessage extends DocumentMessage { private BucketId bucketId; - private String bucketSpace = "default"; GetBucketListMessage() { // must be deserialized into } public GetBucketListMessage(BucketId bucketId) { - this(bucketId, "default"); - } - - public GetBucketListMessage(BucketId bucketId, String bucketSpace) { this.bucketId = bucketId; - this.bucketSpace = bucketSpace; } public BucketId getBucketId() { @@ -29,14 +23,6 @@ public class GetBucketListMessage extends DocumentMessage { bucketId = id; } - public String getBucketSpace() { - return bucketSpace; - } - - public void setBucketSpace(String bucketSpace) { - this.bucketSpace = bucketSpace; - } - @Override public DocumentReply createReply() { return new StatBucketReply(); @@ -44,7 +30,7 @@ public class GetBucketListMessage extends DocumentMessage { @Override public int getApproxSize() { - return super.getApproxSize() + 8 + bucketSpace.length(); + return super.getApproxSize() + 8; } @Override diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories50.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories50.java index 0ea82ba0d83..7417e63480e 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories50.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories50.java @@ -392,28 +392,18 @@ public abstract class RoutableFactories50 { public static class GetBucketListMessageFactory extends DocumentMessageFactory { - protected String decodeBucketSpace(Deserializer deserializer) { - return "default"; // TODO fixed space repo - } - @Override protected DocumentMessage doDecode(DocumentDeserializer buf) { GetBucketListMessage msg = new GetBucketListMessage(); msg.setBucketId(new BucketId(buf.getLong(null))); - msg.setBucketSpace(decodeBucketSpace(buf)); return msg; } - protected boolean encodeBucketSpace(String bucketSpace, DocumentSerializer buf) { - // TODO fixed space repo - return "default".equals(bucketSpace); - } - @Override protected boolean doEncode(DocumentMessage obj, DocumentSerializer buf) { GetBucketListMessage msg = (GetBucketListMessage)obj; buf.putLong(null, msg.getBucketId().getRawId()); - return encodeBucketSpace(msg.getBucketSpace(), buf); + return true; } } @@ -841,30 +831,20 @@ public abstract class RoutableFactories50 { public static class StatBucketMessageFactory extends DocumentMessageFactory { - protected String decodeBucketSpace(Deserializer deserializer) { - return "default"; // TODO fixed space repo - } - @Override protected DocumentMessage doDecode(DocumentDeserializer buf) { StatBucketMessage msg = new StatBucketMessage(); msg.setBucketId(new BucketId(buf.getLong(null))); msg.setDocumentSelection(decodeString(buf)); - msg.setBucketSpace(decodeBucketSpace(buf)); return msg; } - protected boolean encodeBucketSpace(String bucketSpace, DocumentSerializer buf) { - // TODO fixed space repo - return "default".equals(bucketSpace); - } - @Override protected boolean doEncode(DocumentMessage obj, DocumentSerializer buf) { StatBucketMessage msg = (StatBucketMessage)obj; buf.putLong(null, msg.getBucketId().getRawId()); encodeString(msg.getDocumentSelection(), buf); - return encodeBucketSpace(msg.getBucketSpace(), buf); + return true; } } diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories51.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories51.java index a99902c1d13..c2f986b8fb8 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories51.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories51.java @@ -5,7 +5,6 @@ import com.yahoo.document.BucketId; import com.yahoo.document.DocumentId; import com.yahoo.document.serialization.DocumentDeserializer; import com.yahoo.document.serialization.DocumentSerializer; -import com.yahoo.vespa.objects.Deserializer; import java.util.Map; @@ -18,10 +17,6 @@ public abstract class RoutableFactories51 extends RoutableFactories50 { public static class CreateVisitorMessageFactory extends DocumentMessageFactory { - protected String decodeBucketSpace(Deserializer deserializer) { - return "default"; // TODO fixed space repo - } - @Override protected DocumentMessage doDecode(DocumentDeserializer buf) { CreateVisitorMessage msg = new CreateVisitorMessage(); @@ -58,15 +53,9 @@ public abstract class RoutableFactories51 extends RoutableFactories50 { msg.setVisitorOrdering(buf.getInt(null)); msg.setMaxBucketsPerVisitor(buf.getInt(null)); msg.setVisitorDispatcherVersion(50); - msg.setBucketSpace(decodeBucketSpace(buf)); return msg; } - protected boolean encodeBucketSpace(String bucketSpace, DocumentSerializer buf) { - // TODO fixed space repo - return "default".equals(bucketSpace); - } - @Override protected boolean doEncode(DocumentMessage obj, DocumentSerializer buf) { CreateVisitorMessage msg = (CreateVisitorMessage)obj; @@ -103,7 +92,7 @@ public abstract class RoutableFactories51 extends RoutableFactories50 { buf.putInt(null, msg.getVisitorOrdering()); buf.putInt(null, msg.getMaxBucketsPerVisitor()); - return encodeBucketSpace(msg.getBucketSpace(), buf); + return true; } } diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories60.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories60.java deleted file mode 100644 index 723760df117..00000000000 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories60.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.documentapi.messagebus.protocol; - -import com.yahoo.document.serialization.DocumentSerializer; -import com.yahoo.vespa.objects.Deserializer; - -public class RoutableFactories60 extends RoutableFactories52 { - - public static class CreateVisitorMessageFactory extends RoutableFactories52.CreateVisitorMessageFactory { - @Override - protected String decodeBucketSpace(Deserializer deserializer) { - return decodeString(deserializer); - } - - @Override - protected boolean encodeBucketSpace(String bucketSpace, DocumentSerializer buf) { - encodeString(bucketSpace, buf); - return true; - } - } - - public static class StatBucketMessageFactory extends RoutableFactories52.StatBucketMessageFactory { - @Override - protected String decodeBucketSpace(Deserializer deserializer) { - return decodeString(deserializer); - } - - @Override - protected boolean encodeBucketSpace(String bucketSpace, DocumentSerializer buf) { - encodeString(bucketSpace, buf); - return true; - } - } - - public static class GetBucketListMessageFactory extends RoutableFactories52.GetBucketListMessageFactory { - @Override - protected String decodeBucketSpace(Deserializer deserializer) { - return decodeString(deserializer); - } - - @Override - protected boolean encodeBucketSpace(String bucketSpace, DocumentSerializer buf) { - encodeString(bucketSpace, buf); - return true; - } - } - -} diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StatBucketMessage.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StatBucketMessage.java index 8fb4ceb6d41..9b2176d85f6 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StatBucketMessage.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StatBucketMessage.java @@ -6,7 +6,6 @@ import com.yahoo.document.BucketId; public class StatBucketMessage extends DocumentMessage { private BucketId bucketId; - private String bucketSpace = "default"; private String documentSelection; StatBucketMessage() { @@ -14,12 +13,7 @@ public class StatBucketMessage extends DocumentMessage { } public StatBucketMessage(BucketId bucket, String documentSelection) { - this(bucket, "default", documentSelection); - } - - public StatBucketMessage(BucketId bucketId, String bucketSpace, String documentSelection) { - this.bucketId = bucketId; - this.bucketSpace = bucketSpace; + this.bucketId = bucket; this.documentSelection = documentSelection; } @@ -39,14 +33,6 @@ public class StatBucketMessage extends DocumentMessage { this.documentSelection = documentSelection; } - public String getBucketSpace() { - return bucketSpace; - } - - public void setBucketSpace(String bucketSpace) { - this.bucketSpace = bucketSpace; - } - @Override public DocumentReply createReply() { return new StatBucketReply(); @@ -54,7 +40,7 @@ public class StatBucketMessage extends DocumentMessage { @Override public int getApproxSize() { - return super.getApproxSize() + 8 + bucketSpace.length() + documentSelection.length(); + return super.getApproxSize() + 8 + documentSelection.length(); } @Override diff --git a/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java index 181253c4377..54b12b0963d 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java @@ -12,7 +12,6 @@ public class VisitorParametersTestCase { private VisitorParameters createVisitorParameters() { VisitorParameters params = new VisitorParameters(""); params.setDocumentSelection("id.user==5678"); - params.setBucketSpace("narnia"); params.setFromTimestamp(9001); params.setToTimestamp(10001); params.setVisitorLibrary("CoolVisitor"); @@ -90,7 +89,6 @@ public class VisitorParametersTestCase { assertEquals( "VisitorParameters(\n" + " Document selection: id.user==5678\n" + - " Bucket space: narnia\n" + " Visitor library: CoolVisitor\n" + " Max pending: 111\n" + " Timeout (ms): 1337\n" + diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages50TestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages50TestCase.java index 0ef83c6b5af..f0b76907fc4 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages50TestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages50TestCase.java @@ -190,7 +190,6 @@ public class Messages50TestCase extends MessagesTestBase { assertEquals("CreateVisitorMessage(" + "No buckets, " + "selection 'true and false or true', " + - "bucket space 'default', " + "library SomeLibrary, including removes, " + "get fields: [all]" + ")", @@ -201,7 +200,6 @@ public class Messages50TestCase extends MessagesTestBase { assertEquals("CreateVisitorMessage(" + "Bucket BucketId(0x40000000000004d2), " + "selection 'true and false or true', " + - "bucket space 'default', " + "library SomeLibrary, including removes, " + "get fields: [all]" + ")", @@ -218,7 +216,6 @@ public class Messages50TestCase extends MessagesTestBase { "5 buckets: BucketId(0x40000000000004d2) BucketId(0x40000000000004d3) BucketId(0x40000000000004d4) ..., " + "time 10001-20002, " + "selection 'true and false or true', " + - "bucket space 'default', " + "library SomeLibrary, including removes, " + "get fields: [all], " + "visit inconsistent buckets" + diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages51TestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages51TestCase.java index 1c55b5f8e69..0a6e5a66ed9 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages51TestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages51TestCase.java @@ -53,7 +53,7 @@ public class Messages51TestCase extends Messages50TestCase { // //////////////////////////////////////////////////////////////////////////////// - protected static int BASE_MESSAGE_LENGTH = 5; + private static int BASE_MESSAGE_LENGTH = 5; public class testCreateVisitorMessage implements RunnableTest { diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages52TestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages52TestCase.java index 1bda3ea3610..c9cc7193d02 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages52TestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages52TestCase.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.documentapi.messagebus.protocol.test; +import com.google.common.annotations.Beta; import com.yahoo.component.Version; import com.yahoo.document.*; import com.yahoo.document.fieldpathupdate.RemoveFieldPathUpdate; @@ -14,6 +15,7 @@ import static org.junit.Assert.assertEquals; * @author Vegard Sjonfjell */ +@Beta public class Messages52TestCase extends Messages51TestCase { @Override @@ -38,6 +40,7 @@ public class Messages52TestCase extends Messages51TestCase { out.put(DocumentProtocol.MESSAGE_REMOVEDOCUMENT, new testRemoveDocumentMessage()); } + private static int BASE_MESSAGE_LENGTH = 5; private static String CONDITION_STRING = "There's just one condition"; public class testPutDocumentMessage implements RunnableTest { diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages60TestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages60TestCase.java deleted file mode 100644 index 6bb9207edd0..00000000000 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/Messages60TestCase.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.documentapi.messagebus.protocol.test; - -import com.yahoo.component.Version; -import com.yahoo.document.BucketId; -import com.yahoo.document.select.OrderingSpecification; -import com.yahoo.documentapi.messagebus.protocol.CreateVisitorMessage; -import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; -import com.yahoo.documentapi.messagebus.protocol.GetBucketListMessage; -import com.yahoo.documentapi.messagebus.protocol.StatBucketMessage; -import com.yahoo.text.Utf8; - -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -public class Messages60TestCase extends Messages52TestCase { - - @Override - protected Version version() { - return new Version(6, 999); // TODO finalize version - } - - @Override - protected boolean shouldTestCoverage() { - return true; - } - - @Override - protected void registerTests(Map<Integer, MessagesTestBase.RunnableTest> out) { - super.registerTests(out); - - // This list MUST mirror the list of routable factories from the DocumentProtocol constructor that support - // version 6.0. When adding tests to this list, please KEEP THEM ORDERED alphabetically like they are now. - - out.put(DocumentProtocol.MESSAGE_CREATEVISITOR, new Messages60TestCase.testCreateVisitorMessage()); - out.put(DocumentProtocol.MESSAGE_STATBUCKET, new Messages60TestCase.testStatBucketMessage()); - out.put(DocumentProtocol.MESSAGE_GETBUCKETLIST, new Messages60TestCase.testGetBucketListMessage()); - } - - public class testCreateVisitorMessage implements RunnableTest { - - private static final String BUCKET_SPACE = "bjarne"; - - // FIXME there is a large amount of code duplication across version tests, presumably - // to ensure that fields survive across version boundaries, but it makes code very bloated. - // TODO head towards a blissful Protobuf future instead... - @Override - public void run() { - CreateVisitorMessage msg = new CreateVisitorMessage("SomeLibrary", "myvisitor", "newyork", "london"); - msg.setDocumentSelection("true and false or true"); - msg.getParameters().put("myvar", Utf8.toBytes("somevalue")); - msg.getParameters().put("anothervar", Utf8.toBytes("34")); - msg.getBuckets().add(new BucketId(16, 1234)); - msg.setVisitRemoves(true); - msg.setFieldSet("foo bar"); - msg.setVisitorOrdering(OrderingSpecification.DESCENDING); - msg.setMaxBucketsPerVisitor(2); - msg.setBucketSpace(BUCKET_SPACE); - assertEquals(BASE_MESSAGE_LENGTH + 178 + serializedLength(BUCKET_SPACE), serialize("CreateVisitorMessage", msg)); - - for (Language lang : LANGUAGES) { - msg = (CreateVisitorMessage)deserialize("CreateVisitorMessage", DocumentProtocol.MESSAGE_CREATEVISITOR, lang); - assertEquals("SomeLibrary", msg.getLibraryName()); - assertEquals("myvisitor", msg.getInstanceId()); - assertEquals("newyork", msg.getControlDestination()); - assertEquals("london", msg.getDataDestination()); - assertEquals("true and false or true", msg.getDocumentSelection()); - assertEquals(8, msg.getMaxPendingReplyCount()); - assertEquals(true, msg.getVisitRemoves()); - assertEquals("foo bar", msg.getFieldSet()); - assertEquals(false, msg.getVisitInconsistentBuckets()); - assertEquals(1, msg.getBuckets().size()); - assertEquals(new BucketId(16, 1234), msg.getBuckets().iterator().next()); - assertEquals("somevalue", Utf8.toString(msg.getParameters().get("myvar"))); - assertEquals("34", Utf8.toString(msg.getParameters().get("anothervar"))); - assertEquals(OrderingSpecification.DESCENDING, msg.getVisitorOrdering()); - assertEquals(2, msg.getMaxBucketsPerVisitor()); - assertEquals(BUCKET_SPACE, msg.getBucketSpace()); - } - } - } - - public class testStatBucketMessage implements RunnableTest { - - private static final String BUCKET_SPACE = "andrei"; - - @Override - public void run() { - StatBucketMessage msg = new StatBucketMessage(new BucketId(16, 123), "id.user=123"); - msg.setLoadType(null); - msg.setBucketSpace(BUCKET_SPACE); - assertEquals(BASE_MESSAGE_LENGTH + 27 + serializedLength(BUCKET_SPACE), serialize("StatBucketMessage", msg)); - - for (Language lang : LANGUAGES) { - msg = (StatBucketMessage)deserialize("StatBucketMessage", DocumentProtocol.MESSAGE_STATBUCKET, lang); - assertEquals(new BucketId(16, 123), msg.getBucketId()); - assertEquals("id.user=123", msg.getDocumentSelection()); - assertEquals("default", msg.getLoadType().getName()); - assertEquals(BUCKET_SPACE, msg.getBucketSpace()); - } - } - } - - public class testGetBucketListMessage implements RunnableTest { - - private static final String BUCKET_SPACE = "beartato"; - - @Override - public void run() { - GetBucketListMessage msg = new GetBucketListMessage(new BucketId(16, 123)); - msg.setLoadType(loadTypes.getNameMap().get("foo")); - msg.setBucketSpace(BUCKET_SPACE); - assertEquals(BASE_MESSAGE_LENGTH + 12 + serializedLength(BUCKET_SPACE), serialize("GetBucketListMessage", msg)); - - for (Language lang : LANGUAGES) { - msg = (GetBucketListMessage)deserialize("GetBucketListMessage", DocumentProtocol.MESSAGE_GETBUCKETLIST, lang); - assertEquals(new BucketId(16, 123), msg.getBucketId()); - assertEquals("foo", msg.getLoadType().getName()); - assertEquals(BUCKET_SPACE, msg.getBucketSpace()); - } - } - } - - // TODO want to test that non-default bucket space fails to encode with old version - -} diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/test/MessageBusVisitorSessionTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/test/MessageBusVisitorSessionTestCase.java index 874066d50a3..25116273377 100755 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/test/MessageBusVisitorSessionTestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/test/MessageBusVisitorSessionTestCase.java @@ -2560,25 +2560,6 @@ public class MessageBusVisitorSessionTestCase { mc.controlHandler.toString()); } - @Test - public void visit_default_bucket_space_unless_explicitly_given() { - MockComponents mc = createDefaultMock(""); - mc.visitorSession.start(); - mc.executor.expectAndProcessTasks(1); - CreateVisitorMessage cmd = (CreateVisitorMessage)mc.sender.getAndRemoveMessage(0); - assertEquals("default", cmd.getBucketSpace()); - } - - @Test - public void explicitly_provided_bucket_space_is_propagated_to_visitor_commands() { - MockComponents mc = createDefaultMock(""); - mc.params.setBucketSpace("upside down"); - mc.visitorSession.start(); - mc.executor.expectAndProcessTasks(1); - CreateVisitorMessage cmd = (CreateVisitorMessage)mc.sender.getAndRemoveMessage(0); - assertEquals("upside down", cmd.getBucketSpace()); - } - /** * TODOs: * - parameter validation (max pending, ...) diff --git a/documentapi/src/tests/messages/CMakeLists.txt b/documentapi/src/tests/messages/CMakeLists.txt index b762eaca657..c34320bd78d 100644 --- a/documentapi/src/tests/messages/CMakeLists.txt +++ b/documentapi/src/tests/messages/CMakeLists.txt @@ -29,18 +29,6 @@ vespa_add_executable(documentapi_messages52_test_app TEST documentapi ) vespa_add_test(NAME documentapi_messages52_test_app COMMAND documentapi_messages52_test_app) -vespa_add_executable(documentapi_messages60_test_app TEST - SOURCES - testbase.cpp - messages50test.cpp - messages51test.cpp - messages52test.cpp - messages60test.cpp - messages60app.cpp - DEPENDS - documentapi -) -vespa_add_test(NAME documentapi_messages60_test_app COMMAND documentapi_messages60_test_app) vespa_add_executable(documentapi_error_codes_test_app_app TEST SOURCES error_codes_test.cpp diff --git a/documentapi/src/tests/messages/messages50test.cpp b/documentapi/src/tests/messages/messages50test.cpp index db82bdce54d..b50f30c1f91 100644 --- a/documentapi/src/tests/messages/messages50test.cpp +++ b/documentapi/src/tests/messages/messages50test.cpp @@ -31,6 +31,7 @@ Messages50Test::Messages50Test() putTest(DocumentProtocol::MESSAGE_GETBUCKETSTATE, TEST_METHOD(Messages50Test::testGetBucketStateMessage)); putTest(DocumentProtocol::MESSAGE_GETDOCUMENT, TEST_METHOD(Messages50Test::testGetDocumentMessage)); putTest(DocumentProtocol::MESSAGE_MAPVISITOR, TEST_METHOD(Messages50Test::testMapVisitorMessage)); + putTest(DocumentProtocol::MESSAGE_MULTIOPERATION, TEST_METHOD(Messages50Test::testMultiOperationMessage)); putTest(DocumentProtocol::MESSAGE_PUTDOCUMENT, TEST_METHOD(Messages50Test::testPutDocumentMessage)); putTest(DocumentProtocol::MESSAGE_QUERYRESULT, TEST_METHOD(Messages50Test::testQueryResultMessage)); putTest(DocumentProtocol::MESSAGE_REMOVEDOCUMENT, TEST_METHOD(Messages50Test::testRemoveDocumentMessage)); @@ -50,6 +51,7 @@ Messages50Test::Messages50Test() putTest(DocumentProtocol::REPLY_GETBUCKETSTATE, TEST_METHOD(Messages50Test::testGetBucketStateReply)); putTest(DocumentProtocol::REPLY_GETDOCUMENT, TEST_METHOD(Messages50Test::testGetDocumentReply)); putTest(DocumentProtocol::REPLY_MAPVISITOR, TEST_METHOD(Messages50Test::testMapVisitorReply)); + putTest(DocumentProtocol::REPLY_MULTIOPERATION, TEST_METHOD(Messages50Test::testMultiOperationReply)); putTest(DocumentProtocol::REPLY_PUTDOCUMENT, TEST_METHOD(Messages50Test::testPutDocumentReply)); putTest(DocumentProtocol::REPLY_QUERYRESULT, TEST_METHOD(Messages50Test::testQueryResultReply)); putTest(DocumentProtocol::REPLY_REMOVEDOCUMENT, TEST_METHOD(Messages50Test::testRemoveDocumentReply)); @@ -323,6 +325,41 @@ Messages50Test::testDocumentSummaryMessage() } bool +Messages50Test::testMultiOperationMessage() +{ + document::Document::SP doc = + createDoc(getTypeRepo(), "testdoc", "doc:scheme:foo"); + std::vector<char> buffer(1024); + document::BucketIdFactory factory; + + vdslib::WritableDocumentList doclist(getTypeRepoSp(), + &buffer[0], buffer.size()); + ASSERT_TRUE(doclist.addPut(*doc)); + + size_t n = MESSAGE_BASE_LENGTH; + n += sizeof(uint32_t); // routable object type + n += sizeof(uint64_t); // bucket id + n += sizeof(uint32_t); // bytes in docblock + n += sizeof(uint32_t); // num operations + n += sizeof(vdslib::DocumentList::MetaEntry); + n += doc->serialize()->getLength(); + n += 1; // boolean keepTimeStamps + + MultiOperationMessage msg(document::BucketId(16, factory.getBucketId(doc->getId()).getRawId()), doclist); + EXPECT_EQUAL(n, serialize("MultiOperationMessage", msg)); + for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { + mbus::Routable::UP obj = deserialize("MultiOperationMessage", DocumentProtocol::MESSAGE_MULTIOPERATION, lang); + if (EXPECT_TRUE(obj.get() != NULL)) { + MultiOperationMessage &ref = static_cast<MultiOperationMessage&>(*obj); + EXPECT_EQUAL((uint32_t)1, ref.getOperations().size()); + EXPECT_EQUAL(*doc, *dynamic_cast<document::Document*>(ref.getOperations().begin()->getDocument().get())); + EXPECT_EQUAL(document::BucketId(16, factory.getBucketId(doc->getId()).getRawId()), ref.getBucketId()); + } + } + return true; +} + +bool Messages50Test::testGetDocumentMessage() { GetDocumentMessage tmp(document::DocumentId("doc:scheme:"), 0); @@ -664,6 +701,25 @@ Messages50Test::testSearchResultMessage() return true; } + +bool +Messages50Test::testMultiOperationReply() +{ + WriteDocumentReply reply(DocumentProtocol::REPLY_MULTIOPERATION); + reply.setHighestModificationTimestamp(30); + + EXPECT_EQUAL(13u, serialize("MultiOperationReply", reply)); + + for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { + mbus::Routable::UP obj = deserialize("MultiOperationReply", DocumentProtocol::REPLY_MULTIOPERATION, lang); + if (EXPECT_TRUE(obj.get() != NULL)) { + WriteDocumentReply &ref = static_cast<WriteDocumentReply&>(*obj); + EXPECT_EQUAL(30u, ref.getHighestModificationTimestamp()); + } + } + return true; +} + bool Messages50Test::testUpdateDocumentMessage() { diff --git a/documentapi/src/tests/messages/messages50test.h b/documentapi/src/tests/messages/messages50test.h index c764f814a45..8711264ee7a 100644 --- a/documentapi/src/tests/messages/messages50test.h +++ b/documentapi/src/tests/messages/messages50test.h @@ -33,6 +33,8 @@ public: bool testGetDocumentReply(); bool testMapVisitorMessage(); bool testMapVisitorReply(); + bool testMultiOperationMessage(); + bool testMultiOperationReply(); bool testPutDocumentMessage(); bool testPutDocumentReply(); bool testQueryResultMessage(); diff --git a/documentapi/src/tests/messages/messages52test.cpp b/documentapi/src/tests/messages/messages52test.cpp index 642fbc2fc41..33eb5134dce 100644 --- a/documentapi/src/tests/messages/messages52test.cpp +++ b/documentapi/src/tests/messages/messages52test.cpp @@ -21,7 +21,7 @@ createDoc(const DocumentTypeRepo &repo, const string &type_name, const string &i } -static constexpr int MESSAGE_BASE_LENGTH = 5; +static const int MESSAGE_BASE_LENGTH = 5; Messages52Test::Messages52Test() { diff --git a/documentapi/src/tests/messages/messages52test.h b/documentapi/src/tests/messages/messages52test.h index a663ae15fdc..c45f00fb4b4 100644 --- a/documentapi/src/tests/messages/messages52test.h +++ b/documentapi/src/tests/messages/messages52test.h @@ -15,7 +15,7 @@ public: bool testUpdateDocumentMessage(); bool testRemoveDocumentMessage(); -protected: +private: static size_t serializedLength(const string & str) { return sizeof(int32_t) + str.size(); } diff --git a/documentapi/src/tests/messages/messages60app.cpp b/documentapi/src/tests/messages/messages60app.cpp deleted file mode 100644 index a6c626d5b20..00000000000 --- a/documentapi/src/tests/messages/messages60app.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "messages60test.h" - -TEST_APPHOOK(Messages60Test); diff --git a/documentapi/src/tests/messages/messages60test.cpp b/documentapi/src/tests/messages/messages60test.cpp deleted file mode 100644 index e553744452b..00000000000 --- a/documentapi/src/tests/messages/messages60test.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "messages60test.h" -#include <vespa/documentapi/documentapi.h> - -static constexpr int MESSAGE_BASE_LENGTH = 5; - -Messages60Test::Messages60Test() { - // This list MUST mirror the list of routable factories from the DocumentProtocol constructor that support - // version 6.x. When adding tests to this list, please KEEP THEM ORDERED alphabetically like they are now. - putTest(DocumentProtocol::MESSAGE_CREATEVISITOR, TEST_METHOD(Messages60Test::testCreateVisitorMessage)); - putTest(DocumentProtocol::MESSAGE_STATBUCKET, TEST_METHOD(Messages60Test::testStatBucketMessage)); - putTest(DocumentProtocol::MESSAGE_GETBUCKETLIST, TEST_METHOD(Messages60Test::testGetBucketListMessage)); -} - -// TODO code dupe with parent classes -bool Messages60Test::testCreateVisitorMessage() { - CreateVisitorMessage tmp("SomeLibrary", "myvisitor", "newyork", "london"); - tmp.setDocumentSelection("true and false or true"); - tmp.getParameters().set("myvar", "somevalue"); - tmp.getParameters().set("anothervar", uint64_t(34)); - tmp.getBuckets().push_back(document::BucketId(16, 1234)); - tmp.setVisitRemoves(true); - tmp.setFieldSet("foo bar"); - tmp.setVisitorOrdering(document::OrderingSpecification::DESCENDING); - tmp.setMaxBucketsPerVisitor(2); - tmp.setBucketSpace("bjarne"); - - EXPECT_EQUAL(MESSAGE_BASE_LENGTH + serializedLength("bjarne") + 178, serialize("CreateVisitorMessage", tmp)); - - for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { - mbus::Routable::UP obj = deserialize("CreateVisitorMessage", DocumentProtocol::MESSAGE_CREATEVISITOR, lang); - if (EXPECT_TRUE(obj)) { - auto& ref = dynamic_cast<CreateVisitorMessage&>(*obj); - - EXPECT_EQUAL(string("SomeLibrary"), ref.getLibraryName()); - EXPECT_EQUAL(string("myvisitor"), ref.getInstanceId()); - EXPECT_EQUAL(string("newyork"), ref.getControlDestination()); - EXPECT_EQUAL(string("london"), ref.getDataDestination()); - EXPECT_EQUAL(string("true and false or true"), ref.getDocumentSelection()); - EXPECT_EQUAL(string("foo bar"), ref.getFieldSet()); - EXPECT_EQUAL(uint32_t(8), ref.getMaximumPendingReplyCount()); - EXPECT_EQUAL(true, ref.visitRemoves()); - EXPECT_EQUAL(false, ref.visitHeadersOnly()); - EXPECT_EQUAL(false, ref.visitInconsistentBuckets()); - EXPECT_EQUAL(size_t(1), ref.getBuckets().size()); - EXPECT_EQUAL(document::BucketId(16, 1234), ref.getBuckets()[0]); - EXPECT_EQUAL(string("somevalue"), ref.getParameters().get("myvar")); - EXPECT_EQUAL(uint64_t(34), ref.getParameters().get("anothervar", uint64_t(1))); - EXPECT_EQUAL(document::OrderingSpecification::DESCENDING, ref.getVisitorOrdering()); - EXPECT_EQUAL(uint32_t(2), ref.getMaxBucketsPerVisitor()); - EXPECT_EQUAL(string("bjarne"), ref.getBucketSpace()); - } - } - return true; -} - -bool Messages60Test::testStatBucketMessage() { - StatBucketMessage msg(document::BucketId(16, 123), "id.user=123"); - msg.setBucketSpace("andrei"); - - EXPECT_EQUAL(MESSAGE_BASE_LENGTH + 27u + serializedLength("andrei"), serialize("StatBucketMessage", msg)); - - for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { - mbus::Routable::UP obj = deserialize("StatBucketMessage", DocumentProtocol::MESSAGE_STATBUCKET, lang); - if (EXPECT_TRUE(obj.get() != NULL)) { - StatBucketMessage &ref = static_cast<StatBucketMessage&>(*obj); - EXPECT_EQUAL(document::BucketId(16, 123), ref.getBucketId()); - EXPECT_EQUAL("id.user=123", ref.getDocumentSelection()); - EXPECT_EQUAL("andrei", ref.getBucketSpace()); - } - } - return true; -} - -bool Messages60Test::testGetBucketListMessage() { - GetBucketListMessage msg(document::BucketId(16, 123)); - msg.setLoadType(_loadTypes["foo"]); - msg.setBucketSpace("beartato"); - EXPECT_EQUAL(string("foo"), msg.getLoadType().getName()); - EXPECT_EQUAL(MESSAGE_BASE_LENGTH + 12u + serializedLength("beartato"), serialize("GetBucketListMessage", msg)); - - for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { - mbus::Routable::UP obj = deserialize("GetBucketListMessage", DocumentProtocol::MESSAGE_GETBUCKETLIST, lang); - if (EXPECT_TRUE(obj.get() != NULL)) { - GetBucketListMessage &ref = static_cast<GetBucketListMessage&>(*obj); - EXPECT_EQUAL(string("foo"), ref.getLoadType().getName()); - EXPECT_EQUAL(document::BucketId(16, 123), ref.getBucketId()); - EXPECT_EQUAL("beartato", ref.getBucketSpace()); - } - } - return true; -}
\ No newline at end of file diff --git a/documentapi/src/tests/messages/messages60test.h b/documentapi/src/tests/messages/messages60test.h deleted file mode 100644 index 597eace067b..00000000000 --- a/documentapi/src/tests/messages/messages60test.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "messages52test.h" - -class Messages60Test : public Messages52Test { -protected: - // TODO finalize version - const vespalib::Version getVersion() const override { return vespalib::Version(6, 999); } -public: - Messages60Test(); - bool testCreateVisitorMessage(); - bool testStatBucketMessage(); - bool testGetBucketListMessage(); -}; diff --git a/documentapi/src/vespa/documentapi/messagebus/CMakeLists.txt b/documentapi/src/vespa/documentapi/messagebus/CMakeLists.txt index 1df761b8af5..8de99ad78db 100644 --- a/documentapi/src/vespa/documentapi/messagebus/CMakeLists.txt +++ b/documentapi/src/vespa/documentapi/messagebus/CMakeLists.txt @@ -8,7 +8,6 @@ vespa_add_library(documentapi_documentapimessagebus OBJECT routablefactories50.cpp routablefactories51.cpp routablefactories52.cpp - routablefactories60.cpp routablerepository.cpp routingpolicyfactories.cpp routingpolicyrepository.cpp diff --git a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.cpp b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.cpp index dd2e73c9d9b..a1837b6bcd0 100644 --- a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.cpp @@ -3,7 +3,6 @@ #include "routablefactories50.h" #include "routablefactories51.h" #include "routablefactories52.h" -#include "routablefactories60.h" #include "routingpolicyfactories.h" #include "routablerepository.h" #include "routingpolicyrepository.h" @@ -50,12 +49,10 @@ DocumentProtocol::DocumentProtocol(const LoadTypeSet& loadTypes, vespalib::VersionSpecification version50(5, 0); vespalib::VersionSpecification version51(5, 1); vespalib::VersionSpecification version52(5, 115); - vespalib::VersionSpecification version6(6, 999); // TODO finalize version - std::vector<vespalib::VersionSpecification> from50 = { version50, version51, version52, version6 }; - std::vector<vespalib::VersionSpecification> from51 = { version51, version52, version6 }; - std::vector<vespalib::VersionSpecification> from52 = { version52, version6 }; - std::vector<vespalib::VersionSpecification> from6 = { version6 }; + std::vector<vespalib::VersionSpecification> from50 = { version50, version51, version52 }; + std::vector<vespalib::VersionSpecification> from51 = { version51, version52 }; + std::vector<vespalib::VersionSpecification> from52 = { version52 }; // Add 5.0 serialization putRoutableFactory(MESSAGE_BATCHDOCUMENTUPDATE, IRoutableFactory::SP(new RoutableFactories50::BatchDocumentUpdateMessageFactory(*_repo)), from50); @@ -68,6 +65,7 @@ DocumentProtocol::DocumentProtocol(const LoadTypeSet& loadTypes, putRoutableFactory(MESSAGE_GETBUCKETSTATE, IRoutableFactory::SP(new RoutableFactories50::GetBucketStateMessageFactory()), from50); putRoutableFactory(MESSAGE_GETDOCUMENT, IRoutableFactory::SP(new RoutableFactories50::GetDocumentMessageFactory()), from50); putRoutableFactory(MESSAGE_MAPVISITOR, IRoutableFactory::SP(new RoutableFactories50::MapVisitorMessageFactory(*_repo)), from50); + putRoutableFactory(MESSAGE_MULTIOPERATION, IRoutableFactory::SP(new RoutableFactories50::MultiOperationMessageFactory(_repo)), from50); putRoutableFactory(MESSAGE_PUTDOCUMENT, IRoutableFactory::SP(new RoutableFactories50::PutDocumentMessageFactory(*_repo)), from50); putRoutableFactory(MESSAGE_QUERYRESULT, IRoutableFactory::SP(new RoutableFactories50::QueryResultMessageFactory()), from50); putRoutableFactory(MESSAGE_REMOVEDOCUMENT, IRoutableFactory::SP(new RoutableFactories50::RemoveDocumentMessageFactory()), from50); @@ -86,6 +84,7 @@ DocumentProtocol::DocumentProtocol(const LoadTypeSet& loadTypes, putRoutableFactory(REPLY_GETBUCKETSTATE, IRoutableFactory::SP(new RoutableFactories50::GetBucketStateReplyFactory()), from50); putRoutableFactory(REPLY_GETDOCUMENT, IRoutableFactory::SP(new RoutableFactories50::GetDocumentReplyFactory(*_repo)), from50); putRoutableFactory(REPLY_MAPVISITOR, IRoutableFactory::SP(new RoutableFactories50::MapVisitorReplyFactory()), from50); + putRoutableFactory(REPLY_MULTIOPERATION, IRoutableFactory::SP(new RoutableFactories50::MultiOperationReplyFactory()), from50); putRoutableFactory(REPLY_PUTDOCUMENT, IRoutableFactory::SP(new RoutableFactories50::PutDocumentReplyFactory()), from50); putRoutableFactory(REPLY_QUERYRESULT, IRoutableFactory::SP(new RoutableFactories50::QueryResultReplyFactory()), from50); putRoutableFactory(REPLY_REMOVEDOCUMENT, IRoutableFactory::SP(new RoutableFactories50::RemoveDocumentReplyFactory()), from50); @@ -105,14 +104,9 @@ DocumentProtocol::DocumentProtocol(const LoadTypeSet& loadTypes, putRoutableFactory(MESSAGE_PUTDOCUMENT, IRoutableFactory::SP(new RoutableFactories52::PutDocumentMessageFactory(*_repo)), from52); putRoutableFactory(MESSAGE_UPDATEDOCUMENT, IRoutableFactory::SP(new RoutableFactories52::UpdateDocumentMessageFactory(*_repo)), from52); putRoutableFactory(MESSAGE_REMOVEDOCUMENT, IRoutableFactory::SP(new RoutableFactories52::RemoveDocumentMessageFactory()), from52); - - // Add 6.x serialization (TODO finalize version) - putRoutableFactory(MESSAGE_CREATEVISITOR, IRoutableFactory::SP(new RoutableFactories60::CreateVisitorMessageFactory(*_repo)), from6); - putRoutableFactory(MESSAGE_STATBUCKET, IRoutableFactory::SP(new RoutableFactories60::StatBucketMessageFactory()), from6); - putRoutableFactory(MESSAGE_GETBUCKETLIST, IRoutableFactory::SP(new RoutableFactories60::GetBucketListMessageFactory()), from6); } -DocumentProtocol::~DocumentProtocol() = default; +DocumentProtocol::~DocumentProtocol() { } mbus::IRoutingPolicy::UP DocumentProtocol::createPolicy(const mbus::string &name, const mbus::string ¶m) const diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp index 418d152d6bc..62747309c13 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp @@ -9,7 +9,7 @@ namespace documentapi { GetBucketListMessage::GetBucketListMessage(const document::BucketId &bucketId) : DocumentMessage(), _bucketId(bucketId), - _bucketSpace("default") // TODO repo + _bucketSpace() { } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp index 8c968ce46e6..213cc7d9932 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp @@ -9,14 +9,14 @@ StatBucketMessage::StatBucketMessage() : DocumentMessage(), _bucketId(document::BucketId()), _documentSelection(), - _bucketSpace("default") // TODO repo + _bucketSpace() {} StatBucketMessage::StatBucketMessage(document::BucketId bucketId, const string& documentSelection) : DocumentMessage(), _bucketId(bucketId), _documentSelection(documentSelection), - _bucketSpace("default") // TODO repo + _bucketSpace() {} StatBucketMessage::~StatBucketMessage() { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp index 44ec234b75e..c870775fae7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp @@ -11,7 +11,7 @@ CreateVisitorMessage::CreateVisitorMessage() : _instanceId(), _controlDestination(), _dataDestination(), - _bucketSpace("default"), // TODO repo + _bucketSpace(), _docSelection(), _maxPendingReplyCount(8), _buckets(), @@ -35,7 +35,7 @@ CreateVisitorMessage::CreateVisitorMessage(const string& libraryName, _instanceId(instanceId), _controlDestination(controlDestination), _dataDestination(dataDestination), - _bucketSpace("default"), // TODO repo + _bucketSpace(), _docSelection(), _maxPendingReplyCount(8), _buckets(), diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp index 2530e9a5770..4a022d8cabd 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp @@ -404,24 +404,11 @@ RoutableFactories50::EmptyBucketsReplyFactory::doEncode(const DocumentReply &obj return true; } -bool RoutableFactories50::GetBucketListMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - (void) buf; - return (bucketSpace == "default"); // TODO used fixed repo here -} - -string RoutableFactories50::GetBucketListMessageFactory::decodeBucketSpace(document::ByteBuffer&) const { - return "default"; // TODO fixed bucket repo -} - DocumentMessage::UP RoutableFactories50::GetBucketListMessageFactory::doDecode(document::ByteBuffer &buf) const { document::BucketId bucketId(decodeLong(buf)); - auto msg = std::make_unique<GetBucketListMessage>(bucketId); - msg->setBucketSpace(decodeBucketSpace(buf)); - return msg; + return std::make_unique<GetBucketListMessage>(bucketId); } bool @@ -429,7 +416,7 @@ RoutableFactories50::GetBucketListMessageFactory::doEncode(const DocumentMessage { const GetBucketListMessage &msg = static_cast<const GetBucketListMessage&>(obj); buf.putLong(msg.getBucketId().getRawId()); - return encodeBucketSpace(msg.getBucketSpace(), buf); + return true; } DocumentReply::UP @@ -842,17 +829,6 @@ RoutableFactories50::QueryResultReplyFactory::doEncode(const DocumentReply &obj, return true; } -bool RoutableFactories50::StatBucketMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - (void) buf; - return (bucketSpace == "default"); // TODO used fixed repo here -} - -string RoutableFactories50::StatBucketMessageFactory::decodeBucketSpace(document::ByteBuffer&) const { - return "default"; // TODO fixed bucket repo -} - DocumentMessage::UP RoutableFactories50::StatBucketMessageFactory::doDecode(document::ByteBuffer &buf) const { @@ -861,7 +837,6 @@ RoutableFactories50::StatBucketMessageFactory::doDecode(document::ByteBuffer &bu msg.setBucketId(document::BucketId(decodeLong(buf))); msg.setDocumentSelection(decodeString(buf)); - msg.setBucketSpace(decodeBucketSpace(buf)); return ret; } @@ -873,7 +848,8 @@ RoutableFactories50::StatBucketMessageFactory::doEncode(const DocumentMessage &o buf.putLong(msg.getBucketId().getRawId()); buf.putString(msg.getDocumentSelection()); - return encodeBucketSpace(msg.getBucketSpace(), buf); + + return true; } DocumentReply::UP diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h index 4ca069f3f9a..102b7f16c43 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h @@ -234,8 +234,6 @@ public: bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class GetBucketListMessageFactory : public DocumentMessageFactory { - virtual bool encodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf) const; - virtual string decodeBucketSpace(document::ByteBuffer&) const; protected: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; @@ -348,8 +346,6 @@ public: bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class StatBucketMessageFactory : public DocumentMessageFactory { - virtual bool encodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf) const; - virtual string decodeBucketSpace(document::ByteBuffer&) const; protected: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp index 15d485e6181..2eb539c7d3d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.cpp @@ -86,7 +86,6 @@ RoutableFactories51::CreateVisitorMessageFactory::doDecode(document::ByteBuffer msg.setVisitorDispatcherVersion(50); msg.setVisitorOrdering((document::OrderingSpecification::Order)decodeInt(buf)); msg.setMaxBucketsPerVisitor(decodeInt(buf)); - msg.setBucketSpace(decodeBucketSpace(buf)); return ret; } @@ -125,18 +124,8 @@ RoutableFactories51::CreateVisitorMessageFactory::doEncode(const DocumentMessage buf.putInt(msg.getVisitorOrdering()); buf.putInt(msg.getMaxBucketsPerVisitor()); - return encodeBucketSpace(msg.getBucketSpace(), buf); -} -bool RoutableFactories51::CreateVisitorMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - (void) buf; - return (bucketSpace == "default"); // TODO used fixed repo here -} - -string RoutableFactories51::CreateVisitorMessageFactory::decodeBucketSpace(document::ByteBuffer&) const { - return "default"; // TODO fixed bucket repo + return true; } DocumentMessage::UP diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h index fc20324b418..06efc3df6bd 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h @@ -130,9 +130,6 @@ public: protected: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; - - virtual bool encodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf) const; - virtual string decodeBucketSpace(document::ByteBuffer&) const; public: CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories60.cpp b/documentapi/src/vespa/documentapi/messagebus/routablefactories60.cpp deleted file mode 100644 index 5823cc6720e..00000000000 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories60.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "routablefactories60.h" - -namespace documentapi { - -// TODO dedupe - -bool RoutableFactories60::CreateVisitorMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - doEncodeBucketSpace(bucketSpace, buf); - return true; -} - -string RoutableFactories60::CreateVisitorMessageFactory::decodeBucketSpace(document::ByteBuffer& buf) const { - return doDecodeBucketSpace(buf); -} - -bool RoutableFactories60::StatBucketMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - doEncodeBucketSpace(bucketSpace, buf); - return true; -} - -string RoutableFactories60::StatBucketMessageFactory::decodeBucketSpace(document::ByteBuffer& buf) const { - return doDecodeBucketSpace(buf); -} - -bool RoutableFactories60::GetBucketListMessageFactory::encodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) const { - doEncodeBucketSpace(bucketSpace, buf); - return true; -} - -string RoutableFactories60::GetBucketListMessageFactory::decodeBucketSpace(document::ByteBuffer& buf) const { - return doDecodeBucketSpace(buf); -} - -void RoutableFactories60::doEncodeBucketSpace( - vespalib::stringref bucketSpace, - vespalib::GrowableByteBuffer& buf) { - buf.putString(bucketSpace); -} -string RoutableFactories60::doDecodeBucketSpace(document::ByteBuffer& buf) { - return decodeString(buf); -} - -}
\ No newline at end of file diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories60.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories60.h deleted file mode 100644 index 26a8f0cb6d5..00000000000 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories60.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "routablefactories52.h" - -namespace documentapi { -/** - * This class encapsulates all the {@link RoutableFactory} classes needed to implement factories for the document - * routable. When adding new factories to this class, please KEEP THE THEM ORDERED alphabetically like they are now. - */ -class RoutableFactories60 : public RoutableFactories52 { -public: - RoutableFactories60() = delete; - - // TODO dedupe bucket space codec code - - class CreateVisitorMessageFactory : public RoutableFactories52::CreateVisitorMessageFactory { - bool encodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf) const override; - string decodeBucketSpace(document::ByteBuffer&) const override; - public: - CreateVisitorMessageFactory(const document::DocumentTypeRepo& r) - : RoutableFactories52::CreateVisitorMessageFactory(r) {} - }; - - class StatBucketMessageFactory : public RoutableFactories50::StatBucketMessageFactory { - bool encodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf) const override; - string decodeBucketSpace(document::ByteBuffer&) const override; - public: - StatBucketMessageFactory() = default; - }; - - class GetBucketListMessageFactory : public RoutableFactories50::GetBucketListMessageFactory { - bool encodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf) const override; - string decodeBucketSpace(document::ByteBuffer&) const override; - public: - GetBucketListMessageFactory() = default; - }; - - static void doEncodeBucketSpace(vespalib::stringref bucketSpace, vespalib::GrowableByteBuffer& buf); - static string doDecodeBucketSpace(document::ByteBuffer&); -}; - -}
\ No newline at end of file diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-BatchDocumentUpdateMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-BatchDocumentUpdateMessage.dat Binary files differdeleted file mode 100644 index 95e663088c3..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-BatchDocumentUpdateMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-BatchDocumentUpdateReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-BatchDocumentUpdateReply.dat Binary files differdeleted file mode 100644 index 216db17f80e..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-BatchDocumentUpdateReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-CreateVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-CreateVisitorMessage.dat Binary files differdeleted file mode 100644 index b249c8030e4..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-CreateVisitorMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-CreateVisitorReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-CreateVisitorReply.dat Binary files differdeleted file mode 100644 index e13917227d1..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-CreateVisitorReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-DestroyVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-DestroyVisitorMessage.dat Binary files differdeleted file mode 100644 index f39b31217e6..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-DestroyVisitorMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-DestroyVisitorReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-DestroyVisitorReply.dat Binary files differdeleted file mode 100644 index 1468f027b15..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-DestroyVisitorReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentIgnoredReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentIgnoredReply.dat Binary files differdeleted file mode 100644 index 15a7afe2a59..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentIgnoredReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentListMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentListMessage.dat Binary files differdeleted file mode 100644 index 2d8d12d2704..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentListMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentListReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentListReply.dat Binary files differdeleted file mode 100644 index c8a1cd888f0..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentListReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentSummaryReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentSummaryReply.dat Binary files differdeleted file mode 100644 index 16b1e4bc4ef..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-DocumentSummaryReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-EmptyBucketsMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-EmptyBucketsMessage.dat Binary files differdeleted file mode 100644 index b9df278fd7a..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-EmptyBucketsMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-EmptyBucketsReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-EmptyBucketsReply.dat Binary files differdeleted file mode 100644 index 05510dd8c1e..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-EmptyBucketsReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketListMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketListMessage.dat Binary files differdeleted file mode 100644 index c42c61460ac..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketListMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketListReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketListReply.dat Binary files differdeleted file mode 100644 index 830994ed785..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketListReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketStateMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketStateMessage.dat Binary files differdeleted file mode 100644 index aa2d206ca3a..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketStateMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketStateReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketStateReply.dat Binary files differdeleted file mode 100644 index 0f91e3759f8..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-GetBucketStateReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-GetDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-GetDocumentMessage.dat Binary files differdeleted file mode 100644 index 3df64ed657f..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-GetDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-GetDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-GetDocumentReply.dat Binary files differdeleted file mode 100644 index c1ad7920a2e..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-GetDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-MapVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-MapVisitorMessage.dat Binary files differdeleted file mode 100644 index 1a8a837ea16..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-MapVisitorMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-MapVisitorReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-MapVisitorReply.dat Binary files differdeleted file mode 100644 index 541cd718a66..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-MapVisitorReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-PutDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-PutDocumentMessage.dat Binary files differdeleted file mode 100644 index 13c25f0b729..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-PutDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-PutDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-PutDocumentReply.dat Binary files differdeleted file mode 100644 index 480544045bb..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-PutDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-QueryResultReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-QueryResultReply.dat Binary files differdeleted file mode 100644 index 003f35d63a7..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-QueryResultReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveDocumentMessage.dat Binary files differdeleted file mode 100644 index 21f2c9b81c4..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveDocumentReply.dat Binary files differdeleted file mode 100644 index bf5db8761e2..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveLocationMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveLocationMessage.dat Binary files differdeleted file mode 100644 index 16850a6aff3..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveLocationMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveLocationReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveLocationReply.dat Binary files differdeleted file mode 100644 index 752c4dba399..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-RemoveLocationReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-SearchResultReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-SearchResultReply.dat Binary files differdeleted file mode 100644 index cce9c6f8d14..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-SearchResultReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-StatBucketMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-StatBucketMessage.dat Binary files differdeleted file mode 100644 index 5b0b697e562..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-StatBucketMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-StatBucketReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-StatBucketReply.dat Binary files differdeleted file mode 100644 index 0b98e240018..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-StatBucketReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-UpdateDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-UpdateDocumentMessage.dat Binary files differdeleted file mode 100644 index 93274279f0d..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-UpdateDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-UpdateDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-UpdateDocumentReply.dat Binary files differdeleted file mode 100644 index c7151299366..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-UpdateDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-VisitorInfoMessage.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-VisitorInfoMessage.dat Binary files differdeleted file mode 100644 index 80b44e0c6fd..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-VisitorInfoMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-VisitorInfoReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-VisitorInfoReply.dat Binary files differdeleted file mode 100644 index 57a656c9b2d..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-VisitorInfoReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-cpp-WrongDistributionReply.dat b/documentapi/test/crosslanguagefiles/6.999-cpp-WrongDistributionReply.dat Binary files differdeleted file mode 100644 index 0dbe13225ae..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-cpp-WrongDistributionReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-BatchDocumentUpdateMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-BatchDocumentUpdateMessage.dat Binary files differdeleted file mode 100644 index 95e663088c3..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-BatchDocumentUpdateMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-BatchDocumentUpdateReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-BatchDocumentUpdateReply.dat Binary files differdeleted file mode 100644 index 216db17f80e..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-BatchDocumentUpdateReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-CreateVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-CreateVisitorMessage.dat Binary files differdeleted file mode 100644 index b249c8030e4..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-CreateVisitorMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-CreateVisitorReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-CreateVisitorReply.dat Binary files differdeleted file mode 100644 index e13917227d1..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-CreateVisitorReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-DestroyVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-DestroyVisitorMessage.dat Binary files differdeleted file mode 100644 index f39b31217e6..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-DestroyVisitorMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-DestroyVisitorReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-DestroyVisitorReply.dat Binary files differdeleted file mode 100644 index 1468f027b15..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-DestroyVisitorReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-DocumentIgnoredReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-DocumentIgnoredReply.dat Binary files differdeleted file mode 100644 index 15a7afe2a59..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-DocumentIgnoredReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-DocumentListMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-DocumentListMessage.dat Binary files differdeleted file mode 100644 index 2d8d12d2704..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-DocumentListMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-DocumentListReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-DocumentListReply.dat Binary files differdeleted file mode 100644 index c8a1cd888f0..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-DocumentListReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-DocumentSummaryReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-DocumentSummaryReply.dat Binary files differdeleted file mode 100644 index 16b1e4bc4ef..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-DocumentSummaryReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-EmptyBucketsMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-EmptyBucketsMessage.dat Binary files differdeleted file mode 100644 index b9df278fd7a..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-EmptyBucketsMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-EmptyBucketsReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-EmptyBucketsReply.dat Binary files differdeleted file mode 100644 index 05510dd8c1e..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-EmptyBucketsReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketListMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-GetBucketListMessage.dat Binary files differdeleted file mode 100644 index c42c61460ac..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketListMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketListReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-GetBucketListReply.dat Binary files differdeleted file mode 100644 index 830994ed785..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketListReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketStateMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-GetBucketStateMessage.dat Binary files differdeleted file mode 100644 index aa2d206ca3a..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketStateMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketStateReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-GetBucketStateReply.dat Binary files differdeleted file mode 100644 index 0f91e3759f8..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-GetBucketStateReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-GetDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-GetDocumentMessage.dat Binary files differdeleted file mode 100644 index 3df64ed657f..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-GetDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-GetDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-GetDocumentReply.dat Binary files differdeleted file mode 100644 index c1ad7920a2e..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-GetDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-MapVisitorMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-MapVisitorMessage.dat Binary files differdeleted file mode 100644 index 1a8a837ea16..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-MapVisitorMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-MapVisitorReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-MapVisitorReply.dat Binary files differdeleted file mode 100644 index 541cd718a66..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-MapVisitorReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-PutDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-PutDocumentMessage.dat Binary files differdeleted file mode 100644 index 13c25f0b729..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-PutDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-PutDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-PutDocumentReply.dat Binary files differdeleted file mode 100644 index 480544045bb..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-PutDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-QueryResultReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-QueryResultReply.dat Binary files differdeleted file mode 100644 index 003f35d63a7..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-QueryResultReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-RemoveDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-RemoveDocumentMessage.dat Binary files differdeleted file mode 100644 index 21f2c9b81c4..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-RemoveDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-RemoveDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-RemoveDocumentReply.dat Binary files differdeleted file mode 100644 index bf5db8761e2..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-RemoveDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-RemoveLocationMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-RemoveLocationMessage.dat Binary files differdeleted file mode 100644 index 16850a6aff3..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-RemoveLocationMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-RemoveLocationReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-RemoveLocationReply.dat Binary files differdeleted file mode 100644 index 752c4dba399..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-RemoveLocationReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-SearchResultReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-SearchResultReply.dat Binary files differdeleted file mode 100644 index cce9c6f8d14..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-SearchResultReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-StatBucketMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-StatBucketMessage.dat Binary files differdeleted file mode 100644 index 5b0b697e562..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-StatBucketMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-StatBucketReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-StatBucketReply.dat Binary files differdeleted file mode 100644 index 0b98e240018..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-StatBucketReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-UpdateDocumentMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-UpdateDocumentMessage.dat Binary files differdeleted file mode 100644 index 93274279f0d..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-UpdateDocumentMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-UpdateDocumentReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-UpdateDocumentReply.dat Binary files differdeleted file mode 100644 index c7151299366..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-UpdateDocumentReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-VisitorInfoMessage.dat b/documentapi/test/crosslanguagefiles/6.999-java-VisitorInfoMessage.dat Binary files differdeleted file mode 100644 index 80b44e0c6fd..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-VisitorInfoMessage.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-VisitorInfoReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-VisitorInfoReply.dat Binary files differdeleted file mode 100644 index 57a656c9b2d..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-VisitorInfoReply.dat +++ /dev/null diff --git a/documentapi/test/crosslanguagefiles/6.999-java-WrongDistributionReply.dat b/documentapi/test/crosslanguagefiles/6.999-java-WrongDistributionReply.dat Binary files differdeleted file mode 100644 index 0dbe13225ae..00000000000 --- a/documentapi/test/crosslanguagefiles/6.999-java-WrongDistributionReply.dat +++ /dev/null diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index 190c04cf36a..b61717e5b67 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -425,8 +425,7 @@ void CommunicationManager::configure(std::unique_ptr<CommunicationManagerConfig> _mbus = std::make_unique<mbus::RPCMessageBus>( mbus::ProtocolSet() .add(std::make_shared<documentapi::DocumentProtocol>(*_component.getLoadTypes(), _component.getTypeRepo())) - .add(std::make_shared<mbusprot::StorageProtocol>(_component.getTypeRepo(), *_component.getLoadTypes(), - _component.enableMultipleBucketSpaces())), + .add(std::make_shared<mbusprot::StorageProtocol>(_component.getTypeRepo(), *_component.getLoadTypes(), _component.enableMultipleBucketSpaces())), params, _configUri); @@ -767,7 +766,7 @@ void CommunicationManager::updateMessagebusProtocol( const document::DocumentTypeRepo::SP &repo) { if (_mbus.get()) { framework::SecondTime now(_component.getClock().getTimeInSeconds()); - auto newDocumentProtocol = std::make_shared<documentapi::DocumentProtocol>(*_component.getLoadTypes(), repo); + mbus::IProtocol::SP newDocumentProtocol(new documentapi::DocumentProtocol( *_component.getLoadTypes(), repo)); std::lock_guard<std::mutex> guard(_earlierGenerationsLock); _earlierGenerations.push_back(std::make_pair(now, _mbus->getMessageBus().putProtocol(newDocumentProtocol))); mbus::IProtocol::SP newStorageProtocol(new mbusprot::StorageProtocol(repo, *_component.getLoadTypes(), _component.enableMultipleBucketSpaces())); diff --git a/vespaclient-container-plugin/pom.xml b/vespaclient-container-plugin/pom.xml index 150a3241153..3472f3fcdc5 100644 --- a/vespaclient-container-plugin/pom.xml +++ b/vespaclient-container-plugin/pom.xml @@ -37,6 +37,7 @@ <version>${project.version}</version> <scope>provided</scope> </dependency> + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/BucketSpaceEnumerator.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/BucketSpaceEnumerator.java deleted file mode 100644 index 24692859266..00000000000 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/BucketSpaceEnumerator.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.document.restapi; - -import com.yahoo.config.subscription.ConfigGetter; -import com.yahoo.vespa.config.content.core.BucketspacesConfig; - -import java.util.Collections; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * TODO description - */ -class BucketSpaceEnumerator { - - private final Map<String, String> doctypeToSpace; - - private BucketSpaceEnumerator(String configId) { - doctypeToSpace = Collections.unmodifiableMap(buildMappingFromConfig(configId)); - } - - public static BucketSpaceEnumerator fromConfig(String configId) { - return new BucketSpaceEnumerator(configId); - } - - public Map<String, String> getDoctypeToSpaceMapping() { - return doctypeToSpace; - } - - private static Map<String, String> buildMappingFromConfig(String configId) { - BucketspacesConfig config = new ConfigGetter<>(BucketspacesConfig.class).getConfig(configId); - return config.documenttype().stream().collect(Collectors.toMap(dt -> dt.name(), dt -> dt.bucketspace())); - } - -} diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java index 8fe2007e88a..46678ea67e3 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java @@ -7,7 +7,6 @@ import com.yahoo.document.DocumentRemove; import com.yahoo.document.TestAndSetCondition; import com.yahoo.document.json.JsonWriter; import com.yahoo.document.DocumentPut; -import com.yahoo.document.restapi.resource.RestApi; import com.yahoo.documentapi.DocumentAccess; import com.yahoo.documentapi.DocumentAccessException; import com.yahoo.documentapi.SyncParameters; @@ -49,34 +48,11 @@ public class OperationHandlerImpl implements OperationHandler { List<ClusterDef> enumerateClusters(); } - public interface BucketSpaceResolver { - Optional<String> clusterBucketSpaceFromDocumentType(String clusterConfigId, String docType); - } - - public static class BucketSpaceRoute { - private final String clusterRoute; - private final String bucketSpace; - - public BucketSpaceRoute(String clusterRoute, String bucketSpace) { - this.clusterRoute = clusterRoute; - this.bucketSpace = bucketSpace; - } - - public String getClusterRoute() { - return clusterRoute; - } - - public String getBucketSpace() { - return bucketSpace; - } - } - public static final int VISIT_TIMEOUT_MS = 120000; public static final int WANTED_DOCUMENT_COUNT_UPPER_BOUND = 1000; // Approximates the max default size of a bucket private final DocumentAccess documentAccess; private final DocumentApiMetrics metricsHelper; private final ClusterEnumerator clusterEnumerator; - private final BucketSpaceResolver bucketSpaceResolver; private static final class SyncSessionFactory extends ResourceFactory<SyncSession> { private final DocumentAccess documentAccess; @@ -91,25 +67,13 @@ public class OperationHandlerImpl implements OperationHandler { private final ConcurrentResourcePool<SyncSession> syncSessions; - private static ClusterEnumerator defaultClusterEnumerator() { - return () -> new ClusterList("client").getStorageClusters(); - } - - private static BucketSpaceResolver defaultBucketResolver() { - return (clusterConfigId, docType) -> Optional.ofNullable(BucketSpaceEnumerator - .fromConfig(clusterConfigId).getDoctypeToSpaceMapping() - .get(docType)); - } - public OperationHandlerImpl(DocumentAccess documentAccess, MetricReceiver metricReceiver) { - this(documentAccess, defaultClusterEnumerator(), defaultBucketResolver(), metricReceiver); + this(documentAccess, () -> new ClusterList("client").getStorageClusters(), metricReceiver); } - public OperationHandlerImpl(DocumentAccess documentAccess, ClusterEnumerator clusterEnumerator, - BucketSpaceResolver bucketSpaceResolver, MetricReceiver metricReceiver) { + public OperationHandlerImpl(DocumentAccess documentAccess, ClusterEnumerator clusterEnumerator, MetricReceiver metricReceiver) { this.documentAccess = documentAccess; this.clusterEnumerator = clusterEnumerator; - this.bucketSpaceResolver = bucketSpaceResolver; syncSessions = new ConcurrentResourcePool<>(new SyncSessionFactory(documentAccess)); metricsHelper = new DocumentApiMetrics(metricReceiver, "documentV1"); } @@ -316,19 +280,13 @@ public class OperationHandlerImpl implements OperationHandler { } } - protected BucketSpaceRoute resolveBucketSpaceRoute(Optional<String> wantedCluster, String docType) throws RestApiException { + private String resolveClusterRoute(Optional<String> wantedCluster) throws RestApiException { final List<ClusterDef> clusters = clusterEnumerator.enumerateClusters(); - ClusterDef clusterDef = resolveClusterDef(wantedCluster, clusters); - Optional<String> targetBucketSpace = bucketSpaceResolver.clusterBucketSpaceFromDocumentType(clusterDef.getConfigId(), docType); - if (!targetBucketSpace.isPresent()) { - throw new RestApiException(Response.createErrorResponse(400, String.format( - "Document type '%s' in cluster '%s' is not mapped to a known bucket space", docType, clusterDef.getName()), - RestUri.apiErrorCodes.UNKNOWN_BUCKET_SPACE)); // TODO own code - } - return new BucketSpaceRoute(clusterDefToRoute(clusterDef), targetBucketSpace.get()); + return resolveClusterRoute(wantedCluster, clusters); } - protected static ClusterDef resolveClusterDef(Optional<String> wantedCluster, List<ClusterDef> clusters) throws RestApiException { + // Based on resolveClusterRoute in VdsVisit, protected for testability + protected static String resolveClusterRoute(Optional<String> wantedCluster, List<ClusterDef> clusters) throws RestApiException { if (clusters.size() == 0) { throw new IllegalArgumentException("Your Vespa cluster does not have any content clusters " + "declared. Visiting feature is not available."); @@ -338,25 +296,20 @@ public class OperationHandlerImpl implements OperationHandler { throw new RestApiException(Response.createErrorResponse(400, "Several clusters exist: " + clusterListToString(clusters) + " you must specify one. ", RestUri.apiErrorCodes.SEVERAL_CLUSTERS)); } - return clusters.get(0); + return clusterDefToRoute(clusters.get(0)); } for (ClusterDef clusterDef : clusters) { if (clusterDef.getName().equals(wantedCluster.get())) { - return clusterDef; + return clusterDefToRoute(clusterDef); } } throw new RestApiException(Response.createErrorResponse(400, "Your vespa cluster contains the content clusters " + clusterListToString(clusters) + " not " + wantedCluster.get() + ". Please select a valid vespa cluster.", RestUri.apiErrorCodes.MISSING_CLUSTER)); - } - // Based on resolveClusterRoute in VdsVisit, protected for testability - // TODO remove in favor of resolveClusterDef - protected static String resolveClusterRoute(Optional<String> wantedCluster, List<ClusterDef> clusters) throws RestApiException { - return clusterDefToRoute(resolveClusterDef(wantedCluster, clusters)); } - protected static String clusterDefToRoute(ClusterDef clusterDef) { + private static String clusterDefToRoute(ClusterDef clusterDef) { return "[Storage:cluster=" + clusterDef.getName() + ";clusterconfigid=" + clusterDef.getConfigId() + "]"; } @@ -400,9 +353,7 @@ public class OperationHandlerImpl implements OperationHandler { params.visitInconsistentBuckets(true); // TODO document this as part of consistency doc params.setVisitorOrdering(VisitorOrdering.ASCENDING); - BucketSpaceRoute bucketSpaceRoute = resolveBucketSpaceRoute(options.cluster, restUri.getDocumentType()); - params.setRoute(bucketSpaceRoute.getClusterRoute()); - params.setBucketSpace(bucketSpaceRoute.getBucketSpace()); + params.setRoute(resolveClusterRoute(options.cluster)); params.setTraceLevel(0); params.setPriority(DocumentProtocol.Priority.NORMAL_4); diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java index 15d1b54adbe..4eaac48a511 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java @@ -34,7 +34,7 @@ public class RestUri { URL_PARSING(-6), INVALID_CREATE_VALUE(-7), TOO_MANY_PARALLEL_REQUESTS(-8), - MISSING_CLUSTER(-9), UNKNOWN_BUCKET_SPACE(-9), INTERNAL_EXCEPTION(-9), + MISSING_CLUSTER(-9), INTERNAL_EXCEPTION(-9), DOCUMENT_CONDITION_NOT_MET(-10), DOCUMENT_EXCPETION(-11), PARSER_ERROR(-11), diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java index 61bbe1e7030..5735e84f3fe 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java @@ -14,7 +14,10 @@ import org.junit.Test; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import static org.hamcrest.CoreMatchers.containsString; @@ -30,31 +33,27 @@ public class OperationHandlerImplTest { @Test(expected = IllegalArgumentException.class) public void missingClusterDef() throws RestApiException { List<ClusterDef> clusterDef = new ArrayList<>(); - OperationHandlerImpl.resolveClusterDef(Optional.empty(), clusterDef); + OperationHandlerImpl.resolveClusterRoute(Optional.empty(), clusterDef); } @Test(expected = IllegalArgumentException.class) public void missingClusterDefSpecifiedCluster() throws RestApiException { List<ClusterDef> clusterDef = new ArrayList<>(); - OperationHandlerImpl.resolveClusterDef(Optional.of("cluster"), clusterDef); + OperationHandlerImpl.resolveClusterRoute(Optional.of("cluster"), clusterDef); } @Test(expected = RestApiException.class) public void oneClusterPresentNotMatching() throws RestApiException { List<ClusterDef> clusterDef = new ArrayList<>(); clusterDef.add(new ClusterDef("foo", "configId")); - OperationHandlerImpl.resolveClusterDef(Optional.of("cluster"), clusterDef); - } - - private static String toRoute(ClusterDef clusterDef) { - return OperationHandlerImpl.clusterDefToRoute(clusterDef); + OperationHandlerImpl.resolveClusterRoute(Optional.of("cluster"), clusterDef); } @Test() public void oneClusterMatching() throws RestApiException { List<ClusterDef> clusterDef = new ArrayList<>(); clusterDef.add(new ClusterDef("foo", "configId")); - assertThat(toRoute(OperationHandlerImpl.resolveClusterDef(Optional.of("foo"), clusterDef)), + assertThat(OperationHandlerImpl.resolveClusterRoute(Optional.of("foo"), clusterDef), is("[Storage:cluster=foo;clusterconfigid=configId]")); } @@ -64,18 +63,18 @@ public class OperationHandlerImplTest { clusterDef.add(new ClusterDef("foo2", "configId2")); clusterDef.add(new ClusterDef("foo", "configId")); clusterDef.add(new ClusterDef("foo3", "configId2")); - assertThat(toRoute(OperationHandlerImpl.resolveClusterDef(Optional.of("foo"), clusterDef)), + assertThat(OperationHandlerImpl.resolveClusterRoute(Optional.of("foo"), clusterDef), is("[Storage:cluster=foo;clusterconfigid=configId]")); } @Test() - public void unknown_target_cluster_throws_exception() throws RestApiException, IOException { + public void checkErrorMessage() throws RestApiException, IOException { List<ClusterDef> clusterDef = new ArrayList<>(); clusterDef.add(new ClusterDef("foo2", "configId2")); clusterDef.add(new ClusterDef("foo", "configId")); clusterDef.add(new ClusterDef("foo3", "configId2")); try { - OperationHandlerImpl.resolveClusterDef(Optional.of("wrong"), clusterDef); + OperationHandlerImpl.resolveClusterRoute(Optional.of("wrong"), clusterDef); } catch(RestApiException e) { String errorMsg = renderRestApiExceptionAsString(e); assertThat(errorMsg, is("{\"errors\":[{\"description\":" + @@ -97,12 +96,6 @@ public class OperationHandlerImplTest { AtomicReference<VisitorParameters> assignedParameters = new AtomicReference<>(); VisitorControlHandler.CompletionCode completionCode = VisitorControlHandler.CompletionCode.SUCCESS; int bucketsVisited = 0; - Map<String, String> bucketSpaces = new HashMap<>(); - - OperationHandlerImplFixture() { - bucketSpaces.put("foo", "global"); - bucketSpaces.put("document-type", "default"); - } OperationHandlerImpl createHandler() throws Exception { VisitorSession visitorSession = mock(VisitorSession.class); @@ -122,8 +115,7 @@ public class OperationHandlerImplTest { return visitorSession; }); OperationHandlerImpl.ClusterEnumerator clusterEnumerator = () -> Arrays.asList(new ClusterDef("foo", "configId")); - OperationHandlerImpl.BucketSpaceResolver bucketSpaceResolver = (configId, docType) -> Optional.ofNullable(bucketSpaces.get(docType)); - return new OperationHandlerImpl(documentAccess, clusterEnumerator, bucketSpaceResolver, MetricReceiver.nullImplementation); + return new OperationHandlerImpl(documentAccess, clusterEnumerator, MetricReceiver.nullImplementation); } } @@ -183,33 +175,6 @@ public class OperationHandlerImplTest { } @Test - public void document_type_is_mapped_to_correct_bucket_space() throws Exception { - OperationHandlerImplFixture fixture = new OperationHandlerImplFixture(); - fixture.bucketSpaces.put("document-type", "langbein"); - OperationHandlerImpl handler = fixture.createHandler(); - handler.visit(dummyVisitUri(), "", emptyVisitOptions()); - - VisitorParameters parameters = fixture.assignedParameters.get(); - assertEquals("langbein", parameters.getBucketSpace()); - } - - @Test - public void unknown_bucket_space_mapping_throws_exception() throws Exception { - OperationHandlerImplFixture fixture = new OperationHandlerImplFixture(); - fixture.bucketSpaces.remove("document-type"); - try { - OperationHandlerImpl handler = fixture.createHandler(); - handler.visit(dummyVisitUri(), "", emptyVisitOptions()); - } catch (RestApiException e) { - assertThat(e.getResponse().getStatus(), is(400)); - String errorMsg = renderRestApiExceptionAsString(e); - // FIXME isn't this really more of a case of unknown document type..? - assertThat(errorMsg, is("{\"errors\":[{\"description\":" + - "\"UNKNOWN_BUCKET_SPACE Document type 'document-type' in cluster 'foo' is not mapped to a known bucket space\",\"id\":-9}]}")); - } - } - - @Test public void provided_wanted_document_count_is_propagated_to_visitor_parameters() throws Exception { VisitorParameters params = generatedParametersFromVisitOptions(visitOptionsWithWantedDocumentCount(123)); assertThat(params.getMaxTotalHits(), is((long)123)); diff --git a/vespaclient-java/src/main/java/com/yahoo/vespastat/ClientParameters.java b/vespaclient-java/src/main/java/com/yahoo/vespastat/ClientParameters.java index a05e4ed1e48..47a0418e2d8 100644 --- a/vespaclient-java/src/main/java/com/yahoo/vespastat/ClientParameters.java +++ b/vespaclient-java/src/main/java/com/yahoo/vespastat/ClientParameters.java @@ -17,7 +17,6 @@ public class ClientParameters { public final SelectionType selectionType; // The selection id public final String id; - public final String bucketSpace; public ClientParameters( boolean help, @@ -25,22 +24,11 @@ public class ClientParameters { String route, SelectionType selectionType, String id) { - this(help, dumpData, route, selectionType, id, "default"); - } - - public ClientParameters( - boolean help, - boolean dumpData, - String route, - SelectionType selectionType, - String id, - String bucketSpace) { this.help = help; this.dumpData = dumpData; this.route = route; this.selectionType = selectionType; this.id = id; - this.bucketSpace = bucketSpace; } public enum SelectionType {USER, GROUP, BUCKET, GID, DOCUMENT} @@ -51,7 +39,6 @@ public class ClientParameters { private String route; private SelectionType selectionType; private String id; - private String bucketSpace = "default"; // TODO repo etc etc public Builder setHelp(boolean help) { this.help = help; @@ -78,13 +65,8 @@ public class ClientParameters { return this; } - public Builder setBucketSpace(String bucketSpace) { - this.bucketSpace = bucketSpace; - return this; - } - public ClientParameters build() { - return new ClientParameters(help, dumpData, route, selectionType, id, bucketSpace); + return new ClientParameters(help, dumpData, route, selectionType, id); } } diff --git a/vespaclient-java/src/main/java/com/yahoo/vespastat/CommandLineOptions.java b/vespaclient-java/src/main/java/com/yahoo/vespastat/CommandLineOptions.java index b6783efb25b..59ab17af8d6 100644 --- a/vespaclient-java/src/main/java/com/yahoo/vespastat/CommandLineOptions.java +++ b/vespaclient-java/src/main/java/com/yahoo/vespastat/CommandLineOptions.java @@ -25,7 +25,6 @@ public class CommandLineOptions { private static final String BUCKET_OPTION = "bucket"; private static final String GID_OPTION = "gid"; private static final String DOCUMENT_OPTION = "document"; - private static final String BUCKET_SPACE_OPTION = "bucketspace"; private final Options options = createOptions(); @@ -52,13 +51,6 @@ public class CommandLineOptions { .longOpt(ROUTE_OPTION) .build()); - options.addOption(Option.builder("s") - .hasArg(true) - .desc("Stat buckets within the given bucket space. If not provided, 'default' is used.") - .argName("space") - .longOpt(BUCKET_SPACE_OPTION) - .build()); - // A group of mutually exclusive options for user, group, bucket, gid and document. OptionGroup optionGroup = new OptionGroup(); optionGroup.setRequired(false); @@ -117,7 +109,6 @@ public class CommandLineOptions { builder.setHelp(cl.hasOption(HELP_OPTION)); builder.setDumpData(cl.hasOption(DUMP_OPTION)); builder.setRoute(cl.getOptionValue(ROUTE_OPTION, "default")); - builder.setBucketSpace(cl.getOptionValue(BUCKET_SPACE_OPTION, "default")); if (cl.hasOption(USER_OPTION)) { builder.setSelectionType(ClientParameters.SelectionType.USER); diff --git a/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java b/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java index 4f462bf187e..79b48731cc7 100644 --- a/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java +++ b/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java @@ -336,14 +336,6 @@ public class VdsVisit { .desc("Output documents as JSON") .hasArg(false) .build()); - - options.addOption(Option.builder() - .longOpt("bucketspace") - .hasArg(true) - .argName("space") - .desc("Bucket space to visit ('default' or 'global). If not specified, 'default' is used.") - .build()); - return options; } @@ -450,9 +442,6 @@ public class VdsVisit { if (line.hasOption("s")) { params.setDocumentSelection(line.getOptionValue("s")); } - if (line.hasOption("bucketspace")) { - params.setBucketSpace(line.getOptionValue("bucketspace")); - } if (line.hasOption("f")) { params.setFromTimestamp(((Number) line.getParsedOptionValue("f")).longValue()); } @@ -618,7 +607,6 @@ public class VdsVisit { } else { out.println("Visiting documents matching: " + params.getDocumentSelection()); } - out.println(String.format("Visiting bucket space: %s", params.getBucketSpace())); if (params.getFromTimestamp() != 0 && params.getToTimestamp() != 0) { out.println("Visiting in the inclusive timestamp range " + params.getFromTimestamp() + " - " + params.getToTimestamp() + "."); diff --git a/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java b/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java index a6bd7280c36..31cef2a6a86 100644 --- a/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java +++ b/vespaclient-java/src/test/java/com/yahoo/vespastat/CommandLineOptionsTest.java @@ -70,17 +70,6 @@ public class CommandLineOptionsTest { } } - // TODO fixed bucket space repo - @Test - public void bucket_space_is_default_unless_specified() { - assertEquals("default", getParsedOptions("--user", "id").bucketSpace); - } - - @Test - public void can_specify_explicit_bucket_space() { - assertEquals("global", getParsedOptions("--user", "id", "--bucketspace", "global").bucketSpace); - } - @Test public void testDefaultRoute() { assertEquals("default", getParsedOptions("--user", "dummyuser").route); diff --git a/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java b/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java index 32e29ba51ec..e2d045e1d33 100644 --- a/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java +++ b/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java @@ -130,8 +130,7 @@ public class VdsVisitTestCase { "--ordering", "ascending", "--skipbucketsonfatalerrors", "--abortonclusterdown", - "--visitremoves", - "--bucketspace", "outerspace" + "--visitremoves" }; VdsVisit.ArgumentParser parser = createMockArgumentParser(); VdsVisit.VdsVisitParameters allParams = parser.parse(args); @@ -175,9 +174,8 @@ public class VdsVisitTestCase { printStream.flush(); String nl = System.getProperty("line.separator"); // the joys of running tests on windows assertEquals( - "Time out visitor after 123456789 ms." + nl + + "Time out visitor after 123456789 ms." + nl + "Visiting documents matching: 'id.user=1234'" + nl + - "Visiting bucket space: outerspace" + nl + "Visiting in the inclusive timestamp range 5678 - 9012." + nl + "Visiting field set foodoc.bar,foodoc.baz." + nl + "Visiting inconsistent buckets." + nl + |