# # # add_dir "tests/netsync_epoch_refinement" # # add_file "tests/netsync_epoch_refinement/__driver__.lua" # content [4ed9c46f6864a2c19cb69af2e4126bfe787d1c2c] # # patch "ChangeLog" # from [33ca0c0f24f73988cc4ebb3683b906f6906c0701] # to [87c45f5e99dd50bd0ccade6313ae6ec5119a680b] # # patch "netsync.cc" # from [a0fc2d152c269f9769c2f19998934d896cfc696c] # to [a2e6f5749099dc14731f60bc954e2d5cdd7bc91e] # # patch "testsuite.lua" # from [3b1872bd138323a7d1ec7cdab58ecf3fa99f448b] # to [a9ef25cfde676723ff1b16ed9ef694db9c84e9f2] # ============================================================ --- tests/netsync_epoch_refinement/__driver__.lua 4ed9c46f6864a2c19cb69af2e4126bfe787d1c2c +++ tests/netsync_epoch_refinement/__driver__.lua 4ed9c46f6864a2c19cb69af2e4126bfe787d1c2c @@ -0,0 +1,22 @@ +include("common/netsync.lua") +mtn_setup() +netsync.setup() + +-- If we already have epochs for branches we don't have any revisions for, +-- we might get sent those epochs. Make sure that our already having them +-- doesn't prevent us from noting that we received them. + +addfile("foo", "foo") +commit() +check(mtn("db", "set_epoch", "testbranch", string.rep("1234567890", 4))) +check(mtn2("db", "set_epoch", "testbranch", string.rep("1234567890", 4))) + +-- If we completely ignore the epoch (because we already have it), we'll +-- never notice that refinement is done. +srv = netsync.start() +cli = bg(mtn2("--rcfile=netsync.lua", "sy", srv.address, "testbranch"), 0, false, false) +check(cli:wait(20)) -- give it 20 seconds. +srv:stop() + +check(mtn("ls", "branches"), 0, true, false) +check(qgrep("testbranch", "stdout"), 0, false, false) ============================================================ --- ChangeLog 33ca0c0f24f73988cc4ebb3683b906f6906c0701 +++ ChangeLog 87c45f5e99dd50bd0ccade6313ae6ec5119a680b @@ -1,3 +1,11 @@ +2006-10-24 Timothy Brownawell + + Fix an epoch refinement bug. If we already have an epoch for a branch + we're receiving and don't have any revisions for, we will be re-sent + that epoch. There is code to ignore received items that we already + have. This code needs to call maybe_note_epochs_finished() for + epoch items. + 2006-10-24 Nathaniel Smith * cmd_automate.cc (automate stdio): Do not run randomly through ============================================================ --- netsync.cc a0fc2d152c269f9769c2f19998934d896cfc696c +++ netsync.cc a2e6f5749099dc14731f60bc954e2d5cdd7bc91e @@ -1820,6 +1820,8 @@ session::process_data_cmd(netcmd_item_ty if (data_exists(type, item)) { L(FL("%s '%s' already exists in our database") % typestr % hitem); + if (type == epoch_item) + maybe_note_epochs_finished(); return true; } ============================================================ --- testsuite.lua 3b1872bd138323a7d1ec7cdab58ecf3fa99f448b +++ testsuite.lua a9ef25cfde676723ff1b16ed9ef694db9c84e9f2 @@ -683,3 +683,4 @@ table.insert(tests, "multiple_message_co table.insert(tests, "ws_ops_with_wrong_node_type") table.insert(tests, "pivot_root_to_new_dir") table.insert(tests, "multiple_message_commit") +table.insert(tests, "netsync_epoch_refinement")