anchor.diff:  % -> "old" entries should be copied to the snapshot-db in copy-on-write fashion
   -spec test_rdht_tx_read_validate_db_copy(any()) -> ok.
   test_rdht_tx_read_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),
  +    Db = ?DB:init_snapshot(?DB:new()),
  +    EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 1),
  +    Db = ?DB:set_entry(Db, EntryKey),
       TLogEntry = tx_tlog:new_entry(?read, ?KEY("key"), 2, ?ok, 1, ?value, ?VALUE("new_val")),
       {NewDb, _Vote} = rdht_tx_read:validate(Db, 1, TLogEntry),
  -    ?equals(?TEST_DB:get_snapshot_entry(NewDb, ?KEY("key")),
  +    ?equals(?DB:get_snapshot_entry(NewDb, ?KEY("key")),
               {true, EntryKey}), % no readlocks in snap db
  -    ?equals(?TEST_DB:get_entry2(NewDb, ?KEY("key")),
  +    ?equals(?DB:get_entry2(NewDb, ?KEY("key")),
               {true, db_entry:inc_readlock(EntryKey)}), % 1 readlock in live db
       ok.
   
  
positive.code: 
  -spec test_copy_value_to_snapshot_table(any()) -> ok.
  test_copy_value_to_snapshot_table(_Config) ->
      InitDb = ?TEST_DB:new(),
      Db = ?TEST_DB:init_snapshot(InitDb),
      EntryFoo = db_entry:new(?KEY("foo"), ?VALUE("bar"), 0),
      Db = ?TEST_DB:set_entry(Db, EntryFoo),
      Db = ?TEST_DB:set_entry(Db, db_entry:new(?KEY("key"), ?VALUE("val"), 1)),
      Db = ?TEST_DB:set_entry(Db, db_entry:new(?KEY("123"), ?VALUE("456"), 0)),
      Db = ?TEST_DB:copy_value_to_snapshot_table(Db, ?KEY("foo")),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("key")), {false, db_entry:new(?KEY("key"))}),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("123")), {false, db_entry:new(?KEY("123"))}),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("bar")), {false, db_entry:new(?KEY("bar"))}),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("foo")), {true, EntryFoo}),
      ok.
  
  -spec test_set_get_for_snapshot_table(any()) -> ok.
  test_set_get_for_snapshot_table(_Config) ->
      InitDb = ?TEST_DB:new(),
      Db = ?TEST_DB:init_snapshot(InitDb),
      EntryFoo = db_entry:new(?KEY("foo"), ?VALUE("bar"), 5),
      Db = ?TEST_DB:set_snapshot_entry(Db, EntryFoo),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("key")), {false, db_entry:new(?KEY("key"))}),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("foo")), {true, EntryFoo}),
      ok.
  
  -spec test_delete_from_snapshot_table(any()) -> ok.
  test_delete_from_snapshot_table(_Config) ->
      InitDb = ?TEST_DB:new(),
      Db = ?TEST_DB:init_snapshot(InitDb),
      EntryFoo = db_entry:new(?KEY("foo"), ?VALUE("bar"), 5),
      Db = ?TEST_DB:set_snapshot_entry(Db, EntryFoo),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("foo")), {true, EntryFoo}),
      Db = ?TEST_DB:delete_snapshot_entry(Db, db_entry:new(?KEY("foo"), ?VALUE("some_val"), 4711)),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("foo")), {false, db_entry:new(?KEY("foo"))}),
      Db = ?TEST_DB:set_snapshot_entry(Db, EntryFoo),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("foo")), {true, EntryFoo}),
      Db = ?TEST_DB:delete_snapshot_entry_at_key(Db, ?KEY("foo")),
      ?equals(?TEST_DB:get_snapshot_entry(Db, ?KEY("foo")), {false, db_entry:new(?KEY("foo"))}),
      ok.
  
  -spec test_init_snapshot(any()) -> ok.
  test_init_snapshot(_Config) ->
      InitDb = ?TEST_DB:new(),
      Db = ?TEST_DB:init_snapshot(InitDb),
      Db = ?TEST_DB:set_snapshot_entry(Db, db_entry:new(?KEY("foo"), ?VALUE("bar"), 5)),
      EntryKey = db_entry:new(?KEY("key"), ?VALUE("val"), 4711),
      Db = ?TEST_DB:set_entry(Db, EntryKey),
      Db = ?TEST_DB:copy_value_to_snapshot_table(Db, ?KEY("key")),
      ClearDb = ?TEST_DB:init_snapshot(Db),
      ?equals(?TEST_DB:get_snapshot_entry(ClearDb, ?KEY("foo")), {false, db_entry:new(?KEY("foo"))}),
      ?equals(?TEST_DB:get_snapshot_entry(ClearDb, ?KEY("key")), {false, db_entry:new(?KEY("key"))}),
      ?equals(?TEST_DB:get_entry2(ClearDb, ?KEY("key")), {true, EntryKey}),
      ClearDb = ?TEST_DB:copy_value_to_snapshot_table(ClearDb, ?KEY("key")),
      ?equals(?TEST_DB:get_snapshot_entry(ClearDb, ?KEY("key")), {true, EntryKey}),
      ok.
  
  -spec test_delete_snapshot(any()) -> ok.
  test_delete_snapshot(_) ->
      InitDb = ?TEST_DB:new(),
      Db = ?TEST_DB:init_snapshot(InitDb),
      Db = ?TEST_DB:set_snapshot_entry(Db, db_entry:new(?KEY("foo"), ?VALUE("bar"), 5)),
      DelDb = ?TEST_DB:delete_snapshot(Db),
      ?equals(?TEST_DB:snapshot_is_running(DelDb), false),
      ok.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
negative.code: % snapshot number in entry equals local number -> prepared
  -spec test_rdht_tx_read_validate_should_prepare(any()) -> ok.
  test_rdht_tx_read_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(?read, ?KEY("key"), 1, ?ok, 4711, ?value, ?VALUE("new_val")),
      {_NewDb, Vote} = rdht_tx_read:validate(Db, 4711, TLogEntry),
      ?equals(Vote, ?prepared),
  