Paul Rogers created DRILL-5386:
----------------------------------
Summary: Rationalize Drill's use of the Java assertions flag
Key: DRILL-5386
URL: https://issues.apache.org/jira/browse/DRILL-5386
Project: Apache Drill
Issue Type: Improvement
Affects Versions: 1.10.0
Reporter: Paul Rogers
Assignee: Paul Rogers
Fix For: 1.11.0
Java provides a very handy debugging tool: assertions:
{code}
assert someInvariantCondition;
{code}
Basically, this says that {{someInvariantCondition}} should always hold. This
is a quick and easy way to validate invariants in the code.
Assertions add overhead. To address this concern, assertions are a runtime
option, and are off by default. Assertions are enabled with the {{-ea}} JVM
command-line option. When off, the JVM does not evaluate the assertion, it is
as if the assertion were not even in the code.
Although assertions are well-known tools, it seems that Drill went off into two
directions that compromise the usefulness of assertions.
First, Drill uses the {{-ea}} flag to enable other, far more expensive,
debugging aids as well. When assertions are enabled, the allocator performs
very expensive checks and logging on each allocation and deallocation, vastly
slowing execution. Second, assertions control the fault injection mechanism.
Second, since Drill has made assertions so expensive, they are not often used.
Instead, Drill uses Guava preconditions. But, these are always enabled and
entail one or more function calls: much more expensive at run time than
assertions.
To address this state of affairs:
* Detach allocator debugging from assertions. Use a config option to enable the
allocator debug features. This avoids the current huge overhead of enabling
assertions.
* Similarly, use a config option to enable the fault injection mechanism so
faults can be injected when Drill runs at full performance.
* Encourage the use of Java assertions liberally in new code to allow the JVM
to catch bugs so engineers don't have to do quite so much manual testing.
* Over time, replace Guava preconditions with Java assertions to get Drill to
follow normal Java practices.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)