Program: 30865
Project: 30865
Buggy source:
public TableWriter(FilesFacade ff,CharSequence root,CharSequence name,int mkDirMode,int fileOperationRetryCount){
  LOG.info().$("String_Node_Str").$(name).$('\'').$();
  this.ff=ff;
  this.mkDirMode=mkDirMode;
  this.fileOperationRetryCount=fileOperationRetryCount;
  this.path=new CompositePath().of(root).concat(name);
  this.other=new CompositePath().of(root).concat(name);
  this.name=ImmutableCharSequence.of(name);
  this.rootLen=path.length();
  try {
    this.txMem=openTxnFile();
    try {
      this.lockFd=TableUtils.lock(ff,path);
    }
  finally {
      path.trimTo(rootLen);
    }
    if (this.lockFd == -1L) {
      throw CairoException.instance(ff.errno()).put("String_Node_Str").put(path.$());
    }
    this.txMem.jumpTo(TableUtils.TX_EOF);
    long todo=readTodoTaskCode();
    if (todo != -1L) {
switch ((int)(todo & 0xff)) {
case TableUtils.TODO_TRUNCATE:
        repairTruncate();
      break;
case TableUtils.TODO_RESTORE_META:
    repairMetaRename((int)(todo >> 8));
  break;
default :
LOG.error().$("String_Node_Str").$(todo).$();
break;
}
}
this.ddlMem=new AppendMemory();
this.metaMem=new ReadOnlyMemory();
openMetaFile();
this.metadata=new TableWriterMetadata(ff,metaMem);
this.columnCount=metadata.getColumnCount();
this.partitionBy=metaMem.getInt(TableUtils.META_OFFSET_PARTITION_BY);
this.columnSizeMem=new VirtualMemory(ff.getPageSize());
this.refs.extendAndSet(columnCount,0);
this.columns=new ObjList<>(columnCount);
this.nullers=new ObjList<>(columnCount);
this.columnTops=new LongList(columnCount);
this.partitionDirFmt=selectPartitionDirFmt(partitionBy);
configureColumnMemory();
timestampSetter=configureTimestampSetter();
configureAppendPosition();
purgeUnusedPartitions();
}
 catch (CairoException e) {
LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$((Sinkable)e).$('}').$();
close();
throw e;
}
}

Fixed version (ground truth):
public TableWriter(FilesFacade ff,CharSequence root,CharSequence name,int mkDirMode,int fileOperationRetryCount){
  LOG.info().$("String_Node_Str").$(name).$('\'').$();
  this.ff=ff;
  this.mkDirMode=mkDirMode;
  this.fileOperationRetryCount=fileOperationRetryCount;
  this.path=new CompositePath().of(root).concat(name);
  this.other=new CompositePath().of(root).concat(name);
  this.name=ImmutableCharSequence.of(name);
  this.rootLen=path.length();
  try {
    try {
      this.lockFd=TableUtils.lock(ff,path);
    }
  finally {
      path.trimTo(rootLen);
    }
    if (this.lockFd == -1L) {
      throw CairoException.instance(ff.errno()).put("String_Node_Str").put(path.$());
    }
    this.txMem=openTxnFile();
    this.txMem.jumpTo(TableUtils.TX_EOF);
    long todo=readTodoTaskCode();
    if (todo != -1L) {
switch ((int)(todo & 0xff)) {
case TableUtils.TODO_TRUNCATE:
        repairTruncate();
      break;
case TableUtils.TODO_RESTORE_META:
    repairMetaRename((int)(todo >> 8));
  break;
default :
LOG.error().$("String_Node_Str").$(todo).$();
break;
}
}
this.ddlMem=new AppendMemory();
this.metaMem=new ReadOnlyMemory();
openMetaFile();
this.metadata=new TableWriterMetadata(ff,metaMem);
this.columnCount=metadata.getColumnCount();
this.partitionBy=metaMem.getInt(TableUtils.META_OFFSET_PARTITION_BY);
this.columnSizeMem=new VirtualMemory(ff.getPageSize());
this.refs.extendAndSet(columnCount,0);
this.columns=new ObjList<>(columnCount);
this.nullers=new ObjList<>(columnCount);
this.columnTops=new LongList(columnCount);
this.partitionDirFmt=selectPartitionDirFmt(partitionBy);
configureColumnMemory();
timestampSetter=configureTimestampSetter();
configureAppendPosition();
purgeUnusedPartitions();
}
 catch (CairoException e) {
LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$((Sinkable)e).$('}').$();
close();
throw e;
}
}