Re: [sqlite] SQLITE_BUSY retry
Overall sqlite is losing its credits. Now when i run sqlite in multithread & multi process mode system experiences a infinite loop in the busy handler. Also there is no log which tell which process/thread has acquired the lock,hence needing complete system halt and restart. This observed in 3.4.0,3.4.2, 3.5.1,3.5.2 Also as stated elsewhere sqlite 3.5.2 now support passing one connecion acorss threads is not valid. regards ragha ** This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! * - Original Message - From: John Stanton <[EMAIL PROTECTED]> Date: Thursday, November 29, 2007 1:34 am Subject: Re: [sqlite] SQLITE_BUSY retry > You could use a BEGIN IMMEDIATE to lock the DB before you launch > the > transaction and loop on SQLITE_BUSY or use the plain BEGIN which > will > allow reads during the transaction and not lock the DB until you > issue a > COMMIT (the END). Just loop on the BUSY on the END SQL statement > until > the user who has the DB locked releases it. > > A technique we use to get a minimum latency but reasonably > efficient > busy wait is to issue a yield call each time an SQLITE_BUSY is > encountered so that the time slice is dropped and other processes > can > run. A alternative is to issue a short delay or sleep. > > Joanne Pham wrote: > > Hi All, > > Here my statements to insert rows into the database > > Open the database connection > > BEGIN > > insert ...using sqlite3_step > > insert ...using sqlite3_step > > END > > So at the time I issued "END" transaction I got the error message > SQLITE_BUSY so I need to issue the "END" transaction again or What > should I do in this case to handle SQLITE_BUSY. > > Thanks a lot in advance for the help or advice. > > JP > > > > > > > > - Original Message > > From: Joanne Pham <[EMAIL PROTECTED]> > > To: sqlite-users@sqlite.org > > Sent: Wednesday, November 28, 2007 11:27:52 AM > > Subject: [sqlite] SQLITE_BUSY retry > > > > Hi All, > > I have used "BEGIN" and "END" Transaction to insert the data to > SQLite database. > > BEGIN > > insert ... > > insert ... > > END > > > > When I issued the "END" operation the error message return back > is "SQLITE_BUSY". > > What should I do if I want to handle SQLITE_BUSY /retry the > transaction. Should I execute "END" transaction again. > > How to handle the SQLITE_BUSY? > > Thanks, > > JP > > > > > > > > > Get easy, one-click access to your favorites. > > Make Yahoo! your homepage. > > http://www.yahoo.com/r/hs > > > > > > > > > Be a better sports nut! Let your teams follow you > > with Yahoo Mobile. Try it now. > http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQLITE_BUSY retry
Joanne Pham wrote: Hi John, Thanks a lot for your response. Make sure I am understanding your answer related to SQLITE_BUSY. So I need to change my code from Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step END to Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step ... do { rc = END (transaction or commit) while (rc == SQLITE_BUSY) So I just loop on if the return statement is SQLITE_BUSY. Is that correct John? Thanks a ton, JP Correct. You might add a count to drop out if there is a deadlock. e.g. use sqlite3_prepare_v2 var count = MAX_SPINS; while (1) { rc = sqlite3_step(); if (rc == SQLITE_BUSY) yield(); else { if ((rc != SQLITE_OK) || (count <= 0)) report_error(); break; } count--; } - Original Message From: John Stanton <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, November 28, 2007 12:04:34 PM Subject: Re: [sqlite] SQLITE_BUSY retry You could use a BEGIN IMMEDIATE to lock the DB before you launch the transaction and loop on SQLITE_BUSY or use the plain BEGIN which will allow reads during the transaction and not lock the DB until you issue a COMMIT (the END). Just loop on the BUSY on the END SQL statement until the user who has the DB locked releases it. A technique we use to get a minimum latency but reasonably efficient busy wait is to issue a yield call each time an SQLITE_BUSY is encountered so that the time slice is dropped and other processes can run. A alternative is to issue a short delay or sleep. Joanne Pham wrote: Hi All, Here my statements to insert rows into the database Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step END So at the time I issued "END" transaction I got the error message SQLITE_BUSY so I need to issue the "END" transaction again or What should I do in this case to handle SQLITE_BUSY. Thanks a lot in advance for the help or advice. JP - Original Message From: Joanne Pham <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, November 28, 2007 11:27:52 AM Subject: [sqlite] SQLITE_BUSY retry Hi All, I have used "BEGIN" and "END" Transaction to insert the data to SQLite database. BEGIN insert ... insert ... END When I issued the "END" operation the error message return back is "SQLITE_BUSY". What should I do if I want to handle SQLITE_BUSY /retry the transaction. Should I execute "END" transaction again. How to handle the SQLITE_BUSY? Thanks, JP Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ - To unsubscribe, send email to [EMAIL PROTECTED] - Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/ - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQLITE_BUSY retry
Hi John, Thanks a lot for your response. Make sure I am understanding your answer related to SQLITE_BUSY. So I need to change my code from Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step END to Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step ... do { rc = END (transaction or commit) while (rc == SQLITE_BUSY) So I just loop on if the return statement is SQLITE_BUSY. Is that correct John? Thanks a ton, JP - Original Message From: John Stanton <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, November 28, 2007 12:04:34 PM Subject: Re: [sqlite] SQLITE_BUSY retry You could use a BEGIN IMMEDIATE to lock the DB before you launch the transaction and loop on SQLITE_BUSY or use the plain BEGIN which will allow reads during the transaction and not lock the DB until you issue a COMMIT (the END). Just loop on the BUSY on the END SQL statement until the user who has the DB locked releases it. A technique we use to get a minimum latency but reasonably efficient busy wait is to issue a yield call each time an SQLITE_BUSY is encountered so that the time slice is dropped and other processes can run. A alternative is to issue a short delay or sleep. Joanne Pham wrote: > Hi All, > Here my statements to insert rows into the database > Open the database connection > BEGIN >insert ...using sqlite3_step >insert ...using sqlite3_step > END > So at the time I issued "END" transaction I got the error message SQLITE_BUSY > so I need to issue the "END" transaction again or What should I do in this > case to handle SQLITE_BUSY. > Thanks a lot in advance for the help or advice. > JP > > > > - Original Message > From: Joanne Pham <[EMAIL PROTECTED]> > To: sqlite-users@sqlite.org > Sent: Wednesday, November 28, 2007 11:27:52 AM > Subject: [sqlite] SQLITE_BUSY retry > > Hi All, > I have used "BEGIN" and "END" Transaction to insert the data to SQLite > database. >BEGIN >insert ... >insert ... > END > > When I issued the "END" operation the error message return back is > "SQLITE_BUSY". > What should I do if I want to handle SQLITE_BUSY /retry the transaction. > Should I execute "END" transaction again. > How to handle the SQLITE_BUSY? > Thanks, > JP > > > > > Get easy, one-click access to your favorites. > Make Yahoo! your homepage. > http://www.yahoo.com/r/hs > > > > > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. > http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ - To unsubscribe, send email to [EMAIL PROTECTED] - Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/
Re: [sqlite] SQLITE_BUSY retry
You could use a BEGIN IMMEDIATE to lock the DB before you launch the transaction and loop on SQLITE_BUSY or use the plain BEGIN which will allow reads during the transaction and not lock the DB until you issue a COMMIT (the END). Just loop on the BUSY on the END SQL statement until the user who has the DB locked releases it. A technique we use to get a minimum latency but reasonably efficient busy wait is to issue a yield call each time an SQLITE_BUSY is encountered so that the time slice is dropped and other processes can run. A alternative is to issue a short delay or sleep. Joanne Pham wrote: Hi All, Here my statements to insert rows into the database Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step END So at the time I issued "END" transaction I got the error message SQLITE_BUSY so I need to issue the "END" transaction again or What should I do in this case to handle SQLITE_BUSY. Thanks a lot in advance for the help or advice. JP - Original Message From: Joanne Pham <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, November 28, 2007 11:27:52 AM Subject: [sqlite] SQLITE_BUSY retry Hi All, I have used "BEGIN" and "END" Transaction to insert the data to SQLite database. BEGIN insert ... insert ... END When I issued the "END" operation the error message return back is "SQLITE_BUSY". What should I do if I want to handle SQLITE_BUSY /retry the transaction. Should I execute "END" transaction again. How to handle the SQLITE_BUSY? Thanks, JP Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQLITE_BUSY retry
Hi All, Here my statements to insert rows into the database Open the database connection BEGIN insert ...using sqlite3_step insert ...using sqlite3_step END So at the time I issued "END" transaction I got the error message SQLITE_BUSY so I need to issue the "END" transaction again or What should I do in this case to handle SQLITE_BUSY. Thanks a lot in advance for the help or advice. JP - Original Message From: Joanne Pham <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, November 28, 2007 11:27:52 AM Subject: [sqlite] SQLITE_BUSY retry Hi All, I have used "BEGIN" and "END" Transaction to insert the data to SQLite database. BEGIN insert ... insert ... END When I issued the "END" operation the error message return back is "SQLITE_BUSY". What should I do if I want to handle SQLITE_BUSY /retry the transaction. Should I execute "END" transaction again. How to handle the SQLITE_BUSY? Thanks, JP Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ