Program: 154589
Project: 154589
Buggy source:
@Test public void testApplyLogicalLog() throws Exception {
  ds.keepLogicalLogs(true);
  Xid xid=new XidImpl(new byte[1],new byte[1]);
  XAResource xaRes=xaCon.getXaResource();
  xaRes.start(xid,XAResource.TMNOFLAGS);
  int node1=ds.nextId(Node.class);
  xaCon.getNodeConsumer().createNode(node1);
  int node2=ds.nextId(Node.class);
  xaCon.getNodeConsumer().createNode(node2);
  int n1prop1=ds.nextId(PropertyStore.class);
  xaCon.getNodeConsumer().addProperty(node1,n1prop1,index("String_Node_Str"),"String_Node_Str");
  xaCon.getNodeConsumer().getProperties(node1,false);
  int relType1=ds.nextId(RelationshipType.class);
  xaCon.getRelationshipTypeConsumer().addRelationshipType(relType1,"String_Node_Str");
  int rel1=ds.nextId(Relationship.class);
  xaCon.getRelationshipConsumer().createRelationship(rel1,node1,node2,relType1);
  int r1prop1=ds.nextId(PropertyStore.class);
  xaCon.getRelationshipConsumer().addProperty(rel1,r1prop1,index("String_Node_Str"),"String_Node_Str");
  xaCon.getNodeConsumer().changeProperty(node1,n1prop1,"String_Node_Str");
  xaCon.getRelationshipConsumer().changeProperty(rel1,r1prop1,"String_Node_Str");
  xaCon.getNodeConsumer().removeProperty(node1,n1prop1);
  xaCon.getRelationshipConsumer().removeProperty(rel1,r1prop1);
  xaCon.getRelationshipConsumer().deleteRelationship(rel1);
  xaCon.getNodeConsumer().deleteNode(node1);
  xaCon.getNodeConsumer().deleteNode(node2);
  xaRes.end(xid,XAResource.TMSUCCESS);
  xaRes.commit(xid,true);
  long currentVersion=ds.getCurrentLogVersion();
  ds.keepLogicalLogs(true);
  ds.rotateLogicalLog();
  ds.rotateLogicalLog();
  ds.rotateLogicalLog();
  ds.setCurrentLogVersion(currentVersion);
  ds.setCommittedTxId(0);
  ds.makeBackupSlave();
  ds.applyLog(ds.getLogicalLog(currentVersion));
  ds.applyLog(ds.getLogicalLog(currentVersion + 1));
  ds.applyLog(ds.getLogicalLog(currentVersion + 2));
  ds.keepLogicalLogs(false);
}

Fixed version (ground truth):
@Test public void testApplyLogicalLog() throws Exception {
  ds.keepLogicalLogs(true);
  Xid xid=new XidImpl(new byte[1],new byte[1]);
  XAResource xaRes=xaCon.getXaResource();
  xaRes.start(xid,XAResource.TMNOFLAGS);
  int node1=ds.nextId(Node.class);
  xaCon.getNodeConsumer().createNode(node1);
  int node2=ds.nextId(Node.class);
  xaCon.getNodeConsumer().createNode(node2);
  int n1prop1=ds.nextId(PropertyStore.class);
  xaCon.getNodeConsumer().addProperty(node1,n1prop1,index("String_Node_Str"),"String_Node_Str");
  xaCon.getNodeConsumer().getProperties(node1,false);
  int relType1=ds.nextId(RelationshipType.class);
  xaCon.getRelationshipTypeConsumer().addRelationshipType(relType1,"String_Node_Str");
  int rel1=ds.nextId(Relationship.class);
  xaCon.getRelationshipConsumer().createRelationship(rel1,node1,node2,relType1);
  int r1prop1=ds.nextId(PropertyStore.class);
  xaCon.getRelationshipConsumer().addProperty(rel1,r1prop1,index("String_Node_Str"),"String_Node_Str");
  xaCon.getNodeConsumer().changeProperty(node1,n1prop1,"String_Node_Str");
  xaCon.getRelationshipConsumer().changeProperty(rel1,r1prop1,"String_Node_Str");
  xaCon.getNodeConsumer().removeProperty(node1,n1prop1);
  xaCon.getRelationshipConsumer().removeProperty(rel1,r1prop1);
  xaCon.getRelationshipConsumer().deleteRelationship(rel1);
  xaCon.getNodeConsumer().deleteNode(node1);
  xaCon.getNodeConsumer().deleteNode(node2);
  xaRes.end(xid,XAResource.TMSUCCESS);
  xaRes.commit(xid,true);
  long currentVersion=ds.getCurrentLogVersion();
  ds.keepLogicalLogs(true);
  ds.rotateLogicalLog();
  ds.rotateLogicalLog();
  ds.rotateLogicalLog();
  ds.setCurrentLogVersion(currentVersion);
  ds.setLastCommittedTxId(0);
  ds.makeBackupSlave();
  ds.applyLog(ds.getLogicalLog(currentVersion));
  ds.applyLog(ds.getLogicalLog(currentVersion + 1));
  ds.applyLog(ds.getLogicalLog(currentVersion + 2));
  ds.keepLogicalLogs(false);
}