Re: reads which modify data

Klaus Wuestefeld <[email protected]>
Newsgroups gmane.comp.java.prevayler
Message-ID <[email protected]>
The solution described by Edward of having a tick is good. Only the
ticks will update state, not the queries.

You dont need to have one transaction per tick. You execute them
lazily, right before every query or transaction:

   synchronized (system) {
      if ( ! areAllTicksProcessedTill(time))
         processAllTicksTill(time)
   }



> we cannot depend on any pre-seeded sequence
> since this is a read and there is no guarantee it will occur again in
> same order.

With the ticks solution you can guarantee there will be exactly one
tick per logical millisecond and exactly the same number of random
values will be consumed every time you rerun the same simulation with
the same transactions.

You just have to make sure Prevayler's clock and your simulation clock
are consistent.

That is pretty easy since you can configure the clock that Prevayler uses. :)

See you, Klaus.


On Mon, Mar 2, 2009 at 10:12 AM, Edward Kimber <[email protected]> wrote:
> This sounds like some sort of simulation...
> I would think about having a system clock that triggers a model
> update/recalculation on every tick.  This system can include your
> seeded pseudo-random elements and also be deterministic.  You can then
> allow very fast direct access reads and you don't need to worry about
> the write operation because all model updates will be performed by the
> 'tick' transaction.
> Just an idea. :)
> Ed
>
> 2009/3/2 hakan eryargi <[email protected]>:
>> ok, this is what i do without the (pseudo)random part: "lazy evaluation"
>>
>> for the random part, the problem is how to find a random seed that we
>> can later find again and use. using same seed is a solution but of
>> course we dont want that. we are in the middle of a read operation
>> came from some client at some -truly- random time. so we cant use
>> executionTime as a seed. we cannot depend on any pre-seeded sequence
>> since this is a read and there is no guarantee it will occur again in
>> same order.
>>
>> am i missing something ?
>>
>> On Mon, Mar 2, 2009 at 6:38 AM, Klaus Wuestefeld
>> <[email protected]> wrote:
>>> Stop thinking in terms of "reads which modify data" and think about it
>>> as "lazy evaluation", which is perfectly ok. Something like this:
>>>
>>>
>>> Object executeQuery(Date executionTime) {
>>>
>>>   synchronized (_system) {
>>>      if (!isStateUpdatedTo(executionTime))
>>>         updateStateWithReallyComplexAndPseudoRandomRulesTo(executionTime);
>>>   }
>>>
>>>   return queryStateWhatever();
>>> }
>>>
>>>
>>> See you, Klaus.
>>>
>>> ------------------------------------------------------------------------------
>>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
>>> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
>>> -Strategies to boost innovation and cut costs with open source participation
>>> -Receive a $600 discount off the registration fee with the source code: SFAD
>>> http://p.sf.net/sfu/XcvMzF8H
>>> _______________________________________________
>>> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
>>> _______________________________________________
>>> "Databases in Memoriam" -- http://www.prevayler.org
>>>
>>
>> ------------------------------------------------------------------------------
>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
>> -Strategies to boost innovation and cut costs with open source participation
>> -Receive a $600 discount off the registration fee with the source code: SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> _______________________________________________
>> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
>> _______________________________________________
>> "Databases in Memoriam" -- http://www.prevayler.org
>>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> _______________________________________________
> "Databases in Memoriam" -- http://www.prevayler.org
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.