Janak Ramakrishnan has uploaded a new change for review.
https://bazel-review.googlesource.com/1612
Change subject: Don't serialize events in Skyframe.
......................................................................
Don't serialize events in Skyframe.
It's unlikely that users will want to see errors that were emitted on
a previous build and stored, and we're not good at serializing nested
sets anyway.
Change-Id: Ib09758b4169ade5ec10a32bd6a40c23151069c41
---
M src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git
a/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
b/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
index 3795832..bbe857b 100644
---
a/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
+++
b/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
@@ -17,6 +17,9 @@
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.Objects;
import javax.annotation.Nullable;
@@ -75,8 +78,8 @@
/** Implementation of {@link ValueWithMetadata} for the value case. */
public static final class ValueWithEvents extends ValueWithMetadata {
-
- private final NestedSet<TaggedEvents> transitiveEvents;
+ // Non-final only for serialization.
+ private NestedSet<TaggedEvents> transitiveEvents;
public ValueWithEvents(SkyValue value, NestedSet<TaggedEvents>
transitiveEvents) {
super(Preconditions.checkNotNull(value));
@@ -121,13 +124,22 @@
@Override
public String toString() { return value.toString(); }
+
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException {
+ transitiveEvents = NO_EVENTS;
+ }
+
+ private void writeObject(ObjectOutputStream stream) throws IOException
{
+ // Do nothing -- transitive events shouldn't be serialized.
+ }
}
/** Implementation of {@link ValueWithMetadata} for the error case. */
public static final class ErrorInfoValue extends ValueWithMetadata {
-
- private final ErrorInfo errorInfo;
- private final NestedSet<TaggedEvents> transitiveEvents;
+ // Non-final only for serialization.
+ private ErrorInfo errorInfo;
+ private NestedSet<TaggedEvents> transitiveEvents;
public ErrorInfoValue(ErrorInfo errorInfo, @Nullable SkyValue value,
NestedSet<TaggedEvents> transitiveEvents) {
@@ -184,6 +196,17 @@
}
return result.toString();
}
+
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException {
+ errorInfo = (ErrorInfo) stream.readObject();
+ transitiveEvents = NO_EVENTS;
+ }
+
+ private void writeObject(ObjectOutputStream stream) throws IOException
{
+ stream.writeObject(errorInfo);
+ // Don't serialize transitive events.
+ }
}
public static SkyValue justValue(SkyValue value) {
--
To view, visit
https://bazel-review.googlesource.com/1612
To unsubscribe, visit
https://bazel-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib09758b4169ade5ec10a32bd6a40c23151069c41
Gerrit-PatchSet: 1
Gerrit-Project: bazel
Gerrit-Branch: master
Gerrit-Owner: Janak Ramakrishnan <
jan...@google.com>