You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Carlos Rodriguez <cr...@gmail.com> on 2014/06/16 13:21:36 UTC

Trident State and Static State

Hi guys,

We are using Riak as a State to write and read data from different riak
buckets. (We are using this code
https://github.com/hackreduce/storm-hackathon/blob/master/src/main/java/org/hackreduce/storm/example/riak/RiakBackingMap.java
)

We first write to a bucket with partitionPersist, which returns a
TridentState var, and then we get data from this bucket with the
TridentState var returned previously.

The problem is that sometimes we just need to read (because another process
is filling this bucket with data), so no partitionPersist is done, and
therefore we have no TridentState var to get data from that bucket.

I've seen in the Trident State API doc (
https://github.com/nathanmarz/storm/wiki/Trident-state) a call to
topology.newStaticState(), and thought that maybe it would do the trick.

I didn't find more info about these "Static" states, so I would like to
know what does "Static" means in that context and the difference between
this and the TridentState var returned when a partitonPersist() is done.

Greetings,
Carlos

Re: Trident State and Static State

Posted by Nathan Marz <na...@nathanmarz.com>.
That would only work if it's an external state (e.g. state is kept in a
database) as opposed to keeping state in memory within the topology.


On Mon, Jun 16, 2014 at 6:38 PM, Romain Leroux <le...@gmail.com> wrote:

> Can we define a StateFactory (sf) and do those 2 things with it ? (or
> would that be a bad practice?)
>
> - update a state with something like partitionAggregate(sf) or
> partitionPersist(sf)
>
> - create a newStatic(sf) for querying this state (that we have updated)
> later in the topology
>
>
> On Jun 17, 2014 2:18 AM, "Nathan Marz" <na...@nathanmarz.com> wrote:
>
>> Static state just refers to a state that is not maintained by your
>> Trident topology but which you still want to be able to query, so something
>> like a database that some other system is responsible for updating.
>>
>>
>> On Mon, Jun 16, 2014 at 4:21 AM, Carlos Rodriguez <cr...@gmail.com>
>> wrote:
>>
>>> Hi guys,
>>>
>>> We are using Riak as a State to write and read data from different riak
>>> buckets. (We are using this code
>>> https://github.com/hackreduce/storm-hackathon/blob/master/src/main/java/org/hackreduce/storm/example/riak/RiakBackingMap.java
>>> )
>>>
>>> We first write to a bucket with partitionPersist, which returns a
>>> TridentState var, and then we get data from this bucket with the
>>> TridentState var returned previously.
>>>
>>> The problem is that sometimes we just need to read (because another
>>> process is filling this bucket with data), so no partitionPersist is done,
>>> and therefore we have no TridentState var to get data from that bucket.
>>>
>>> I've seen in the Trident State API doc (
>>> https://github.com/nathanmarz/storm/wiki/Trident-state) a call to
>>> topology.newStaticState(), and thought that maybe it would do the trick.
>>>
>>> I didn't find more info about these "Static" states, so I would like to
>>> know what does "Static" means in that context and the difference between
>>> this and the TridentState var returned when a partitonPersist() is done.
>>>
>>> Greetings,
>>> Carlos
>>>
>>
>>
>>
>> --
>> Twitter: @nathanmarz
>> http://nathanmarz.com
>>
>


-- 
Twitter: @nathanmarz
http://nathanmarz.com

Re: Trident State and Static State

Posted by Romain Leroux <le...@gmail.com>.
Can we define a StateFactory (sf) and do those 2 things with it ? (or would
that be a bad practice?)

- update a state with something like partitionAggregate(sf) or
partitionPersist(sf)

- create a newStatic(sf) for querying this state (that we have updated)
later in the topology


On Jun 17, 2014 2:18 AM, "Nathan Marz" <na...@nathanmarz.com> wrote:

> Static state just refers to a state that is not maintained by your Trident
> topology but which you still want to be able to query, so something like a
> database that some other system is responsible for updating.
>
>
> On Mon, Jun 16, 2014 at 4:21 AM, Carlos Rodriguez <cr...@gmail.com>
> wrote:
>
>> Hi guys,
>>
>> We are using Riak as a State to write and read data from different riak
>> buckets. (We are using this code
>> https://github.com/hackreduce/storm-hackathon/blob/master/src/main/java/org/hackreduce/storm/example/riak/RiakBackingMap.java
>> )
>>
>> We first write to a bucket with partitionPersist, which returns a
>> TridentState var, and then we get data from this bucket with the
>> TridentState var returned previously.
>>
>> The problem is that sometimes we just need to read (because another
>> process is filling this bucket with data), so no partitionPersist is done,
>> and therefore we have no TridentState var to get data from that bucket.
>>
>> I've seen in the Trident State API doc (
>> https://github.com/nathanmarz/storm/wiki/Trident-state) a call to
>> topology.newStaticState(), and thought that maybe it would do the trick.
>>
>> I didn't find more info about these "Static" states, so I would like to
>> know what does "Static" means in that context and the difference between
>> this and the TridentState var returned when a partitonPersist() is done.
>>
>> Greetings,
>> Carlos
>>
>
>
>
> --
> Twitter: @nathanmarz
> http://nathanmarz.com
>

Re: Trident State and Static State

Posted by Nathan Marz <na...@nathanmarz.com>.
Static state just refers to a state that is not maintained by your Trident
topology but which you still want to be able to query, so something like a
database that some other system is responsible for updating.


On Mon, Jun 16, 2014 at 4:21 AM, Carlos Rodriguez <cr...@gmail.com> wrote:

> Hi guys,
>
> We are using Riak as a State to write and read data from different riak
> buckets. (We are using this code
> https://github.com/hackreduce/storm-hackathon/blob/master/src/main/java/org/hackreduce/storm/example/riak/RiakBackingMap.java
> )
>
> We first write to a bucket with partitionPersist, which returns a
> TridentState var, and then we get data from this bucket with the
> TridentState var returned previously.
>
> The problem is that sometimes we just need to read (because another
> process is filling this bucket with data), so no partitionPersist is done,
> and therefore we have no TridentState var to get data from that bucket.
>
> I've seen in the Trident State API doc (
> https://github.com/nathanmarz/storm/wiki/Trident-state) a call to
> topology.newStaticState(), and thought that maybe it would do the trick.
>
> I didn't find more info about these "Static" states, so I would like to
> know what does "Static" means in that context and the difference between
> this and the TridentState var returned when a partitonPersist() is done.
>
> Greetings,
> Carlos
>



-- 
Twitter: @nathanmarz
http://nathanmarz.com