Program: 30796
Project: 30796
Buggy source:
@Test public void testUnsuccessfulFileRemoveAndReload() throws Exception {
  TestUtils.assertMemoryLeak(() -> {
    try (TableModel model=new TableModel(configuration,"String_Node_Str",PartitionBy.NONE).col("String_Node_Str",ColumnType.STRING).col("String_Node_Str",ColumnType.STRING)){
      CairoTestUtils.create(model);
    }
     Rnd rnd=new Rnd();
    final int N=1000;
    TestFilesFacade ff=new TestFilesFacade(){
      int counter=2;
      @Override public boolean remove(      LPSZ name){
        if (counter > 0 && Chars.endsWith(name,"String_Node_Str") || Chars.endsWith(name,"String_Node_Str")) {
          counter--;
          return false;
        }
        return super.remove(name);
      }
      @Override public boolean wasCalled(){
        return counter < 1;
      }
    }
;
    CairoConfiguration configuration=new DefaultCairoConfiguration(root){
      @Override public FilesFacade getFilesFacade(){
        return ff;
      }
    }
;
    try (TableWriter writer=new TableWriter(configuration,"String_Node_Str")){
      for (int i=0; i < N; i++) {
        TableWriter.Row row=writer.newRow(0);
        row.putStr(0,rnd.nextChars(10));
        row.putStr(1,rnd.nextChars(15));
        row.append();
      }
      writer.commit();
      try (TableReader reader=new TableReader(configuration,"String_Node_Str")){
        long counter=0;
        rnd.reset();
        RecordCursor cursor=reader.getCursor();
        while (cursor.hasNext()) {
          Record record=cursor.next();
          Assert.assertEquals(rnd.nextChars(10),record.getFlyweightStr(0));
          Assert.assertEquals(rnd.nextChars(15),record.getFlyweightStr(1));
          counter++;
        }
        Assert.assertEquals(N,counter);
        writer.removeColumn("String_Node_Str");
        writer.addColumn("String_Node_Str",ColumnType.STRING);
        Assert.assertTrue(reader.reload());
        Assert.assertEquals(N,reader.size());
        rnd.reset();
        while (cursor.hasNext()) {
          Record record=cursor.next();
          Assert.assertEquals(rnd.nextChars(10),record.getFlyweightStr(0));
          rnd.nextChars(15);
          Assert.assertNull(record.getFlyweightStr(1));
          counter++;
        }
        Assert.assertEquals(N,counter);
      }
     }
     Assert.assertTrue(ff.wasCalled());
  }
);
}

Fixed version (ground truth):
@Test public void testUnsuccessfulFileRemoveAndReload() throws Exception {
  TestUtils.assertMemoryLeak(() -> {
    try (TableModel model=new TableModel(configuration,"String_Node_Str",PartitionBy.NONE).col("String_Node_Str",ColumnType.STRING).col("String_Node_Str",ColumnType.STRING)){
      CairoTestUtils.create(model);
    }
     Rnd rnd=new Rnd();
    final int N=1000;
    TestFilesFacade ff=new TestFilesFacade(){
      int counter=2;
      @Override public boolean remove(      LPSZ name){
        if (counter > 0 && (Chars.endsWith(name,"String_Node_Str") || Chars.endsWith(name,"String_Node_Str"))) {
          counter--;
          return false;
        }
        return super.remove(name);
      }
      @Override public boolean wasCalled(){
        return counter < 1;
      }
    }
;
    CairoConfiguration configuration=new DefaultCairoConfiguration(root){
      @Override public FilesFacade getFilesFacade(){
        return ff;
      }
    }
;
    try (TableWriter writer=new TableWriter(configuration,"String_Node_Str")){
      for (int i=0; i < N; i++) {
        TableWriter.Row row=writer.newRow(0);
        row.putStr(0,rnd.nextChars(10));
        row.putStr(1,rnd.nextChars(15));
        row.append();
      }
      writer.commit();
      try (TableReader reader=new TableReader(configuration,"String_Node_Str")){
        long counter=0;
        rnd.reset();
        RecordCursor cursor=reader.getCursor();
        while (cursor.hasNext()) {
          Record record=cursor.next();
          Assert.assertEquals(rnd.nextChars(10),record.getFlyweightStr(0));
          Assert.assertEquals(rnd.nextChars(15),record.getFlyweightStr(1));
          counter++;
        }
        Assert.assertEquals(N,counter);
        writer.removeColumn("String_Node_Str");
        writer.addColumn("String_Node_Str",ColumnType.STRING);
        Assert.assertTrue(reader.reload());
        Assert.assertEquals(N,reader.size());
        rnd.reset();
        cursor.toTop();
        while (cursor.hasNext()) {
          Record record=cursor.next();
          Assert.assertEquals(rnd.nextChars(10),record.getFlyweightStr(0));
          rnd.nextChars(15);
          Assert.assertNull(record.getFlyweightStr(1));
          counter++;
        }
        Assert.assertEquals(N * 2,counter);
      }
     }
     Assert.assertTrue(ff.wasCalled());
  }
);
}