BUG: handling of the transaction log was totally wrong, though easily solved
diff --git a/log4cxx.properties b/log4cxx.properties
index ccf24a6..e89f3b0 100644
--- a/log4cxx.properties
+++ b/log4cxx.properties
@@ -8,9 +8,11 @@
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.target=System.err
#log4j.appender.A1.layout.ConversionPattern=%d{dd-MMM HH:MM:SS,SSS} %p %c %m%n
-log4j.appender.A1.layout.ConversionPattern=%d{h:m:s,SSS} %t %-10c{1} %m%n
+log4j.appender.A1.layout.ConversionPattern=%d{hh:mm:ss,SSS} %-14t %-10c{1} %m%n
log4j.logger.SyncLogic = TRACE
+log4j.logger.AppDataFetch = TRACE
+log4j.logger.Test = TRACE
#log4j.logger.bgpparser=TRACE
#log4j.logger.bgpparser.AttributeType=ERROR
#log4j.logger.bgpparser.MRTCommonHeader=ERROR
diff --git a/model/sync-app-data-fetch.cc b/model/sync-app-data-fetch.cc
index 4cf22a3..b3bf362 100644
--- a/model/sync-app-data-fetch.cc
+++ b/model/sync-app-data-fetch.cc
@@ -21,6 +21,7 @@
*/
#include "sync-app-data-fetch.h"
+#include "sync-log.h"
using namespace std;
using namespace boost;
@@ -28,9 +29,13 @@
namespace Sync
{
+INIT_LOGGER ("AppDataFetch");
+
void
AppDataFetch::onUpdate (const std::string &prefix, const SeqNo &newSeq, const SeqNo &oldSeq)
{
+ _LOG_FUNCTION (this << ", " << prefix << ", " << newSeq << ", " << oldSeq);
+
// sequence number logic here
uint32_t start = 0;
if (oldSeq.isValid ())
@@ -54,6 +59,8 @@
void
AppDataFetch::onRemove (const std::string &prefix)
{
+ _LOG_FUNCTION (this << ", " << prefix);
+
// I guess this should be somewhere in app
}
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 088f8e3..2134256 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -284,7 +284,7 @@
}
m_log.erase (m_state.getDigest()); // remove diff state with the same digest. next pointers are still valid
/// @todo Optimization
- m_log.insert (diffLog);
+ m_log.get<sequenced> ().push_front (diffLog);
_LOG_DEBUG (*diffLog->getDigest () << " " << m_log.size ());
}
diff --git a/test/test_app_socket.cc b/test/test_app_socket.cc
index 4773c36..bf7db83 100644
--- a/test/test_app_socket.cc
+++ b/test/test_app_socket.cc
@@ -38,12 +38,13 @@
using namespace std;
using namespace boost;
-INIT_LOGGER ("Test::AppSocket");
+INIT_LOGGER ("Test.AppSocket");
class TestSocketApp {
public:
map<string, string> data;
void set(string str1, string str2) {
+ _LOG_FUNCTION (this << ", " << str1);
data.insert(make_pair(str1, str2));
// cout << str1 << ", " << str2 << endl;
}
@@ -102,13 +103,14 @@
s1.publish (p1, 0, data1, 10);
_LOG_DEBUG ("s1 publish");
s1.publish (p1, 0, data2, 10);
- this_thread::sleep (posix_time::milliseconds (1000));
-
+ this_thread::sleep (posix_time::milliseconds (100));
+
+ _LOG_DEBUG ("testing");
// // // from code logic, we won't be fetching our own data
- // a1.set(p1 + "/0/1", data1);
- // a1.set(p1 + "/0/2", data2);
- // BOOST_CHECK_EQUAL(a1.toString(), a2.toString());
- // // BOOST_CHECK_EQUAL(a2.toString(), a3.toString());
+ a1.set(p1 + "/0/1", data1);
+ a1.set(p1 + "/0/2", data2);
+ BOOST_CHECK_EQUAL(a1.toString(), a2.toString());
+ BOOST_CHECK_EQUAL(a2.toString(), a3.toString());
// // another single source
// // string data3 = "You surf the Internet, I surf the real world";