Factor out version assertions in InMemoryNodeEntry, and make those assertions go to logError() so that they can be handled specially by subclasses if desired.
@@ -295,11 +295,7 @@ public class InMemoryNodeEntry implements NodeEntry {
public synchronized Set<SkyKey> setValue(SkyValue value, Version version)
throws InterruptedException {
Preconditions.checkState(isReady(), "%s %s", this, value);
- // This check may need to be removed when we move to a non-linear versioning sequence.
- Preconditions.checkState(
- this.lastChangedVersion.atMost(version), "%s %s %s", this, version, value);
- Preconditions.checkState(
- this.lastEvaluatedVersion.atMost(version), "%s %s %s", this, version, value);
+ assertVersionCompatibleWhenSettingValue(version, value);
this.lastEvaluatedVersion = version;
if (isDirty() && getDirtyBuildingState().unchangedFromLastBuild(value)) {
@@ -329,6 +325,18 @@ public class InMemoryNodeEntry implements NodeEntry {
return setStateFinishedAndReturnReverseDepsToSignal();
}
+ protected void assertVersionCompatibleWhenSettingValue(
+ Version version, SkyValue valueForDebugging) {
+ if (!this.lastChangedVersion.atMost(version)) {
+ logError(
+ new IllegalStateException("Bad ch: " + this + ", " + version + ", " + valueForDebugging));
+ }
+ if (!this.lastEvaluatedVersion.atMost(version)) {
+ logError(
+ new IllegalStateException("Bad ev: " + this + ", " + version + ", " + valueForDebugging));
+ }
+ }
+
@Override
public synchronized DependencyState addReverseDepAndCheckIfDone(SkyKey reverseDep) {
if (reverseDep != null) {
