"Alexander Batyrshin" <[EMAIL PROTECTED]>
wrote in message
news:[EMAIL PROTECTED]
> 1. Any single SQL command in SQLite start transaction.
Yes, unless part of an explicit transaction initiated with a BEGIN
statement.
> Any write
> operation should start with getting shared lock.
No, write opera
> > For example, if 2 processes executes simple SQL INSERT commands and
> > gets situation like above, one of them can easily drop read lock and
> > wait for another one. There is no problem for this case.
>
> Two concurrent inserts never result in a deadlock. For a deadlock to
> occur in SQLit
I got it. Fixed my program with "IMMEDIATE" transaction.
On Fri, Apr 25, 2008 at 12:01 AM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> "Alexander Batyrshin" <[EMAIL PROTECTED]>
> wrote in message
> news:[EMAIL PROTECTED]
>
> >> Dropping the read lock is the same as rolling back the
> >> trans
"Alexander Batyrshin" <[EMAIL PROTECTED]>
wrote in message
news:[EMAIL PROTECTED]
>> Dropping the read lock is the same as rolling back the
>> transaction. The first process can, in fact, do this. And
>> the second process is waiting for the first process to do
>> this. But the first process
> Dropping the read lock is the same as rolling back the
> transaction. The first process can, in fact, do this. And
> the second process is waiting for the first process to do
> this. But the first process cannot do it automatically. The
> application must issue a "COMMIT" or "ROLLBACK" c
On Apr 24, 2008, at 7:42 AM, Alexander Batyrshin wrote:
> I am not understand this example. First of all second process can't
> promote exclusive lock from reserved. It should use intermediate
> pending lock.
It does go to pending. But it still cannot complete the transaction
until it is able t
If you are using processes you can sync them using a semaphore so that
it automatically blocks. Alternatively do not use sqlite3_exec (it is
an old interface) and instead use sqlite3_prepare ... sqlite3_step. If
you get an SQLITE_BUSY returned by sqlite3_step then pause a hundred mS
or so and
I am not understand this example. First of all second process can't
promote exclusive lock from reserved. It should use intermediate
pending lock. And secondary why first process can't just drop read
lock and then invoke busy handler?
In this case any write to database that already has process
On
Alexander,
>From http://www.sqlite.org/c3ref/busy_handler.html
"The presence of a busy handler does not guarantee that it will be
invoked when there is lock contention. If SQLite determines that
invoking the busy handler could result in a deadlock, it will go ahead
and return SQLITE_BUSY or SQLIT
Oh... Nope, I am not using any thread-mechanism.
I am using simple processes (via fork). So synchronization should be
task for SQLite library.
But right now I am confused, because my processes do not blocks on
sqlite3_exec. They immediately report BUSY_TIMEOUT, without awaiting
for time set by sql
If it is one process I would assign a mutex to the resource (Sqlite) and
wait on it to get access to the resource. When the Sqlite operation is
complete release the mutex and the next thread will have exclusive
access to it.
If you use pthreads you can use read and write locks to get concurren
So, you advice me, to implement synchronization inside my process by my self?
On Thu, Apr 24, 2008 at 3:40 PM, John Stanton <[EMAIL PROTECTED]> wrote:
> You have a single shared resource, Sqlite, and you have to synchronize
> access. You can use the internal locking in Sqlite and use polling or
You have a single shared resource, Sqlite, and you have to synchronize
access. You can use the internal locking in Sqlite and use polling or
wait on a mutex or semaphore.
Alexander Batyrshin wrote:
> Hello All,
>
> I am observing situation, that my concurrency process does not have
> access t
Hello All,
I am observing situation, that my concurrency process does not have
access to SQLite database with equal probability.
Here is example. I have N process that do work like this:
while (1) {
do_some_work(); // takes ~ 30 sec
save_work_result_to_sqlite(); // takes ~ 1 sec
}
So,
14 matches
Mail list logo