anchor.diff:  % (in this case: decreasing the readlock count) should be applied to both dbs.
   -spec test_rdht_tx_read_commit_with_snap_1(any()) -> ok.
   test_rdht_tx_read_commit_with_snap_1(_) ->
  -    Db = ?TEST_DB:init_snapshot(?TEST_DB:new()),
  -    EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
  -    TmpDb = ?TEST_DB:set_entry(Db, db_entry:inc_readlock(EntryKey)),
  -    NewDb = ?TEST_DB:set_snapshot_entry(TmpDb, db_entry:inc_readlock(EntryKey)),
  +    Db = ?DB:init_snapshot(?DB:new()),
  +    EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
  +    TmpDb = ?DB:set_entry(Db, db_entry:inc_readlock(EntryKey)),
  +    NewDb = ?DB:set_snapshot_entry(TmpDb, db_entry:inc_readlock(EntryKey)),
       TLogEntry = tx_tlog:new_entry(?read, ?KEY("key"), 1, ?ok, 1, ?value, ?VALUE("val")),
       CommitDb = rdht_tx_read:commit(NewDb, TLogEntry, ?prepared, 1, 2),
  -    ?equals(?TEST_DB:get_snapshot_entry(CommitDb, ?KEY("key")),
  +    ?equals(?DB:get_snapshot_entry(CommitDb, ?KEY("key")),
               {true, EntryKey}), % no readlocks in snap db
  -    ?equals(?TEST_DB:get_entry2(CommitDb, ?KEY("key")),
  +    ?equals(?DB:get_entry2(CommitDb, ?KEY("key")),
               {true, EntryKey}), % no readlocks in live db
       ok.
   
  
positive.code: % -> "old" entries should be copied to the snapshot-db in copy-on-write fashion
  -spec test_rdht_tx_write_validate_db_copy(any()) -> ok.
  test_rdht_tx_write_validate_db_copy(_) ->
      Db = ?TEST_DB:init_snapshot(?TEST_DB:new()),
      EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
      Db = ?TEST_DB:set_entry(Db, EntryKey),
      TLogEntry = tx_tlog:new_entry(?write, ?KEY("key"), 1, ?ok, 1, ?value, ?VALUE("val")),
      {NewDb, _Vote} = rdht_tx_write:validate(Db, 1, TLogEntry),
      ?equals(?TEST_DB:get_snapshot_entry(NewDb, ?KEY("key")),
              {true, EntryKey}), % no lock in snap db
      ?equals(?TEST_DB:get_entry2(NewDb, ?KEY("key")),
              {true, db_entry:set_writelock(EntryKey, 1)}), % lock in live db
      ok.
  
  % for "old" transactions (as in TM snapnr 1 is lesser than local snapnr 2), changes should be applied to both dbs.
  -spec test_rdht_tx_write_commit_with_snap(any()) -> ok.
  test_rdht_tx_write_commit_with_snap(_) ->
      Db = ?TEST_DB:init_snapshot(?TEST_DB:new()),
      EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
      EntryKey_WL = db_entry:set_writelock(EntryKey, 1),
      TmpDb = ?TEST_DB:set_entry(Db, EntryKey_WL),
      NewDb = ?TEST_DB:set_snapshot_entry(TmpDb, EntryKey_WL),
      TLogEntry = tx_tlog:new_entry(?write, ?KEY("key"), 1, ?ok, 1, ?value, ?VALUE("val")),
      NewEntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 2),
      CommitDb = rdht_tx_write:commit(NewDb, TLogEntry, ?prepared, 1, 2),
      ?equals(?TEST_DB:get_snapshot_entry(CommitDb, ?KEY("key")),
              {true, NewEntryKey}), % no lock in snap db
      ?equals(?TEST_DB:get_entry2(CommitDb, ?KEY("key")),
              {true, NewEntryKey}), % no lock in live db
      ok.
  
  % "new" transaction -> changes only on live db, snapshot db remains untouched
  -spec test_rdht_tx_write_commit_without_snap(any()) -> ok.
  test_rdht_tx_write_commit_without_snap(_) ->
      Db = ?TEST_DB:init_snapshot(?TEST_DB:new()),
      EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
      EntryKey_WL = db_entry:set_writelock(EntryKey, 1),
      TmpDb = ?TEST_DB:set_entry(Db, EntryKey_WL),
      NewDb = ?TEST_DB:set_snapshot_entry(TmpDb, EntryKey_WL),
      TLogEntry = tx_tlog:new_entry(?write, ?KEY("key"), 1, ?ok, 2, ?value, ?VALUE("val")),
      NewEntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 2),
      CommitDb = rdht_tx_write:commit(NewDb, TLogEntry, ?prepared, 2, 2),
      ?equals(?TEST_DB:get_snapshot_entry(CommitDb, ?KEY("key")),
              {true, EntryKey_WL}), % lock in snap db
      ?equals(?TEST_DB:get_entry2(CommitDb, ?KEY("key")),
              {true, NewEntryKey}), % no lock in live db
      ok.
  
  % for "old" transactions (as in TM snapnr 1 is lesser than local snapnr 2), changes should be applied to both dbs.
  -spec test_rdht_tx_write_abort_with_snap(any()) -> ok.
  test_rdht_tx_write_abort_with_snap(_) ->
      Db = ?TEST_DB:init_snapshot(?TEST_DB:new()),
      EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
      EntryKey_WL = db_entry:set_writelock(EntryKey, 1),
      TmpDb = ?TEST_DB:set_entry(Db, EntryKey_WL),
      NewDb = ?TEST_DB:set_snapshot_entry(TmpDb, EntryKey_WL),
      ?equals(?TEST_DB:get_entry2(Db, ?KEY("key")), {true, EntryKey_WL}),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("key")), {true, EntryKey_WL}),
      TLogEntry = tx_tlog:new_entry(?write, ?KEY("key"), 1, ?ok, 1, ?value, ?VALUE("val")),
      CommitDb = rdht_tx_write:abort(NewDb, TLogEntry, ?prepared, 1, 2),
      ?equals(?TEST_DB:get_snapshot_entry(CommitDb, ?KEY("key")),
              {true, EntryKey}), % no lock in snap db
      ?equals(?TEST_DB:get_entry2(CommitDb, ?KEY("key")),
              {true, EntryKey}), % no lock in live db
      ok.
  
  % "new" transaction -> changes only on live db, snapshot db remains untouched
  -spec test_rdht_tx_write_abort_without_snap(any()) -> ok.
  test_rdht_tx_write_abort_without_snap(_) ->
      Db = ?TEST_DB:init_snapshot(?TEST_DB:new()),
      EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
      EntryKey_WL = db_entry:set_writelock(EntryKey, 1),
      TmpDb = ?TEST_DB:set_entry(Db, EntryKey_WL),
      NewDb = ?TEST_DB:set_snapshot_entry(TmpDb, EntryKey_WL),
      TLogEntry = tx_tlog:new_entry(?write, ?KEY("key"), 1, ?ok, 2, ?value, ?VALUE("val")),
      CommitDb = rdht_tx_write:abort(NewDb, TLogEntry, ?prepared, 1, 2),
      ?equals(?TEST_DB:get_snapshot_entry(CommitDb, ?KEY("key")),
              {true, EntryKey_WL}), % lock in snap db
      ?equals(?TEST_DB:get_entry2(CommitDb, ?KEY("key")),
              {true, EntryKey}), % no lock in live db
      ok.
  
  
negative.code: % snapshot number in entry equals local number -> prepared
  -spec test_rdht_tx_write_validate_should_prepare(any()) -> ok.
  test_rdht_tx_write_validate_should_prepare(_) ->
      Db = ?DB:init_snapshot(?DB:new()),
      Db = ?DB:set_entry(Db, db_entry:new(?KEY("key"), ?VALUE("val"), 1)),
      TLogEntry = tx_tlog:new_entry(?write, ?KEY("key"), 1, ?ok, 4711, ?value, ?VALUE("val")),
      {_NewDb, Vote} = rdht_tx_write:validate(Db, 4711, TLogEntry),
      ?equals(Vote, ?prepared),
  