You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2006/04/23 21:29:41 UTC
svn commit: r396309 - /apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Author: bojan
Date: Sun Apr 23 12:29:40 2006
New Revision: 396309
URL: http://svn.apache.org/viewcvs?rev=396309&view=rev
Log:
Retry SQLite3 query on BUSY
Modified:
apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=396309&r1=396308&r2=396309&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Sun Apr 23 12:29:40 2006
@@ -253,12 +253,24 @@
apr_dbd_mutex_lock();
do {
+ int retry_count = 0;
+
ret = sqlite3_prepare(sql->conn, query, length, &stmt, &tail);
if (ret != SQLITE_OK) {
sqlite3_finalize(stmt);
break;
}
- ret = sqlite3_step(stmt);
+
+ while(retry_count++ <= MAX_RETRY_COUNT) {
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_BUSY)
+ break;
+
+ apr_dbd_mutex_unlock(sql->mutex);
+ apr_sleep(MAX_RETRY_SLEEP);
+ apr_dbd_mutex_lock(sql->mutex);
+ }
+
*nrows = sqlite3_changes(sql->conn);
sqlite3_finalize(stmt);
length -= (tail - query);
Re: svn commit: r396309 -
/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Posted by Bojan Smojver <bo...@rexursive.com>.
Quoting bojan@apache.org:
> Retry SQLite3 query on BUSY
This is in trunk now, but if nobody objects, I would like to backport
it to 1.2.x as well.
--
Bojan