Program: 30784
Project: 30784
Buggy source:
private void testReplaceIndexedColWithUnindexed(int partitionBy,long increment,int expectedPartitionMin) throws Exception {
  TestUtils.assertMemoryLeak(() -> {
    final int M=1000;
    final int N=100;
    try (TableModel model=new TableModel(configuration,"String_Node_Str",partitionBy).col("String_Node_Str",ColumnType.STRING).col("String_Node_Str",ColumnType.SYMBOL).indexed(true,N / 4).col("String_Node_Str",ColumnType.INT).timestamp().col("String_Node_Str",ColumnType.SYMBOL).indexed(true,N / 4)){
      CairoTestUtils.create(model);
    }
     final Rnd rnd=new Rnd();
    final String symbols[]=new String[N];
    for (int i=0; i < N; i++) {
      symbols[i]=rnd.nextChars(8).toString();
    }
    long timestamp=0;
    try (TableWriter writer=new TableWriter(configuration,"String_Node_Str")){
      for (int i=0; i < M; i++) {
        TableWriter.Row row=writer.newRow(timestamp+=increment);
        row.putStr(0,rnd.nextChars(20));
        row.putSym(1,symbols[rnd.nextPositiveInt() % N]);
        row.putInt(2,rnd.nextInt());
        row.putSym(4,symbols[rnd.nextPositiveInt() % N]);
        row.append();
      }
      writer.commit();
      try (TableReader reader=new TableReader(configuration,"String_Node_Str")){
        final TableReaderDataFrameCursor cursor=new TableReaderDataFrameCursor();
        final TableReaderRecord record=new TableReaderRecord(reader);
        Assert.assertTrue(reader.getPartitionCount() > expectedPartitionMin);
        cursor.of(reader);
        assertSymbolFoundInIndex(cursor,record,1,M);
        cursor.toTop();
        assertSymbolFoundInIndex(cursor,record,4,M);
        writer.removeColumn("String_Node_Str");
        writer.addColumn("String_Node_Str",ColumnType.SYMBOL);
        for (int i=0; i < M; i++) {
          TableWriter.Row row=writer.newRow(timestamp+=increment);
          row.putStr(0,rnd.nextChars(20));
          row.putSym(1,symbols[rnd.nextPositiveInt() % N]);
          row.putInt(2,rnd.nextInt());
          row.putSym(4,symbols[rnd.nextPositiveInt() % N]);
          row.append();
        }
        writer.commit();
        Assert.assertTrue(reader.reload());
        cursor.reload();
        assertSymbolFoundInIndex(cursor,record,1,M * 2);
        cursor.toTop();
        assertNoIndex(cursor,4);
      }
     }
   }
);
}

Fixed version (ground truth):
private void testReplaceIndexedColWithUnindexed(int partitionBy,long increment,int expectedPartitionMin,boolean testRestricted) throws Exception {
  TestUtils.assertMemoryLeak(() -> {
    final int M=1000;
    final int N=100;
    try (TableModel model=new TableModel(configuration,"String_Node_Str",partitionBy).col("String_Node_Str",ColumnType.STRING).col("String_Node_Str",ColumnType.SYMBOL).indexed(true,N / 4).col("String_Node_Str",ColumnType.INT).timestamp().col("String_Node_Str",ColumnType.SYMBOL).indexed(true,N / 4)){
      CairoTestUtils.create(model);
    }
     final Rnd rnd=new Rnd();
    final String symbols[]=new String[N];
    for (int i=0; i < N; i++) {
      symbols[i]=rnd.nextChars(8).toString();
    }
    long timestamp=0;
    try (TableWriter writer=new TableWriter(configuration,"String_Node_Str")){
      for (int i=0; i < M; i++) {
        TableWriter.Row row=writer.newRow(timestamp+=increment);
        row.putStr(0,rnd.nextChars(20));
        row.putSym(1,symbols[rnd.nextPositiveInt() % N]);
        row.putInt(2,rnd.nextInt());
        row.putSym(4,symbols[rnd.nextPositiveInt() % N]);
        row.append();
      }
      writer.commit();
      try (TableReader reader=new TableReader(configuration,"String_Node_Str")){
        final TableReaderDataFrameCursor cursor=new TableReaderDataFrameCursor();
        final TableReaderRecord record=new TableReaderRecord(reader);
        Assert.assertTrue(reader.getPartitionCount() > expectedPartitionMin);
        cursor.of(reader);
        assertSymbolFoundInIndex(cursor,record,1,M);
        cursor.toTop();
        assertSymbolFoundInIndex(cursor,record,4,M);
        if (testRestricted || configuration.getFilesFacade().isRestrictedFileSystem()) {
          reader.closeColumnForRemove("String_Node_Str");
        }
        writer.removeColumn("String_Node_Str");
        writer.addColumn("String_Node_Str",ColumnType.SYMBOL);
        for (int i=0; i < M; i++) {
          TableWriter.Row row=writer.newRow(timestamp+=increment);
          row.putStr(0,rnd.nextChars(20));
          row.putSym(1,symbols[rnd.nextPositiveInt() % N]);
          row.putInt(2,rnd.nextInt());
          row.putSym(4,symbols[rnd.nextPositiveInt() % N]);
          row.append();
        }
        writer.commit();
        Assert.assertTrue(reader.reload());
        cursor.reload();
        assertSymbolFoundInIndex(cursor,record,1,M * 2);
        cursor.toTop();
        assertNoIndex(cursor);
      }
     }
   }
);
}