Replace FullSync algorithm and fix bugs to lower delay and overhead
1) During high update frequency PSync nodes can send data that contain
nothing new. This blocks the receiver nodes from syncing leading to
high delays. To fix this, Sync interests now include the cumulative number
of elements inserted into the IBF. This is used as an heuristic to guide
PSync on decode failures to minimize the chance of sending of such data
packets. Sync data freshness for entire dataset is also reduced.
If a no new update still happens, introduce some safeguards in the code.
2) Fast reaction upon negative set being detected is introduced. Timed
processing for interests is also introduced.
3) Fix satisfyPendingInterests to send the new update on publish even if
pending IBF decode fails, since we have something to send.
4) For interests which request segments, only respond with segments already contained
in in-memory storage.
refs: [solution II] in Thesis:
"Improvements to PSync: Distributed Full Dataset Synchronization
in Named-Data Networking"
https://digitalcommons.memphis.edu/cgi/viewcontent.cgi?article=3162&context=etd
Change-Id: Ie235b4fb56fcb7de21068511205e407006292b23
diff --git a/tests/test-full-sync.cpp b/tests/test-full-sync.cpp
index c483d89..ff25728 100644
--- a/tests/test-full-sync.cpp
+++ b/tests/test-full-sync.cpp
@@ -297,7 +297,7 @@
nodes[i]->publishName(userPrefixes[i]);
}
- advanceClocks(10_ms, 100);
+ advanceClocks(100_ms, 100);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
BOOST_CHECK_EQUAL(nodes[i]->getSeqNo(userPrefixes[j]).value_or(NOT_EXIST), 1);
@@ -308,7 +308,7 @@
nodes[i]->publishName(userPrefixes[i], 4);
}
- advanceClocks(10_ms, 100);
+ advanceClocks(100_ms, 100);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
BOOST_CHECK_EQUAL(nodes[i]->getSeqNo(userPrefixes[j]).value_or(NOT_EXIST), 4);
@@ -464,55 +464,6 @@
});
}
-BOOST_AUTO_TEST_CASE(DelayedSecondSegment)
-{
- addNode(0);
-
- int i = 0;
- detail::State state;
- std::shared_ptr<ndn::Buffer> compressed;
- do {
- auto prefixToPublish = makeSubPrefix(0, i++);
- nodes[0]->addUserNode(prefixToPublish);
- nodes[0]->publishName(prefixToPublish);
-
- state.addContent(Name(prefixToPublish).appendNumber(nodes[0]->m_prefixes[prefixToPublish]));
-
- auto block = state.wireEncode();
- compressed = detail::compress(nodes[0]->m_contentCompression, block);
- } while (compressed->size() < (ndn::MAX_NDN_PACKET_SIZE >> 1));
-
- advanceClocks(10_ms, 100);
-
- Name syncInterestName(syncPrefix);
- detail::IBLT iblt(40, nodes[0]->m_ibltCompression);
- iblt.appendToName(syncInterestName);
-
- nodes[0]->onSyncInterest(syncPrefix, Interest(syncInterestName));
-
- advanceClocks(10_ms);
-
- BOOST_CHECK_EQUAL(nodes[0]->m_segmentPublisher.m_ims.size(), 2);
- // Expire contents from segmentPublisher
- advanceClocks(10_ms, 100);
- BOOST_CHECK_EQUAL(nodes[0]->m_segmentPublisher.m_ims.size(), 0);
-
- // Get data name from face and increase segment number to form next interest
- BOOST_REQUIRE(!faces[0]->sentData.empty());
- Name dataName = faces[0]->sentData.front().getName();
- Name interestName = dataName.getPrefix(-1).appendSegment(1);
- faces[0]->sentData.clear();
-
- nodes[0]->onSyncInterest(syncPrefix, Interest(interestName));
- advanceClocks(10_ms);
-
- // Should have repopulated SegmentPublisher
- BOOST_CHECK_EQUAL(nodes[0]->m_segmentPublisher.m_ims.size(), 2);
- // Should have received the second data segment this time
- BOOST_REQUIRE(!faces[0]->sentData.empty());
- BOOST_CHECK_EQUAL(faces[0]->sentData.front().getName().at(-1).toSegment(), 1);
-}
-
BOOST_AUTO_TEST_SUITE_END()
} // namespace psync::tests