summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/fs4
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-03-19 09:19:00 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2019-03-19 09:19:00 +0100
commit88c865f18bd34eca59bf01531839e6e5c36bb55d (patch)
tree6135c01ccef7548c37387d364f877df882dab869 /container-search/src/main/java/com/yahoo/fs4
parent43b44b6d1fba5c5c7eb982716119bf37aeeb7604 (diff)
GC dead code
Diffstat (limited to 'container-search/src/main/java/com/yahoo/fs4')
-rw-r--r--container-search/src/main/java/com/yahoo/fs4/QueryPacket.java53
1 files changed, 0 insertions, 53 deletions
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 028b0176c85..60bd5314cff 100644
--- a/container-search/src/main/java/com/yahoo/fs4/QueryPacket.java
+++ b/container-search/src/main/java/com/yahoo/fs4/QueryPacket.java
@@ -8,7 +8,6 @@ import com.yahoo.search.Query;
import com.yahoo.search.grouping.vespa.GroupingExecutor;
import com.yahoo.search.query.Ranking;
import com.yahoo.searchlib.aggregation.Grouping;
-import com.yahoo.text.Utf8;
import com.yahoo.text.Utf8String;
import com.yahoo.vespa.objects.BufferSerializer;
@@ -29,10 +28,6 @@ public class QueryPacket extends Packet {
private final Query query;
private QueryPacketData queryPacketData;
- private int sessionOffset = 0; // Start of sessionKey ignore section for cache key
- private int sessionSize = 0; // Length of sessionKey ignore section for cache key
- private int ignoreableOffset = 0; // Start of (hits/offset/timestamp) ignore section for cache key
- private int ignoreableSize = 0; // Length of (hits/offset/timestamp) ignore section for cache key
private QueryPacket(String serverId, Query query) {
this.serverId = serverId;
@@ -72,62 +67,16 @@ public class QueryPacket extends Packet {
return query.getHits();
}
- private byte[] getSummaryClassAsUtf8() {
- if (query.getPresentation().getSummary() != null) {
- return Utf8.toBytes(query.getPresentation().getSummary());
- }
- return new byte[0];
- }
-
- private int getSessionKeySkipLength() {
- return (sessionSize > 0) ? sessionSize + 4 : 0;
- }
-
- /**
- * Returns an opaque cache key for the query represented by this
- * (pre-serialized) packet.
- */
- public byte[] getOpaqueCacheKey() {
-
- // the cache key is generated by taking the serialized packet
- // body and switching out the offset/hits/timeout fields with
- // the requested summary class. We add a single '\0' byte in
- // addition to the utf8 encoded summaryclass name to avoid the
- // need to fiddle with feature flags to handle a non-existing
- // summary class.
-
- byte[] utf8Summary = getSummaryClassAsUtf8();
- byte[] stripped = new byte[encodedBody.length - (ignoreableSize + getSessionKeySkipLength()) + utf8Summary.length + 1];
-
- System.arraycopy(encodedBody, 0, stripped, 0, ignoreableOffset);
- stripped[1] = (byte)(stripped[1] & 0x7f); // Ignore sessionKey feature flag
- System.arraycopy(utf8Summary, 0, stripped, ignoreableOffset, utf8Summary.length);
- stripped[ignoreableOffset + utf8Summary.length] = 0;
-
- // Copy part up to sessionKey
- System.arraycopy(encodedBody, ignoreableOffset + ignoreableSize,
- stripped, ignoreableOffset + utf8Summary.length + 1,
- sessionOffset - (ignoreableOffset + ignoreableSize));
- // Copy part after sessionKey
- System.arraycopy(encodedBody, sessionOffset + getSessionKeySkipLength(),
- stripped, utf8Summary.length + 1 + (sessionOffset - ignoreableSize),
- encodedBody.length - (sessionOffset + getSessionKeySkipLength()));
- return stripped;
- }
-
public void encodeBody(ByteBuffer buffer) {
queryPacketData = new QueryPacketData();
- final int relativeZero = buffer.position();
boolean sendSessionKey = query.getGroupingSessionCache() || query.getRanking().getQueryCache();
int featureFlag = getFeatureInt(sendSessionKey);
buffer.putInt(featureFlag);
- ignoreableOffset = buffer.position() - relativeZero;
IntegerCompressor.putCompressedPositiveNumber(getOffset(), buffer);
IntegerCompressor.putCompressedPositiveNumber(getHits(), buffer);
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();
Item.putString(query.getRanking().getProfile(), buffer);
@@ -162,10 +111,8 @@ public class QueryPacket extends Packet {
buffer.put(blob);
}
- sessionOffset = buffer.position() - relativeZero;
if (sendSessionKey) {
Utf8String key = query.getSessionId(serverId).asUtf8String();
- sessionSize = key.getByteLength();
buffer.putInt(key.getByteLength());
buffer.put(key.getBytes());
}