Re: [sqlite] Multi-master replication with updated Ver sioning extension

2009-07-31 Thread Alexey Pechnikov
Hello!

On Thursday 30 July 2009 18:17:45 Jim Showalter wrote:
> MD5 hashes can still collide. How does this implementation deal with 
> hash collisions?

Now it is possible to use any hash function:

-- first column is unique key
select versioning('arg1','sessions');
-- use md5 hash of all fields
select versioning('md5','sessions');

Note: function arg1() is coded in versioning extension.
select arg1('a');
a
select arg1('a','b','c');
a

When you will define sha256 function (as example) you can do
select versioning('sha256','sessions');

Thanks for you comment.

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Multi-master replication with updated Ver sioning extension

2009-07-30 Thread Alexey Pechnikov
Hello!

On Thursday 30 July 2009 19:47:39 Jay A. Kreibich wrote:
>   Then again, given that ROWID values are signed 64 bit values, you
>   could just start each master at some offset (like +0x00FF)
>   and not worry about it.  It would still be a good idea to force all
>   the tables into an AUTOINCREMENT mode somehow.

I'm not agree. I did use this but it is "manual replication". Before start 
replication
databases may be copied from prototype database as files and so they are binary 
equal.
And for replication between different versions of the database you way doesn't 
work.

UUID is really unique key for multi-master replication.
SQLite extension is available by link http://mobigroup.ru/files/sqlite-ext/uuid/
Hash of record may be used as pseudo-UUID for some tables.

>   PRAGMA request: http://www.sqlite.org/cvstrac/tktview?tn=4002

This is bad because ROWID without explicit field is not persistant and may 
change 
after dump/restore. Please see illustration of the problem:

sqlite> create table test(a);
sqlite> insert into test values(1);
sqlite> insert into test values(2);
sqlite> insert into test values(3);
sqlite> select rowid,* from test;
1|1
2|2
3|3
sqlite> delete from test where rowid=2;
sqlite> .dump test
BEGIN TRANSACTION;
CREATE TABLE test(a);
INSERT INTO "test" VALUES(1);
INSERT INTO "test" VALUES(3);
COMMIT;
sqlite> drop table test;
sqlite> BEGIN TRANSACTION;
sqlite> CREATE TABLE test(a);
sqlite> INSERT INTO "test" VALUES(1);
sqlite> INSERT INTO "test" VALUES(3);
sqlite> COMMIT;
sqlite> select rowid,* from test;
1|1
2|3

As you can see now ROWID=2 is correspond to field value 3 and it's wrong.

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Multi-master replication with updated Ver sioning extension

2009-07-30 Thread Alexey Pechnikov
Hello!

On Thursday 30 July 2009 18:17:45 Jim Showalter wrote:
> MD5 hashes can still collide. How does this implementation deal with 
> hash collisions?

You may use any other hash (sha256 as example). But I think md5 collisions is 
not 
the problem for common applications. 

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users