diff options
author | 2017-11-30 02:03:14 -0800 | |
---|---|---|
committer | 2017-11-30 02:05:13 -0800 | |
commit | ec3d9326cb779ed339adf09f2fe60629446c6c73 (patch) | |
tree | 41d358a9abe4ae92e2e15bb8c89e51b62e810d85 /src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java | |
parent | 70eabb67e113f96d83b3f950305631b490be37a4 (diff) |
Buffer blaze query
It was previously sending each label individually over gRPC, where each call
has a lot of overhead.
This makes queries with a large amount of output _a lot_ faster. For an example
query where all packages are already loaded, I observe a difference of ~3.5s
before this change to ~1.6s after this change.
PiperOrigin-RevId: 177426957
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java b/src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java index 7f6c173b24..d13beac249 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java +++ b/src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java @@ -153,6 +153,16 @@ public abstract class OutputFormatter implements Serializable { : DependencyFilter.NO_IMPLICIT_DEPS); } + /** + * Workaround for a bug in {@link java.nio.channels.Channels#newChannel(OutputStream)}, which + * attempts to close the output stream on interrupt, which can cause a deadlock if there is an + * ongoing write. If this formatter uses Channels.newChannel, then it must return false here, and + * perform its own buffering. + */ + public boolean canBeBuffered() { + return true; + } + public void verifyCompatible(QueryEnvironment<?> env, QueryExpression expr) throws QueryException { } |