@Override public boolean visitRelationshipCommand(Command.RelationshipCommand command) throws IOException { long id = channel.getLong(); byte inUseFlag = channel.get(); boolean inUse = false; if ((inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue()) { inUse = true; } else if ((inUseFlag & Record.IN_USE.byteValue()) != Record.NOT_IN_USE.byteValue()) { throw new IOException("Illegal in use flag: " + inUseFlag); } RelationshipRecord record; if (inUse) { record = new RelationshipRecord(id, channel.getLong(), channel.getLong(), channel.getInt()); record.setInUse(inUse); record.setFirstPrevRel(channel.getLong()); record.setFirstNextRel(channel.getLong()); record.setSecondPrevRel(channel.getLong()); record.setSecondNextRel(channel.getLong()); record.setNextProp(channel.getLong()); /* * Logs for version 2.0 do not contain the proper values for the following two flags. Also, * the defaults won't do, because the pointers for prev in the fist record will not be interpreted * properly. So we need to set the flags explicitly here. * * Note that this leaves the prev field for the first record in the chain having a value of -1, * which is not correct, as it should contain the relationship count instead. However, we cannot * determine this value from the contents of the log alone. */ record.setFirstInFirstChain( record.getFirstPrevRel() == Record.NO_PREV_RELATIONSHIP.intValue()); record.setFirstInSecondChain( record.getSecondPrevRel() == Record.NO_PREV_RELATIONSHIP.intValue()); } else { record = new RelationshipRecord(id, -1, -1, -1); record.setInUse(false); } command.init(record); return false; }