Program: 132321
Project: 132321
Buggy source:
@Override public LSN restart() throws BabuDBException {
synchronized (stopped) {
    if (!stopped.get()) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str" + "String_Node_Str");
    }
    databaseManager.reset();
    LSN dbLsn=null;
    for (    Database db : databaseManager.getDatabaseList()) {
      if (dbLsn == null)       dbLsn=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
 else {
        LSN onDiskLSN=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
        if (!(LSMDatabase.NO_DB_LSN.equals(dbLsn) || LSMDatabase.NO_DB_LSN.equals(onDiskLSN))) {
          dbLsn=dbLsn.compareTo(onDiskLSN) < 0 ? dbLsn : onDiskLSN;
        }
      }
    }
    if (dbLsn == null) {
      dbLsn=new LSN(0,0);
    }
 else {
      dbLsn=new LSN(dbLsn.getViewId(),dbLsn.getSequenceNo() + 1);
    }
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
    LSN nextLSN=replayLogs(dbLsn);
    if (dbLsn.compareTo(nextLSN) > 0)     nextLSN=dbLsn;
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + nextLSN);
    try {
      logger=new DiskLogger(configuration.getDbLogDir(),nextLSN.getViewId(),nextLSN.getSequenceNo(),configuration.getSyncMode(),configuration.getPseudoSyncWait(),configuration.getMaxQueueLength() * configuration.getNumThreads());
      logger.start();
    }
 catch (    IOException ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str" + "String_Node_Str",ex);
    }
    this.permMan.setLogger(logger);
    if (configuration.getNumThreads() > 0) {
      worker=new LSMDBWorker[configuration.getNumThreads()];
      for (int i=0; i < configuration.getNumThreads(); i++) {
        worker[i]=new LSMDBWorker(this,i,configuration.getMaxQueueLength());
        worker[i].start();
      }
    }
 else {
      assert(configuration.getNumThreads() == 0);
      worker=null;
    }
    this.dbCheckptr.init(logger,configuration.getCheckInterval(),configuration.getMaxLogfileSize());
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + BABUDB_VERSION + "String_Node_Str");
    this.stopped.set(false);
    return new LSN(nextLSN.getViewId(),nextLSN.getSequenceNo() - 1L);
  }
}

Fixed version (ground truth):
@Override public LSN restart() throws BabuDBException {
synchronized (stopped) {
    if (!stopped.get()) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str" + "String_Node_Str");
    }
    databaseManager.reset();
    LSN dbLsn=null;
    for (    Database db : databaseManager.getDatabaseList()) {
      if (dbLsn == null)       dbLsn=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
 else {
        LSN onDiskLSN=((DatabaseImpl)db).getLSMDB().getOndiskLSN();
        if (!(LSMDatabase.NO_DB_LSN.equals(dbLsn) || LSMDatabase.NO_DB_LSN.equals(onDiskLSN))) {
          dbLsn=dbLsn.compareTo(onDiskLSN) < 0 ? dbLsn : onDiskLSN;
        }
      }
    }
    if (dbLsn == null) {
      dbLsn=new LSN(0,0);
    }
 else {
      dbLsn=new LSN(dbLsn.getViewId(),dbLsn.getSequenceNo() + 1);
    }
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
    LSN nextLSN=replayLogs(dbLsn);
    if (dbLsn.compareTo(nextLSN) > 0)     nextLSN=dbLsn;
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + nextLSN);
    try {
      logger=new DiskLogger(configuration.getDbLogDir(),nextLSN.getViewId(),nextLSN.getSequenceNo(),configuration.getSyncMode(),configuration.getPseudoSyncWait(),configuration.getMaxQueueLength() * configuration.getNumThreads());
      logger.start();
    }
 catch (    IOException ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str" + "String_Node_Str",ex);
    }
    this.permMan.init(new LSN(nextLSN.getViewId(),nextLSN.getSequenceNo() - 1L));
    this.permMan.setLogger(logger);
    if (configuration.getNumThreads() > 0) {
      worker=new LSMDBWorker[configuration.getNumThreads()];
      for (int i=0; i < configuration.getNumThreads(); i++) {
        worker[i]=new LSMDBWorker(this,i,configuration.getMaxQueueLength());
        worker[i].start();
      }
    }
 else {
      assert(configuration.getNumThreads() == 0);
      worker=null;
    }
    this.dbCheckptr.init(logger,configuration.getCheckInterval(),configuration.getMaxLogfileSize());
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + BABUDB_VERSION + "String_Node_Str");
    this.stopped.set(false);
    return new LSN(nextLSN.getViewId(),nextLSN.getSequenceNo() - 1L);
  }
}