Skip to content

Commit

Permalink
poolmanager: Warn when spacecostfactor is too big
Browse files Browse the repository at this point in the history
When space cost factor is large, wass may run into a problem caused by
the limited precision of floating point arithmetic. When that happens
the code reaches a statement that was thought to be unreachable.

This patch adds a check that detects the situation and generates
a more suitable error message.

Target: trunk
Request: 2.10
Request: 2.9
Request: 2.8
Request: 2.7
Request: 2.6
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Karsten Schwank <karsten.schwank@desy.de>
Patch: https://rb.dcache.org/r/7399/
(cherry picked from commit b9b1ecd)
  • Loading branch information
gbehrmann committed Oct 27, 2014
1 parent 4d86055 commit b8b5271
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -278,6 +278,10 @@ public <P> P selectByAvailableSpace(List<P> pools, long filesize,
}
}

throw new RuntimeException("Unreachable statement");
if (sum == Double.POSITIVE_INFINITY) {
throw new IllegalStateException("WASS overflow: Space cost factor is too large.");
}

throw new RuntimeException("Unreachable statement.");
}
}

0 comments on commit b8b5271

Please sign in to comment.