diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-25 02:38:55 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-01-25 18:55:20 +0100 |
commit | e215f5577b3b58ea78670f2ec5e4d259cb825082 (patch) | |
tree | 3037eff5fb340f63ef4018295895ac369e45b142 /container-core | |
parent | dd98862b1e13654bb4005b88c2d748e5fc47b3c7 (diff) |
Render timeout information all the way.
Diffstat (limited to 'container-core')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/handler/Coverage.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/Coverage.java b/container-core/src/main/java/com/yahoo/container/handler/Coverage.java index fd3c8ed4c49..6a12502b0eb 100644 --- a/container-core/src/main/java/com/yahoo/container/handler/Coverage.java +++ b/container-core/src/main/java/com/yahoo/container/handler/Coverage.java @@ -12,6 +12,8 @@ public class Coverage { protected long docs; protected long active; + protected long soonActive; + protected int degradedReason; protected int nodes; protected int resultSets; protected int fullResultSets; @@ -23,6 +25,10 @@ public class Coverage { EXPLICITLY_FULL, EXPLICITLY_INCOMPLETE, DOCUMENT_COUNT; } + private final static int DEGRADED_BY_MATCH_PHASE = 1; + private final static int DEGRADED_BY_TIMEOUT = 2; + private final static int DEGRADED_BY_ADAPTIVE_TIMEOUT = 4; + /** * Build an invalid instance to initiate manually. */ @@ -46,6 +52,8 @@ public class Coverage { this.docs = docs; this.nodes = nodes; this.active = active; + this.soonActive = active; + this.degradedReason = 0; this.resultSets = resultSets; this.fullReason = fullReason; this.fullResultSets = getFull() ? resultSets : 0; @@ -58,6 +66,8 @@ public class Coverage { docs += other.getDocs(); nodes += other.getNodes(); active += other.getActive(); + soonActive += other.getSoonActive(); + degradedReason |= other.degradedReason; resultSets += other.getResultSets(); fullResultSets += other.getFullResultSets(); @@ -94,6 +104,18 @@ public class Coverage { public long getActive() { return active; } /** + * Total number of documents that will be searchable once redistribution has settled. + * + * @return Total number of documents that will soon be available. + */ + public long getSoonActive() { return soonActive; } + + public boolean isDegraded() { return degradedReason != 0; } + public boolean isDegradedByMatchPhase() { return (degradedReason & DEGRADED_BY_MATCH_PHASE) != 0; } + public boolean isDegradedByTimeout() { return (degradedReason & DEGRADED_BY_TIMEOUT) != 0; } + public boolean isDegradedByAdapativeTimeout() { return (degradedReason & DEGRADED_BY_ADAPTIVE_TIMEOUT) != 0; } + + /** * @return whether the search had full coverage or not */ public boolean getFull() { |