diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-06-08 14:29:47 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-06-08 14:29:47 +0200 |
commit | 52547867a875de1435c9142caa5727652f911c4c (patch) | |
tree | f3d3e9e7f1eddcc5bf6b287a249394a8bb9f4381 /documentapi | |
parent | 14ceb2e5596a30d63a0ae3ea6262f2f41bed93e7 (diff) |
Remove on Vespa 8
Diffstat (limited to 'documentapi')
5 files changed, 48 insertions, 166 deletions
diff --git a/documentapi/abi-spec.json b/documentapi/abi-spec.json index 257b5a8d183..f6ed4805e7f 100644 --- a/documentapi/abi-spec.json +++ b/documentapi/abi-spec.json @@ -867,8 +867,6 @@ "public java.lang.String getRemoteDataHandler()", "public com.yahoo.documentapi.VisitorDataHandler getLocalDataHandler()", "public com.yahoo.documentapi.VisitorControlHandler getControlHandler()", - "public boolean getDynamicallyIncreaseMaxBucketsPerVisitor()", - "public float getDynamicMaxBucketsIncreaseFactor()", "public com.yahoo.documentapi.messagebus.protocol.DocumentProtocol$Priority getPriority()", "public void setDocumentSelection(java.lang.String)", "public void setBucketSpace(java.lang.String)", @@ -909,8 +907,6 @@ "public void slice(int, int)", "public int getSlices()", "public int getSliceId()", - "public void setDynamicallyIncreaseMaxBucketsPerVisitor(boolean)", - "public void setDynamicMaxBucketsIncreaseFactor(float)", "public java.lang.String toString()" ], "fields": [] diff --git a/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java b/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java index 651269f8db2..d22d7ecb550 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/VisitorParameters.java @@ -40,8 +40,6 @@ public class VisitorParameters extends Parameters { private final float weight = 1; private long maxTotalHits = -1; private int maxBucketsPerVisitor = 1; - private boolean dynamicallyIncreaseMaxBucketsPerVisitor = false; - private float dynamicMaxBucketsIncreaseFactor = 2; private DocumentProtocol.Priority priority = null; private int traceLevel = 0; private boolean skipBucketsOnFatalErrors = false; @@ -90,10 +88,6 @@ public class VisitorParameters extends Parameters { setMaxTotalHits(params.getMaxTotalHits()); setMaxBucketsPerVisitor(params.getMaxBucketsPerVisitor()); setPriority(params.getPriority()); - setDynamicallyIncreaseMaxBucketsPerVisitor( - params.getDynamicallyIncreaseMaxBucketsPerVisitor()); - setDynamicMaxBucketsIncreaseFactor( - params.getDynamicMaxBucketsIncreaseFactor()); setTraceLevel(params.getTraceLevel()); skipBucketsOnFatalErrors(params.skipBucketsOnFatalErrors()); slice(params.getSlices(), getSliceId()); @@ -101,81 +95,66 @@ public class VisitorParameters extends Parameters { // Get functions - // TODO: s/@return/Returns/ - this javadoc will not contain text in the method overview - - /** @return The selection string used for visiting. */ + /** Returns the selection string used for visiting. */ public String getDocumentSelection() { return documentSelection; } - /** @return The bucket space to visit */ + /** Returns 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. */ + /** Returns 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; } - /** @return The maximum number of messages each storage visitor will have pending before waiting for acks from client. */ + /** Returns the maximum number of messages each storage visitor will have pending before waiting for acks from client. */ public int getMaxPending() { return maxPending; } - /** @return The timeout for each sent visitor operation in milliseconds. */ + /** Returns the timeout for each sent visitor operation in milliseconds. */ public long getTimeoutMs() { return timeoutMs; } /** - * @return Session timeout in milliseconds, or -1 if not timeout has been set. -1 implies - * that session will run to completion without automatically timing out. + * Returns session timeout in milliseconds, or -1 if not timeout has been set. -1 implies + * that session will run to completion without automatically timing out. */ public long getSessionTimeoutMs() { return sessionTimeoutMs; } - /** @return The minimum timestamp (in microsecs) of documents the visitor will visit. */ + /** Returns the minimum timestamp (in microsecs) of documents the visitor will visit. */ public long getFromTimestamp() { return fromTimestamp; } - /** @return The maximum timestamp (in microsecs) of documents the visitor will visit. */ + /** Returns the maximum timestamp (in microsecs) of documents the visitor will visit. */ public long getToTimestamp() { return toTimestamp; } - /** @return If this method returns true, the visitor will visit remove entries as well as documents (you can see what documents have been deleted). */ + /** Returns if this method returns true, the visitor will visit remove entries as well as documents (you can see what documents have been deleted). */ public boolean visitRemoves() { return visitRemoves; } public boolean getVisitRemoves() { return visitRemoves; } - /** @return The field set to use. */ + /** Returns the field set to use. */ public String fieldSet() { return fieldSet; } public String getFieldSet() { return fieldSet; } - /** @return If this method returns true, the visitor will visit inconsistent buckets. */ + /** Returns if this method returns true, the visitor will visit inconsistent buckets. */ public boolean visitInconsistentBuckets() { return visitInconsistentBuckets; } public boolean getVisitInconsistentBuckets() { return visitInconsistentBuckets; } - /** @return Returns a map of string → string of arguments that are passed to the visitor library. */ + /** Returns a map of string → string of arguments that are passed to the visitor library. */ public Map<String, byte []> getLibraryParameters() { return libraryParameters; } - /** @return The progress token, which can be used to resume visitor. */ + /** Returns the progress token, which can be used to resume visitor. */ public ProgressToken getResumeToken() { return resumeToken; } - /** @return The filename for reading/storing progress token. */ + /** Returns the filename for reading/storing progress token. */ public String getResumeFileName() { return resumeFileName; } - /** @return Address to the remote data handler. */ + /** Returns address to the remote data handler. */ public String getRemoteDataHandler() { return remoteDataHandler; } - /** @return The local data handler. */ + /** Returns the local data handler. */ public VisitorDataHandler getLocalDataHandler() { return localDataHandler; } - /** @return The control handler. */ + /** Returns the control handler. */ public VisitorControlHandler getControlHandler() { return controlHandler; } - /** @return Whether or not max buckets per visitor value should be dynamically - * increased when using orderdoc and visitors do not return at least half - * the desired amount of documents - */ - public boolean getDynamicallyIncreaseMaxBucketsPerVisitor() { - return dynamicallyIncreaseMaxBucketsPerVisitor; - } - - /** @return Factor with which max buckets are dynamically increased each time */ - public float getDynamicMaxBucketsIncreaseFactor() { - return dynamicMaxBucketsIncreaseFactor; - } - public DocumentProtocol.Priority getPriority() { if (priority != null) { return priority; @@ -186,23 +165,23 @@ public class VisitorParameters extends Parameters { // Set functions - /** Set the document selection expression */ + /** Sets the document selection expression */ public void setDocumentSelection(String selection) { documentSelection = selection; } - /** Set which (single) bucket space this visiting will be against. */ + /** Sets 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. */ + /** Sets which visitor library is used for visiting in storage. DumpVisitor is most common implementation. */ public void setVisitorLibrary(String library) { visitorLibrary = library; } - /** Set maximum pending messages one storage visitor will have pending to this client before stalling, waiting for acks. */ + /** Sets maximum pending messages one storage visitor will have pending to this client before stalling, waiting for acks. */ public void setMaxPending(int maxPending) { this.maxPending = maxPending; } - /** Set the timeout for each visitor command in milliseconds. */ + /** Sets the timeout for each visitor command in milliseconds. */ public void setTimeoutMs(long timeoutMs) { this.timeoutMs = timeoutMs; } /** - * Sets timeout for the entire visiting session, in milliseconds. -1 implies infinity. + * Setss timeout for the entire visiting session, in milliseconds. -1 implies infinity. * * If the session takes more time than this to complete, it will automatically * be failed with CompletionCode.TIMEOUT. @@ -211,69 +190,69 @@ public class VisitorParameters extends Parameters { */ public void setSessionTimeoutMs(long timeoutMs) { this.sessionTimeoutMs = timeoutMs; } - /** Set from timestamp in microseconds. Documents put/updated before this timestamp will not be visited. */ + /** Sets from timestamp in microseconds. Documents put/updated before this timestamp will not be visited. */ public void setFromTimestamp(long timestamp) { fromTimestamp = timestamp; } - /** Set to timestamp in microseconds. Documents put/updated after this timestamp will not be visited. */ + /** Sets to timestamp in microseconds. Documents put/updated after this timestamp will not be visited. */ public void setToTimestamp(long timestamp) { toTimestamp = timestamp; } - /** Set whether to visit remove entries. That is, entries saying that some document has been removed. */ + /** Sets whether to visit remove entries. That is, entries saying that some document has been removed. */ public void visitRemoves(boolean visitRemoves) { this.visitRemoves = visitRemoves; } public void setVisitRemoves(boolean visitRemoves) { this.visitRemoves = visitRemoves; } - /** Set field set to use. */ + /** Sets field set to use. */ public void fieldSet(String fieldSet) { this.fieldSet = fieldSet; } public void setFieldSet(String fieldSet) { this.fieldSet = fieldSet; } - /** Set whether to visit inconsistent buckets. */ + /** Sets whether to visit inconsistent buckets. */ public void visitInconsistentBuckets(boolean visitInconsistentBuckets) { this.visitInconsistentBuckets = visitInconsistentBuckets; } public void setVisitInconsistentBuckets(boolean visitInconsistentBuckets) { this.visitInconsistentBuckets = visitInconsistentBuckets; } - /** Set a visitor library specific parameter. */ + /** Sets a visitor library specific parameter. */ public void setLibraryParameter(String param, String value) { libraryParameters.put(param, Utf8.toBytes(value)); } - /** Set a visitor library specific parameter. */ + /** Sets a visitor library specific parameter. */ public void setLibraryParameter(String param, byte [] value) { libraryParameters.put(param, value); } - /** Set all visitor library specific parameters. */ + /** Sets all visitor library specific parameters. */ public void setLibraryParameters(Map<String, byte []> params) { libraryParameters = params; } - /** Set progress token, which can be used to resume visitor. */ + /** Sets progress token, which can be used to resume visitor. */ public void setResumeToken(ProgressToken token) { resumeToken = token; } /** - * Set filename for reading/storing progress token. If the file exists and + * Sets filename for reading/storing progress token. If the file exists and * contains progress data, visitor should resume visiting from this point. */ public void setResumeFileName(String fileName) { resumeFileName = fileName; } - /** Set address for the remote data handler. */ + /** Sets address for the remote data handler. */ public void setRemoteDataHandler(String remoteDataHandler) { this.remoteDataHandler = remoteDataHandler; localDataHandler = null; } - /** Set local data handler. */ + /** Sets local data handler. */ public void setLocalDataHandler(VisitorDataHandler localDataHandler) { this.localDataHandler = localDataHandler; remoteDataHandler = null; } - /** Set control handler. */ + /** Sets control handler. */ public void setControlHandler(VisitorControlHandler controlHandler) { this.controlHandler = controlHandler; } - /** Set the name of the storage cluster route to visit. Default is "storage/cluster.storage". */ + /** Sets the name of the storage cluster route to visit. Default is "storage/cluster.storage". */ public void setRoute(String route) { setRoute(Route.parse(route)); } - /** Set the route to visit. */ + /** Sets the route to visit. */ public void setRoute(Route route) { visitRoute = route; } - /** @return Returns the name of the storage cluster to visit. */ + /** Returns the name of the storage cluster to visit. */ // TODO: Document: Where is the default - does this ever return null, or does it return "storage" if input is null? public Route getRoute() { return visitRoute; } - /** Set the maximum number of documents to visit (max documents returned by the visitor) */ + /** Sets the maximum number of documents to visit (max documents returned by the visitor) */ public void setMaxTotalHits(long max) { maxTotalHits = max; } - /** @return Returns the maximum number of documents to visit (max documents returned by the visitor) */ + /** Returns the maximum number of documents to visit (max documents returned by the visitor) */ public long getMaxTotalHits() { return maxTotalHits; } public Set<BucketId> getBucketsToVisit() { return bucketsToVisit; } @@ -305,28 +284,7 @@ public class VisitorParameters extends Parameters { public int getSliceId() { return sliceId; } - /** - * Set whether or not max buckets per visitor value should be dynamically - * increased when using orderdoc and visitors do not return at least half - * the desired amount of documents - * - * @param dynamicallyIncreaseMaxBucketsPerVisitor whether or not to increase - * - * @deprecated deprecated feature, will be removed on Vespa 8 - */ - @Deprecated(since = "7", forRemoval = true) // TODO: Vespa 8: remove - public void setDynamicallyIncreaseMaxBucketsPerVisitor(boolean dynamicallyIncreaseMaxBucketsPerVisitor) { - this.dynamicallyIncreaseMaxBucketsPerVisitor = dynamicallyIncreaseMaxBucketsPerVisitor; - } - - /** - * Set factor with which max buckets are dynamically increased each time - * @param dynamicMaxBucketsIncreaseFactor increase factor (must be 1 or more) - */ - public void setDynamicMaxBucketsIncreaseFactor(float dynamicMaxBucketsIncreaseFactor) { - this.dynamicMaxBucketsIncreaseFactor = dynamicMaxBucketsIncreaseFactor; - } - + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("VisitorParameters(\n") @@ -355,14 +313,9 @@ public class VisitorParameters extends Parameters { sb.append(" Max total hits: ").append(maxTotalHits).append('\n'); sb.append(" Max buckets: ").append(maxBucketsPerVisitor).append('\n'); sb.append(" Priority: ").append(getPriority().toString()).append('\n'); - if (dynamicallyIncreaseMaxBucketsPerVisitor) { - sb.append(" Dynamically increasing max buckets per visitor\n"); - sb.append(" Increase factor: ") - .append(dynamicMaxBucketsIncreaseFactor) - .append('\n'); - } sb.append(')'); return sb.toString(); } + } 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 ccd9c65e77e..3607f652a51 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java @@ -638,7 +638,7 @@ public class MessageBusVisitorSession implements VisitorSession { return sb.toString(); } - @SuppressWarnings("removal") // TODO: Remove on Vespa 8 + @SuppressWarnings("removal") // TODO: Remove on Vespa 9 private CreateVisitorMessage createMessage(VisitorIterator.BucketProgress bucket) { CreateVisitorMessage msg = new CreateVisitorMessage( params.getVisitorLibrary(), @@ -997,15 +997,8 @@ public class MessageBusVisitorSession implements VisitorSession { progress.getIterator().update(bucket, ProgressToken.FINISHED_BUCKET); } - @SuppressWarnings("removal") // TODO: Vespa 8: remove private boolean enoughHitsReceived() { - // TODO: Vespa 8: remove "Nth pass" concept entirely from API and internals - if (params.getMaxTotalHits() != -1 - && (statistics.getDocumentsReturned() >= params.getMaxTotalHits())) - { - return true; - } - return false; + return params.getMaxTotalHits() != -1 && (statistics.getDocumentsReturned() >= params.getMaxTotalHits()); } /** @@ -1080,7 +1073,6 @@ public class MessageBusVisitorSession implements VisitorSession { return scheduleSendCreateVisitorsIfApplicable(0, TimeUnit.MILLISECONDS); } - @SuppressWarnings("removal")// TODO: Vespa 8: remove private void handleCreateVisitorReply(CreateVisitorReply reply) { CreateVisitorMessage msg = (CreateVisitorMessage)reply.getMessage(); @@ -1100,16 +1092,6 @@ public class MessageBusVisitorSession implements VisitorSession { trace.getRoot().addChild(reply.getTrace().getRoot()); } - // TODO: Vespa 8 remove this unused functionality (?) - if (params.getDynamicallyIncreaseMaxBucketsPerVisitor()) { - // Attempt to increase parallelism to reduce latency of visiting - // Ensure new count is within [1, 128] - int newMaxBuckets = Math.max(Math.min((int)(params.getMaxBucketsPerVisitor() - * params.getDynamicMaxBucketsIncreaseFactor()), 128), 1); - params.setMaxBucketsPerVisitor(newMaxBuckets); - log.log(Level.FINE, () -> sessionName + ": increasing max buckets per visitor to " - + params.getMaxBucketsPerVisitor()); - } } private void handleWrongDistributionReply(WrongDistributionReply reply) { @@ -1237,4 +1219,5 @@ public class MessageBusVisitorSession implements VisitorSession { log.log(Level.FINE, () -> sessionName + ": synchronous destroy() done"); } } + } diff --git a/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java index 6d641eaba08..0a0191a9815 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/VisitorParametersTestCase.java @@ -6,10 +6,8 @@ import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; import org.junit.Test; import static org.junit.Assert.*; -@SuppressWarnings("removal") // TODO: Vespa 9: Remove public class VisitorParametersTestCase { - @SuppressWarnings("removal")// TODO: Vespa 9: Remove private VisitorParameters createVisitorParameters() { VisitorParameters params = new VisitorParameters(""); params.setDocumentSelection("id.user==5678"); @@ -33,8 +31,6 @@ public class VisitorParametersTestCase { params.setRemoteDataHandler("mars_rover"); params.setControlHandler(new VisitorControlHandler()); params.setMaxTotalHits(777); - params.setDynamicallyIncreaseMaxBucketsPerVisitor(true); - params.setDynamicMaxBucketsIncreaseFactor(2.5f); params.skipBucketsOnFatalErrors(true); return params; @@ -67,8 +63,6 @@ public class VisitorParametersTestCase { assertEquals("mars_rover", copy.getRemoteDataHandler()); assertEquals(params.getControlHandler(), copy.getControlHandler()); assertEquals(777, copy.getMaxTotalHits()); - assertEquals(true, copy.getDynamicallyIncreaseMaxBucketsPerVisitor()); - assertEquals(2.5f, copy.getDynamicMaxBucketsIncreaseFactor(), 0.0001); assertEquals(true, copy.skipBucketsOnFatalErrors()); // Test local data handler copy @@ -101,9 +95,8 @@ public class VisitorParametersTestCase { " Max total hits: 777\n" + " Max buckets: 55\n" + " Priority: HIGHEST\n" + - " Dynamically increasing max buckets per visitor\n" + - " Increase factor: 2.5\n" + ")", params.toString()); } + } diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java index d729bb9aa76..43dd0ee392e 100755 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java @@ -2290,49 +2290,6 @@ public class MessageBusVisitorSessionTestCase { mc.controlHandler.toString()); } - @SuppressWarnings("removal")// TODO: Vespa 8: remove test - @Test - public void testDynamicallyIncreaseMaxBucketsPerVisitorOption() { - VisitorParameters visitorParameters = createVisitorParameters("id.user==1234"); - visitorParameters.setDynamicallyIncreaseMaxBucketsPerVisitor(true); - visitorParameters.setMaxBucketsPerVisitor(2); - visitorParameters.setDynamicMaxBucketsIncreaseFactor(10); - MockComponents mc = createDefaultMock(visitorParameters); - - mc.visitorSession.start(); - mc.executor.expectAndProcessTasks(1); - - assertEquals("CreateVisitorMessage(buckets=[\n" + - "BucketId(0x80000000000004d2)\n" + - "BucketId(0x0000000000000000)\n" + - "]\n" + - "selection='id.user==1234'\n" + - "max buckets per visitor=2\n)", - replyToCreateVisitor(mc.sender, new BucketId(33, 1234 | (1L << 32)))); - mc.executor.expectAndProcessTasks(1); // reply - mc.executor.expectAndProcessTasks(1); // send create visitors - - assertEquals("CreateVisitorMessage(buckets=[\n" + - "BucketId(0x80000000000004d2)\n" + - "BucketId(0x84000001000004d2)\n" + - "]\n" + - "selection='id.user==1234'\n" + - "max buckets per visitor=20\n)", - replyToCreateVisitor(mc.sender, new BucketId(34, 1234 | (1L << 33)))); - - mc.executor.expectAndProcessTasks(1); // reply - mc.executor.expectAndProcessTasks(1); // send create visitors - - // Saturate at 128 - assertEquals("CreateVisitorMessage(buckets=[\n" + - "BucketId(0x80000000000004d2)\n" + - "BucketId(0x88000002000004d2)\n" + - "]\n" + - "selection='id.user==1234'\n" + - "max buckets per visitor=128\n)", - replyToCreateVisitor(mc.sender, ProgressToken.FINISHED_BUCKET)); - } - @Test public void testVisitorTimeoutsNotConsideredFatal() { VisitorParameters visitorParameters = createVisitorParameters("id.user==1234"); |