private void setInitialStateForRun(boolean alreadyCompiled) throws CommandProcessorException {
    driverState.lock();
    try {
      if (alreadyCompiled) {
        if (driverState.isCompiled()) {
          driverState.executing();
        } else {
          String errorMessage = "FAILED: Precompiled query has been cancelled or closed.";
          CONSOLE.printError(errorMessage);
          throw DriverUtils.createProcessorException(driverContext, 12, errorMessage, null, null);
        }
      } else {
        driverState.compiling();
      }
    } finally {
      driverState.unlock();
    }
  }
Checks if the recorded snapshot is up-to-date
ql/src/java/org/apache/hadoop/hive/ql/Driver.java