[Csync2] Working on database abstration layer and mysql support

Dennis Schafroth dennis at schafroth.dk
Mon Aug 30 08:12:50 CEST 2010


Two (now) known issue:

Filename column is too short, but this is due to the fact that mysql 5 only supports keys length of max 1000 bytes.

So the filename+peername must be below 333 UTF characters (since mysql looks at worst-case when generating the tables). 

Weird characters in filename cuts off the filename at the character. I have a danish letter (å encoded in iso-8859-1: \370) still present in my 
now UTF-8 filesystem names. 

Two regressions from the current trunk... :-(

cheers, 
:-Dennis

On 29/08/2010, at 22.36, Dennis Schafroth wrote:

> Hey,
> 
> Attached is a patch to a database abstraction. I have it running on two Fedora 13 and a OpenSUSE 11.3. It should be considered beta status, and I would like to get feed back on how it works for others set-ups (non production!). 
> <db_api.patch.gz>
> 
> 
> I have mostly tested using MySQL 5. I have done some minor testing on sqlite 3, and haven't seen any regression, but wont promise.
> 
> The SQL statements has been modified to a level so they work for these databases, but some more advanced SQL mapping  is prob. needed to support more.
> 
> DB API with support for:
> - sqlite 2 (not tested), sqlite 3 (somewhat tested), mysql 5  
> - New global configuration: database <file with database spec> containing one of: 
> 	- mysql://user:passwd@host:port/schema 
> 	- sqlite3://path/to/file
> 	- sqlite2://path/to/file
> - For testing the -a option can be used to give a similar database specification. 
> - No support for creating the database and tables in mysql 5. There is a ./sql/csync.sql for creating the tables where it uses UTF-8 binary character encoding, but this must be changed to match your file system setup and case (in)sensitive !!!  
> 
> I have done some changes in the autoconf / automake, in which I am no expert. 
> 
> mysql support is currently only enabled if you configure with --enable-mysql. 
> 
> For a mysql set-up: 
> 1) configure and built with mysql support
> 2) create a database as root/admin and grant access to your csync2 user. 
> 3) create the tables/indexes using the sql/csync2.sql (modified to your setup) 
> 4) create the database file spec file. 
> 5) add the global configuration:  database <database spec file> 
> 
> Should now be ready to test. 
> 
> Also included in the patch is a option for syslog logging (-l) and a change in backup strategy in the daemon. I prefer to create a identical directory tree in the backup, instead of the flat structure. 
> 
> cheers, 
> :-Dennis Schafroth
> 
> On 22/08/2010, at 21.51, Lars Ellenberg wrote:
> 
>> On Sat, Aug 21, 2010 at 11:05:27PM +0200, Dennis Schafroth wrote:
>>> Hey, 
>>> 
>>> I am working on a patch to introduce a simple database abstraction
>>> layer, so it will be easier to introduce alternative databases. I also
>>> have the a basic mysql version (almost) working, it has crashed on a
>>> OpenSuse box, but worked on my Fedora boxes.
>>> 
>>> If there are any brave volunteers, that wants to try, let me know. It
>>> wont be clean at the moment. 
>> 
>> Great.
>> Please post a unified diff against latest svn to this list.
>> Or, if you prefer, send it pm my way.
>> Or put it online as git/mercurial/whatever.
>> 
>> Thanks,
>> 
>> -- 
>> : Lars Ellenberg
>> : LINBIT | Your Way to High Availability
>> : DRBD/HA support and consulting http://www.linbit.com
>> 
>> DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
>> _______________________________________________
>> Csync2 mailing list
>> Csync2 at lists.linbit.com
>> http://lists.linbit.com/mailman/listinfo/csync2
>> 
> _______________________________________________
> Csync2 mailing list
> Csync2 at lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/csync2

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/csync2/attachments/20100830/5a7b882a/attachment.htm>


More information about the Csync2 mailing list