Program: 132418
Project: 132418
Buggy source:
public void checkpoint() throws BabuDBException, InterruptedException {
  if (replication_isSlave()) {
    throw new BabuDBException(ErrorCode.REPLICATION_FAILURE,slaveProtection);
  }
  List<LSMDatabase> dbListCopy;
synchronized (dbModificationLock) {
    dbListCopy=new ArrayList<LSMDatabase>(databases.size());
    for (    LSMDatabase db : databases.values()) {
      dbListCopy.add(db);
    }
  }
synchronized (checkpointLock) {
    try {
      int[][] snapIds=new int[dbListCopy.size()][];
      int i=0;
      LSN lastWrittenLSN=null;
      try {
        logger.lockLogger();
        for (        LSMDatabase db : dbListCopy) {
          snapIds[i++]=db.createSnapshot();
        }
        lastWrittenLSN=logger.switchLogFile();
      }
  finally {
        logger.unlockLogger();
      }
      i=0;
      for (      LSMDatabase db : dbListCopy) {
        db.writeSnapshot(lastWrittenLSN.getViewId(),lastWrittenLSN.getSequenceNo(),snapIds[i++]);
        db.cleanupSnapshot(lastWrittenLSN.getViewId(),lastWrittenLSN.getSequenceNo());
      }
      File f=new File(configuration.getDbLogDir());
      String[] logs=f.list(new FilenameFilter(){
        public boolean accept(        File dir,        String name){
          return name.endsWith("String_Node_Str");
        }
      }
);
      if (logs != null) {
        Pattern p=Pattern.compile("String_Node_Str");
        for (        String log : logs) {
          Matcher m=p.matcher(log);
          m.matches();
          String tmp=m.group(1);
          int viewId=Integer.valueOf(tmp);
          tmp=m.group(2);
          int seqNo=Integer.valueOf(tmp);
          LSN logLSN=new LSN(viewId,seqNo);
          if (logLSN.compareTo(lastWrittenLSN) <= 0) {
            Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + log);
            f=new File(configuration.getDbLogDir() + log);
            f.delete();
          }
        }
      }
    }
 catch (    IOException ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
private void checkpoint(boolean incrementViewId) throws BabuDBException, InterruptedException {
  List<LSMDatabase> dbListCopy;
synchronized (dbModificationLock) {
    dbListCopy=new ArrayList<LSMDatabase>(databases.size());
    for (    LSMDatabase db : databases.values()) {
      dbListCopy.add(db);
    }
  }
synchronized (checkpointLock) {
    try {
      int[][] snapIds=new int[dbListCopy.size()][];
      int i=0;
      LSN lastWrittenLSN=null;
      try {
        logger.lockLogger();
        for (        LSMDatabase db : dbListCopy) {
          snapIds[i++]=db.createSnapshot();
        }
        lastWrittenLSN=logger.switchLogFile(incrementViewId);
      }
  finally {
        logger.unlockLogger();
      }
      i=0;
      for (      LSMDatabase db : dbListCopy) {
        db.writeSnapshot(lastWrittenLSN.getViewId(),lastWrittenLSN.getSequenceNo(),snapIds[i++]);
        db.cleanupSnapshot(lastWrittenLSN.getViewId(),lastWrittenLSN.getSequenceNo());
      }
      File f=new File(configuration.getDbLogDir());
      String[] logs=f.list(new FilenameFilter(){
        public boolean accept(        File dir,        String name){
          return name.endsWith("String_Node_Str");
        }
      }
);
      if (logs != null) {
        Pattern p=Pattern.compile("String_Node_Str");
        for (        String log : logs) {
          Matcher m=p.matcher(log);
          m.matches();
          String tmp=m.group(1);
          int viewId=Integer.valueOf(tmp);
          tmp=m.group(2);
          int seqNo=Integer.valueOf(tmp);
          LSN logLSN=new LSN(viewId,seqNo);
          if (logLSN.compareTo(lastWrittenLSN) <= 0) {
            Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + log);
            f=new File(configuration.getDbLogDir() + log);
            f.delete();
          }
        }
      }
    }
 catch (    IOException ex) {
      throw new BabuDBException(ErrorCode.IO_ERROR,"String_Node_Str",ex);
    }
  }
}