Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-29 Thread pisymbol .
On Thu, Sep 28, 2017 at 9:18 PM, Keith Medcalf wrote: > > If they are both using the same connection, yes. Transaction state is an > attribute of the connection, not the statement or thread. > > Thanks everybody for the explanations! I have moved to a connection per thread

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Keith Medcalf
sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of pisymbol . >Sent: Thursday, 28 September, 2017 13:02 >To: SQLite mailing list >Subject: Re: [sqlite] FULLMUTEX and exclusive transactions between >threads > >On Thu, Sep 28, 2017 at 2:10 PM, Simon S

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Jens Alfke
> On Sep 28, 2017, at 10:41 AM, pisymbol . wrote: > > If you are using two different connections, then they both have to be > opened with full mutex and then SQLite will serial accordingly. Is that > right? SQLite connections are completely independent of each other; they

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread pisymbol .
On Thu, Sep 28, 2017 at 3:11 PM, Igor Korot wrote: > Not if you use connection-per-thread model. > > Yes, right. That I understand and am in the midst of doing that right now. -aps ___ sqlite-users mailing list

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Igor Korot
Not if you use connection-per-thread model. On Thu, Sep 28, 2017 at 3:07 PM, Simon Slavin wrote: > > > On 28 Sep 2017, at 8:01pm, pisymbol . wrote: > >> So you can still have issues with thread 1 issuing a "BEGIN" and then >> thread 2 issuing another

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Simon Slavin
On 28 Sep 2017, at 8:01pm, pisymbol . wrote: > So you can still have issues with thread 1 issuing a "BEGIN" and then > thread 2 issuing another "BEGIN" before thread 1 finalizes the transaction > causing failure. Correct? Don’t know. Hope someone else does. Simon.

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread pisymbol .
On Thu, Sep 28, 2017 at 2:10 PM, Simon Slavin wrote: > > > On 28 Sep 2017, at 6:57pm, Keith Medcalf wrote: > > > The mutex is used to prevent multiple concurrent entry (ie, calling an > sqlite3_* function) using the same connection from multiple

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Simon Slavin
On 28 Sep 2017, at 6:57pm, Keith Medcalf wrote: > The mutex is used to prevent multiple concurrent entry (ie, calling an > sqlite3_* function) using the same connection from multiple threads. (ie, > serialization). It does not provide isolation of any sort. THat is to

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Keith Medcalf
>> The follow-up to this is what is the purpose of full mutex mode and when >> should it be used over no mutex mode? >The mutex is useful when SQLite can tell that your commands are >actually part of two separate efforts. i.e. when you’re using two >different connections. The mutex is used to

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Simon Slavin
On 28 Sep 2017, at 6:41pm, pisymbol . wrote: > If you are using two different connections, then they both have to be > opened with full mutex and then SQLite will serial accordingly. Is that > right? You’re right at the edge of my competency but I believe that is correct.

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Keith Medcalf
[sqlite] FULLMUTEX and exclusive transactions between >threads > >On Thu, Sep 28, 2017 at 11:55 AM, Simon Slavin <slav...@bigfraud.org> >wrote: > >> >> >> On 28 Sep 2017, at 3:31pm, pisymbol . <pisym...@gmail.com> wrote: >> >> > Specificially, if threa

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread pisymbol .
On Thu, Sep 28, 2017 at 1:30 PM, Simon Slavin wrote: > > > On 28 Sep 2017, at 6:16pm, pisymbol . wrote: > > > So even with full mutex, if I have thread 1 issue a "BEGIN" and it starts > > processing, and another thread 2 issues a "BEGIN" somewhere in

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Simon Slavin
On 28 Sep 2017, at 6:16pm, pisymbol . wrote: > So even with full mutex, if I have thread 1 issue a "BEGIN" and it starts > processing, and another thread 2 issues a "BEGIN" somewhere in between > that, the other thread will just flat out fail because a transaction has >

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread pisymbol .
On Thu, Sep 28, 2017 at 1:16 PM, pisymbol . wrote: > > > On Thu, Sep 28, 2017 at 11:55 AM, Simon Slavin > wrote: > >> >> >> On 28 Sep 2017, at 3:31pm, pisymbol . wrote: >> >> > Specificially, if thread 1 and 2 both have a handle to

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread pisymbol .
On Thu, Sep 28, 2017 at 11:55 AM, Simon Slavin wrote: > > > On 28 Sep 2017, at 3:31pm, pisymbol . wrote: > > > Specificially, if thread 1 and 2 both have a handle to sqlite3 with full > > mutex, then both could start a transaction simultaneously, one

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Simon Slavin
On 28 Sep 2017, at 5:00pm, Igor Korot wrote: > But the lock will be released on _finalize(), right? Yes. Or on _reset(). Nevertheless, the transaction lasts until that point, so the use of BEGIN, or the start of another SQLite one-statement transaction cannot happen

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Igor Korot
Hi, Simon, On Thu, Sep 28, 2017 at 11:55 AM, Simon Slavin wrote: > > > On 28 Sep 2017, at 3:31pm, pisymbol . wrote: > >> Specificially, if thread 1 and 2 both have a handle to sqlite3 with full >> mutex, then both could start a transaction

Re: [sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread Simon Slavin
On 28 Sep 2017, at 3:31pm, pisymbol . wrote: > Specificially, if thread 1 and 2 both have a handle to sqlite3 with full > mutex, then both could start a transaction simultaneously, one will win the > other will wait, [snip] By "serialised" the documentation means that no

[sqlite] FULLMUTEX and exclusive transactions between threads

2017-09-28 Thread pisymbol .
Hello: I have an application that makes heavy use of sqlite3 and during load testing I very, very rarely (read: it has only happened once so far) occasionally see the following error message: "BEGIN EXCLUSIVE error: cannot start a transaction within a transaction" I understand this error