|
From: Daniel G. <go...@b1...> - 2009-11-08 16:14:46
|
On Saturday 07 November 2009 12:58:38 am Chris Frey wrote:
> Hi,
>
> In the opensync_archive_internals.h header, _save_ignored_conflict()
> is documented as such:
>
> /**
> * @brief Saves an entry in the ignored conflict list.
> *
> * @param archive The group archive
> * @param objtype Reported object type of entry
> * @param mappingid Mapping Entry ID of entry
That's correct.
> * @param changetype Changetype of entry
> * @param error Pointer to an error struct
> * @return Returns TRUE on success, FALSE otherwise
> */
> osync_bool osync_archive_save_ignored_conflict(OSyncArchive *archive, const
> char *objtype, long long int mappingid, OSyncChangeType changetype,
> OSyncError **error);
>
>
> In opensync_archive.c, it is implemented like this:
>
> osync_bool osync_archive_save_ignored_conflict(OSyncArchive *archive, const
> char *objtype, long long int id, OSyncChangeType changetype, OSyncError
> **error) {
> [...]
maybe we should sync this up with the other declaration and call it "mappingid".
>
> query = osync_strdup_printf("INSERT INTO tbl_changelog (objtype,
> entryid, changetype) VALUES('%s', '%lli', '%i')", escaped_objtype, id,
> changetype);
The tbl_changelog is indeed very confusing. There is one column left-over we
doesn't us at all: "id"
And the "entryid" is also very confusing.
>
> ...
>
>
> Isn't the entryid field used for the archive id's themselves, and not the
> mapping ids?
Not quite sure which ID you mean for "archive id".
FYI, the tbl_changelog is only used for handling "ignored" conflicts ...
tbl_changes is used to store the "mappings".
tbl_archive stores only the entire entries of a change when merger/demerge
gets used.
While looking into this i found a bug in OpenSync which broke the support
of "ignore conflicts". Which is hopefully fixed now with r5950
Here is a dump of the tbl_changes and tbl_changelog, which contains two
conflicts which got ignored. (I used for that a group with two file-sync members)
----8<----
BEGIN TRANSACTION;
CREATE TABLE tbl_changes (objtype VARCHAR(64) NOT NULL, id INTEGER PRIMARY KEY AUTOINCREMENT, uid VARCHAR NOT NULL, memberid INTEGER NOT NULL, mappingid INTEGER NOT NULL,
objengine VARCHAR(64) NOT NULL );
INSERT INTO "tbl_changes" VALUES('contact',67,'foo0',2,1,'contact');
INSERT INTO "tbl_changes" VALUES('contact',68,'foo3',2,2,'contact');
INSERT INTO "tbl_changes" VALUES('contact',69,'foo1',2,3,'contact');
INSERT INTO "tbl_changes" VALUES('contact',70,'test1.vcard',2,4,'contact');
INSERT INTO "tbl_changes" VALUES('contact',71,'foo5',2,5,'contact');
INSERT INTO "tbl_changes" VALUES('contact',72,'foo8',2,6,'contact');
INSERT INTO "tbl_changes" VALUES('contact',73,'foo4',2,7,'contact');
INSERT INTO "tbl_changes" VALUES('contact',74,'foo2',2,8,'contact');
INSERT INTO "tbl_changes" VALUES('contact',75,'foo6',2,9,'contact');
INSERT INTO "tbl_changes" VALUES('contact',76,'foo7',2,10,'contact');
INSERT INTO "tbl_changes" VALUES('contact',77,'foo9',2,11,'contact');
INSERT INTO "tbl_changes" VALUES('contact',78,'foo0',1,1,'contact');
INSERT INTO "tbl_changes" VALUES('contact',79,'foo3',1,2,'contact');
INSERT INTO "tbl_changes" VALUES('contact',80,'foo1',1,3,'contact');
INSERT INTO "tbl_changes" VALUES('contact',81,'test1.vcard',1,4,'contact');
INSERT INTO "tbl_changes" VALUES('contact',82,'foo5',1,5,'contact');
INSERT INTO "tbl_changes" VALUES('contact',84,'foo4',1,7,'contact');
INSERT INTO "tbl_changes" VALUES('contact',85,'foo2',1,8,'contact');
INSERT INTO "tbl_changes" VALUES('contact',86,'foo6',1,9,'contact');
INSERT INTO "tbl_changes" VALUES('contact',87,'foo7',1,10,'contact');
INSERT INTO "tbl_changes" VALUES('contact',88,'foo9',1,11,'contact');
COMMIT;
dgollub@marvin:~> sqlite3 .config/opensync/0.40/group1/archive.db ".dump tbl_changelog"
BEGIN TRANSACTION;
CREATE TABLE tbl_changelog (objtype VARCHAR(64), id INTEGER, entryid INTEGER, changetype INTEGER, PRIMARY KEY (objtype, id) );
INSERT INTO "tbl_changelog" VALUES('contact',NULL,4,4);
INSERT INTO "tbl_changelog" VALUES('contact',NULL,4,4);
INSERT INTO "tbl_changelog" VALUES('contact',NULL,6,4);
INSERT INTO "tbl_changelog" VALUES('contact',NULL,6,3);
COMMIT;
---->8---
(changetypes: 3 == deleted, 4 == modified)
And indeed this looks pretty strange - 4 tbl_changelog for 2 mappings ...
The information is missing which member was sending which changetype ...
I guess it should look like this:
----8<---
BEGIN TRANSACTION;
CREATE TABLE tbl_changelog (objtype VARCHAR(64) NOT NULL, memberid INTEGER NOT NULL, mappingid INTEGER NOT NULL, changetype INTEGER NOT NULL, PRIMARY KEY (objtype, memberid,
mappingid) );
INSERT INTO "tbl_changelog" VALUES('contact',1,4,4);
INSERT INTO "tbl_changelog" VALUES('contact',2,4,4);
INSERT INTO "tbl_changelog" VALUES('contact',1,6,4);
INSERT INTO "tbl_changelog" VALUES('contact',2,6,3);
COMMIT;
---->8---
Does this sound sane?
Does this address your question?
Best Regards,
Daniel
--
Daniel Gollub Geschaeftsfuehrer: Ralph Dehner
FOSS Developer Unternehmenssitz: Vohburg
B1 Systems GmbH Amtsgericht: Ingolstadt
Mobil: +49-(0)-160 47 73 970 Handelsregister: HRB 3537
EMail: go...@b1... http://www.b1-systems.de
Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg
http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D
|