Program: 15947
Project: 15947
Buggy source:
private void testCase() throws Exception {
  FileUtils.delete(fileName);
  MVStore s;
  MVMap<Integer,byte[]> m;
  s=new MVStore.Builder().fileName(fileName).pageSplitSize(50).writeDelay(0).open();
  m=s.openMap("String_Node_Str");
  Random r=new Random(seed);
  op=0;
  int size=getSize(10,100);
  TreeMap<Integer,byte[]> map=new TreeMap<Integer,byte[]>();
  for (; op < size; op++) {
    int k=r.nextInt(100);
    byte[] v=new byte[r.nextInt(10) * 10];
    int type=r.nextInt(11);
switch (type) {
case 0:
case 1:
case 2:
case 3:
      log(op,k,v,"String_Node_Str");
    m.put(k,v);
  map.put(k,v);
break;
case 4:
case 5:
log(op,k,v,"String_Node_Str");
m.remove(k);
map.remove(k);
break;
case 6:
log(op,k,v,"String_Node_Str");
s.store();
break;
case 7:
log(op,k,v,"String_Node_Str");
s.compact(80);
break;
case 8:
log(op,k,v,"String_Node_Str");
m.clear();
map.clear();
break;
case 9:
log(op,k,v,"String_Node_Str");
s.commit();
break;
case 10:
log(op,k,v,"String_Node_Str");
s.commit();
s.close();
s=new MVStore.Builder().fileName(fileName).pageSplitSize(50).writeDelay(0).open();
m=s.openMap("String_Node_Str");
break;
}
assertEqualsMapValues(map.get(k),m.get(k));
assertEquals(map.ceilingKey(k),m.ceilingKey(k));
assertEquals(map.floorKey(k),m.floorKey(k));
assertEquals(map.higherKey(k),m.higherKey(k));
assertEquals(map.lowerKey(k),m.lowerKey(k));
assertEquals(map.isEmpty(),m.isEmpty());
if (map.size() != m.size()) {
assertEquals(map.size(),m.size());
}
}
s.store();
s.close();
}

Fixed version (ground truth):
private void testCase() throws Exception {
  FileUtils.delete(fileName);
  MVStore s;
  s=new MVStore.Builder().fileName(fileName).pageSplitSize(50).writeDelay(0).open();
  MVMap<Integer,byte[]> m;
  if (concurrent) {
    m=s.openMap("String_Node_Str",new MVMapConcurrent.Builder<Integer,byte[]>());
  }
 else {
    m=s.openMap("String_Node_Str");
  }
  Random r=new Random(seed);
  op=0;
  int size=getSize(100,1000);
  TreeMap<Integer,byte[]> map=new TreeMap<Integer,byte[]>();
  for (; op < size; op++) {
    int k=r.nextInt(100);
    byte[] v=new byte[r.nextInt(10) * 10];
    int type=r.nextInt(13);
switch (type) {
case 0:
case 1:
case 2:
case 3:
      log(op,k,v,"String_Node_Str");
    m.put(k,v);
  map.put(k,v);
break;
case 4:
case 5:
log(op,k,v,"String_Node_Str");
m.remove(k);
map.remove(k);
break;
case 6:
log(op,k,v,"String_Node_Str");
s.store();
break;
case 7:
log(op,k,v,"String_Node_Str");
s.compact(90);
break;
case 8:
log(op,k,v,"String_Node_Str");
m.clear();
map.clear();
break;
case 9:
log(op,k,v,"String_Node_Str");
s.commit();
break;
case 10:
log(op,k,v,"String_Node_Str");
s.commit();
s.close();
s=new MVStore.Builder().fileName(fileName).pageSplitSize(50).writeDelay(0).open();
m=s.openMap("String_Node_Str");
break;
case 11:
log(op,k,v,"String_Node_Str");
s.commit();
s.compactMoveChunks();
break;
case 12:
log(op,k,v,"String_Node_Str");
ArrayList<Integer> keyList=new ArrayList<Integer>(map.keySet());
int index=Collections.binarySearch(keyList,k,null);
int index2=(int)m.getKeyIndex(k);
assertEquals(index,index2);
if (index >= 0) {
int k2=m.getKey(index);
assertEquals(k2,k);
}
break;
}
assertEqualsMapValues(map.get(k),m.get(k));
assertEquals(map.ceilingKey(k),m.ceilingKey(k));
assertEquals(map.floorKey(k),m.floorKey(k));
assertEquals(map.higherKey(k),m.higherKey(k));
assertEquals(map.lowerKey(k),m.lowerKey(k));
assertEquals(map.isEmpty(),m.isEmpty());
assertEquals(map.size(),m.size());
if (!map.isEmpty()) {
assertEquals(map.firstKey(),m.firstKey());
assertEquals(map.lastKey(),m.lastKey());
}
}
s.store();
s.close();
}