summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <jonbratseth@yahoo.com>2018-02-05 15:43:57 +0100
committerGitHub <noreply@github.com>2018-02-05 15:43:57 +0100
commit3632387ab3bf56688d54c0714bcefe6f0f6d999f (patch)
tree5a98c5a3e4f8a05e574820c2d2622978cb316e67
parent45da6a8b2aab6defe1b6c26133be84de6829df28 (diff)
parent8632a41f9bd78cc6adb9b9bbb97d894812e0f6d4 (diff)
Merge pull request #4919 from vespa-engine/revert-4918-revert-4916-balder/again-when-time-is-up-it-is-up
Revert "Revert "Balder/again when time is up it is up""
-rw-r--r--container-search/src/main/java/com/yahoo/fs4/GetDocSumsPacket.java5
-rw-r--r--container-search/src/main/java/com/yahoo/fs4/QueryPacket.java3
-rw-r--r--container-search/src/test/java/com/yahoo/fs4/test/QueryTestCase.java10
-rwxr-xr-xvespaclient-core/src/main/java/com/yahoo/feedhandler/FeedResponse.java12
4 files changed, 18 insertions, 12 deletions
diff --git a/container-search/src/main/java/com/yahoo/fs4/GetDocSumsPacket.java b/container-search/src/main/java/com/yahoo/fs4/GetDocSumsPacket.java
index a40f5d55317..c1b0e9ccb37 100644
--- a/container-search/src/main/java/com/yahoo/fs4/GetDocSumsPacket.java
+++ b/container-search/src/main/java/com/yahoo/fs4/GetDocSumsPacket.java
@@ -102,10 +102,9 @@ public class GetDocSumsPacket extends Packet {
buffer.putInt((int)features);
buffer.putInt(0); //Unused, was docstamp
long timeLeft = query.getTimeLeft();
- final int minTimeout = 50;
- buffer.putInt(Math.max(minTimeout, (int)timeLeft));
+ buffer.putInt(Math.max(1, (int)timeLeft)); // Safety to avoid sending down 0 or negative number
if (log.isLoggable(LogLevel.DEBUG)) {
- log.log(LogLevel.DEBUG, "Timeout from query(" + query.getTimeout() + "), sent to backend: " + Math.max(minTimeout, timeLeft));
+ log.log(LogLevel.DEBUG, "Timeout from query(" + query.getTimeout() + "), sent to backend: " + timeLeft);
}
if (queryPacketData != null)
diff --git a/container-search/src/main/java/com/yahoo/fs4/QueryPacket.java b/container-search/src/main/java/com/yahoo/fs4/QueryPacket.java
index 1513cf2213c..8a14ea5c343 100644
--- a/container-search/src/main/java/com/yahoo/fs4/QueryPacket.java
+++ b/container-search/src/main/java/com/yahoo/fs4/QueryPacket.java
@@ -123,8 +123,7 @@ public class QueryPacket extends Packet {
ignoreableOffset = buffer.position() - relativeZero;
IntegerCompressor.putCompressedPositiveNumber(getOffset(), buffer);
IntegerCompressor.putCompressedPositiveNumber(getHits(), buffer);
- // store the cutoff time in the tag object, and then do a similar Math.max there
- buffer.putInt(Math.max(50, (int)query.getTimeLeft()));
+ buffer.putInt(Math.max(1, (int)query.getTimeLeft())); // Safety to avoid sending down 0 or negative number
ignoreableSize = buffer.position() - relativeZero - ignoreableOffset;
buffer.putInt(getFlagInt());
int startOfFieldToSave = buffer.position();
diff --git a/container-search/src/test/java/com/yahoo/fs4/test/QueryTestCase.java b/container-search/src/test/java/com/yahoo/fs4/test/QueryTestCase.java
index f47c8e9e0b8..c7359ce2f94 100644
--- a/container-search/src/test/java/com/yahoo/fs4/test/QueryTestCase.java
+++ b/container-search/src/test/java/com/yahoo/fs4/test/QueryTestCase.java
@@ -35,7 +35,7 @@ public class QueryTestCase extends junit.framework.TestCase {
0,0,0,6, // Features
2,
8,
- 0,0,0,50, // querytimeout
+ 0,0,0,1, // querytimeout
0,0,0x40,0x01, // qflags
7,
'd', 'e', 'f', 'a', 'u', 'l', 't',
@@ -57,7 +57,7 @@ public class QueryTestCase extends junit.framework.TestCase {
0,0,0,6, // Features
2,
8,
- 0,0,0,50, // querytimeout
+ 0,0,0,1, // querytimeout
0,0,0x40,0x01, // QFlags
3,
't','w','o', // Ranking
@@ -162,7 +162,7 @@ public class QueryTestCase extends junit.framework.TestCase {
0,0,0,-122, // Features
2, // offset
8, // maxhits
- 0,0,0,50, // querytimeout
+ 0,0,0,1, // querytimeout
0,0,0x40,0x01, // qflags
7,
'd', 'e', 'f', 'a', 'u', 'l', 't',
@@ -233,7 +233,7 @@ public class QueryTestCase extends junit.framework.TestCase {
0,0,0,6, // Features
2,
8,
- 0,0,0,50, // querytimeout
+ 0,0,0,1, // querytimeout
0,0,0x40,0x01, // qflags
7,
'd', 'e', 'f', 'a', 'u', 'l', 't',
@@ -252,7 +252,7 @@ public class QueryTestCase extends junit.framework.TestCase {
0,0,0,6, // Features
2,
8,
- 0,0,0,50, // querytimeout
+ 0,0,0,1, // querytimeout
0,0,0x40,0x01, // qflags
7,
'd', 'e', 'f', 'a', 'u', 'l', 't',
diff --git a/vespaclient-core/src/main/java/com/yahoo/feedhandler/FeedResponse.java b/vespaclient-core/src/main/java/com/yahoo/feedhandler/FeedResponse.java
index 635659204e8..3b84f83fafa 100755
--- a/vespaclient-core/src/main/java/com/yahoo/feedhandler/FeedResponse.java
+++ b/vespaclient-core/src/main/java/com/yahoo/feedhandler/FeedResponse.java
@@ -172,14 +172,22 @@ public final class FeedResponse extends HttpResponse implements SharedSender.Res
// Like busy, no space etc.
if (error == DocumentProtocol.ERROR_NO_SPACE) {
return com.yahoo.container.protect.Error.INSUFFICIENT_STORAGE;
- } else if (error >= ErrorCode.TRANSIENT_ERROR && (error < ErrorCode.FATAL_ERROR)) {
+ } else if (isTransientError(error)) {
return com.yahoo.container.protect.Error.INTERNAL_SERVER_ERROR;
- } if (error >= ErrorCode.FATAL_ERROR && (error < ErrorCode.ERROR_LIMIT)) {
+ } if (isFatalError(error)) {
return com.yahoo.container.protect.Error.INTERNAL_SERVER_ERROR;
}
return com.yahoo.container.protect.Error.INTERNAL_SERVER_ERROR;
}
+ private static boolean isFatalError(int error) {
+ return (error >= ErrorCode.FATAL_ERROR) && (error < ErrorCode.ERROR_LIMIT);
+ }
+
+ private static boolean isTransientError(int error) {
+ return (error >= ErrorCode.TRANSIENT_ERROR) && (error < ErrorCode.FATAL_ERROR);
+ }
+
public boolean isSuccess() {
return errors.isEmpty();
}