Fix key cmp and version next index

Also moved debugging code to a separate file to use from
bitcask_keydir.c