Hello ch,

I'd say yes it'll block. As to whether this is a problem I guess it
depends on how much writing you do. I break my writing down into
sections so, there's time in between transactions for readers to get
in and read.

WAL mode should work. It used to work for me a number of versions back.

If I was going to look deeper into this I'd use a fresh simple table
put the new DB into WAL mode and experiment with 2-3 processes trying
to access the fresh DB.

Tuesday, August 11, 2015, 8:08:39 PM, you wrote:

c> We didn't try journal mode but the WAL mode doesn't work for us
c> even if we set busy timeout handler to try to go across this.
c> Unfortunately, the busy timeout handler doesn't get called every
c> time and after that we still cannot get the file recovered
c> correctly. The issue is still shown in 3.8.8.3. Thanks for letting
c> me know journal mode working for you! However, is reading gonna
c> blocked by writing in journal mode? I thought that is the sqlite documents 
mentioned.

>> Date: Tue, 11 Aug 2015 00:41:50 -0400
>> From: Teg at djii.com
>> To: chaihua_sina at hotmail.com
>> CC: sqlite-users at mailinglists.sqlite.org
>> Subject: Re: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY 
>> (Multithread)
>> 
>> Hello ch,
>> 
>> I  ran  into  a  similar  problem when I was trying to use WAL mode. I
>> ended up just turning it off. It seemed that once there was contention
>> for  the  file  it never recovered. This was in windows. I didn't look
>> into  it  any  deeper  than this.  The same code works fine in journal
>> mode.  I  haven't  tried  it  again with the latest.    I think I last
>> tested this in 3.8.8.2.
>> 
>> There's  typically  not  much more than 2-3 connections contending for
>> file  access  in my program. Most of the time it's only one connection
>> at a time.
>> 
>> I  assumed  it  was something I was doing because I wasn't reading any
>> other reports of it. 
>> 
>> C
>> 
>> 
>> Monday, August 10, 2015, 9:28:03 PM, you wrote:
>> 
>> c> Hi,
>> c> I have similar problems. We have multiple connections to write to
>> c> the database and the updates are surrounded by create&release
>> c> savepoints. The issue is when two updates from different
>> c> connections try to modify the database, the second operation gonna
>> c> fail and it either returned database is busy or locked, while
>> c> another operation just keeps occupying the database lock until it
>> c> finishes. After the first operation finishes, the failed operation
>> c> (a short update) tries again with creating a new savepoint but it
>> c> still fails and after that any further operation cannot use the
>> c> database anymore and all of them fail with SQLITE_BUSY or database
>> c> locked. Is this because we don't create and handle savepoints
>> c> correct? One way to avoid the continuous abort is we use begin
>> c> transaction IMMEDIATE to wrap all our operations but it looks like
>> c> our solution is bandage. I don't know what will be the best
>> c> solution to solve our issue. If anyone could help answer it, I appreciate.
>> >> Date: Mon, 10 Aug 2015 15:40:17 +0300
>> >> From: dm3chip at gmail.com
>> >> To: sqlite-users at mailinglists.sqlite.org
>> >> Subject: [sqlite] Fwd: Problem with SQLite in C++. DB is BUSY 
>> >> (Multithread)
>> >> 
>> >> ---------- Forwarded message ----------
>> >> From: ??????? ??????????? <dm3chip at gmail.com>
>> >> Date: 2015-08-10 0:37 GMT+03:00
>> >> Subject: Problem with SQLite in C++. DB is BUSY (Multithread)
>> >> To: sqlite-users at mailinglists.sqlite.org
>> >> 
>> >> 
>> >> Hello!
>> >> I've got a problem. I'm using sqlite3 in my C++ project. In the log I've
>> >> got error's *DB is locked error code 5*. As I know error code 5 means, 
>> >> that
>> >> DB is busy. To solve this I started to use WAL journal mode. But it 
>> >> doesn't
>> >> help.
>> >> 
>> >> In my program I've got 2 connections to the same db. I use mutexes for 
>> >> both
>> >> DB connections.
>> >> I'm opening connections with this code:
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> *if (sqlite3_open_v2(db_path.c_str(), &this->db, SQLITE_OPEN_READWRITE |
>> >> SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, 0) ) {
>> >> LOG4CPLUS_FATAL(this->logger, "Can not open/create DB " <<
>> >> sqlite3_errmsg(db));    sqlite3_close(this->db);}if 
>> >> (sqlite3_exec(this->db,
>> >> "PRAGMA journal_mode = WAL;", 0, 0, &err)) {
>> >> LOG4CPLUS_ERROR(this->logger, "SQL det journal mode error: " << err);
>> >> sqlite3_free(err);}*
>> >> 
>> >> First connection is used for inserting data to the DB. It happens with 4
>> >> time every second.
>> >> Second connection is used for starting transaction, selecting, updating,
>> >> deleting data and committing. It happens every 5 seconds.
>> >> 
>> >> I'm getting errors from the first connection.
>> >> 
>> >> Please help me to solve this problem.
>> >> 
>> >> P.S. Sorry for my bad English
>> >> _______________________________________________
>> >> sqlite-users mailing list
>> >> sqlite-users at mailinglists.sqlite.org
>> >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>> c>                                           
>> c> _______________________________________________
>> c> sqlite-users mailing list
>> c> sqlite-users at mailinglists.sqlite.org
>> c> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>> 
>> 
>> 
>> -- 
>>  Teg                            mailto:Teg at djii.com
>> 
c>                                           



-- 
 Teg                            mailto:Teg at djii.com

Reply via email to