Re: [sqlite] How does one block a reader connection?

2017-03-27 Thread Jens Alfke
> On Mar 26, 2017, at 11:37 PM, Hick Gunter wrote: > > I think this kind of problem (transfer of information between cooperating > processes) is best solved using the tools designed for inter-process > communication and not attempting to abuse a DB system designed to isolate

Re: [sqlite] How does one block a reader connection?

2017-03-27 Thread Hick Gunter
. März 2017 03:43 An: sqlite-users@mailinglists.sqlite.org Betreff: Re: [sqlite] How does one block a reader connection? On 3/25/17 6:52 PM, petern wrote: > I would like to construct a SQLite database for one writer and one or > more reader connections. The writer will be updating variou

Re: [sqlite] How does one block a reader connection?

2017-03-27 Thread Hick Gunter
('cmd_ready'); -- wake up readers Gunter -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von petern Gesendet: Samstag, 25. März 2017 23:52 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: [sqlite] How do

Re: [sqlite] How does one block a reader connection?

2017-03-26 Thread Rowan Worth
On 26 March 2017 at 14:17, Keith Medcalf wrote: > If you do not specify your own custom busy handler (to display flying ball > bearings, etc, or do your own exponential sleeping, etc) then the default > busy_handler is used. The default busy handler does its own exponential

Re: [sqlite] How does one block a reader connection?

2017-03-26 Thread petern
Keith, I understand your point. The timescale of polling is between 1 and 10 seconds by sleep loop depending on operational objectives. This range of sleep loop will have a corresponding latency of between 0.5 and 5 seconds for single commands with a uniform arrival time distribution. The idea

Re: [sqlite] How does one block a reader connection?

2017-03-26 Thread Jens Alfke
> On Mar 25, 2017, at 3:52 PM, petern wrote: > > So finally, here is the question. Is there a SQLite API way for reader > connections to block and wait for a meaningful change, like a new row, in > the 'cmd' table instead of madly polling and using up database

Re: [sqlite] How does one block a reader connection?

2017-03-26 Thread Keith Medcalf
Saturday, 25 March, 2017 23:44. petern wrote: > Can anybody explain the purpose of > http://sqlite.org/c3ref/busy_handler.html > ? It seems the only practical use would be to allow the caller to give > the engine a suggested lock deadline before SQLITE_BUSY is

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread Jay Kreibich
On Mar 25, 2017, at 5:52 PM, petern wrote: > So finally, here is the question. Is there a SQLite API way for reader > connections to block and wait for a meaningful change, like a new row, in > the 'cmd' table instead of madly polling and using up database

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread petern
Thanks Simon. Yes, the actual command table has other columns like a time stamp to allow readers to join and restart asynchronously without losing state. The concept of 'done' in this system is also not so clear to the readers because command execution depends on the state of independent systems

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread Keith Medcalf
On Saturday, 25 March, 2017 19:35, petern wrote: > All good points. Yes, query by 'rowid > $lastCmdRowid' was the intent. > Is there something that can be done by the writer, like holding a BEGIN > EXCLUSIVE TRANSACTION open with PRAGMA read_uncommitted=0? Would

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread Simon Slavin
On 26 Mar 2017, at 2:35am, petern wrote: > Is there something that can be done by the writer, like holding a BEGIN > EXCLUSIVE TRANSACTION open with PRAGMA read_uncommitted=0? Would that > block all readers or would they continue to get empty results from the >

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread Richard Damon
On 3/25/17 6:52 PM, petern wrote: I would like to construct a SQLite database for one writer and one or more reader connections. The writer will be updating various data tables which occasionally trigger one or more row inserts in a command table named 'cmd'. This command table is being polled

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread petern
All good points. Yes, query by 'rowid > $lastCmdRowid' was the intent. Is there something that can be done by the writer, like holding a BEGIN EXCLUSIVE TRANSACTION open with PRAGMA read_uncommitted=0? Would that block all readers or would they continue to get empty results from the command

Re: [sqlite] How does one block a reader connection?

2017-03-25 Thread Simon Slavin
On 25 Mar 2017, at 10:52pm, petern wrote: > CREATE TABLE cmd(opcode TEXT, params TEXT); > > Also assume each reader is in a different process which maintains its own > open db connection over which it periodically executes the following > command retrieval query, >

[sqlite] How does one block a reader connection?

2017-03-25 Thread petern
I would like to construct a SQLite database for one writer and one or more reader connections. The writer will be updating various data tables which occasionally trigger one or more row inserts in a command table named 'cmd'. This command table is being polled by the readers for new commands.