Ok, Then let me explain my problem to see if I done the best solution!

I have an replication system using sqlite where:
- I have 2 databases: one for output* and other for input*;
- I have 2 process accessing booth:
 The first is the replicator:
     - Get the data on server and write on input database;
     - Get the data on output database and write on server;
 The second process:
     - Read the input database;
     - Write on output database;

And I have triggers and tables to control what data has to be sync;

The problem, I guess solved today, is:
The replicator before open a single connection attaching booth of databases,
then when the replicator commits transactions that are writing only in input 
database and the 
second process try to write on output database the second process receive a 
database locked error,
then after that I have to close and open again the database;

To solve this I done two connection to databases on replicator:
One only for input database that only receive data;
And the other for output database attaching input database (to make some joins);

The point is.

I tried to make the output connection readonly to ensure that.
But that don't works.

Other question:

When the replicator is sending data to the server they acquire read lock on 
output database,
then the second process has some delay trying to acquire write lock on output 
database, there are some way to make 
this delay gone? Making the read process read the data writed until begin of 
read?

Thats it, thanks for patience.

Regards,

--
Israel Lins Albuquerque

Antes de imprimir, pense em sua responsabilidade com o MEIO AMBIENTE.



Em 26/06/2013, às 14:24, Israel Lins Albuquerque <israelin...@yahoo.com.br> 
escreveu:

> I open an database twice times in same process and same thread one in 
> readonly mode, and the other read write.
> With shared_cache enable.
> Opening first the readonly mode and after readwrite mode, the second 
> connection works as read only too.
> 
> Then I looked to sqlite code and I see the problem in:
> sqlite3BtreeOpen line 1788, because the shared cache uses the same structure 
> in booth connections, and pBt->pPager->readOnly is set to 1.
> 
> To workaround this I will open read write mode first, but that make readonly 
> connection become read write.
> 
> There is an know issue?
> 
> Regards,
> --
> Israel Lins Albuquerque
> 
> Antes de imprimir, pense em sua responsabilidade com o MEIO AMBIENTE.
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to