On Thu, 2011-09-15 at 09:32 +0200, Patrick Ohly wrote:
> There's one more minor issue: in server mode, when an Add command
> results in modifying an existing item, the statistics say that the item
> was added. That means that the numbers do not add up, because "items
> before sync + added items != items after sync".
>
> I'm seeing it with DB_Conflict, but I think it'll also occur with
> DB_DataReplaced/Merged.
>
> The point where the statistics are changes is in
> TLocalEngineDS::engProcessRemoteItemAsServer():
>
> // add allowed
> ===> fLocalItemsAdded++;
> #ifdef OBJECT_FILTERING
> // test if acceptable
> if (!isAcceptable(aSyncItemP,aStatusCommand)) { ok=false; break; } //
> cannot be accepted
> // Note: making item to pass sync set filter is implemented in
> derived DB implementation
> // as criteria for passing might be in data that must first be read
> from the DB
> #endif
> remainsvisible=true; // should remain visible
> ok=logicProcessRemoteItem(aSyncItemP,aStatusCommand,remainsvisible);
> // add to local database NOW
>
> What would be the right fix for this? Add another retval to
> logicProcessRemoteItem() which tells the caller whether an add was
> turned into an update? Or change the return value from bool to an enum?
None of these options seemed very attractive, because they are so
intrusive. How about the attached patch instead? Its purely local to the
409 handling code.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
>From 87b76b0098a884c7ab7a50d1910e928e83af12cc Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Fri, 30 Sep 2011 11:56:28 +0200
Subject: [PATCH 3/3] DB_Conflict (409): correctly count updated and unmodified items
TLocalEngineDS::engProcessRemoteItemAsServer() in localengineds.cpp
counts Add commands as "added items", even if later on a 409 DB result
causes the item to be updated or be left unmodified.
Instead changing the whole statistics logic, this patch merely fixes
the statistics locally in the 409 handling code.
---
src/sysync/customimplds.cpp | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/sysync/customimplds.cpp b/src/sysync/customimplds.cpp
index b30bc17..338f4d9 100755
--- a/src/sysync/customimplds.cpp
+++ b/src/sysync/customimplds.cpp
@@ -2874,7 +2874,18 @@ bool TCustomImplDS::implProcessItem(
else
sta = LOCERR_OK;
// in server case, further process like backend merge (but no need to fetch again, we just keep augmentedItemP)
- if (IS_SERVER && sta==LOCERR_OK) sta = DB_DataMerged;
+ if (IS_SERVER && sta==LOCERR_OK) {
+ // TLocalEngineDS::engProcessRemoteItemAsServer() in
+ // localengineds.cpp already counted the item as added
+ // because it didn't know that special handling would be
+ // needed. Instead of a complicated mechanism to report
+ // back the actual outcome, let's fix the statistics
+ // here.
+ fLocalItemsAdded--;
+ if (changedDBVersion)
+ fLocalItemsUpdated++;
+ sta = DB_DataMerged;
+ }
}
}
if (IS_SERVER) {
--
1.7.2.5
_______________________________________________
os-libsynthesis mailing list
[email protected]
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis