<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>That's an interesting idea, Austin. I was going to respond that
my intention has been for Ur/Web to hide all issues with
concurrency control, restarting transactions as necessary. I
believe that logic already works properly for PostgreSQL, and I
just don't do as much testing with SQLite. So, I would be happy
to implement either the kind of solution I had in mind OR the
solution that Austin suggests.</p>
<p>To implement either fix, I'll need some detailed suggestions
specific to SQLite.</p>
<p><b>OPTION 1.</b> Change the generated C code to detect
concurrency errors that imply restarts. Someone would ideally
build a representative minimal example with "urweb -debug" and
examine the generated /tmp/webapp.c file, to make suggestions on
changes.</p>
<p><b>OPTION 2.</b> Change the SQL schemas generated automatically
by Ur/Web, to add extra settings that preclude the problem Sergey
reported. Someone would need to use the 'sql' .urp directive with
SQLite as the backend, then tell me which diff should be applied
to generated files. It sounds like Austin probably already knows
the exact change that's called for, but I'm presenting both
options in case it becomes clear that Option 1 is preferable.<br>
</p>
<div class="moz-cite-prefix">On 02/28/2017 01:28 PM, Austin Seipp
wrote:<br>
</div>
<blockquote
cite="mid:CAEs96n3_cUQSU91XOUQH1qSP4U6r-v7pJMn_90Ze_LUZj_NhTw@mail.gmail.com"
type="cite">
<div dir="ltr">An alternative might be to turn on WAL mode for
your SQLite database. This will allow
<div>readers and writers (SELECT and INSERTs) to proceed
concurrently and might alleviate</div>
<div>this problem for you, without having to do some kind of
heuristic backoff.<br>
<div><br>
</div>
<div>(Perhaps Ur/Web should enable WAL by default in the
Schema it generates for SQLite)</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 28, 2017 at 11:42 AM,
Sergey Mironov <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:grrwlf@gmail.com" target="_blank">grrwlf@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi. My
sqlite-based application uses sequences during GET
processing.<br>
AFAIK sequences are implemented as INSERTs for sqlite
backend, so I<br>
think the question is about generic sqlite behavior.<br>
<br>
In my application, some transactions take a considerable
time to<br>
produce a page. During the process, other requests, even
those which<br>
only access sequences, are denied with 'Database is locked'
error. Is<br>
it possible to treat the sqlite locking error as a 'Bounded
error'<br>
rather than to terminate the request immediately? By bounded
error I<br>
mean to attempt to process transaction several times after
certain<br>
delay. What are possible negative effects of such a
modification?<br>
<br>
Regards,<br>
Sergey<br>
</blockquote>
</div>
</div>
</blockquote>
</body>
</html>